From e81d9d49145e432d917eea3a70d2ae74dcad1d89 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 30 Dec 2015 11:55:28 +0000 Subject: Vendor import of stripped lldb trunk r256633: https://llvm.org/svn/llvm-project/lldb/trunk@256633 --- .../Plugins/Process/gdb-remote/ProcessGDBRemote.h | 138 ++++++++++++--------- 1 file changed, 78 insertions(+), 60 deletions(-) (limited to 'source/Plugins/Process/gdb-remote/ProcessGDBRemote.h') diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 45c74ea64ee50..54749827d6ac6 100644 --- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -11,12 +11,14 @@ #define liblldb_ProcessGDBRemote_h_ // C Includes - // C++ Includes -#include +#include +#include +#include #include // Other libraries and framework includes +// Project includes #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/ConstString.h" @@ -42,11 +44,12 @@ class ThreadGDBRemote; class ProcessGDBRemote : public Process { public: - //------------------------------------------------------------------ - // Constructors and Destructors - //------------------------------------------------------------------ + ProcessGDBRemote(lldb::TargetSP target_sp, Listener &listener); + + ~ProcessGDBRemote() override; + static lldb::ProcessSP - CreateInstance (Target& target, + CreateInstance (lldb::TargetSP target_sp, Listener &listener, const FileSpec *crash_file_path); @@ -65,19 +68,11 @@ public: static const char * GetPluginDescriptionStatic(); - //------------------------------------------------------------------ - // Constructors and Destructors - //------------------------------------------------------------------ - ProcessGDBRemote(Target& target, Listener &listener); - - virtual - ~ProcessGDBRemote(); - //------------------------------------------------------------------ // Check if a given Process //------------------------------------------------------------------ bool - CanDebug (Target &target, bool plugin_specified_by_name) override; + CanDebug (lldb::TargetSP target_sp, bool plugin_specified_by_name) override; CommandObject * GetPluginCommandObject() override; @@ -152,6 +147,9 @@ public: void RefreshStateAfterStop() override; + void + SetUnixSignals(const lldb::UnixSignalsSP &signals_sp); + //------------------------------------------------------------------ // Process Queries //------------------------------------------------------------------ @@ -161,6 +159,9 @@ public: lldb::addr_t GetImageInfoAddress() override; + void + WillPublicStop () override; + //------------------------------------------------------------------ // Process Memory //------------------------------------------------------------------ @@ -238,6 +239,11 @@ public: const ArchSpec& arch, ModuleSpec &module_spec) override; + bool + GetHostOSVersion(uint32_t &major, + uint32_t &minor, + uint32_t &update) override; + size_t LoadModules() override; @@ -257,20 +263,63 @@ protected: class GDBLoadedModuleInfoList; + //------------------------------------------------------------------ + /// Broadcaster event bits definitions. + //------------------------------------------------------------------ + enum + { + eBroadcastBitAsyncContinue = (1 << 0), + eBroadcastBitAsyncThreadShouldExit = (1 << 1), + eBroadcastBitAsyncThreadDidExit = (1 << 2) + }; + + Flags m_flags; // Process specific flags (see eFlags enums) + GDBRemoteCommunicationClient m_gdb_comm; + std::atomic m_debugserver_pid; + std::vector m_stop_packet_stack; // The stop packet stack replaces the last stop packet variable + Mutex m_last_stop_packet_mutex; + GDBRemoteDynamicRegisterInfo m_register_info; + Broadcaster m_async_broadcaster; + Listener m_async_listener; + HostThread m_async_thread; + Mutex m_async_thread_state_mutex; + typedef std::vector tid_collection; + typedef std::vector< std::pair > tid_sig_collection; + typedef std::map MMapMap; + typedef std::map ExpeditedRegisterMap; + tid_collection m_thread_ids; // Thread IDs for all threads. This list gets updated after stopping + std::vector m_thread_pcs; // PC values for all the threads. + StructuredData::ObjectSP m_jstopinfo_sp; // Stop info only for any threads that have valid stop infos + StructuredData::ObjectSP m_jthreadsinfo_sp; // Full stop info, expedited registers and memory for all threads if "jThreadsInfo" packet is supported + tid_collection m_continue_c_tids; // 'c' for continue + tid_sig_collection m_continue_C_tids; // 'C' for continue with signal + tid_collection m_continue_s_tids; // 's' for step + tid_sig_collection m_continue_S_tids; // 'S' for step with signal + uint64_t m_max_memory_size; // The maximum number of bytes to read/write when reading and writing memory + uint64_t m_remote_stub_max_memory_size; // The maximum memory size the remote gdb stub can handle + MMapMap m_addr_to_mmap_size; + lldb::BreakpointSP m_thread_create_bp_sp; + bool m_waiting_for_attach; + bool m_destroy_tried_resuming; + lldb::CommandObjectSP m_command_sp; + int64_t m_breakpoint_pc_offset; + lldb::tid_t m_initial_tid; // The initial thread ID, given by stub on attach + //---------------------------------------------------------------------- // Accessors //---------------------------------------------------------------------- bool IsRunning ( lldb::StateType state ) { - return state == lldb::eStateRunning || IsStepping(state); + return state == lldb::eStateRunning || IsStepping(state); } bool IsStepping ( lldb::StateType state) { - return state == lldb::eStateStepping; + return state == lldb::eStateStepping; } + bool CanResume ( lldb::StateType state) { @@ -305,6 +354,9 @@ protected: UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list) override; + Error + EstablishConnectionIfNeeded (const ProcessInfo &process_info); + Error LaunchAndConnectToDebugserver (const ProcessInfo &process_info); @@ -333,46 +385,10 @@ protected: CalculateThreadStopInfo (ThreadGDBRemote *thread); size_t - UpdateThreadIDsFromStopReplyThreadsValue (std::string &value); + UpdateThreadPCsFromStopReplyThreadsValue (std::string &value); - //------------------------------------------------------------------ - /// Broadcaster event bits definitions. - //------------------------------------------------------------------ - enum - { - eBroadcastBitAsyncContinue = (1 << 0), - eBroadcastBitAsyncThreadShouldExit = (1 << 1), - eBroadcastBitAsyncThreadDidExit = (1 << 2) - }; - - Flags m_flags; // Process specific flags (see eFlags enums) - GDBRemoteCommunicationClient m_gdb_comm; - std::atomic m_debugserver_pid; - std::vector m_stop_packet_stack; // The stop packet stack replaces the last stop packet variable - Mutex m_last_stop_packet_mutex; - GDBRemoteDynamicRegisterInfo m_register_info; - Broadcaster m_async_broadcaster; - HostThread m_async_thread; - Mutex m_async_thread_state_mutex; - typedef std::vector tid_collection; - typedef std::vector< std::pair > tid_sig_collection; - typedef std::map MMapMap; - typedef std::map ExpeditedRegisterMap; - tid_collection m_thread_ids; // Thread IDs for all threads. This list gets updated after stopping - StructuredData::ObjectSP m_threads_info_sp; // Stop info for all threads if "jThreadsInfo" packet is supported - tid_collection m_continue_c_tids; // 'c' for continue - tid_sig_collection m_continue_C_tids; // 'C' for continue with signal - tid_collection m_continue_s_tids; // 's' for step - tid_sig_collection m_continue_S_tids; // 'S' for step with signal - uint64_t m_max_memory_size; // The maximum number of bytes to read/write when reading and writing memory - uint64_t m_remote_stub_max_memory_size; // The maximum memory size the remote gdb stub can handle - MMapMap m_addr_to_mmap_size; - lldb::BreakpointSP m_thread_create_bp_sp; - bool m_waiting_for_attach; - bool m_destroy_tried_resuming; - lldb::CommandObjectSP m_command_sp; - int64_t m_breakpoint_pc_offset; - lldb::tid_t m_initial_tid; // The inital thread ID, given by stub on attach + size_t + UpdateThreadIDsFromStopReplyThreadsValue (std::string &value); bool HandleNotifyPacket(StringExtractorGDBRemote &packet); @@ -396,7 +412,10 @@ protected: lldb::StateType SetThreadStopInfo (StringExtractor& stop_packet); - lldb::StateType + bool + GetThreadStopInfoFromJSON (ThreadGDBRemote *thread, const StructuredData::ObjectSP &thread_infos_sp); + + lldb::ThreadSP SetThreadStopInfo (StructuredData::Dictionary *thread_dict); lldb::ThreadSP @@ -445,7 +464,7 @@ protected: GetLoadedModuleList (GDBLoadedModuleInfoList &); lldb::ModuleSP - LoadModuleAtAddress (const FileSpec &file, lldb::addr_t base_addr); + LoadModuleAtAddress (const FileSpec &file, lldb::addr_t base_addr, bool value_is_offset); private: //------------------------------------------------------------------ @@ -458,10 +477,9 @@ private: lldb::user_id_t break_loc_id); DISALLOW_COPY_AND_ASSIGN (ProcessGDBRemote); - }; } // namespace process_gdb_remote } // namespace lldb_private -#endif // liblldb_ProcessGDBRemote_h_ +#endif // liblldb_ProcessGDBRemote_h_ -- cgit v1.2.3