blob: 45c74ea64ee50887c4e8f0646f09a4c75600197c [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- ProcessGDBRemote.h --------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_ProcessGDBRemote_h_
11#define liblldb_ProcessGDBRemote_h_
12
13// C Includes
14
15// C++ Includes
16#include <list>
Greg Clayton71fc2a32011-02-12 06:28:37 +000017#include <vector>
Chris Lattner30fdc8d2010-06-08 16:52:24 +000018
19// Other libraries and framework includes
20#include "lldb/Core/ArchSpec.h"
21#include "lldb/Core/Broadcaster.h"
Jason Molenda2e56a252013-05-11 03:09:05 +000022#include "lldb/Core/ConstString.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000023#include "lldb/Core/Error.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000024#include "lldb/Core/StreamString.h"
Jim Ingham5aee1622010-08-09 23:31:02 +000025#include "lldb/Core/StringList.h"
Jason Molenda705b1802014-06-13 02:37:02 +000026#include "lldb/Core/StructuredData.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000027#include "lldb/Core/ThreadSafeValue.h"
Zachary Turner39de3112014-09-09 20:54:56 +000028#include "lldb/Host/HostThread.h"
Todd Fiala4ceced32014-08-29 17:35:57 +000029#include "lldb/lldb-private-forward.h"
Pavel Labathf805e192015-07-07 10:08:41 +000030#include "lldb/Utility/StringExtractor.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000031#include "lldb/Target/Process.h"
32#include "lldb/Target/Thread.h"
33
Greg Clayton576d8832011-03-22 04:00:09 +000034#include "GDBRemoteCommunicationClient.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000035#include "GDBRemoteRegisterContext.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000036
Tamas Berghammerdb264a62015-03-31 09:52:22 +000037namespace lldb_private {
38namespace process_gdb_remote {
39
Chris Lattner30fdc8d2010-06-08 16:52:24 +000040class ThreadGDBRemote;
41
Tamas Berghammerdb264a62015-03-31 09:52:22 +000042class ProcessGDBRemote : public Process
Chris Lattner30fdc8d2010-06-08 16:52:24 +000043{
44public:
45 //------------------------------------------------------------------
46 // Constructors and Destructors
47 //------------------------------------------------------------------
Greg Claytonc3776bf2012-02-09 06:16:32 +000048 static lldb::ProcessSP
Tamas Berghammerdb264a62015-03-31 09:52:22 +000049 CreateInstance (Target& target,
50 Listener &listener,
51 const FileSpec *crash_file_path);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000052
53 static void
54 Initialize();
55
56 static void
Tamas Berghammerdb264a62015-03-31 09:52:22 +000057 DebuggerInitialize (Debugger &debugger);
Greg Clayton7f982402013-07-15 22:54:20 +000058
59 static void
Chris Lattner30fdc8d2010-06-08 16:52:24 +000060 Terminate();
61
Tamas Berghammerdb264a62015-03-31 09:52:22 +000062 static ConstString
Chris Lattner30fdc8d2010-06-08 16:52:24 +000063 GetPluginNameStatic();
64
65 static const char *
66 GetPluginDescriptionStatic();
67
68 //------------------------------------------------------------------
69 // Constructors and Destructors
70 //------------------------------------------------------------------
Tamas Berghammerdb264a62015-03-31 09:52:22 +000071 ProcessGDBRemote(Target& target, Listener &listener);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000072
73 virtual
74 ~ProcessGDBRemote();
75
76 //------------------------------------------------------------------
77 // Check if a given Process
78 //------------------------------------------------------------------
Tamas Berghammer30b8cd32015-03-23 15:50:03 +000079 bool
Tamas Berghammerdb264a62015-03-31 09:52:22 +000080 CanDebug (Target &target, bool plugin_specified_by_name) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000081
Tamas Berghammerdb264a62015-03-31 09:52:22 +000082 CommandObject *
Eric Christopher7ab81b92014-11-04 03:13:17 +000083 GetPluginCommandObject() override;
Jim Ingham5aee1622010-08-09 23:31:02 +000084
Chris Lattner30fdc8d2010-06-08 16:52:24 +000085 //------------------------------------------------------------------
86 // Creating a new process, or attaching to an existing one
87 //------------------------------------------------------------------
Tamas Berghammerdb264a62015-03-31 09:52:22 +000088 Error
89 WillLaunch (Module* module) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000090
Tamas Berghammerdb264a62015-03-31 09:52:22 +000091 Error
92 DoLaunch (Module *exe_module, ProcessLaunchInfo &launch_info) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000093
Tamas Berghammer30b8cd32015-03-23 15:50:03 +000094 void
Eric Christopher7ab81b92014-11-04 03:13:17 +000095 DidLaunch () override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000096
Tamas Berghammerdb264a62015-03-31 09:52:22 +000097 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +000098 WillAttachToProcessWithID (lldb::pid_t pid) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000099
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000100 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000101 WillAttachToProcessWithName (const char *process_name, bool wait_for_launch) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000102
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000103 Error
104 DoConnectRemote (Stream *strm, const char *remote_url) override;
Greg Claytonb766a732011-02-04 01:58:07 +0000105
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000106 Error
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000107 WillLaunchOrAttach ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000108
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000109 Error
110 DoAttachToProcessWithID (lldb::pid_t pid, const ProcessAttachInfo &attach_info) override;
Han Ming Ong84647042012-02-25 01:07:38 +0000111
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000112 Error
Han Ming Ong84647042012-02-25 01:07:38 +0000113 DoAttachToProcessWithName (const char *process_name,
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000114 const ProcessAttachInfo &attach_info) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000115
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000116 void
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000117 DidAttach (ArchSpec &process_arch) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000118
119 //------------------------------------------------------------------
120 // PluginInterface protocol
121 //------------------------------------------------------------------
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000122 ConstString
Eric Christopher7ab81b92014-11-04 03:13:17 +0000123 GetPluginName() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000124
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000125 uint32_t
Eric Christopher7ab81b92014-11-04 03:13:17 +0000126 GetPluginVersion() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000127
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000128 //------------------------------------------------------------------
129 // Process Control
130 //------------------------------------------------------------------
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000131 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000132 WillResume () override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000133
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000134 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000135 DoResume () override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000136
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000137 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000138 DoHalt (bool &caused_stop) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000139
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000140 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000141 DoDetach (bool keep_stopped) override;
Jim Ingham8af3b9c2013-03-29 01:18:12 +0000142
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000143 bool
Eric Christopher7ab81b92014-11-04 03:13:17 +0000144 DetachRequiresHalt() override { return true; }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000145
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000146 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000147 DoSignal (int signal) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000148
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000149 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000150 DoDestroy () override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000151
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000152 void
Eric Christopher7ab81b92014-11-04 03:13:17 +0000153 RefreshStateAfterStop() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000154
155 //------------------------------------------------------------------
156 // Process Queries
157 //------------------------------------------------------------------
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000158 bool
Eric Christopher7ab81b92014-11-04 03:13:17 +0000159 IsAlive () override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000160
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000161 lldb::addr_t
Eric Christopher7ab81b92014-11-04 03:13:17 +0000162 GetImageInfoAddress() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000163
164 //------------------------------------------------------------------
165 // Process Memory
166 //------------------------------------------------------------------
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000167 size_t
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000168 DoReadMemory (lldb::addr_t addr, void *buf, size_t size, Error &error) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000169
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000170 size_t
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000171 DoWriteMemory (lldb::addr_t addr, const void *buf, size_t size, Error &error) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000172
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000173 lldb::addr_t
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000174 DoAllocateMemory (size_t size, uint32_t permissions, Error &error) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000175
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000176 Error
177 GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &region_info) override;
Greg Clayton46fb5582011-11-18 07:03:08 +0000178
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000179 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000180 DoDeallocateMemory (lldb::addr_t ptr) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000181
182 //------------------------------------------------------------------
183 // Process STDIO
184 //------------------------------------------------------------------
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000185 size_t
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000186 PutSTDIN (const char *buf, size_t buf_size, Error &error) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000187
188 //----------------------------------------------------------------------
189 // Process Breakpoints
190 //----------------------------------------------------------------------
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000191 Error
192 EnableBreakpointSite (BreakpointSite *bp_site) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000193
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000194 Error
195 DisableBreakpointSite (BreakpointSite *bp_site) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000196
197 //----------------------------------------------------------------------
198 // Process Watchpoints
199 //----------------------------------------------------------------------
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000200 Error
201 EnableWatchpoint (Watchpoint *wp, bool notify = true) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000202
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000203 Error
204 DisableWatchpoint (Watchpoint *wp, bool notify = true) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000205
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000206 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000207 GetWatchpointSupportInfo (uint32_t &num) override;
Johnny Chen64637202012-05-23 21:09:52 +0000208
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000209 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000210 GetWatchpointSupportInfo (uint32_t &num, bool& after) override;
Enrico Granataf04a2192012-07-13 23:18:48 +0000211
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000212 bool
Eric Christopher7ab81b92014-11-04 03:13:17 +0000213 StartNoticingNewThreads() override;
Jim Ingham1c823b42011-01-22 01:33:44 +0000214
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000215 bool
Eric Christopher7ab81b92014-11-04 03:13:17 +0000216 StopNoticingNewThreads() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000217
Greg Claytonc1422c12012-04-09 22:46:21 +0000218 GDBRemoteCommunicationClient &
219 GetGDBRemote()
220 {
221 return m_gdb_comm;
222 }
Greg Claytonfbb76342013-11-20 21:07:01 +0000223
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000224 Error
Eric Christopher7ab81b92014-11-04 03:13:17 +0000225 SendEventData(const char *data) override;
Jason Molendaa3329782014-03-29 18:54:20 +0000226
Greg Claytonfbb76342013-11-20 21:07:01 +0000227 //----------------------------------------------------------------------
Greg Clayton5df78fa2015-05-23 03:54:53 +0000228 // Override DidExit so we can disconnect from the remote GDB server
Greg Claytonfbb76342013-11-20 21:07:01 +0000229 //----------------------------------------------------------------------
Greg Clayton5df78fa2015-05-23 03:54:53 +0000230 void
231 DidExit () override;
Greg Claytonfbb76342013-11-20 21:07:01 +0000232
Jason Molenda6076bf42014-05-06 04:34:52 +0000233 void
234 SetUserSpecifiedMaxMemoryTransferSize (uint64_t user_specified_max);
235
Tamas Berghammer7cb18bf2015-03-24 11:15:23 +0000236 bool
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000237 GetModuleSpec(const FileSpec& module_file_spec,
238 const ArchSpec& arch,
239 ModuleSpec &module_spec) override;
Tamas Berghammer7cb18bf2015-03-24 11:15:23 +0000240
Tamas Berghammer783bfc82015-06-18 20:43:56 +0000241 size_t
242 LoadModules() override;
243
244 Error
245 GetFileLoadAddress(const FileSpec& file, bool& is_loaded, lldb::addr_t& load_addr) override;
Colin Rileyc3c95b22015-04-16 15:51:33 +0000246
Greg Clayton0b90be12015-06-23 21:27:50 +0000247 void
248 ModulesDidLoad (ModuleList &module_list) override;
249
Jason Molenda20ee21b2015-07-10 23:15:22 +0000250 StructuredData::ObjectSP
251 GetLoadedDynamicLibrariesInfos (lldb::addr_t image_list_address, lldb::addr_t image_count) override;
252
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000253protected:
254 friend class ThreadGDBRemote;
Greg Clayton576d8832011-03-22 04:00:09 +0000255 friend class GDBRemoteCommunicationClient;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000256 friend class GDBRemoteRegisterContext;
257
Aidan Doddsc0c83852015-05-08 09:36:31 +0000258 class GDBLoadedModuleInfoList;
259
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000260 //----------------------------------------------------------------------
261 // Accessors
262 //----------------------------------------------------------------------
263 bool
264 IsRunning ( lldb::StateType state )
265 {
266 return state == lldb::eStateRunning || IsStepping(state);
267 }
268
269 bool
270 IsStepping ( lldb::StateType state)
271 {
272 return state == lldb::eStateStepping;
273 }
274 bool
275 CanResume ( lldb::StateType state)
276 {
277 return state == lldb::eStateStopped;
278 }
279
280 bool
281 HasExited (lldb::StateType state)
282 {
283 return state == lldb::eStateExited;
284 }
285
286 bool
287 ProcessIDIsValid ( ) const;
288
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000289 void
290 Clear ( );
291
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000292 Flags &
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000293 GetFlags ()
294 {
295 return m_flags;
296 }
297
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000298 const Flags &
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000299 GetFlags () const
300 {
301 return m_flags;
302 }
303
Tamas Berghammer30b8cd32015-03-23 15:50:03 +0000304 bool
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000305 UpdateThreadList (ThreadList &old_thread_list,
306 ThreadList &new_thread_list) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000307
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000308 Error
309 LaunchAndConnectToDebugserver (const ProcessInfo &process_info);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000310
311 void
312 KillDebugserverProcess ();
313
314 void
Greg Clayton513c26c2011-01-29 07:10:55 +0000315 BuildDynamicRegisterInfo (bool force);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000316
Greg Clayton09c3e3d2011-12-06 04:51:14 +0000317 void
Greg Clayton8cda7f02013-05-21 21:55:59 +0000318 SetLastStopPacket (const StringExtractorGDBRemote &response);
Jason Molendad1fae142012-09-29 08:03:33 +0000319
Greg Claytonef8180a2013-10-15 00:14:28 +0000320 bool
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000321 ParsePythonTargetDefinition(const FileSpec &target_definition_fspec);
Greg Claytonef8180a2013-10-15 00:14:28 +0000322
Todd Fialaaf245d12014-06-30 21:05:18 +0000323 const lldb::DataBufferSP
324 GetAuxvData() override;
Steve Pucci03904ac2014-03-04 23:18:46 +0000325
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000326 StructuredData::ObjectSP
Jason Molenda705b1802014-06-13 02:37:02 +0000327 GetExtendedInfoForThread (lldb::tid_t tid);
328
Jason Molenda6076bf42014-05-06 04:34:52 +0000329 void
330 GetMaxMemorySize();
331
Greg Clayton358cf1e2015-06-25 21:46:34 +0000332 bool
333 CalculateThreadStopInfo (ThreadGDBRemote *thread);
334
Greg Clayton2e59d4f2015-06-29 20:08:51 +0000335 size_t
336 UpdateThreadIDsFromStopReplyThreadsValue (std::string &value);
337
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000338 //------------------------------------------------------------------
339 /// Broadcaster event bits definitions.
340 //------------------------------------------------------------------
341 enum
342 {
343 eBroadcastBitAsyncContinue = (1 << 0),
Jim Inghamb1e2e842012-04-12 18:49:31 +0000344 eBroadcastBitAsyncThreadShouldExit = (1 << 1),
345 eBroadcastBitAsyncThreadDidExit = (1 << 2)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000346 };
Jim Ingham455fa5c2012-11-01 01:15:33 +0000347
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000348 Flags m_flags; // Process specific flags (see eFlags enums)
Greg Clayton576d8832011-03-22 04:00:09 +0000349 GDBRemoteCommunicationClient m_gdb_comm;
Todd Fiala7b0917a2014-09-15 20:07:33 +0000350 std::atomic<lldb::pid_t> m_debugserver_pid;
Ewan Crawford9aa2da002015-05-27 14:12:34 +0000351 std::vector<StringExtractorGDBRemote> m_stop_packet_stack; // The stop packet stack replaces the last stop packet variable
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000352 Mutex m_last_stop_packet_mutex;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000353 GDBRemoteDynamicRegisterInfo m_register_info;
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000354 Broadcaster m_async_broadcaster;
355 HostThread m_async_thread;
356 Mutex m_async_thread_state_mutex;
Greg Clayton71fc2a32011-02-12 06:28:37 +0000357 typedef std::vector<lldb::tid_t> tid_collection;
358 typedef std::vector< std::pair<lldb::tid_t,int> > tid_sig_collection;
Greg Clayton70b57652011-05-15 01:25:55 +0000359 typedef std::map<lldb::addr_t, lldb::addr_t> MMapMap;
Greg Clayton358cf1e2015-06-25 21:46:34 +0000360 typedef std::map<uint32_t, std::string> ExpeditedRegisterMap;
Greg Clayton9e920902012-04-10 02:25:43 +0000361 tid_collection m_thread_ids; // Thread IDs for all threads. This list gets updated after stopping
Greg Clayton358cf1e2015-06-25 21:46:34 +0000362 StructuredData::ObjectSP m_threads_info_sp; // Stop info for all threads if "jThreadsInfo" packet is supported
Greg Clayton71fc2a32011-02-12 06:28:37 +0000363 tid_collection m_continue_c_tids; // 'c' for continue
364 tid_sig_collection m_continue_C_tids; // 'C' for continue with signal
365 tid_collection m_continue_s_tids; // 's' for step
366 tid_sig_collection m_continue_S_tids; // 'S' for step with signal
Jason Molenda6076bf42014-05-06 04:34:52 +0000367 uint64_t m_max_memory_size; // The maximum number of bytes to read/write when reading and writing memory
368 uint64_t m_remote_stub_max_memory_size; // The maximum memory size the remote gdb stub can handle
Greg Clayton70b57652011-05-15 01:25:55 +0000369 MMapMap m_addr_to_mmap_size;
Greg Clayton4116e932012-05-15 02:33:01 +0000370 lldb::BreakpointSP m_thread_create_bp_sp;
371 bool m_waiting_for_attach;
Jim Ingham43c555d2012-07-04 00:35:43 +0000372 bool m_destroy_tried_resuming;
Greg Clayton998255b2012-10-13 02:07:45 +0000373 lldb::CommandObjectSP m_command_sp;
Hafiz Abid Qadeer85a4daf2013-10-18 10:04:33 +0000374 int64_t m_breakpoint_pc_offset;
Ewan Crawford78baa192015-05-13 09:18:18 +0000375 lldb::tid_t m_initial_tid; // The inital thread ID, given by stub on attach
Todd Fialaaf245d12014-06-30 21:05:18 +0000376
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000377 bool
Ewan Crawford76df2882015-06-23 12:32:06 +0000378 HandleNotifyPacket(StringExtractorGDBRemote &packet);
379
380 bool
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000381 StartAsyncThread ();
382
383 void
384 StopAsyncThread ();
385
Virgile Bellob2f1fb22013-08-23 12:44:05 +0000386 static lldb::thread_result_t
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000387 AsyncThread (void *arg);
388
389 static bool
390 MonitorDebugserverProcess (void *callback_baton,
391 lldb::pid_t pid,
Greg Claytone4e45922011-11-16 05:37:56 +0000392 bool exited,
393 int signo,
394 int exit_status);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000395
396 lldb::StateType
397 SetThreadStopInfo (StringExtractor& stop_packet);
398
Greg Clayton358cf1e2015-06-25 21:46:34 +0000399 lldb::StateType
400 SetThreadStopInfo (StructuredData::Dictionary *thread_dict);
401
402 lldb::ThreadSP
403 SetThreadStopInfo (lldb::tid_t tid,
404 ExpeditedRegisterMap &expedited_register_map,
405 uint8_t signo,
406 const std::string &thread_name,
407 const std::string &reason,
408 const std::string &description,
409 uint32_t exc_type,
410 const std::vector<lldb::addr_t> &exc_data,
Greg Clayton2e59d4f2015-06-29 20:08:51 +0000411 lldb::addr_t thread_dispatch_qaddr,
412 bool queue_vars_valid,
413 std::string &queue_name,
414 lldb::QueueKind queue_kind,
415 uint64_t queue_serial);
Greg Clayton358cf1e2015-06-25 21:46:34 +0000416
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000417 void
Ewan Crawford78baa192015-05-13 09:18:18 +0000418 HandleStopReplySequence ();
419
420 void
Greg Clayton9e920902012-04-10 02:25:43 +0000421 ClearThreadIDList ();
422
423 bool
424 UpdateThreadIDList ();
425
426 void
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000427 DidLaunchOrAttach (ArchSpec& process_arch);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000428
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000429 Error
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000430 ConnectToDebugserver (const char *host_port);
431
432 const char *
433 GetDispatchQueueNameForThread (lldb::addr_t thread_dispatch_qaddr,
434 std::string &dispatch_queue_name);
435
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000436 DynamicLoader *
Eric Christopher7ab81b92014-11-04 03:13:17 +0000437 GetDynamicLoader () override;
Jason Molenda5e8534e2012-10-03 01:29:34 +0000438
Aidan Doddsc0c83852015-05-08 09:36:31 +0000439 // Query remote GDBServer for register information
440 bool
441 GetGDBServerRegisterInfo ();
442
443 // Query remote GDBServer for a detailed loaded library list
444 Error
445 GetLoadedModuleList (GDBLoadedModuleInfoList &);
446
447 lldb::ModuleSP
448 LoadModuleAtAddress (const FileSpec &file, lldb::addr_t base_addr);
449
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000450private:
451 //------------------------------------------------------------------
452 // For ProcessGDBRemote only
453 //------------------------------------------------------------------
Jim Ingham1c823b42011-01-22 01:33:44 +0000454 static bool
455 NewThreadNotifyBreakpointHit (void *baton,
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000456 StoppointCallbackContext *context,
Jim Ingham1c823b42011-01-22 01:33:44 +0000457 lldb::user_id_t break_id,
458 lldb::user_id_t break_loc_id);
459
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000460 DISALLOW_COPY_AND_ASSIGN (ProcessGDBRemote);
461
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000462};
463
Tamas Berghammerdb264a62015-03-31 09:52:22 +0000464} // namespace process_gdb_remote
465} // namespace lldb_private
466
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000467#endif // liblldb_ProcessGDBRemote_h_