diff options
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
20 files changed, 343 insertions, 286 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 62bc3627f69..0470665fe6b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -43,6 +43,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; GDBRemoteCommunication::History::History (uint32_t size) : m_packets(), @@ -93,7 +94,7 @@ GDBRemoteCommunication::History::AddPacket (const std::string &src, } void -GDBRemoteCommunication::History::Dump (lldb_private::Stream &strm) const +GDBRemoteCommunication::History::Dump (Stream &strm) const { const uint32_t size = GetNumPacketsInHistory (); const uint32_t first_idx = GetFirstSavedPacketIndex (); @@ -114,7 +115,7 @@ GDBRemoteCommunication::History::Dump (lldb_private::Stream &strm) const } void -GDBRemoteCommunication::History::Dump (lldb_private::Log *log) const +GDBRemoteCommunication::History::Dump (Log *log) const { if (log && !m_dumped_to_log) { @@ -679,7 +680,7 @@ GDBRemoteCommunication::ListenThread (lldb::thread_arg_t arg) Error GDBRemoteCommunication::StartDebugserverProcess (const char *hostname, uint16_t in_port, - lldb_private::ProcessLaunchInfo &launch_info, + ProcessLaunchInfo &launch_info, uint16_t &out_port) { Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index b704df3b72f..77f60ea76aa 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -27,6 +27,9 @@ #include "Utility/StringExtractorGDBRemote.h" +namespace lldb_private { +namespace process_gdb_remote { + typedef enum { eStoppointInvalid = -1, @@ -39,7 +42,7 @@ typedef enum class ProcessGDBRemote; -class GDBRemoteCommunication : public lldb_private::Communication +class GDBRemoteCommunication : public Communication { public: enum @@ -96,7 +99,7 @@ public: size_t payload_length); bool - GetSequenceMutex (lldb_private::Mutex::Locker& locker, const char *failure_message = NULL); + GetSequenceMutex (Mutex::Locker& locker, const char *failure_message = NULL); bool CheckForPacket (const uint8_t *src, @@ -139,20 +142,20 @@ public: uint32_t GetPacketTimeoutInMicroSeconds () const { - return m_packet_timeout * lldb_private::TimeValue::MicroSecPerSec; + return m_packet_timeout * TimeValue::MicroSecPerSec; } //------------------------------------------------------------------ // Start a debugserver instance on the current host using the // supplied connection URL. //------------------------------------------------------------------ - lldb_private::Error + Error StartDebugserverProcess (const char *hostname, uint16_t in_port, // If set to zero, then out_port will contain the bound port on exit - lldb_private::ProcessLaunchInfo &launch_info, + ProcessLaunchInfo &launch_info, uint16_t &out_port); void - DumpHistory(lldb_private::Stream &strm); + DumpHistory(Stream &strm); protected: @@ -209,10 +212,10 @@ protected: uint32_t bytes_transmitted); void - Dump (lldb_private::Stream &strm) const; + Dump (Stream &strm) const; void - Dump (lldb_private::Log *log) const; + Dump (Log *log) const; bool DidDumpToLog () const @@ -274,19 +277,19 @@ protected: uint32_t timeout_usec); bool - WaitForNotRunningPrivate (const lldb_private::TimeValue *timeout_ptr); + WaitForNotRunningPrivate (const TimeValue *timeout_ptr); //------------------------------------------------------------------ // Classes that inherit from GDBRemoteCommunication can see and modify these //------------------------------------------------------------------ uint32_t m_packet_timeout; #ifdef ENABLE_MUTEX_ERROR_CHECKING - lldb_private::TrackingMutex m_sequence_mutex; + TrackingMutex m_sequence_mutex; #else - lldb_private::Mutex m_sequence_mutex; // Restrict access to sending/receiving packets to a single thread at a time + Mutex m_sequence_mutex; // Restrict access to sending/receiving packets to a single thread at a time #endif - lldb_private::Predicate<bool> m_public_is_running; - lldb_private::Predicate<bool> m_private_is_running; + Predicate<bool> m_public_is_running; + Predicate<bool> m_private_is_running; History m_history; bool m_send_acks; bool m_is_platform; // Set to true if this class represents a platform, @@ -294,9 +297,8 @@ protected: // a single process - lldb_private::Error - StartListenThread (const char *hostname = "127.0.0.1", - uint16_t port = 0); + Error + StartListenThread (const char *hostname = "127.0.0.1", uint16_t port = 0); bool JoinListenThread (); @@ -305,7 +307,7 @@ protected: ListenThread (lldb::thread_arg_t arg); private: - lldb_private::HostThread m_listen_thread; + HostThread m_listen_thread; std::string m_listen_url; //------------------------------------------------------------------ @@ -314,4 +316,7 @@ private: DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunication); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_GDBRemoteCommunication_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index aad69a06b9c..756406c4e8c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -42,6 +42,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; #if defined(LLDB_DISABLE_POSIX) && !defined(SIGSTOP) #define SIGSTOP 17 diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index acd8a17db8b..4019ab74530 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -21,6 +21,9 @@ #include "GDBRemoteCommunication.h" +namespace lldb_private { +namespace process_gdb_remote { + class GDBRemoteCommunicationClient : public GDBRemoteCommunication { public: @@ -36,7 +39,7 @@ public: // we are communicating with it. //------------------------------------------------------------------ bool - HandshakeWithServer (lldb_private::Error *error_ptr); + HandshakeWithServer (Error *error_ptr); PacketResult SendPacketAndWaitForResponse (const char *send_payload, @@ -95,7 +98,7 @@ public: SendAsyncSignal (int signo); bool - SendInterrupt (lldb_private::Mutex::Locker &locker, + SendInterrupt (Mutex::Locker &locker, uint32_t seconds_to_wait_for_stop, bool &timed_out); @@ -126,7 +129,7 @@ public: /// response was received. //------------------------------------------------------------------ int - SendArgumentsPacket (const lldb_private::ProcessLaunchInfo &launch_info); + SendArgumentsPacket (const ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the @@ -268,29 +271,28 @@ public: bool DeallocateMemory (lldb::addr_t addr); - lldb_private::Error + Error Detach (bool keep_stopped); - lldb_private::Error - GetMemoryRegionInfo (lldb::addr_t addr, - lldb_private::MemoryRegionInfo &range_info); + Error + GetMemoryRegionInfo (lldb::addr_t addr, MemoryRegionInfo &range_info); - lldb_private::Error + Error GetWatchpointSupportInfo (uint32_t &num); - lldb_private::Error + Error GetWatchpointSupportInfo (uint32_t &num, bool& after); - lldb_private::Error + Error GetWatchpointsTriggerAfterInstruction (bool &after); - const lldb_private::ArchSpec & + const ArchSpec & GetHostArchitecture (); uint32_t GetHostDefaultPacketTimeout(); - const lldb_private::ArchSpec & + const ArchSpec & GetProcessArchitecture (); void @@ -328,7 +330,7 @@ public: bool GetOSKernelDescription (std::string &s); - lldb_private::ArchSpec + ArchSpec GetSystemArchitecture (); bool @@ -341,12 +343,11 @@ public: GetSupportsThreadSuffix (); bool - GetProcessInfo (lldb::pid_t pid, - lldb_private::ProcessInstanceInfo &process_info); + GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info); uint32_t - FindProcesses (const lldb_private::ProcessInstanceInfoMatch &process_match_info, - lldb_private::ProcessInstanceInfoList &process_infos); + FindProcesses (const ProcessInstanceInfoMatch &process_match_info, + ProcessInstanceInfoList &process_infos); bool GetUserName (uint32_t uid, std::string &name); @@ -425,7 +426,7 @@ public: bool GetAugmentedLibrariesSVR4ReadSupported (); - lldb_private::LazyBool + LazyBool SupportsAllocDeallocMemory () // const { // Uncomment this to have lldb pretend the debug server doesn't respond to alloc/dealloc memory packets. @@ -444,22 +445,18 @@ public: } lldb::user_id_t - OpenFile (const lldb_private::FileSpec& file_spec, - uint32_t flags, - mode_t mode, - lldb_private::Error &error); + OpenFile (const FileSpec& file_spec, uint32_t flags, mode_t mode, Error &error); bool - CloseFile (lldb::user_id_t fd, - lldb_private::Error &error); + CloseFile (lldb::user_id_t fd, Error &error); lldb::user_id_t - GetFileSize (const lldb_private::FileSpec& file_spec); + GetFileSize (const FileSpec& file_spec); - lldb_private::Error + Error GetFilePermissions(const char *path, uint32_t &file_permissions); - lldb_private::Error + Error SetFilePermissions(const char *path, uint32_t file_permissions); uint64_t @@ -467,30 +464,29 @@ public: uint64_t offset, void *dst, uint64_t dst_len, - lldb_private::Error &error); + Error &error); uint64_t WriteFile (lldb::user_id_t fd, uint64_t offset, const void* src, uint64_t src_len, - lldb_private::Error &error); + Error &error); - lldb_private::Error + Error CreateSymlink (const char *src, const char *dst); - lldb_private::Error + Error Unlink (const char *path); - lldb_private::Error - MakeDirectory (const char *path, - uint32_t mode); + Error + MakeDirectory (const char *path, uint32_t mode); bool - GetFileExists (const lldb_private::FileSpec& file_spec); + GetFileExists (const FileSpec& file_spec); - lldb_private::Error + Error RunShellCommand (const char *command, // Shouldn't be NULL const char *working_dir, // Pass NULL to use the current working directory int *status_ptr, // Pass NULL if you don't want the process exit status @@ -499,9 +495,7 @@ public: uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish bool - CalculateMD5 (const lldb_private::FileSpec& file_spec, - uint64_t &high, - uint64_t &low); + CalculateMD5 (const FileSpec& file_spec, uint64_t &high, uint64_t &low); std::string HarmonizeThreadIdsForProfileData (ProcessGDBRemote *process, @@ -535,9 +529,9 @@ public: GetThreadExtendedInfoSupported(); bool - GetModuleInfo (const lldb_private::FileSpec& module_file_spec, - const lldb_private::ArchSpec& arch_spec, - lldb_private::ModuleSpec &module_spec); + GetModuleInfo (const FileSpec& module_file_spec, + const ArchSpec& arch_spec, + ModuleSpec &module_spec); protected: @@ -555,35 +549,35 @@ protected: //------------------------------------------------------------------ // Classes that inherit from GDBRemoteCommunicationClient can see and modify these //------------------------------------------------------------------ - lldb_private::LazyBool m_supports_not_sending_acks; - lldb_private::LazyBool m_supports_thread_suffix; - lldb_private::LazyBool m_supports_threads_in_stop_reply; - lldb_private::LazyBool m_supports_vCont_all; - lldb_private::LazyBool m_supports_vCont_any; - lldb_private::LazyBool m_supports_vCont_c; - lldb_private::LazyBool m_supports_vCont_C; - lldb_private::LazyBool m_supports_vCont_s; - lldb_private::LazyBool m_supports_vCont_S; - lldb_private::LazyBool m_qHostInfo_is_valid; - lldb_private::LazyBool m_curr_pid_is_valid; - lldb_private::LazyBool m_qProcessInfo_is_valid; - lldb_private::LazyBool m_qGDBServerVersion_is_valid; - lldb_private::LazyBool m_supports_alloc_dealloc_memory; - lldb_private::LazyBool m_supports_memory_region_info; - lldb_private::LazyBool m_supports_watchpoint_support_info; - lldb_private::LazyBool m_supports_detach_stay_stopped; - lldb_private::LazyBool m_watchpoints_trigger_after_instruction; - lldb_private::LazyBool m_attach_or_wait_reply; - lldb_private::LazyBool m_prepare_for_reg_writing_reply; - lldb_private::LazyBool m_supports_p; - lldb_private::LazyBool m_supports_x; - lldb_private::LazyBool m_avoid_g_packets; - lldb_private::LazyBool m_supports_QSaveRegisterState; - lldb_private::LazyBool m_supports_qXfer_auxv_read; - lldb_private::LazyBool m_supports_qXfer_libraries_read; - lldb_private::LazyBool m_supports_qXfer_libraries_svr4_read; - lldb_private::LazyBool m_supports_augmented_libraries_svr4_read; - lldb_private::LazyBool m_supports_jThreadExtendedInfo; + LazyBool m_supports_not_sending_acks; + LazyBool m_supports_thread_suffix; + LazyBool m_supports_threads_in_stop_reply; + LazyBool m_supports_vCont_all; + LazyBool m_supports_vCont_any; + LazyBool m_supports_vCont_c; + LazyBool m_supports_vCont_C; + LazyBool m_supports_vCont_s; + LazyBool m_supports_vCont_S; + LazyBool m_qHostInfo_is_valid; + LazyBool m_curr_pid_is_valid; + LazyBool m_qProcessInfo_is_valid; + LazyBool m_qGDBServerVersion_is_valid; + LazyBool m_supports_alloc_dealloc_memory; + LazyBool m_supports_memory_region_info; + LazyBool m_supports_watchpoint_support_info; + LazyBool m_supports_detach_stay_stopped; + LazyBool m_watchpoints_trigger_after_instruction; + LazyBool m_attach_or_wait_reply; + LazyBool m_prepare_for_reg_writing_reply; + LazyBool m_supports_p; + LazyBool m_supports_x; + LazyBool m_avoid_g_packets; + LazyBool m_supports_QSaveRegisterState; + LazyBool m_supports_qXfer_auxv_read; + LazyBool m_supports_qXfer_libraries_read; + LazyBool m_supports_qXfer_libraries_svr4_read; + LazyBool m_supports_augmented_libraries_svr4_read; + LazyBool m_supports_jThreadExtendedInfo; bool m_supports_qProcessInfoPID:1, @@ -608,8 +602,8 @@ protected: // If we need to send a packet while the target is running, the m_async_XXX // member variables take care of making this happen. - lldb_private::Mutex m_async_mutex; - lldb_private::Predicate<bool> m_async_packet_predicate; + Mutex m_async_mutex; + Predicate<bool> m_async_packet_predicate; std::string m_async_packet; PacketResult m_async_result; StringExtractorGDBRemote m_async_response; @@ -618,8 +612,8 @@ protected: std::string m_partial_profile_data; std::map<uint64_t, uint32_t> m_thread_id_to_used_usec_map; - lldb_private::ArchSpec m_host_arch; - lldb_private::ArchSpec m_process_arch; + ArchSpec m_host_arch; + ArchSpec m_process_arch; uint32_t m_os_version_major; uint32_t m_os_version_minor; uint32_t m_os_version_update; @@ -633,7 +627,7 @@ protected: bool DecodeProcessInfoResponse (StringExtractorGDBRemote &response, - lldb_private::ProcessInstanceInfo &process_info); + ProcessInstanceInfo &process_info); private: //------------------------------------------------------------------ // For GDBRemoteCommunicationClient only @@ -641,4 +635,7 @@ private: DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_GDBRemoteCommunicationClient_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index c24656159e1..409efdfa2f7 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -23,6 +23,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; GDBRemoteCommunicationServer::GDBRemoteCommunicationServer(const char *comm_name, const char *listener_name) : diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h index 148545f4103..992c6dffaf5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h @@ -20,16 +20,19 @@ #include "lldb/lldb-private-forward.h" #include "GDBRemoteCommunication.h" -class ProcessGDBRemote; class StringExtractorGDBRemote; -class GDBRemoteCommunicationServer : - public GDBRemoteCommunication +namespace lldb_private { +namespace process_gdb_remote { + +class ProcessGDBRemote; + +class GDBRemoteCommunicationServer : public GDBRemoteCommunication { public: using PortMap = std::map<uint16_t, lldb::pid_t>; using PacketHandler = std::function<PacketResult(StringExtractorGDBRemote &packet, - lldb_private::Error &error, + Error &error, bool &interrupt, bool &quit)>; @@ -44,14 +47,14 @@ public: PacketResult GetPacketAndSendResponse (uint32_t timeout_usec, - lldb_private::Error &error, + Error &error, bool &interrupt, bool &quit); // After connecting, do a little handshake with the client to make sure // we are at least communicating bool - HandshakeWithClient (lldb_private::Error *error_ptr); + HandshakeWithClient (Error *error_ptr); protected: std::map<StringExtractorGDBRemote::ServerPacketType, PacketHandler> m_packet_handlers; @@ -76,4 +79,7 @@ private: DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationServer); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_GDBRemoteCommunicationServer_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index 3e9ad7c3fdb..74e27beceff 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -45,6 +45,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; #ifdef __ANDROID__ const static uint32_t g_default_packet_timeout_sec = 20; // seconds diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h index 8fc270fa462..c11a927ead4 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h @@ -23,9 +23,13 @@ #include "GDBRemoteCommunicationServer.h" #include "GDBRemoteCommunicationServerCommon.h" -class ProcessGDBRemote; class StringExtractorGDBRemote; +namespace lldb_private { +namespace process_gdb_remote { + +class ProcessGDBRemote; + class GDBRemoteCommunicationServerCommon : public GDBRemoteCommunicationServer { @@ -37,10 +41,10 @@ public: protected: std::set<lldb::pid_t> m_spawned_pids; - lldb_private::Mutex m_spawned_pids_mutex; - lldb_private::ProcessLaunchInfo m_process_launch_info; - lldb_private::Error m_process_launch_error; - lldb_private::ProcessInstanceInfoList m_proc_infos; + Mutex m_spawned_pids_mutex; + ProcessLaunchInfo m_process_launch_info; + Error m_process_launch_error; + ProcessInstanceInfoList m_proc_infos; uint32_t m_proc_infos_index; bool m_thread_suffix_supported; bool m_list_threads_in_stop_reply; @@ -154,12 +158,12 @@ protected: KillSpawnedProcess (lldb::pid_t pid); static void - CreateProcessInfoResponse (const lldb_private::ProcessInstanceInfo &proc_info, - lldb_private::StreamString &response); + CreateProcessInfoResponse (const ProcessInstanceInfo &proc_info, + StreamString &response); static void - CreateProcessInfoResponse_DebugServerStyle (const lldb_private::ProcessInstanceInfo &proc_info, - lldb_private::StreamString &response); + CreateProcessInfoResponse_DebugServerStyle (const ProcessInstanceInfo &proc_info, + StreamString &response); template <typename T> void @@ -168,7 +172,7 @@ protected: { RegisterPacketHandler(packet_type, [this, handler] (StringExtractorGDBRemote packet, - lldb_private::Error &error, + Error &error, bool &interrupt, bool &quit) { @@ -193,11 +197,14 @@ protected: /// An Error object indicating the success or failure of the /// launch. //------------------------------------------------------------------ - virtual lldb_private::Error + virtual Error LaunchProcess () = 0; - virtual lldb_private::FileSpec - FindModuleFile (const std::string& module_path, const lldb_private::ArchSpec& arch); + virtual FileSpec + FindModuleFile (const std::string& module_path, const ArchSpec& arch); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_GDBRemoteCommunicationServerCommon_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 3892f483904..3dfb6684e26 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -53,6 +53,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; //---------------------------------------------------------------------- // GDBRemote Errors @@ -189,32 +190,32 @@ GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers() }); } -lldb_private::Error +Error GDBRemoteCommunicationServerLLGS::SetLaunchArguments (const char *const args[], int argc) { if ((argc < 1) || !args || !args[0] || !args[0][0]) - return lldb_private::Error ("%s: no process command line specified to launch", __FUNCTION__); + return Error ("%s: no process command line specified to launch", __FUNCTION__); m_process_launch_info.SetArguments (const_cast<const char**> (args), true); - return lldb_private::Error (); + return Error (); } -lldb_private::Error +Error GDBRemoteCommunicationServerLLGS::SetLaunchFlags (unsigned int launch_flags) { m_process_launch_info.GetFlags ().Set (launch_flags); - return lldb_private::Error (); + return Error (); } -lldb_private::Error +Error GDBRemoteCommunicationServerLLGS::LaunchProcess () { Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); if (!m_process_launch_info.GetArguments ().GetArgumentCount ()) - return lldb_private::Error ("%s: no process command line specified to launch", __FUNCTION__); + return Error ("%s: no process command line specified to launch", __FUNCTION__); - lldb_private::Error error; + Error error; { Mutex::Locker locker (m_debugged_process_mutex); assert (!m_debugged_process_sp && "lldb-gdbserver creating debugged process but one already exists"); @@ -286,7 +287,7 @@ GDBRemoteCommunicationServerLLGS::LaunchProcess () return error; } -lldb_private::Error +Error GDBRemoteCommunicationServerLLGS::AttachToProcess (lldb::pid_t pid) { Error error; @@ -340,7 +341,7 @@ GDBRemoteCommunicationServerLLGS::AttachToProcess (lldb::pid_t pid) } void -GDBRemoteCommunicationServerLLGS::InitializeDelegate (lldb_private::NativeProcessProtocol *process) +GDBRemoteCommunicationServerLLGS::InitializeDelegate (NativeProcessProtocol *process) { assert (process && "process cannot be NULL"); Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -354,7 +355,7 @@ GDBRemoteCommunicationServerLLGS::InitializeDelegate (lldb_private::NativeProces } GDBRemoteCommunication::PacketResult -GDBRemoteCommunicationServerLLGS::SendWResponse (lldb_private::NativeProcessProtocol *process) +GDBRemoteCommunicationServerLLGS::SendWResponse (NativeProcessProtocol *process) { assert (process && "process cannot be NULL"); Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -653,7 +654,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread (lldb::tid_t tid) } void -GDBRemoteCommunicationServerLLGS::HandleInferiorState_Exited (lldb_private::NativeProcessProtocol *process) +GDBRemoteCommunicationServerLLGS::HandleInferiorState_Exited (NativeProcessProtocol *process) { assert (process && "process cannot be NULL"); @@ -705,7 +706,7 @@ GDBRemoteCommunicationServerLLGS::HandleInferiorState_Exited (lldb_private::Nati } void -GDBRemoteCommunicationServerLLGS::HandleInferiorState_Stopped (lldb_private::NativeProcessProtocol *process) +GDBRemoteCommunicationServerLLGS::HandleInferiorState_Stopped (NativeProcessProtocol *process) { assert (process && "process cannot be NULL"); @@ -734,7 +735,7 @@ GDBRemoteCommunicationServerLLGS::HandleInferiorState_Stopped (lldb_private::Nat } void -GDBRemoteCommunicationServerLLGS::ProcessStateChanged (lldb_private::NativeProcessProtocol *process, lldb::StateType state) +GDBRemoteCommunicationServerLLGS::ProcessStateChanged (NativeProcessProtocol *process, lldb::StateType state) { assert (process && "process cannot be NULL"); Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -793,7 +794,7 @@ GDBRemoteCommunicationServerLLGS::SendONotification (const char *buffer, uint32_ return SendPacketNoLock (response.GetData (), response.GetSize ()); } -lldb_private::Error +Error GDBRemoteCommunicationServerLLGS::SetSTDIOFileDescriptor (int fd) { Error error; @@ -1002,7 +1003,7 @@ GDBRemoteCommunicationServerLLGS::Handle_C (StringExtractorGDBRemote &packet) return SendIllFormedResponse (packet, "unexpected content after $C{signal-number}"); } - lldb_private::ResumeActionList resume_actions (StateType::eStateRunning, 0); + ResumeActionList resume_actions (StateType::eStateRunning, 0); Error error; // We have two branches: what to do if a continue thread is specified (in which case we target @@ -1015,7 +1016,7 @@ GDBRemoteCommunicationServerLLGS::Handle_C (StringExtractorGDBRemote &packet) if (signal_tid != LLDB_INVALID_THREAD_ID) { // The resume action for the continue thread (or all threads if a continue thread is not set). - lldb_private::ResumeAction action = { GetContinueThreadID (), StateType::eStateRunning, static_cast<int> (signo) }; + ResumeAction action = { GetContinueThreadID (), StateType::eStateRunning, static_cast<int> (signo) }; // Add the action for the continue thread (or all threads when the continue thread isn't present). resume_actions.Append (action); @@ -1080,7 +1081,7 @@ GDBRemoteCommunicationServerLLGS::Handle_c (StringExtractorGDBRemote &packet) } // Build the ResumeActionList - lldb_private::ResumeActionList actions (StateType::eStateRunning, 0); + ResumeActionList actions (StateType::eStateRunning, 0); Error error = m_debugged_process_sp->Resume (actions); if (error.Fail ()) @@ -1841,7 +1842,7 @@ GDBRemoteCommunicationServerLLGS::Handle_m (StringExtractorGDBRemote &packet) // Retrieve the process memory. lldb::addr_t bytes_read = 0; - lldb_private::Error error = m_debugged_process_sp->ReadMemory (read_addr, &buf[0], byte_count, bytes_read); + Error error = m_debugged_process_sp->ReadMemory (read_addr, &buf[0], byte_count, bytes_read); if (error.Fail ()) { if (log) @@ -1921,7 +1922,7 @@ GDBRemoteCommunicationServerLLGS::Handle_M (StringExtractorGDBRemote &packet) // Write the process memory. lldb::addr_t bytes_written = 0; - lldb_private::Error error = m_debugged_process_sp->WriteMemory (write_addr, &buf[0], byte_count, bytes_written); + Error error = m_debugged_process_sp->WriteMemory (write_addr, &buf[0], byte_count, bytes_written); if (error.Fail ()) { if (log) @@ -2234,10 +2235,10 @@ GDBRemoteCommunicationServerLLGS::Handle_s (StringExtractorGDBRemote &packet) return SendErrorResponse (0x33); // Create the step action for the given thread. - lldb_private::ResumeAction action = { tid, eStateStepping, 0 }; + ResumeAction action = { tid, eStateStepping, 0 }; // Setup the actions list. - lldb_private::ResumeActionList actions; + ResumeActionList actions; actions.Append (action); // All other threads stop while we're single stepping a thread. @@ -2642,7 +2643,7 @@ GDBRemoteCommunicationServerLLGS::MaybeCloseInferiorTerminalConnection () } -lldb_private::NativeThreadProtocolSP +NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix (StringExtractorGDBRemote &packet) { NativeThreadProtocolSP thread_sp; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h index d7fc115fbe3..a47e9a19f0b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h @@ -23,12 +23,16 @@ // Project includes #include "GDBRemoteCommunicationServerCommon.h" -class ProcessGDBRemote; class StringExtractorGDBRemote; +namespace lldb_private { +namespace process_gdb_remote { + +class ProcessGDBRemote; + class GDBRemoteCommunicationServerLLGS : public GDBRemoteCommunicationServerCommon, - public lldb_private::NativeProcessProtocol::NativeDelegate + public NativeProcessProtocol::NativeDelegate { public: //------------------------------------------------------------------ @@ -53,7 +57,7 @@ public: /// An Error object indicating the success or failure of making /// the setting. //------------------------------------------------------------------ - lldb_private::Error + Error SetLaunchArguments (const char *const args[], int argc); //------------------------------------------------------------------ @@ -66,7 +70,7 @@ public: /// An Error object indicating the success or failure of making /// the setting. //------------------------------------------------------------------ - lldb_private::Error + Error SetLaunchFlags (unsigned int launch_flags); //------------------------------------------------------------------ @@ -80,7 +84,7 @@ public: /// An Error object indicating the success or failure of the /// launch. //------------------------------------------------------------------ - lldb_private::Error + Error LaunchProcess () override; //------------------------------------------------------------------ @@ -93,33 +97,33 @@ public: /// An Error object indicating the success or failure of the /// attach operation. //------------------------------------------------------------------ - lldb_private::Error + Error AttachToProcess (lldb::pid_t pid); //------------------------------------------------------------------ // NativeProcessProtocol::NativeDelegate overrides //------------------------------------------------------------------ void - InitializeDelegate (lldb_private::NativeProcessProtocol *process) override; + InitializeDelegate (NativeProcessProtocol *process) override; void - ProcessStateChanged (lldb_private::NativeProcessProtocol *process, lldb::StateType state) override; + ProcessStateChanged (NativeProcessProtocol *process, lldb::StateType state) override; void - DidExec (lldb_private::NativeProcessProtocol *process) override; + DidExec (NativeProcessProtocol *process) override; protected: lldb::PlatformSP m_platform_sp; lldb::thread_t m_async_thread; lldb::tid_t m_current_tid; lldb::tid_t m_continue_tid; - lldb_private::Mutex m_debugged_process_mutex; - lldb_private::NativeProcessProtocolSP m_debugged_process_sp; + Mutex m_debugged_process_mutex; + NativeProcessProtocolSP m_debugged_process_sp; lldb::DebuggerSP m_debugger_sp; Communication m_stdio_communication; lldb::StateType m_inferior_prev_state; lldb::DataBufferSP m_active_auxv_buffer_sp; - lldb_private::Mutex m_saved_registers_mutex; + Mutex m_saved_registers_mutex; std::unordered_map<uint32_t, lldb::DataBufferSP> m_saved_registers_map; uint32_t m_next_saved_registers_id; @@ -127,7 +131,7 @@ protected: SendONotification (const char *buffer, uint32_t len); PacketResult - SendWResponse (lldb_private::NativeProcessProtocol *process); + SendWResponse (NativeProcessProtocol *process); PacketResult SendStopReplyPacketForThread (lldb::tid_t tid); @@ -246,14 +250,14 @@ protected: lldb::tid_t GetContinueThreadID () const { return m_continue_tid; } - lldb_private::Error + Error SetSTDIOFileDescriptor (int fd); static void STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len); - lldb_private::FileSpec - FindModuleFile (const std::string& module_path, const lldb_private::ArchSpec& arch) override; + FileSpec + FindModuleFile (const std::string& module_path, const ArchSpec& arch) override; private: bool @@ -267,15 +271,15 @@ private: int status); void - HandleInferiorState_Exited (lldb_private::NativeProcessProtocol *process); + HandleInferiorState_Exited (NativeProcessProtocol *process); void - HandleInferiorState_Stopped (lldb_private::NativeProcessProtocol *process); + HandleInferiorState_Stopped (NativeProcessProtocol *process); void FlushInferiorOutput (); - lldb_private::NativeThreadProtocolSP + NativeThreadProtocolSP GetThreadFromSuffix (StringExtractorGDBRemote &packet); uint32_t @@ -296,4 +300,7 @@ private: DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationServerLLGS); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_GDBRemoteCommunicationServerLLGS_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index 346162f305b..0ab965853a5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -33,6 +33,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; //---------------------------------------------------------------------- // GDBRemoteCommunicationServerPlatform constructor @@ -275,11 +276,11 @@ GDBRemoteCommunicationServerPlatform::ReapDebugserverProcess (void *callback_bat return true; } -lldb_private::Error +Error GDBRemoteCommunicationServerPlatform::LaunchProcess () { if (!m_process_launch_info.GetArguments ().GetArgumentCount ()) - return lldb_private::Error ("%s: no process command line specified to launch", __FUNCTION__); + return Error ("%s: no process command line specified to launch", __FUNCTION__); // specify the process monitor if not already set. This should // generally be what happens since we need to reap started @@ -287,7 +288,7 @@ GDBRemoteCommunicationServerPlatform::LaunchProcess () if (!m_process_launch_info.GetMonitorProcessCallback ()) m_process_launch_info.SetMonitorProcessCallback(ReapDebugserverProcess, this, false); - lldb_private::Error error = m_platform_sp->LaunchProcess (m_process_launch_info); + Error error = m_platform_sp->LaunchProcess (m_process_launch_info); if (!error.Success ()) { fprintf (stderr, "%s: failed to launch executable %s", __FUNCTION__, m_process_launch_info.GetArguments ().GetArgumentAtIndex (0)); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h index 430cc5e505e..4124b0424f5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h @@ -12,6 +12,9 @@ #include "GDBRemoteCommunicationServerCommon.h" +namespace lldb_private { +namespace process_gdb_remote { + class GDBRemoteCommunicationServerPlatform : public GDBRemoteCommunicationServerCommon { @@ -23,7 +26,7 @@ public: virtual ~GDBRemoteCommunicationServerPlatform(); - lldb_private::Error + Error LaunchProcess () override; // Set both ports to zero to let the platform automatically bind to @@ -93,4 +96,7 @@ private: DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationServerPlatform); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_GDBRemoteCommunicationServerPlatform_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 6d7eca1a0ce..74b0d04859e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -33,6 +33,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; //---------------------------------------------------------------------- // GDBRemoteRegisterContext constructor @@ -151,7 +152,7 @@ GDBRemoteRegisterContext::PrivateSetRegisterValue (uint32_t reg, StringExtractor // Helper function for GDBRemoteRegisterContext::ReadRegisterBytes(). bool -GDBRemoteRegisterContext::GetPrimordialRegister(const lldb_private::RegisterInfo *reg_info, +GDBRemoteRegisterContext::GetPrimordialRegister(const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm) { const uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; @@ -265,7 +266,7 @@ GDBRemoteRegisterContext::WriteRegister (const RegisterInfo *reg_info, // Helper function for GDBRemoteRegisterContext::WriteRegisterBytes(). bool -GDBRemoteRegisterContext::SetPrimordialRegister(const lldb_private::RegisterInfo *reg_info, +GDBRemoteRegisterContext::SetPrimordialRegister(const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm) { StreamString packet; @@ -316,7 +317,7 @@ GDBRemoteRegisterContext::SyncThreadState(Process *process) } bool -GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo *reg_info, DataExtractor &data, uint32_t data_offset) +GDBRemoteRegisterContext::WriteRegisterBytes (const RegisterInfo *reg_info, DataExtractor &data, uint32_t data_offset) { ExecutionContext exe_ctx (CalculateThread()); @@ -460,7 +461,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo * } bool -GDBRemoteRegisterContext::ReadAllRegisterValues (lldb_private::RegisterCheckpoint ®_checkpoint) +GDBRemoteRegisterContext::ReadAllRegisterValues (RegisterCheckpoint ®_checkpoint) { ExecutionContext exe_ctx (CalculateThread()); @@ -486,7 +487,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb_private::RegisterCheckpoin } bool -GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb_private::RegisterCheckpoint ®_checkpoint) +GDBRemoteRegisterContext::WriteAllRegisterValues (const RegisterCheckpoint ®_checkpoint) { uint32_t save_id = reg_checkpoint.GetID(); if (save_id != 0) diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h index 6702b7ceab4..117d280cc54 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h @@ -25,9 +25,13 @@ #include "GDBRemoteCommunicationClient.h" +class StringExtractor; + +namespace lldb_private { +namespace process_gdb_remote { + class ThreadGDBRemote; class ProcessGDBRemote; -class StringExtractor; class GDBRemoteDynamicRegisterInfo : public DynamicRegisterInfo @@ -47,7 +51,7 @@ public: }; -class GDBRemoteRegisterContext : public lldb_private::RegisterContext +class GDBRemoteRegisterContext : public RegisterContext { public: //------------------------------------------------------------------ @@ -70,20 +74,20 @@ public: size_t GetRegisterCount () override; - const lldb_private::RegisterInfo * + const RegisterInfo * GetRegisterInfoAtIndex (size_t reg) override; size_t GetRegisterSetCount () override; - const lldb_private::RegisterSet * + const RegisterSet * GetRegisterSet (size_t reg_set) override; bool - ReadRegister (const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override; + ReadRegister (const RegisterInfo *reg_info, RegisterValue &value) override; bool - WriteRegister (const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override; + WriteRegister (const RegisterInfo *reg_info, const RegisterValue &value) override; bool ReadAllRegisterValues (lldb::DataBufferSP &data_sp) override; @@ -92,10 +96,10 @@ public: WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override; bool - ReadAllRegisterValues (lldb_private::RegisterCheckpoint ®_checkpoint) override; + ReadAllRegisterValues (RegisterCheckpoint ®_checkpoint) override; bool - WriteAllRegisterValues (const lldb_private::RegisterCheckpoint ®_checkpoint) override; + WriteAllRegisterValues (const RegisterCheckpoint ®_checkpoint) override; uint32_t ConvertRegisterKindToRegisterNumber (lldb::RegisterKind kind, uint32_t num) override; @@ -104,12 +108,12 @@ protected: friend class ThreadGDBRemote; bool - ReadRegisterBytes (const lldb_private::RegisterInfo *reg_info, - lldb_private::DataExtractor &data); + ReadRegisterBytes (const RegisterInfo *reg_info, + DataExtractor &data); bool - WriteRegisterBytes (const lldb_private::RegisterInfo *reg_info, - lldb_private::DataExtractor &data, + WriteRegisterBytes (const RegisterInfo *reg_info, + DataExtractor &data, uint32_t data_offset); bool @@ -130,7 +134,7 @@ protected: } void - SetRegisterIsValid (const lldb_private::RegisterInfo *reg_info, bool valid) + SetRegisterIsValid (const RegisterInfo *reg_info, bool valid) { if (reg_info) return SetRegisterIsValid (reg_info->kinds[lldb::eRegisterKindLLDB], valid); @@ -147,19 +151,19 @@ protected: } void - SyncThreadState(lldb_private::Process *process); // Assumes the sequence mutex has already been acquired. + SyncThreadState(Process *process); // Assumes the sequence mutex has already been acquired. GDBRemoteDynamicRegisterInfo &m_reg_info; std::vector<bool> m_reg_valid; - lldb_private::DataExtractor m_reg_data; + DataExtractor m_reg_data; bool m_read_all_at_once; private: // Helper function for ReadRegisterBytes(). - bool GetPrimordialRegister(const lldb_private::RegisterInfo *reg_info, + bool GetPrimordialRegister(const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm); // Helper function for WriteRegisterBytes(). - bool SetPrimordialRegister(const lldb_private::RegisterInfo *reg_info, + bool SetPrimordialRegister(const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm); //------------------------------------------------------------------ @@ -168,4 +172,7 @@ private: DISALLOW_COPY_AND_ASSIGN (GDBRemoteRegisterContext); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // lldb_GDBRemoteRegisterContext_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index d9912cc1e53..55964350b39 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -73,6 +73,10 @@ #include "ProcessGDBRemoteLog.h" #include "ThreadGDBRemote.h" +#define DEBUGSERVER_BASENAME "debugserver" +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; namespace lldb { @@ -85,18 +89,13 @@ namespace lldb void DumpProcessGDBRemotePacketHistory (void *p, const char *path) { - lldb_private::StreamFile strm; - lldb_private::Error error (strm.GetFile().Open(path, lldb_private::File::eOpenOptionWrite | lldb_private::File::eOpenOptionCanCreate)); + StreamFile strm; + Error error (strm.GetFile().Open(path, File::eOpenOptionWrite | File::eOpenOptionCanCreate)); if (error.Success()) ((ProcessGDBRemote *)p)->GetGDBRemote().DumpHistory (strm); } } -#define DEBUGSERVER_BASENAME "debugserver" -using namespace lldb; -using namespace lldb_private; - - namespace { static PropertyDefinition @@ -199,7 +198,7 @@ get_random_port () } #endif -lldb_private::ConstString +ConstString ProcessGDBRemote::GetPluginNameStatic() { static ConstString g_name("gdb-remote"); @@ -2240,7 +2239,7 @@ ProcessGDBRemote::DoDestroy () void ProcessGDBRemote::SetLastStopPacket (const StringExtractorGDBRemote &response) { - lldb_private::Mutex::Locker locker (m_last_stop_packet_mutex); + Mutex::Locker locker (m_last_stop_packet_mutex); const bool did_exec = response.GetStringRef().find(";reason:exec;") != std::string::npos; if (did_exec) { @@ -2380,7 +2379,7 @@ ProcessGDBRemote::DoWriteMemory (addr_t addr, const void *buf, size_t size, Erro lldb::addr_t ProcessGDBRemote::DoAllocateMemory (size_t size, uint32_t permissions, Error &error) { - lldb_private::Log *log (lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS|LIBLLDB_LOG_EXPRESSIONS)); + Log *log (GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS|LIBLLDB_LOG_EXPRESSIONS)); addr_t allocated_addr = LLDB_INVALID_ADDRESS; LazyBool supported = m_gdb_comm.SupportsAllocDeallocMemory(); @@ -2972,7 +2971,7 @@ ProcessGDBRemote::Initialize() } void -ProcessGDBRemote::DebuggerInitialize (lldb_private::Debugger &debugger) +ProcessGDBRemote::DebuggerInitialize (Debugger &debugger) { if (!PluginManager::GetSettingForProcessPlugin(debugger, PluginProperties::GetSettingName())) { @@ -3191,13 +3190,13 @@ ProcessGDBRemote::AsyncThread (void *arg) // bool ProcessGDBRemote::NewThreadNotifyBreakpointHit (void *baton, - lldb_private::StoppointCallbackContext *context, + StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id) { // I don't think I have to do anything here, just make sure I notice the new thread when it starts to // run so I can stop it if that's what I want to do. - Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Hit New Thread Notification breakpoint."); return false; @@ -3207,7 +3206,7 @@ ProcessGDBRemote::NewThreadNotifyBreakpointHit (void *baton, bool ProcessGDBRemote::StartNoticingNewThreads() { - Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_thread_create_bp_sp) { if (log && log->GetVerbose()) @@ -3239,7 +3238,7 @@ ProcessGDBRemote::StartNoticingNewThreads() bool ProcessGDBRemote::StopNoticingNewThreads() { - Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) log->Printf ("Disabling new thread notification breakpoint."); @@ -3249,7 +3248,7 @@ ProcessGDBRemote::StopNoticingNewThreads() return true; } -lldb_private::DynamicLoader * +DynamicLoader * ProcessGDBRemote::GetDynamicLoader () { if (m_dyld_ap.get() == NULL) diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 8cd445e8792..5cde354ff3c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -34,29 +34,32 @@ #include "Utility/StringExtractor.h" #include "GDBRemoteRegisterContext.h" +namespace lldb_private { +namespace process_gdb_remote { + class ThreadGDBRemote; -class ProcessGDBRemote : public lldb_private::Process +class ProcessGDBRemote : public Process { public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ static lldb::ProcessSP - CreateInstance (lldb_private::Target& target, - lldb_private::Listener &listener, - const lldb_private::FileSpec *crash_file_path); + CreateInstance (Target& target, + Listener &listener, + const FileSpec *crash_file_path); static void Initialize(); static void - DebuggerInitialize (lldb_private::Debugger &debugger); + DebuggerInitialize (Debugger &debugger); static void Terminate(); - static lldb_private::ConstString + static ConstString GetPluginNameStatic(); static const char * @@ -65,7 +68,7 @@ public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - ProcessGDBRemote(lldb_private::Target& target, lldb_private::Listener &listener); + ProcessGDBRemote(Target& target, Listener &listener); virtual ~ProcessGDBRemote(); @@ -74,54 +77,52 @@ public: // Check if a given Process //------------------------------------------------------------------ bool - CanDebug (lldb_private::Target &target, - bool plugin_specified_by_name) override; + CanDebug (Target &target, bool plugin_specified_by_name) override; - lldb_private::CommandObject * + CommandObject * GetPluginCommandObject() override; //------------------------------------------------------------------ // Creating a new process, or attaching to an existing one //------------------------------------------------------------------ - lldb_private::Error - WillLaunch (lldb_private::Module* module) override; + Error + WillLaunch (Module* module) override; - lldb_private::Error - DoLaunch (lldb_private::Module *exe_module, - lldb_private::ProcessLaunchInfo &launch_info) override; + Error + DoLaunch (Module *exe_module, ProcessLaunchInfo &launch_info) override; void DidLaunch () override; - lldb_private::Error + Error WillAttachToProcessWithID (lldb::pid_t pid) override; - lldb_private::Error + Error WillAttachToProcessWithName (const char *process_name, bool wait_for_launch) override; - lldb_private::Error - DoConnectRemote (lldb_private::Stream *strm, const char *remote_url) override; + Error + DoConnectRemote (Stream *strm, const char *remote_url) override; - lldb_private::Error + Error WillLaunchOrAttach (); - lldb_private::Error + Error DoAttachToProcessWithID (lldb::pid_t pid) override; - lldb_private::Error - DoAttachToProcessWithID (lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override; + Error + DoAttachToProcessWithID (lldb::pid_t pid, const ProcessAttachInfo &attach_info) override; - lldb_private::Error + Error DoAttachToProcessWithName (const char *process_name, - const lldb_private::ProcessAttachInfo &attach_info) override; + const ProcessAttachInfo &attach_info) override; void - DidAttach (lldb_private::ArchSpec &process_arch) override; + DidAttach (ArchSpec &process_arch) override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - lldb_private::ConstString + ConstString GetPluginName() override; uint32_t @@ -130,25 +131,25 @@ public: //------------------------------------------------------------------ // Process Control //------------------------------------------------------------------ - lldb_private::Error + Error WillResume () override; - lldb_private::Error + Error DoResume () override; - lldb_private::Error + Error DoHalt (bool &caused_stop) override; - lldb_private::Error + Error DoDetach (bool keep_stopped) override; bool DetachRequiresHalt() override { return true; } - lldb_private::Error + Error DoSignal (int signal) override; - lldb_private::Error + Error DoDestroy () override; void @@ -167,49 +168,48 @@ public: // Process Memory //------------------------------------------------------------------ size_t - DoReadMemory (lldb::addr_t addr, void *buf, size_t size, lldb_private::Error &error) override; + DoReadMemory (lldb::addr_t addr, void *buf, size_t size, Error &error) override; size_t - DoWriteMemory (lldb::addr_t addr, const void *buf, size_t size, lldb_private::Error &error) override; + DoWriteMemory (lldb::addr_t addr, const void *buf, size_t size, Error &error) override; lldb::addr_t - DoAllocateMemory (size_t size, uint32_t permissions, lldb_private::Error &error) override; + DoAllocateMemory (size_t size, uint32_t permissions, Error &error) override; - lldb_private::Error - GetMemoryRegionInfo (lldb::addr_t load_addr, - lldb_private::MemoryRegionInfo ®ion_info) override; + Error + GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo ®ion_info) override; - lldb_private::Error + Error DoDeallocateMemory (lldb::addr_t ptr) override; //------------------------------------------------------------------ // Process STDIO //------------------------------------------------------------------ size_t - PutSTDIN (const char *buf, size_t buf_size, lldb_private::Error &error) override; + PutSTDIN (const char *buf, size_t buf_size, Error &error) override; //---------------------------------------------------------------------- // Process Breakpoints //---------------------------------------------------------------------- - lldb_private::Error - EnableBreakpointSite (lldb_private::BreakpointSite *bp_site) override; + Error + EnableBreakpointSite (BreakpointSite *bp_site) override; - lldb_private::Error - DisableBreakpointSite (lldb_private::BreakpointSite *bp_site) override; + Error + DisableBreakpointSite (BreakpointSite *bp_site) override; //---------------------------------------------------------------------- // Process Watchpoints //---------------------------------------------------------------------- - lldb_private::Error - EnableWatchpoint (lldb_private::Watchpoint *wp, bool notify = true) override; + Error + EnableWatchpoint (Watchpoint *wp, bool notify = true) override; - lldb_private::Error - DisableWatchpoint (lldb_private::Watchpoint *wp, bool notify = true) override; + Error + DisableWatchpoint (Watchpoint *wp, bool notify = true) override; - lldb_private::Error + Error GetWatchpointSupportInfo (uint32_t &num) override; - lldb_private::Error + Error GetWatchpointSupportInfo (uint32_t &num, bool& after) override; bool @@ -224,7 +224,7 @@ public: return m_gdb_comm; } - lldb_private::Error + Error SendEventData(const char *data) override; //---------------------------------------------------------------------- @@ -237,9 +237,9 @@ public: SetUserSpecifiedMaxMemoryTransferSize (uint64_t user_specified_max); bool - GetModuleSpec(const lldb_private::FileSpec& module_file_spec, - const lldb_private::ArchSpec& arch, - lldb_private::ModuleSpec &module_spec) override; + GetModuleSpec(const FileSpec& module_file_spec, + const ArchSpec& arch, + ModuleSpec &module_spec) override; protected: friend class ThreadGDBRemote; @@ -278,24 +278,24 @@ protected: void Clear ( ); - lldb_private::Flags & + Flags & GetFlags () { return m_flags; } - const lldb_private::Flags & + const Flags & GetFlags () const { return m_flags; } bool - UpdateThreadList (lldb_private::ThreadList &old_thread_list, - lldb_private::ThreadList &new_thread_list) override; + UpdateThreadList (ThreadList &old_thread_list, + ThreadList &new_thread_list) override; - lldb_private::Error - LaunchAndConnectToDebugserver (const lldb_private::ProcessInfo &process_info); + Error + LaunchAndConnectToDebugserver (const ProcessInfo &process_info); void KillDebugserverProcess (); @@ -307,12 +307,12 @@ protected: SetLastStopPacket (const StringExtractorGDBRemote &response); bool - ParsePythonTargetDefinition(const lldb_private::FileSpec &target_definition_fspec); + ParsePythonTargetDefinition(const FileSpec &target_definition_fspec); const lldb::DataBufferSP GetAuxvData() override; - lldb_private::StructuredData::ObjectSP + StructuredData::ObjectSP GetExtendedInfoForThread (lldb::tid_t tid); void @@ -328,15 +328,15 @@ protected: eBroadcastBitAsyncThreadDidExit = (1 << 2) }; - lldb_private::Flags m_flags; // Process specific flags (see eFlags enums) + Flags m_flags; // Process specific flags (see eFlags enums) GDBRemoteCommunicationClient m_gdb_comm; std::atomic<lldb::pid_t> m_debugserver_pid; StringExtractorGDBRemote m_last_stop_packet; - lldb_private::Mutex m_last_stop_packet_mutex; + Mutex m_last_stop_packet_mutex; GDBRemoteDynamicRegisterInfo m_register_info; - lldb_private::Broadcaster m_async_broadcaster; - lldb_private::HostThread m_async_thread; - lldb_private::Mutex m_async_thread_state_mutex; + Broadcaster m_async_broadcaster; + HostThread m_async_thread; + Mutex m_async_thread_state_mutex; typedef std::vector<lldb::tid_t> tid_collection; typedef std::vector< std::pair<lldb::tid_t,int> > tid_sig_collection; typedef std::map<lldb::addr_t, lldb::addr_t> MMapMap; @@ -380,16 +380,16 @@ protected: UpdateThreadIDList (); void - DidLaunchOrAttach (lldb_private::ArchSpec& process_arch); + DidLaunchOrAttach (ArchSpec& process_arch); - lldb_private::Error + Error ConnectToDebugserver (const char *host_port); const char * GetDispatchQueueNameForThread (lldb::addr_t thread_dispatch_qaddr, std::string &dispatch_queue_name); - lldb_private::DynamicLoader * + DynamicLoader * GetDynamicLoader () override; private: @@ -398,7 +398,7 @@ private: //------------------------------------------------------------------ static bool NewThreadNotifyBreakpointHit (void *baton, - lldb_private::StoppointCallbackContext *context, + StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); @@ -406,4 +406,7 @@ private: }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_ProcessGDBRemote_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp index 0f73e44590b..d4726adc890 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp @@ -18,6 +18,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; // We want to avoid global constructors where code needs to be run so here we diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h index c551f8eba59..3cd974d7d82 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h @@ -32,29 +32,35 @@ #define GDBR_LOG_ALL (UINT32_MAX) #define GDBR_LOG_DEFAULT GDBR_LOG_PACKETS +namespace lldb_private { +namespace process_gdb_remote { + class ProcessGDBRemoteLog { public: static void Initialize(); - static lldb_private::Log * + static Log * GetLogIfAllCategoriesSet(uint32_t mask = 0); - static lldb_private::Log * + static Log * GetLogIfAnyCategoryIsSet (uint32_t mask); static void - DisableLog (const char **categories, lldb_private::Stream *feedback_strm); + DisableLog (const char **categories, Stream *feedback_strm); - static lldb_private::Log * - EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, const char **categories, lldb_private::Stream *feedback_strm); + static Log * + EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, const char **categories, Stream *feedback_strm); static void - ListLogCategories (lldb_private::Stream *strm); + ListLogCategories (Stream *strm); static void LogIf (uint32_t mask, const char *format, ...); }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_ProcessGDBRemoteLog_h_ diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 6309f7511a4..e4108edc03f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -30,6 +30,7 @@ using namespace lldb; using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; //---------------------------------------------------------------------- // Thread Registers @@ -148,7 +149,7 @@ ThreadGDBRemote::FetchThreadExtendedInfo () { StructuredData::ObjectSP object_sp; const lldb::user_id_t tid = GetProtocolID(); - Log *log(lldb_private::GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); + Log *log(GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); if (log) log->Printf ("Fetching extended information for thread %4.4" PRIx64, tid); ProcessSP process_sp (GetProcess()); @@ -165,7 +166,7 @@ ThreadGDBRemote::WillResume (StateType resume_state) { int signo = GetResumeSignal(); const lldb::user_id_t tid = GetProtocolID(); - Log *log(lldb_private::GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); + Log *log(GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); if (log) log->Printf ("Resuming thread: %4.4" PRIx64 " with state: %s.", tid, StateAsCString(resume_state)); diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h index e465f19d188..8bff54456dc 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h @@ -17,12 +17,16 @@ #include "lldb/Target/Thread.h" class StringExtractor; + +namespace lldb_private { +namespace process_gdb_remote { + class ProcessGDBRemote; -class ThreadGDBRemote : public lldb_private::Thread +class ThreadGDBRemote : public Thread { public: - ThreadGDBRemote (lldb_private::Process &process, lldb::tid_t tid); + ThreadGDBRemote (Process &process, lldb::tid_t tid); virtual ~ThreadGDBRemote (); @@ -52,10 +56,10 @@ public: GetRegisterContext () override; lldb::RegisterContextSP - CreateRegisterContextForFrame (lldb_private::StackFrame *frame) override; + CreateRegisterContextForFrame (StackFrame *frame) override; void - Dump (lldb_private::Log *log, uint32_t index); + Dump (Log *log, uint32_t index); static bool ThreadIDIsValid (lldb::tid_t thread); @@ -87,7 +91,7 @@ public: m_thread_dispatch_qaddr = thread_dispatch_qaddr; } - lldb_private::StructuredData::ObjectSP + StructuredData::ObjectSP FetchThreadExtendedInfo () override; protected: @@ -113,8 +117,9 @@ protected: bool CalculateStopInfo () override; - - }; +} // namespace process_gdb_remote +} // namespace lldb_private + #endif // liblldb_ThreadGDBRemote_h_ |