annotate lldb/docs/lldb-gdb-remote.txt @ 213:25ca0248ac32

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 11 Jul 2021 17:05:31 +0900
parents 2e18cbf3894f
children 5f17cb93ff66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 LLDB has added new GDB server packets to better support multi-threaded and
anatofuz
parents:
diff changeset
2 remote debugging. Why? Normally you need to start the correct GDB and the
anatofuz
parents:
diff changeset
3 correct GDB server when debugging. If you have mismatch, then things go wrong
anatofuz
parents:
diff changeset
4 very quickly. LLDB makes extensive use of the GDB remote protocol and we
anatofuz
parents:
diff changeset
5 wanted to make sure that the experience was a bit more dynamic where we can
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
6 discover information about a remote target without having to know anything up
150
anatofuz
parents:
diff changeset
7 front. We also ran into performance issues with the existing GDB remote
anatofuz
parents:
diff changeset
8 protocol that can be overcome when using a reliable communications layer.
anatofuz
parents:
diff changeset
9 Some packets improve performance, others allow for remote process launching
anatofuz
parents:
diff changeset
10 (if you have an OS), and others allow us to dynamically figure out what
anatofuz
parents:
diff changeset
11 registers a thread might have. Again with GDB, both sides pre-agree on how the
anatofuz
parents:
diff changeset
12 registers will look (how many, their register number,name and offsets). We
anatofuz
parents:
diff changeset
13 prefer to be able to dynamically determine what kind of architecture, OS and
anatofuz
parents:
diff changeset
14 vendor we are debugging, as well as how things are laid out when it comes to
anatofuz
parents:
diff changeset
15 the thread register contexts. Below are the details on the new packets we have
anatofuz
parents:
diff changeset
16 added above and beyond the standard GDB remote protocol packets.
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
19 // "QStartNoAckMode"
anatofuz
parents:
diff changeset
20 //
anatofuz
parents:
diff changeset
21 // BRIEF
anatofuz
parents:
diff changeset
22 // Try to enable no ACK mode to skip sending ACKs and NACKs.
anatofuz
parents:
diff changeset
23 //
anatofuz
parents:
diff changeset
24 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
25 // High. Any GDB remote server that can implement this should if the
anatofuz
parents:
diff changeset
26 // connection is reliable. This improves packet throughput and increases
anatofuz
parents:
diff changeset
27 // the performance of the connection.
anatofuz
parents:
diff changeset
28 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
29 Having to send an ACK/NACK after every packet slows things down a bit, so we
anatofuz
parents:
diff changeset
30 have a way to disable ACK packets to minimize the traffic for reliable
anatofuz
parents:
diff changeset
31 communication interfaces (like sockets). Below GDB or LLDB will send this
anatofuz
parents:
diff changeset
32 packet to try and disable ACKs. All lines that start with "send packet: " are
anatofuz
parents:
diff changeset
33 from GDB/LLDB, and all lines that start with "read packet: " are from the GDB
anatofuz
parents:
diff changeset
34 remote server:
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 send packet: $QStartNoAckMode#b0
anatofuz
parents:
diff changeset
37 read packet: +
anatofuz
parents:
diff changeset
38 read packet: $OK#9a
anatofuz
parents:
diff changeset
39 send packet: +
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
44 // "A" - launch args packet
anatofuz
parents:
diff changeset
45 //
anatofuz
parents:
diff changeset
46 // BRIEF
anatofuz
parents:
diff changeset
47 // Launch a program using the supplied arguments
anatofuz
parents:
diff changeset
48 //
anatofuz
parents:
diff changeset
49 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
50 // Low. Only needed if the remote target wants to launch a target after
anatofuz
parents:
diff changeset
51 // making a connection to a GDB server that isn't already connected to
anatofuz
parents:
diff changeset
52 // an inferior process.
anatofuz
parents:
diff changeset
53 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
54
anatofuz
parents:
diff changeset
55 We have added support for the "set program arguments" packet where we can
anatofuz
parents:
diff changeset
56 start a connection to a remote server and then later supply the path to the
anatofuz
parents:
diff changeset
57 executable and the arguments to use when executing:
anatofuz
parents:
diff changeset
58
anatofuz
parents:
diff changeset
59 GDB remote docs for this:
anatofuz
parents:
diff changeset
60
anatofuz
parents:
diff changeset
61 set program arguments(reserved) Aarglen,argnum,arg,...
anatofuz
parents:
diff changeset
62
anatofuz
parents:
diff changeset
63 Where A is followed by the length in bytes of the hex encoded argument,
anatofuz
parents:
diff changeset
64 followed by an argument integer, and followed by the ASCII characters
anatofuz
parents:
diff changeset
65 converted into hex bytes foreach arg
anatofuz
parents:
diff changeset
66
anatofuz
parents:
diff changeset
67 send packet: $A98,0,2f566f6c756d65732f776f726b2f67636c6179746f6e2f446f63756d656e74732f7372632f6174746163682f612e6f7574#00
anatofuz
parents:
diff changeset
68 read packet: $OK#00
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 The above packet helps when you have remote debugging abilities where you
anatofuz
parents:
diff changeset
71 could launch a process on a remote host, this isn't needed for bare board
anatofuz
parents:
diff changeset
72 debugging.
anatofuz
parents:
diff changeset
73
anatofuz
parents:
diff changeset
74 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
75 // "QEnvironment:NAME=VALUE"
anatofuz
parents:
diff changeset
76 //
anatofuz
parents:
diff changeset
77 // BRIEF
anatofuz
parents:
diff changeset
78 // Setup the environment up for a new child process that will soon be
anatofuz
parents:
diff changeset
79 // launched using the "A" packet.
anatofuz
parents:
diff changeset
80 //
anatofuz
parents:
diff changeset
81 // NB: key/value pairs are sent as-is so gdb-remote protocol meta characters
anatofuz
parents:
diff changeset
82 // (e.g. '#' or '$') are not acceptable. If any non-printable or
anatofuz
parents:
diff changeset
83 // metacharacters are present in the strings, QEnvironmentHexEncoded
anatofuz
parents:
diff changeset
84 // should be used instead if it is available. If you don't want to
anatofuz
parents:
diff changeset
85 // scan the environment strings before sending, prefer
anatofuz
parents:
diff changeset
86 // the QEnvironmentHexEncoded packet over QEnvironment, if it is
anatofuz
parents:
diff changeset
87 // available.
anatofuz
parents:
diff changeset
88 //
anatofuz
parents:
diff changeset
89 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
90 // Low. Only needed if the remote target wants to launch a target after
anatofuz
parents:
diff changeset
91 // making a connection to a GDB server that isn't already connected to
anatofuz
parents:
diff changeset
92 // an inferior process.
anatofuz
parents:
diff changeset
93 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
94
anatofuz
parents:
diff changeset
95 Both GDB and LLDB support passing down environment variables. Is it ok to
anatofuz
parents:
diff changeset
96 respond with a "$#00" (unimplemented):
anatofuz
parents:
diff changeset
97
anatofuz
parents:
diff changeset
98 send packet: $QEnvironment:ACK_COLOR_FILENAME=bold yellow#00
anatofuz
parents:
diff changeset
99 read packet: $OK#00
anatofuz
parents:
diff changeset
100
anatofuz
parents:
diff changeset
101 This packet can be sent one or more times _prior_ to sending a "A" packet.
anatofuz
parents:
diff changeset
102
anatofuz
parents:
diff changeset
103 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
104 // "QEnvironmentHexEncoded:HEX-ENCODING(NAME=VALUE)"
anatofuz
parents:
diff changeset
105 //
anatofuz
parents:
diff changeset
106 // BRIEF
anatofuz
parents:
diff changeset
107 // Setup the environment up for a new child process that will soon be
anatofuz
parents:
diff changeset
108 // launched using the "A" packet.
anatofuz
parents:
diff changeset
109 //
anatofuz
parents:
diff changeset
110 // The only difference between this packet and QEnvironment is that the
anatofuz
parents:
diff changeset
111 // environment key-value pair is ascii hex encoded for transmission.
anatofuz
parents:
diff changeset
112 // This allows values with gdb-remote metacharacters like '#' to be sent.
anatofuz
parents:
diff changeset
113 //
anatofuz
parents:
diff changeset
114 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
115 // Low. Only needed if the remote target wants to launch a target after
anatofuz
parents:
diff changeset
116 // making a connection to a GDB server that isn't already connected to
anatofuz
parents:
diff changeset
117 // an inferior process.
anatofuz
parents:
diff changeset
118 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
119
anatofuz
parents:
diff changeset
120 Both GDB and LLDB support passing down environment variables. Is it ok to
anatofuz
parents:
diff changeset
121 respond with a "$#00" (unimplemented):
anatofuz
parents:
diff changeset
122
anatofuz
parents:
diff changeset
123 send packet: $QEnvironment:41434b5f434f4c4f525f46494c454e414d453d626f6c642379656c6c6f77#00
anatofuz
parents:
diff changeset
124 read packet: $OK#00
anatofuz
parents:
diff changeset
125
anatofuz
parents:
diff changeset
126 This packet can be sent one or more times _prior_ to sending a "A" packet.
anatofuz
parents:
diff changeset
127
anatofuz
parents:
diff changeset
128 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
129 // "QEnableErrorStrings"
anatofuz
parents:
diff changeset
130 //
anatofuz
parents:
diff changeset
131 // BRIEF
anatofuz
parents:
diff changeset
132 // This packet enables reporting of Error strings in remote packet
anatofuz
parents:
diff changeset
133 // replies from the server to client. If the server supports this
anatofuz
parents:
diff changeset
134 // feature, it should send an OK response. The client can expect the
anatofuz
parents:
diff changeset
135 // following error replies if this feature is enabled in the server ->
anatofuz
parents:
diff changeset
136 //
anatofuz
parents:
diff changeset
137 // EXX;AAAAAAAAA
anatofuz
parents:
diff changeset
138 //
anatofuz
parents:
diff changeset
139 // where AAAAAAAAA will be a hex encoded ASCII string.
anatofuz
parents:
diff changeset
140 // XX is hex encoded byte number.
anatofuz
parents:
diff changeset
141 //
anatofuz
parents:
diff changeset
142 // It must be noted that even if the client has enabled reporting
anatofuz
parents:
diff changeset
143 // strings in error replies, it must not expect error strings to all
anatofuz
parents:
diff changeset
144 // error replies.
anatofuz
parents:
diff changeset
145 //
anatofuz
parents:
diff changeset
146 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
147 // Low. Only needed if the remote target wants to provide strings that
anatofuz
parents:
diff changeset
148 // are human readable along with an error code.
anatofuz
parents:
diff changeset
149 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
150
anatofuz
parents:
diff changeset
151 send packet: $QEnableErrorStrings
anatofuz
parents:
diff changeset
152 read packet: $OK#00
anatofuz
parents:
diff changeset
153
anatofuz
parents:
diff changeset
154 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
155 // "QSetSTDIN:<ascii-hex-path>"
anatofuz
parents:
diff changeset
156 // "QSetSTDOUT:<ascii-hex-path>"
anatofuz
parents:
diff changeset
157 // "QSetSTDERR:<ascii-hex-path>"
anatofuz
parents:
diff changeset
158 //
anatofuz
parents:
diff changeset
159 // BRIEF
anatofuz
parents:
diff changeset
160 // Setup where STDIN, STDOUT, and STDERR go prior to sending an "A"
anatofuz
parents:
diff changeset
161 // packet.
anatofuz
parents:
diff changeset
162 //
anatofuz
parents:
diff changeset
163 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
164 // Low. Only needed if the remote target wants to launch a target after
anatofuz
parents:
diff changeset
165 // making a connection to a GDB server that isn't already connected to
anatofuz
parents:
diff changeset
166 // an inferior process.
anatofuz
parents:
diff changeset
167 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
168
anatofuz
parents:
diff changeset
169 When launching a program through the GDB remote protocol with the "A" packet,
anatofuz
parents:
diff changeset
170 you might also want to specify where stdin/out/err go:
anatofuz
parents:
diff changeset
171
anatofuz
parents:
diff changeset
172 QSetSTDIN:<ascii-hex-path>
anatofuz
parents:
diff changeset
173 QSetSTDOUT:<ascii-hex-path>
anatofuz
parents:
diff changeset
174 QSetSTDERR:<ascii-hex-path>
anatofuz
parents:
diff changeset
175
anatofuz
parents:
diff changeset
176 These packets must be sent _prior_ to sending a "A" packet.
anatofuz
parents:
diff changeset
177
anatofuz
parents:
diff changeset
178 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
179 // "QSetWorkingDir:<ascii-hex-path>"
anatofuz
parents:
diff changeset
180 //
anatofuz
parents:
diff changeset
181 // BRIEF
anatofuz
parents:
diff changeset
182 // Set the working directory prior to sending an "A" packet.
anatofuz
parents:
diff changeset
183 //
anatofuz
parents:
diff changeset
184 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
185 // Low. Only needed if the remote target wants to launch a target after
anatofuz
parents:
diff changeset
186 // making a connection to a GDB server that isn't already connected to
anatofuz
parents:
diff changeset
187 // an inferior process.
anatofuz
parents:
diff changeset
188 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
189
anatofuz
parents:
diff changeset
190 Or specify the working directory:
anatofuz
parents:
diff changeset
191
anatofuz
parents:
diff changeset
192 QSetWorkingDir:<ascii-hex-path>
anatofuz
parents:
diff changeset
193
anatofuz
parents:
diff changeset
194 This packet must be sent _prior_ to sending a "A" packet.
anatofuz
parents:
diff changeset
195
anatofuz
parents:
diff changeset
196 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
197 // "QSetDisableASLR:<bool>"
anatofuz
parents:
diff changeset
198 //
anatofuz
parents:
diff changeset
199 // BRIEF
anatofuz
parents:
diff changeset
200 // Enable or disable ASLR on the next "A" packet.
anatofuz
parents:
diff changeset
201 //
anatofuz
parents:
diff changeset
202 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
203 // Low. Only needed if the remote target wants to launch a target after
anatofuz
parents:
diff changeset
204 // making a connection to a GDB server that isn't already connected to
anatofuz
parents:
diff changeset
205 // an inferior process and if the target supports disabling ASLR
anatofuz
parents:
diff changeset
206 // (Address space layout randomization).
anatofuz
parents:
diff changeset
207 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
208
anatofuz
parents:
diff changeset
209 Or control if ASLR is enabled/disabled:
anatofuz
parents:
diff changeset
210
anatofuz
parents:
diff changeset
211 send packet: QSetDisableASLR:1
anatofuz
parents:
diff changeset
212 read packet: OK
anatofuz
parents:
diff changeset
213
anatofuz
parents:
diff changeset
214 send packet: QSetDisableASLR:0
anatofuz
parents:
diff changeset
215 read packet: OK
anatofuz
parents:
diff changeset
216
anatofuz
parents:
diff changeset
217 This packet must be sent _prior_ to sending a "A" packet.
anatofuz
parents:
diff changeset
218
anatofuz
parents:
diff changeset
219 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
220 // QListThreadsInStopReply
anatofuz
parents:
diff changeset
221 //
anatofuz
parents:
diff changeset
222 // BRIEF
anatofuz
parents:
diff changeset
223 // Enable the threads: and thread-pcs: data in the question-mark packet
anatofuz
parents:
diff changeset
224 // ("T packet") responses when the stub reports that a program has
anatofuz
parents:
diff changeset
225 // stopped executing.
anatofuz
parents:
diff changeset
226 //
anatofuz
parents:
diff changeset
227 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
228 // Performance. This is a performance benefit to lldb if the thread id's
anatofuz
parents:
diff changeset
229 // and thread pc values are provided to lldb in the T stop packet -- if
anatofuz
parents:
diff changeset
230 // they are not provided to lldb, lldb will likely need to send one to
anatofuz
parents:
diff changeset
231 // two packets per thread to fetch the data at every private stop.
anatofuz
parents:
diff changeset
232 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
233
anatofuz
parents:
diff changeset
234 send packet: QListThreadsInStopReply
anatofuz
parents:
diff changeset
235 read packet: OK
anatofuz
parents:
diff changeset
236
anatofuz
parents:
diff changeset
237 //----------------------------------------------------------------------
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
238 // jLLDBTraceSupported
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
239 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
240 // BRIEF
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
241 // Get the processor tracing type supported by the gdb-server for the current
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
242 // inferior. Responses might be different depending on the architecture and
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
243 // capabilities of the underlying OS.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
244 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
245 // OUTPUT SCHEMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
246 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
247 // "name": <string>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
248 // Tracing technology name, e.g. intel-pt, arm-coresight.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
249 // "description": <string>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
250 // Description for this technology.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
251 // }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
252 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
253 // If no tracing technology is supported for the inferior, or no process is
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
254 // running, then an error message is returned.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
255 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
256 // NOTE
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
257 // This packet is used by Trace plug-ins (see lldb_private::Trace.h) to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
258 // do live tracing. Specifically, the name of the plug-in should match the name
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
259 // of the tracing technology returned by this packet.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
260 //----------------------------------------------------------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
261
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
262 send packet: jLLDBTraceSupported
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
263 read packet: {"name":<name>, "description":<description>}/E<error code>;AAAAAAAAA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
264
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
265 //----------------------------------------------------------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
266 // jLLDBTraceStart
150
anatofuz
parents:
diff changeset
267 //
anatofuz
parents:
diff changeset
268 // BRIEF
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
269 // Start tracing a process or its threads using a provided tracing technology.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
270 // The input and output are specified as JSON objects. In case of success, an OK
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
271 // response is returned, or an error otherwise.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
272 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
273 // PROCESS TRACING
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
274 // This traces existing and future threads of the current process. An error is
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
275 // returned if the process is already being traced.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
276 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
277 // THREAD TRACING
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
278 // This traces specific threads.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
279 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
280 // INPUT SCHEMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
281 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
282 // "type": <string>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
283 // Tracing technology name, e.g. intel-pt, arm-coresight.
150
anatofuz
parents:
diff changeset
284 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
285 // /* thread tracing only */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
286 // "tids": [<decimal integer>],
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
287 // Individual threads to trace.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
288 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
289 // ... other parameters specific to the provided tracing type
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
290 // }
150
anatofuz
parents:
diff changeset
291 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
292 // NOTES
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
293 // - If "tids" is not provided, then the operation is "process tracing",
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
294 // otherwise it's "thread tracing".
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
295 // - Each tracing technology can have different levels of support for "thread
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
296 // tracing" and "process tracing".
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
297 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
298 // INTEL-PT
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
299 // intel-pt supports both "thread tracing" and "process tracing".
150
anatofuz
parents:
diff changeset
300 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
301 // "Process tracing" is implemented by tracing each thread individually, but
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
302 // managed by the same "process trace" instance.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
303 // Each actual thread trace, either from "process tracing" or "thread tracing",
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
304 // is stored in an in-memory circular buffer, which keeps the most recent data.
150
anatofuz
parents:
diff changeset
305 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
306 // Additional params in the input schema:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
307 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
308 // "threadBufferSize": <decimal integer>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
309 // Trace buffer size per thread in bytes. It must be a power of 2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
310 // greater than or equal to 4096 (2^12) bytes.
150
anatofuz
parents:
diff changeset
311 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
312 // /* process tracing only */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
313 // "processBufferSizeLimit": <decimal integer>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
314 // Maximum total buffer size per process in bytes.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
315 // This limit applies to the sum of the sizes of all trace buffers for
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
316 // the current process, excluding the ones started with "thread tracing".
150
anatofuz
parents:
diff changeset
317 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
318 // Whenever a thread is attempted to be traced due to "process tracing"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
319 // and the limit would be reached, the process is stopped with a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
320 // "tracing" reason along with a meaningful description, so that the
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
321 // user can retrace the process if needed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
322 // }
150
anatofuz
parents:
diff changeset
323 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
324 // Notes:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
325 // - Modifying the parameters of an existing trace is not supported. The user
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
326 // needs to stop the trace and start a new one.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
327 // - If "process tracing" is attempted and there are individual threads
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
328 // already being traced with "thread tracing", these traces are left
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
329 // unaffected and the threads not traced twice.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
330 // - If "thread tracing" is attempted on a thread already being traced with
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
331 // either "thread tracing" or "process tracing", it fails.
150
anatofuz
parents:
diff changeset
332 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
333
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
334 Process tracing:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
335 send packet: jLLDBTraceStart:{"type":<type>,...other params}]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
336 read packet: OK/E<error code>;AAAAAAAAA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
337
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
338 Thread tracing:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
339 send packet: jLLDBTraceStart:{"type":<type>,"tids":<tids>,...other params}]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
340 read packet: OK/E<error code>;AAAAAAAAA
150
anatofuz
parents:
diff changeset
341
anatofuz
parents:
diff changeset
342 //----------------------------------------------------------------------
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
343 // jLLDBTraceStop
150
anatofuz
parents:
diff changeset
344 //
anatofuz
parents:
diff changeset
345 // BRIEF
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
346 // Stop tracing a process or its threads using a provided tracing technology.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
347 // The input and output are specified as JSON objects. In case of success, an OK
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
348 // response is returned, or an error otherwise.
150
anatofuz
parents:
diff changeset
349 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
350 // PROCESS TRACE STOPPING
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
351 // Stopping a process trace doesn't stop the active traces initiated with
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
352 // "thread tracing".
150
anatofuz
parents:
diff changeset
353 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
354 // THREAD TRACE STOPPING
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
355 // This is a best effort request, which tries to stop as many traces as
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
356 // possible.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
357 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
358 // INPUT SCHEMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
359 // The schema for the input is
150
anatofuz
parents:
diff changeset
360 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
361 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
362 // "type": <string>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
363 // Tracing technology name, e.g. intel-pt, arm-coresight.
150
anatofuz
parents:
diff changeset
364 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
365 // /* thread trace stopping only */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
366 // "tids": [<decimal integer>]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
367 // Individual thread traces to stop.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
368 // }
150
anatofuz
parents:
diff changeset
369 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
370 // NOTES
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
371 // - If "tids" is not provided, then the operation is "process trace stopping".
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
372 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
373 // INTEL PT
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
374 // Stopping a specific thread trace started with "process tracing" is allowed.
150
anatofuz
parents:
diff changeset
375 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
376
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
377 Process trace stopping:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
378 send packet: jLLDBTraceStop:{"type":<type>}]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
379 read packet: OK/E<error code>;AAAAAAAAA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
380
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
381 Thread trace stopping:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
382 send packet: jLLDBTraceStop:{"type":<type>,"tids":<tids>}]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
383 read packet: OK/E<error code>;AAAAAAAAA
150
anatofuz
parents:
diff changeset
384
anatofuz
parents:
diff changeset
385 //----------------------------------------------------------------------
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
386 // jLLDBTraceGetState
150
anatofuz
parents:
diff changeset
387 //
anatofuz
parents:
diff changeset
388 // BRIEF
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
389 // Get the current state of the process and its threads being traced by
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
390 // a given trace technology. The response is a JSON object with custom
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
391 // information depending on the trace technology. In case of errors, an
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
392 // error message is returned.
150
anatofuz
parents:
diff changeset
393 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
394 // INPUT SCHEMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
395 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
396 // "type": <string>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
397 // Tracing technology name, e.g. intel-pt, arm-coresight.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
398 // }
150
anatofuz
parents:
diff changeset
399 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
400 // OUTPUT SCHEMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
401 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
402 // "tracedThreads": [{
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
403 // "tid": <decimal integer>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
404 // "binaryData": [
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
405 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
406 // "kind": <string>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
407 // Identifier for some binary data related to this thread to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
408 // fetch with the jLLDBTraceGetBinaryData packet.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
409 // "size": <decimal integer>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
410 // Size in bytes of this thread data.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
411 // },
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
412 // ]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
413 // }],
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
414 // "processBinaryData": [
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
415 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
416 // "kind": <string>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
417 // Identifier for some binary data related to this process to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
418 // fetch with the jLLDBTraceGetBinaryData packet.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
419 // "size": <decimal integer>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
420 // Size in bytes of this thread data.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
421 // },
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
422 // }]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
423 // }
150
anatofuz
parents:
diff changeset
424 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
425 // NOTES
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
426 // - "traceThreads" includes all thread traced by both "process tracing" and
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
427 // "thread tracing".
150
anatofuz
parents:
diff changeset
428 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
429 // INTEL PT
150
anatofuz
parents:
diff changeset
430 //
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
431 // Binary data kinds:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
432 // - threadTraceBuffer: trace buffer for a thread.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
433 // - cpuInfo: contents of the /proc/cpuinfo file.
150
anatofuz
parents:
diff changeset
434 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
435
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
436 send packet: jLLDBTraceGetState:{"type":<type>}]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
437 read packet: {...object}/E<error code>;AAAAAAAAA
150
anatofuz
parents:
diff changeset
438
anatofuz
parents:
diff changeset
439 //----------------------------------------------------------------------
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
440 // jLLDBTraceGetBinaryData
150
anatofuz
parents:
diff changeset
441 //
anatofuz
parents:
diff changeset
442 // BRIEF
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
443 // Get binary data given a trace technology and a data identifier.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
444 // The input is specified as a JSON object and the response has the same format
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
445 // as the "binary memory read" (aka "x") packet. In case of failures, an error
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
446 // message is returned.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
447 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
448 // SCHEMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
449 // The schema for the input is
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
450 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
451 // {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
452 // "type": <string>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
453 // Tracing technology name, e.g. intel-pt, arm-coresight.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
454 // "kind": <string>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
455 // Identifier for the data.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
456 // "tid"?: <Optional decimal>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
457 // Tid in decimal if the data belongs to a thread.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
458 // "offset": <decimal>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
459 // Offset of the data in bytes.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
460 // "size": <decimal>,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
461 // Number of bytes in to read starting from the offset.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
462 // }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
463 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
464 // INTEL PT
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
465 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
466 // Binary data kinds:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
467 // - threadTraceBuffer: trace buffer for a thread.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
468 // - cpuInfo: contents of the /proc/cpuinfo file.
150
anatofuz
parents:
diff changeset
469 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
470
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
471 send packet: jLLDBTraceGetBinaryData:{"type":<type>,"kind":<query>,"tid":<tid>,"offset":<offset>,"size":<size>}]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
472 read packet: <binary data>/E<error code>;AAAAAAAAA
150
anatofuz
parents:
diff changeset
473
anatofuz
parents:
diff changeset
474 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
475 // "qRegisterInfo<hex-reg-id>"
anatofuz
parents:
diff changeset
476 //
anatofuz
parents:
diff changeset
477 // BRIEF
anatofuz
parents:
diff changeset
478 // Discover register information from the remote GDB server.
anatofuz
parents:
diff changeset
479 //
anatofuz
parents:
diff changeset
480 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
481 // High. Any target that can self describe its registers, should do so.
anatofuz
parents:
diff changeset
482 // This means if new registers are ever added to a remote target, they
anatofuz
parents:
diff changeset
483 // will get picked up automatically, and allows registers to change
anatofuz
parents:
diff changeset
484 // depending on the actual CPU type that is used.
anatofuz
parents:
diff changeset
485 //
anatofuz
parents:
diff changeset
486 // NB: As of summer 2015, lldb can get register information from the
anatofuz
parents:
diff changeset
487 // "qXfer:features:read:target.xml" FSF gdb standard register packet
anatofuz
parents:
diff changeset
488 // where the stub provides register definitions in an XML file.
anatofuz
parents:
diff changeset
489 // If qXfer:features:read:target.xml is supported, qRegisterInfo does
anatofuz
parents:
diff changeset
490 // not need to be implemented.
anatofuz
parents:
diff changeset
491 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
492
anatofuz
parents:
diff changeset
493 With LLDB, for register information, remote GDB servers can add
anatofuz
parents:
diff changeset
494 support for the "qRegisterInfoN" packet where "N" is a zero based
anatofuz
parents:
diff changeset
495 base16 register number that must start at zero and increase by one
anatofuz
parents:
diff changeset
496 for each register that is supported. The response is done in typical
anatofuz
parents:
diff changeset
497 GDB remote fashion where a series of "KEY:VALUE;" pairs are returned.
anatofuz
parents:
diff changeset
498 An example for the x86_64 registers is included below:
anatofuz
parents:
diff changeset
499
anatofuz
parents:
diff changeset
500 send packet: $qRegisterInfo0#00
anatofuz
parents:
diff changeset
501 read packet: $name:rax;bitsize:64;offset:0;encoding:uint;format:hex;set:General Purpose Registers;gcc:0;dwarf:0;#00
anatofuz
parents:
diff changeset
502 send packet: $qRegisterInfo1#00
anatofuz
parents:
diff changeset
503 read packet: $name:rbx;bitsize:64;offset:8;encoding:uint;format:hex;set:General Purpose Registers;gcc:3;dwarf:3;#00
anatofuz
parents:
diff changeset
504 send packet: $qRegisterInfo2#00
anatofuz
parents:
diff changeset
505 read packet: $name:rcx;bitsize:64;offset:16;encoding:uint;format:hex;set:General Purpose Registers;gcc:2;dwarf:2;#00
anatofuz
parents:
diff changeset
506 send packet: $qRegisterInfo3#00
anatofuz
parents:
diff changeset
507 read packet: $name:rdx;bitsize:64;offset:24;encoding:uint;format:hex;set:General Purpose Registers;gcc:1;dwarf:1;#00
anatofuz
parents:
diff changeset
508 send packet: $qRegisterInfo4#00
anatofuz
parents:
diff changeset
509 read packet: $name:rdi;bitsize:64;offset:32;encoding:uint;format:hex;set:General Purpose Registers;gcc:5;dwarf:5;#00
anatofuz
parents:
diff changeset
510 send packet: $qRegisterInfo5#00
anatofuz
parents:
diff changeset
511 read packet: $name:rsi;bitsize:64;offset:40;encoding:uint;format:hex;set:General Purpose Registers;gcc:4;dwarf:4;#00
anatofuz
parents:
diff changeset
512 send packet: $qRegisterInfo6#00
anatofuz
parents:
diff changeset
513 read packet: $name:rbp;alt-name:fp;bitsize:64;offset:48;encoding:uint;format:hex;set:General Purpose Registers;gcc:6;dwarf:6;generic:fp;#00
anatofuz
parents:
diff changeset
514 send packet: $qRegisterInfo7#00
anatofuz
parents:
diff changeset
515 read packet: $name:rsp;alt-name:sp;bitsize:64;offset:56;encoding:uint;format:hex;set:General Purpose Registers;gcc:7;dwarf:7;generic:sp;#00
anatofuz
parents:
diff changeset
516 send packet: $qRegisterInfo8#00
anatofuz
parents:
diff changeset
517 read packet: $name:r8;bitsize:64;offset:64;encoding:uint;format:hex;set:General Purpose Registers;gcc:8;dwarf:8;#00
anatofuz
parents:
diff changeset
518 send packet: $qRegisterInfo9#00
anatofuz
parents:
diff changeset
519 read packet: $name:r9;bitsize:64;offset:72;encoding:uint;format:hex;set:General Purpose Registers;gcc:9;dwarf:9;#00
anatofuz
parents:
diff changeset
520 send packet: $qRegisterInfoa#00
anatofuz
parents:
diff changeset
521 read packet: $name:r10;bitsize:64;offset:80;encoding:uint;format:hex;set:General Purpose Registers;gcc:10;dwarf:10;#00
anatofuz
parents:
diff changeset
522 send packet: $qRegisterInfob#00
anatofuz
parents:
diff changeset
523 read packet: $name:r11;bitsize:64;offset:88;encoding:uint;format:hex;set:General Purpose Registers;gcc:11;dwarf:11;#00
anatofuz
parents:
diff changeset
524 send packet: $qRegisterInfoc#00
anatofuz
parents:
diff changeset
525 read packet: $name:r12;bitsize:64;offset:96;encoding:uint;format:hex;set:General Purpose Registers;gcc:12;dwarf:12;#00
anatofuz
parents:
diff changeset
526 send packet: $qRegisterInfod#00
anatofuz
parents:
diff changeset
527 read packet: $name:r13;bitsize:64;offset:104;encoding:uint;format:hex;set:General Purpose Registers;gcc:13;dwarf:13;#00
anatofuz
parents:
diff changeset
528 send packet: $qRegisterInfoe#00
anatofuz
parents:
diff changeset
529 read packet: $name:r14;bitsize:64;offset:112;encoding:uint;format:hex;set:General Purpose Registers;gcc:14;dwarf:14;#00
anatofuz
parents:
diff changeset
530 send packet: $qRegisterInfof#00
anatofuz
parents:
diff changeset
531 read packet: $name:r15;bitsize:64;offset:120;encoding:uint;format:hex;set:General Purpose Registers;gcc:15;dwarf:15;#00
anatofuz
parents:
diff changeset
532 send packet: $qRegisterInfo10#00
anatofuz
parents:
diff changeset
533 read packet: $name:rip;alt-name:pc;bitsize:64;offset:128;encoding:uint;format:hex;set:General Purpose Registers;gcc:16;dwarf:16;generic:pc;#00
anatofuz
parents:
diff changeset
534 send packet: $qRegisterInfo11#00
anatofuz
parents:
diff changeset
535 read packet: $name:rflags;alt-name:flags;bitsize:64;offset:136;encoding:uint;format:hex;set:General Purpose Registers;#00
anatofuz
parents:
diff changeset
536 send packet: $qRegisterInfo12#00
anatofuz
parents:
diff changeset
537 read packet: $name:cs;bitsize:64;offset:144;encoding:uint;format:hex;set:General Purpose Registers;#00
anatofuz
parents:
diff changeset
538 send packet: $qRegisterInfo13#00
anatofuz
parents:
diff changeset
539 read packet: $name:fs;bitsize:64;offset:152;encoding:uint;format:hex;set:General Purpose Registers;#00
anatofuz
parents:
diff changeset
540 send packet: $qRegisterInfo14#00
anatofuz
parents:
diff changeset
541 read packet: $name:gs;bitsize:64;offset:160;encoding:uint;format:hex;set:General Purpose Registers;#00
anatofuz
parents:
diff changeset
542 send packet: $qRegisterInfo15#00
anatofuz
parents:
diff changeset
543 read packet: $name:fctrl;bitsize:16;offset:176;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
544 send packet: $qRegisterInfo16#00
anatofuz
parents:
diff changeset
545 read packet: $name:fstat;bitsize:16;offset:178;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
546 send packet: $qRegisterInfo17#00
anatofuz
parents:
diff changeset
547 read packet: $name:ftag;bitsize:8;offset:180;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
548 send packet: $qRegisterInfo18#00
anatofuz
parents:
diff changeset
549 read packet: $name:fop;bitsize:16;offset:182;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
550 send packet: $qRegisterInfo19#00
anatofuz
parents:
diff changeset
551 read packet: $name:fioff;bitsize:32;offset:184;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
552 send packet: $qRegisterInfo1a#00
anatofuz
parents:
diff changeset
553 read packet: $name:fiseg;bitsize:16;offset:188;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
554 send packet: $qRegisterInfo1b#00
anatofuz
parents:
diff changeset
555 read packet: $name:fooff;bitsize:32;offset:192;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
556 send packet: $qRegisterInfo1c#00
anatofuz
parents:
diff changeset
557 read packet: $name:foseg;bitsize:16;offset:196;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
558 send packet: $qRegisterInfo1d#00
anatofuz
parents:
diff changeset
559 read packet: $name:mxcsr;bitsize:32;offset:200;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
560 send packet: $qRegisterInfo1e#00
anatofuz
parents:
diff changeset
561 read packet: $name:mxcsrmask;bitsize:32;offset:204;encoding:uint;format:hex;set:Floating Point Registers;#00
anatofuz
parents:
diff changeset
562 send packet: $qRegisterInfo1f#00
anatofuz
parents:
diff changeset
563 read packet: $name:stmm0;bitsize:80;offset:208;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:33;dwarf:33;#00
anatofuz
parents:
diff changeset
564 send packet: $qRegisterInfo20#00
anatofuz
parents:
diff changeset
565 read packet: $name:stmm1;bitsize:80;offset:224;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:34;dwarf:34;#00
anatofuz
parents:
diff changeset
566 send packet: $qRegisterInfo21#00
anatofuz
parents:
diff changeset
567 read packet: $name:stmm2;bitsize:80;offset:240;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:35;dwarf:35;#00
anatofuz
parents:
diff changeset
568 send packet: $qRegisterInfo22#00
anatofuz
parents:
diff changeset
569 read packet: $name:stmm3;bitsize:80;offset:256;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:36;dwarf:36;#00
anatofuz
parents:
diff changeset
570 send packet: $qRegisterInfo23#00
anatofuz
parents:
diff changeset
571 read packet: $name:stmm4;bitsize:80;offset:272;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:37;dwarf:37;#00
anatofuz
parents:
diff changeset
572 send packet: $qRegisterInfo24#00
anatofuz
parents:
diff changeset
573 read packet: $name:stmm5;bitsize:80;offset:288;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:38;dwarf:38;#00
anatofuz
parents:
diff changeset
574 send packet: $qRegisterInfo25#00
anatofuz
parents:
diff changeset
575 read packet: $name:stmm6;bitsize:80;offset:304;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:39;dwarf:39;#00
anatofuz
parents:
diff changeset
576 send packet: $qRegisterInfo26#00
anatofuz
parents:
diff changeset
577 read packet: $name:stmm7;bitsize:80;offset:320;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:40;dwarf:40;#00
anatofuz
parents:
diff changeset
578 send packet: $qRegisterInfo27#00
anatofuz
parents:
diff changeset
579 read packet: $name:xmm0;bitsize:128;offset:336;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:17;dwarf:17;#00
anatofuz
parents:
diff changeset
580 send packet: $qRegisterInfo28#00
anatofuz
parents:
diff changeset
581 read packet: $name:xmm1;bitsize:128;offset:352;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:18;dwarf:18;#00
anatofuz
parents:
diff changeset
582 send packet: $qRegisterInfo29#00
anatofuz
parents:
diff changeset
583 read packet: $name:xmm2;bitsize:128;offset:368;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:19;dwarf:19;#00
anatofuz
parents:
diff changeset
584 send packet: $qRegisterInfo2a#00
anatofuz
parents:
diff changeset
585 read packet: $name:xmm3;bitsize:128;offset:384;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:20;dwarf:20;#00
anatofuz
parents:
diff changeset
586 send packet: $qRegisterInfo2b#00
anatofuz
parents:
diff changeset
587 read packet: $name:xmm4;bitsize:128;offset:400;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:21;dwarf:21;#00
anatofuz
parents:
diff changeset
588 send packet: $qRegisterInfo2c#00
anatofuz
parents:
diff changeset
589 read packet: $name:xmm5;bitsize:128;offset:416;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:22;dwarf:22;#00
anatofuz
parents:
diff changeset
590 send packet: $qRegisterInfo2d#00
anatofuz
parents:
diff changeset
591 read packet: $name:xmm6;bitsize:128;offset:432;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:23;dwarf:23;#00
anatofuz
parents:
diff changeset
592 send packet: $qRegisterInfo2e#00
anatofuz
parents:
diff changeset
593 read packet: $name:xmm7;bitsize:128;offset:448;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:24;dwarf:24;#00
anatofuz
parents:
diff changeset
594 send packet: $qRegisterInfo2f#00
anatofuz
parents:
diff changeset
595 read packet: $name:xmm8;bitsize:128;offset:464;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:25;dwarf:25;#00
anatofuz
parents:
diff changeset
596 send packet: $qRegisterInfo30#00
anatofuz
parents:
diff changeset
597 read packet: $name:xmm9;bitsize:128;offset:480;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:26;dwarf:26;#00
anatofuz
parents:
diff changeset
598 send packet: $qRegisterInfo31#00
anatofuz
parents:
diff changeset
599 read packet: $name:xmm10;bitsize:128;offset:496;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:27;dwarf:27;#00
anatofuz
parents:
diff changeset
600 send packet: $qRegisterInfo32#00
anatofuz
parents:
diff changeset
601 read packet: $name:xmm11;bitsize:128;offset:512;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:28;dwarf:28;#00
anatofuz
parents:
diff changeset
602 send packet: $qRegisterInfo33#00
anatofuz
parents:
diff changeset
603 read packet: $name:xmm12;bitsize:128;offset:528;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:29;dwarf:29;#00
anatofuz
parents:
diff changeset
604 send packet: $qRegisterInfo34#00
anatofuz
parents:
diff changeset
605 read packet: $name:xmm13;bitsize:128;offset:544;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:30;dwarf:30;#00
anatofuz
parents:
diff changeset
606 send packet: $qRegisterInfo35#00
anatofuz
parents:
diff changeset
607 read packet: $name:xmm14;bitsize:128;offset:560;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:31;dwarf:31;#00
anatofuz
parents:
diff changeset
608 send packet: $qRegisterInfo36#00
anatofuz
parents:
diff changeset
609 read packet: $name:xmm15;bitsize:128;offset:576;encoding:vector;format:vector-uint8;set:Floating Point Registers;gcc:32;dwarf:32;#00
anatofuz
parents:
diff changeset
610 send packet: $qRegisterInfo37#00
anatofuz
parents:
diff changeset
611 read packet: $name:trapno;bitsize:32;offset:696;encoding:uint;format:hex;set:Exception State Registers;#00
anatofuz
parents:
diff changeset
612 send packet: $qRegisterInfo38#00
anatofuz
parents:
diff changeset
613 read packet: $name:err;bitsize:32;offset:700;encoding:uint;format:hex;set:Exception State Registers;#00
anatofuz
parents:
diff changeset
614 send packet: $qRegisterInfo39#00
anatofuz
parents:
diff changeset
615 read packet: $name:faultvaddr;bitsize:64;offset:704;encoding:uint;format:hex;set:Exception State Registers;#00
anatofuz
parents:
diff changeset
616 send packet: $qRegisterInfo3a#00
anatofuz
parents:
diff changeset
617 read packet: $E45#00
anatofuz
parents:
diff changeset
618
anatofuz
parents:
diff changeset
619 As we see above we keep making subsequent calls to the remote server to
anatofuz
parents:
diff changeset
620 discover all registers by increasing the number appended to qRegisterInfo and
anatofuz
parents:
diff changeset
621 we get a response back that is a series of "key=value;" strings.
anatofuz
parents:
diff changeset
622
anatofuz
parents:
diff changeset
623 The offset: fields should not leave a gap anywhere in the g/G packet -- the
anatofuz
parents:
diff changeset
624 register values should be appended one after another. For instance, if the
anatofuz
parents:
diff changeset
625 register context for a thread looks like
anatofuz
parents:
diff changeset
626
anatofuz
parents:
diff changeset
627 struct rctx {
anatofuz
parents:
diff changeset
628 uint32_t gpr1; // offset 0
anatofuz
parents:
diff changeset
629 uint32_t gpr2; // offset 4
anatofuz
parents:
diff changeset
630 uint32_t gpr3; // offset 8
anatofuz
parents:
diff changeset
631 uint64_t fp1; // offset 16
anatofuz
parents:
diff changeset
632 };
anatofuz
parents:
diff changeset
633
anatofuz
parents:
diff changeset
634 You may end up with a 4-byte gap between gpr3 and fp1 on architectures
anatofuz
parents:
diff changeset
635 that align values like this. The correct offset: value for fp1 is 12 -
anatofuz
parents:
diff changeset
636 in the g/G packet fp1 will immediately follow gpr3, even though the
anatofuz
parents:
diff changeset
637 in-memory thread structure has an empty 4 bytes for alignment between
anatofuz
parents:
diff changeset
638 these two registers.
anatofuz
parents:
diff changeset
639
anatofuz
parents:
diff changeset
640 The keys and values are detailed below:
anatofuz
parents:
diff changeset
641
anatofuz
parents:
diff changeset
642 Key Value
anatofuz
parents:
diff changeset
643 ========== ================================================================
anatofuz
parents:
diff changeset
644 name The primary register name as a string ("rbp" for example)
anatofuz
parents:
diff changeset
645
anatofuz
parents:
diff changeset
646 alt-name An alternate name for a register as a string ("fp" for example for
anatofuz
parents:
diff changeset
647 the above "rbp")
anatofuz
parents:
diff changeset
648
anatofuz
parents:
diff changeset
649 bitsize Size in bits of a register (32, 64, etc). Base 10.
anatofuz
parents:
diff changeset
650
anatofuz
parents:
diff changeset
651 offset The offset within the "g" and "G" packet of the register data for
anatofuz
parents:
diff changeset
652 this register. This is the byte offset once the data has been
anatofuz
parents:
diff changeset
653 transformed into binary, not the character offset into the g/G
anatofuz
parents:
diff changeset
654 packet. Base 10.
anatofuz
parents:
diff changeset
655
anatofuz
parents:
diff changeset
656 encoding The encoding type of the register which must be one of:
anatofuz
parents:
diff changeset
657
anatofuz
parents:
diff changeset
658 uint (unsigned integer)
anatofuz
parents:
diff changeset
659 sint (signed integer)
anatofuz
parents:
diff changeset
660 ieee754 (IEEE 754 float)
anatofuz
parents:
diff changeset
661 vector (vector register)
anatofuz
parents:
diff changeset
662
anatofuz
parents:
diff changeset
663 format The preferred format for display of this register. The value must
anatofuz
parents:
diff changeset
664 be one of:
anatofuz
parents:
diff changeset
665
anatofuz
parents:
diff changeset
666 binary
anatofuz
parents:
diff changeset
667 decimal
anatofuz
parents:
diff changeset
668 hex
anatofuz
parents:
diff changeset
669 float
anatofuz
parents:
diff changeset
670 vector-sint8
anatofuz
parents:
diff changeset
671 vector-uint8
anatofuz
parents:
diff changeset
672 vector-sint16
anatofuz
parents:
diff changeset
673 vector-uint16
anatofuz
parents:
diff changeset
674 vector-sint32
anatofuz
parents:
diff changeset
675 vector-uint32
anatofuz
parents:
diff changeset
676 vector-float32
anatofuz
parents:
diff changeset
677 vector-uint128
anatofuz
parents:
diff changeset
678
anatofuz
parents:
diff changeset
679 set The register set name as a string that this register belongs to.
anatofuz
parents:
diff changeset
680
anatofuz
parents:
diff changeset
681 gcc The GCC compiler registers number for this register (used for
anatofuz
parents:
diff changeset
682 EH frame and other compiler information that is encoded in the
anatofuz
parents:
diff changeset
683 executable files). The supplied number will be decoded like a
anatofuz
parents:
diff changeset
684 string passed to strtoul() with a base of zero, so the number
anatofuz
parents:
diff changeset
685 can be decimal, or hex if it is prefixed with "0x".
anatofuz
parents:
diff changeset
686
anatofuz
parents:
diff changeset
687 NOTE: If the compiler doesn't have a register number for this
anatofuz
parents:
diff changeset
688 register, this key/value pair should be omitted.
anatofuz
parents:
diff changeset
689
anatofuz
parents:
diff changeset
690 dwarf The DWARF register number for this register that is used for this
anatofuz
parents:
diff changeset
691 register in the debug information. The supplied number will be decoded
anatofuz
parents:
diff changeset
692 like a string passed to strtoul() with a base of zero, so the number
anatofuz
parents:
diff changeset
693 can be decimal, or hex if it is prefixed with "0x".
anatofuz
parents:
diff changeset
694
anatofuz
parents:
diff changeset
695 NOTE: If the compiler doesn't have a register number for this
anatofuz
parents:
diff changeset
696 register, this key/value pair should be omitted.
anatofuz
parents:
diff changeset
697
anatofuz
parents:
diff changeset
698 generic If the register is a generic register that most CPUs have, classify
anatofuz
parents:
diff changeset
699 it correctly so the debugger knows. Valid values are one of:
anatofuz
parents:
diff changeset
700 pc (a program counter register. for example "name=eip;" (i386),
anatofuz
parents:
diff changeset
701 "name=rip;" (x86_64), "name=r15;" (32 bit arm) would
anatofuz
parents:
diff changeset
702 include a "generic=pc;" key value pair)
anatofuz
parents:
diff changeset
703 sp (a stack pointer register. for example "name=esp;" (i386),
anatofuz
parents:
diff changeset
704 "name=rsp;" (x86_64), "name=r13;" (32 bit arm) would
anatofuz
parents:
diff changeset
705 include a "generic=sp;" key value pair)
anatofuz
parents:
diff changeset
706 fp (a frame pointer register. for example "name=ebp;" (i386),
anatofuz
parents:
diff changeset
707 "name=rbp;" (x86_64), "name=r7;" (32 bit arm with macosx
anatofuz
parents:
diff changeset
708 ABI) would include a "generic=fp;" key value pair)
anatofuz
parents:
diff changeset
709 ra (a return address register. for example "name=lr;" (32 bit ARM)
anatofuz
parents:
diff changeset
710 would include a "generic=ra;" key value pair)
anatofuz
parents:
diff changeset
711 fp (a CPU flags register. for example "name=eflags;" (i386),
anatofuz
parents:
diff changeset
712 "name=rflags;" (x86_64), "name=cpsr;" (32 bit ARM)
anatofuz
parents:
diff changeset
713 would include a "generic=flags;" key value pair)
anatofuz
parents:
diff changeset
714 arg1 - arg8 (specified for registers that contain function
anatofuz
parents:
diff changeset
715 arguments when the argument fits into a register)
anatofuz
parents:
diff changeset
716
anatofuz
parents:
diff changeset
717 container-regs
anatofuz
parents:
diff changeset
718 The value for this key is a comma separated list of raw hex (optional
anatofuz
parents:
diff changeset
719 leading "0x") register numbers.
anatofuz
parents:
diff changeset
720
anatofuz
parents:
diff changeset
721 This specifies that this register is contained in other concrete
anatofuz
parents:
diff changeset
722 register values. For example "eax" is in the lower 32 bits of the
anatofuz
parents:
diff changeset
723 "rax" register value for x86_64, so "eax" could specify that it is
anatofuz
parents:
diff changeset
724 contained in "rax" by specifying the register number for "rax" (whose
anatofuz
parents:
diff changeset
725 register number is 0x00)
anatofuz
parents:
diff changeset
726
anatofuz
parents:
diff changeset
727 "container-regs:00;"
anatofuz
parents:
diff changeset
728
anatofuz
parents:
diff changeset
729 If a register is comprised of one or more registers, like "d0" is ARM
anatofuz
parents:
diff changeset
730 which is a 64 bit register, it might be made up of "s0" and "s1". If
anatofuz
parents:
diff changeset
731 the register number for "s0" is 0x20, and the register number of "s1"
anatofuz
parents:
diff changeset
732 is "0x21", the "container-regs" key/value pair would be:
anatofuz
parents:
diff changeset
733
anatofuz
parents:
diff changeset
734 "container-regs:20,21;"
anatofuz
parents:
diff changeset
735
anatofuz
parents:
diff changeset
736 This is handy for defining what GDB used to call "pseudo" registers.
anatofuz
parents:
diff changeset
737 These registers are never requested by LLDB via the register read
anatofuz
parents:
diff changeset
738 or write packets, the container registers will be requested on behalf
anatofuz
parents:
diff changeset
739 of this register.
anatofuz
parents:
diff changeset
740
anatofuz
parents:
diff changeset
741 invalidate-regs
anatofuz
parents:
diff changeset
742 The value for this key is a comma separated list of raw hex (optional
anatofuz
parents:
diff changeset
743 leading "0x") register numbers.
anatofuz
parents:
diff changeset
744
anatofuz
parents:
diff changeset
745 This specifies which register values should be invalidated when this
anatofuz
parents:
diff changeset
746 register is modified. For example if modifying "eax" would cause "rax",
anatofuz
parents:
diff changeset
747 "eax", "ax", "ah", and "al" to be modified where rax is 0x0, eax is 0x15,
anatofuz
parents:
diff changeset
748 ax is 0x25, ah is 0x35, and al is 0x39, the "invalidate-regs" key/value
anatofuz
parents:
diff changeset
749 pair would be:
anatofuz
parents:
diff changeset
750
anatofuz
parents:
diff changeset
751 "invalidate-regs:0,15,25,35,39;"
anatofuz
parents:
diff changeset
752
anatofuz
parents:
diff changeset
753 If there is a single register that gets invalidated, then omit the comma
anatofuz
parents:
diff changeset
754 and just list a single register:
anatofuz
parents:
diff changeset
755
anatofuz
parents:
diff changeset
756 "invalidate-regs:0;"
anatofuz
parents:
diff changeset
757
anatofuz
parents:
diff changeset
758 This is handy when modifying a specific register can cause other
anatofuz
parents:
diff changeset
759 register values to change. For example, when debugging an ARM target,
anatofuz
parents:
diff changeset
760 modifying the CPSR register can cause the r8 - r14 and cpsr value to
anatofuz
parents:
diff changeset
761 change depending on if the mode has changed.
anatofuz
parents:
diff changeset
762
anatofuz
parents:
diff changeset
763 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
764 // "qPlatform_shell"
anatofuz
parents:
diff changeset
765 //
anatofuz
parents:
diff changeset
766 // BRIEF
anatofuz
parents:
diff changeset
767 // Run a command in a shell on the connected remote machine.
anatofuz
parents:
diff changeset
768 //
anatofuz
parents:
diff changeset
769 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
770 // High. This command allows LLDB clients to run arbitrary shell
anatofuz
parents:
diff changeset
771 // commands on a remote host.
anatofuz
parents:
diff changeset
772 //
anatofuz
parents:
diff changeset
773 /----------------------------------------------------------------------
anatofuz
parents:
diff changeset
774
anatofuz
parents:
diff changeset
775 The request consists of the command to be executed encoded in ASCII characters
anatofuz
parents:
diff changeset
776 converted into hex bytes.
anatofuz
parents:
diff changeset
777
anatofuz
parents:
diff changeset
778 The response to this packet consists of the letter F followed by the return code,
anatofuz
parents:
diff changeset
779 followed by the signal number (or 0 if no signal was delivered), and escaped bytes
anatofuz
parents:
diff changeset
780 of captured program output.
anatofuz
parents:
diff changeset
781
anatofuz
parents:
diff changeset
782 Below is an example communication from a client sending an "ls -la" command:
anatofuz
parents:
diff changeset
783
anatofuz
parents:
diff changeset
784 send packet: $qPlatform_shell:6c73202d6c61,00000002#ec
anatofuz
parents:
diff changeset
785 read packet: $F,00000000,00000000,total 4736
anatofuz
parents:
diff changeset
786 drwxrwxr-x 16 username groupname 4096 Aug 15 21:36 .
anatofuz
parents:
diff changeset
787 drwxr-xr-x 17 username groupname 4096 Aug 10 16:39 ..
anatofuz
parents:
diff changeset
788 -rw-rw-r-- 1 username groupname 73875 Aug 12 16:46 notes.txt
anatofuz
parents:
diff changeset
789 drwxrwxr-x 5 username groupname 4096 Aug 15 21:36 source.cpp
anatofuz
parents:
diff changeset
790 -rw-r--r-- 1 username groupname 2792 Aug 12 16:46 a.out
anatofuz
parents:
diff changeset
791 -rw-r--r-- 1 username groupname 3190 Aug 12 16:46 Makefile
anatofuz
parents:
diff changeset
792
anatofuz
parents:
diff changeset
793 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
794 // "qPlatform_mkdir"
anatofuz
parents:
diff changeset
795 //
anatofuz
parents:
diff changeset
796 // BRIEF
anatofuz
parents:
diff changeset
797 // Creates a new directory on the connected remote machine.
anatofuz
parents:
diff changeset
798 //
anatofuz
parents:
diff changeset
799 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
800 // Low. This command allows LLDB clients to create new directories on
anatofuz
parents:
diff changeset
801 // a remote host.
anatofuz
parents:
diff changeset
802 //
anatofuz
parents:
diff changeset
803 /----------------------------------------------------------------------
anatofuz
parents:
diff changeset
804
anatofuz
parents:
diff changeset
805 Request:
anatofuz
parents:
diff changeset
806 qPlatform_mkdir:<hex-file-mode>,<ascii-hex-path>
anatofuz
parents:
diff changeset
807
anatofuz
parents:
diff changeset
808 Reply:
anatofuz
parents:
diff changeset
809 F<mkdir-return-code>
anatofuz
parents:
diff changeset
810 mkdir called successfully and returned with the given return code
anatofuz
parents:
diff changeset
811 Exx
anatofuz
parents:
diff changeset
812 An error occurred
anatofuz
parents:
diff changeset
813
anatofuz
parents:
diff changeset
814 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
815 // "qPlatform_chmod"
anatofuz
parents:
diff changeset
816 //
anatofuz
parents:
diff changeset
817 // BRIEF
anatofuz
parents:
diff changeset
818 // Change the permissions of a file on the connected remote machine.
anatofuz
parents:
diff changeset
819 //
anatofuz
parents:
diff changeset
820 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
821 // Low. This command allows LLDB clients to change the permissions of
anatofuz
parents:
diff changeset
822 // a file on the remote host.
anatofuz
parents:
diff changeset
823 //
anatofuz
parents:
diff changeset
824 /----------------------------------------------------------------------
anatofuz
parents:
diff changeset
825
anatofuz
parents:
diff changeset
826 Request:
anatofuz
parents:
diff changeset
827 qPlatform_chmod:<hex-file-mode>,<ascii-hex-path>
anatofuz
parents:
diff changeset
828
anatofuz
parents:
diff changeset
829 Reply:
anatofuz
parents:
diff changeset
830 F<chmod-return-code>
anatofuz
parents:
diff changeset
831 chmod called successfully and returned with the given return code
anatofuz
parents:
diff changeset
832 Exx
anatofuz
parents:
diff changeset
833 An error occurred
anatofuz
parents:
diff changeset
834
anatofuz
parents:
diff changeset
835 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
836 // "qHostInfo"
anatofuz
parents:
diff changeset
837 //
anatofuz
parents:
diff changeset
838 // BRIEF
anatofuz
parents:
diff changeset
839 // Get information about the host we are remotely connected to.
anatofuz
parents:
diff changeset
840 //
anatofuz
parents:
diff changeset
841 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
842 // High. This packet is usually very easy to implement and can help
anatofuz
parents:
diff changeset
843 // LLDB select the correct plug-ins for the job based on the target
anatofuz
parents:
diff changeset
844 // triple information that is supplied.
anatofuz
parents:
diff changeset
845 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
846
anatofuz
parents:
diff changeset
847 LLDB supports a host info call that gets all sorts of details of the system
anatofuz
parents:
diff changeset
848 that is being debugged:
anatofuz
parents:
diff changeset
849
anatofuz
parents:
diff changeset
850 send packet: $qHostInfo#00
anatofuz
parents:
diff changeset
851 read packet: $cputype:16777223;cpusubtype:3;ostype:darwin;vendor:apple;endian:little;ptrsize:8;#00
anatofuz
parents:
diff changeset
852
anatofuz
parents:
diff changeset
853 Key value pairs are one of:
anatofuz
parents:
diff changeset
854
anatofuz
parents:
diff changeset
855 cputype: is a number that is the mach-o CPU type that is being debugged (base 10)
anatofuz
parents:
diff changeset
856 cpusubtype: is a number that is the mach-o CPU subtype type that is being debugged (base 10)
anatofuz
parents:
diff changeset
857 triple: a string for the target triple (x86_64-apple-macosx) that can be used to specify arch + vendor + os in one entry
anatofuz
parents:
diff changeset
858 vendor: a string for the vendor (apple), not needed if "triple" is specified
anatofuz
parents:
diff changeset
859 ostype: a string for the OS being debugged (macosx, linux, freebsd, ios, watchos), not needed if "triple" is specified
anatofuz
parents:
diff changeset
860 endian: is one of "little", "big", or "pdp"
anatofuz
parents:
diff changeset
861 ptrsize: an unsigned number that represents how big pointers are in bytes on the debug target
anatofuz
parents:
diff changeset
862 hostname: the hostname of the host that is running the GDB server if available
anatofuz
parents:
diff changeset
863 os_build: a string for the OS build for the remote host as a string value
anatofuz
parents:
diff changeset
864 os_kernel: a string describing the kernel version
anatofuz
parents:
diff changeset
865 os_version: a version string that represents the current OS version (10.8.2)
anatofuz
parents:
diff changeset
866 watchpoint_exceptions_received: one of "before" or "after" to specify if a watchpoint is triggered before or after the pc when it stops
anatofuz
parents:
diff changeset
867 default_packet_timeout: an unsigned number that specifies the default timeout in seconds
anatofuz
parents:
diff changeset
868 distribution_id: optional. For linux, specifies distribution id (e.g. ubuntu, fedora, etc.)
anatofuz
parents:
diff changeset
869 osmajor: optional, specifies the major version number of the OS (e.g. for macOS 10.12.2, it would be 10)
anatofuz
parents:
diff changeset
870 osminor: optional, specifies the minor version number of the OS (e.g. for macOS 10.12.2, it would be 12)
anatofuz
parents:
diff changeset
871 ospatch: optional, specifies the patch level number of the OS (e.g. for macOS 10.12.2, it would be 2)
anatofuz
parents:
diff changeset
872 addressing_bits: optional, specifies how many bits in addresses are
anatofuz
parents:
diff changeset
873 significant for addressing, base 10. If bits 38..0
anatofuz
parents:
diff changeset
874 in a 64-bit pointer are significant for addressing,
anatofuz
parents:
diff changeset
875 then the value is 39. This is needed on e.g. Aarch64
anatofuz
parents:
diff changeset
876 v8.3 ABIs that use pointer authentication, so lldb
anatofuz
parents:
diff changeset
877 knows which bits to clear/set to get the actual
anatofuz
parents:
diff changeset
878 addresses.
anatofuz
parents:
diff changeset
879
anatofuz
parents:
diff changeset
880 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
881 // "qGDBServerVersion"
anatofuz
parents:
diff changeset
882 //
anatofuz
parents:
diff changeset
883 // BRIEF
anatofuz
parents:
diff changeset
884 // Get version information about this implementation of the gdb-remote
anatofuz
parents:
diff changeset
885 // protocol.
anatofuz
parents:
diff changeset
886 //
anatofuz
parents:
diff changeset
887 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
888 // High. This packet is usually very easy to implement and can help
anatofuz
parents:
diff changeset
889 // LLDB to work around bugs in a server's implementation when they
anatofuz
parents:
diff changeset
890 // are found.
anatofuz
parents:
diff changeset
891 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
892
anatofuz
parents:
diff changeset
893 The goal of this packet is to provide enough information about an
anatofuz
parents:
diff changeset
894 implementation of the gdb-remote-protocol server that lldb can
anatofuz
parents:
diff changeset
895 work around implementation problems that are discovered after the
anatofuz
parents:
diff changeset
896 version has been released/deployed. The name and version number
anatofuz
parents:
diff changeset
897 should be sufficiently unique that lldb can unambiguously identify
anatofuz
parents:
diff changeset
898 the origin of the program (for instance, debugserver from lldb) and
anatofuz
parents:
diff changeset
899 the version/submission number/patch level of the program - whatever
anatofuz
parents:
diff changeset
900 is appropriate for your server implementation.
anatofuz
parents:
diff changeset
901
anatofuz
parents:
diff changeset
902 The packet follows the key-value pair model, semicolon separated.
anatofuz
parents:
diff changeset
903
anatofuz
parents:
diff changeset
904 send packet: $qGDBServerVersion#00
anatofuz
parents:
diff changeset
905 read packet: $name:debugserver;version:310.2;#00
anatofuz
parents:
diff changeset
906
anatofuz
parents:
diff changeset
907 Other clients may find other key-value pairs to be useful for identifying
anatofuz
parents:
diff changeset
908 a gdb stub. Patch level, release name, build number may all be keys that
anatofuz
parents:
diff changeset
909 better describe your implementation's version.
anatofuz
parents:
diff changeset
910 Suggested key names:
anatofuz
parents:
diff changeset
911
anatofuz
parents:
diff changeset
912 name : the name of your remote server - "debugserver" is the lldb standard
anatofuz
parents:
diff changeset
913 implementation
anatofuz
parents:
diff changeset
914
anatofuz
parents:
diff changeset
915 version : identifies the version number of this server
anatofuz
parents:
diff changeset
916
anatofuz
parents:
diff changeset
917 patch_level : the patch level of this server
anatofuz
parents:
diff changeset
918
anatofuz
parents:
diff changeset
919 release_name : the name of this release, if your project uses names
anatofuz
parents:
diff changeset
920
anatofuz
parents:
diff changeset
921 build_number : if you use a build system with increasing build numbers,
anatofuz
parents:
diff changeset
922 this may be the right key name for your server
anatofuz
parents:
diff changeset
923
anatofuz
parents:
diff changeset
924 major_version : major version number
anatofuz
parents:
diff changeset
925 minor_version : minor version number
anatofuz
parents:
diff changeset
926
anatofuz
parents:
diff changeset
927 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
928 // "qProcessInfo"
anatofuz
parents:
diff changeset
929 //
anatofuz
parents:
diff changeset
930 // BRIEF
anatofuz
parents:
diff changeset
931 // Get information about the process we are currently debugging.
anatofuz
parents:
diff changeset
932 //
anatofuz
parents:
diff changeset
933 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
934 // Medium. On systems which can launch multiple different architecture processes,
anatofuz
parents:
diff changeset
935 // the qHostInfo may not disambiguate sufficiently to know what kind of
anatofuz
parents:
diff changeset
936 // process is being debugged.
anatofuz
parents:
diff changeset
937 // e.g. on a 64-bit x86 Mac system both 32-bit and 64-bit user processes are possible,
anatofuz
parents:
diff changeset
938 // and with Mach-O universal files, the executable file may contain both 32- and
anatofuz
parents:
diff changeset
939 // 64-bit slices so it may be impossible to know until you're attached to a real
anatofuz
parents:
diff changeset
940 // process to know what you're working with.
anatofuz
parents:
diff changeset
941 //
anatofuz
parents:
diff changeset
942 // All numeric fields return base-16 numbers without any "0x" prefix.
anatofuz
parents:
diff changeset
943 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
944
anatofuz
parents:
diff changeset
945 An i386 process:
anatofuz
parents:
diff changeset
946
anatofuz
parents:
diff changeset
947 send packet: $qProcessInfo#00
anatofuz
parents:
diff changeset
948 read packet: $pid:42a8;parent-pid:42bf;real-uid:ecf;real-gid:b;effective-uid:ecf;effective-gid:b;cputype:7;cpusubtype:3;ostype:macosx;vendor:apple;endian:little;ptrsize:4;#00
anatofuz
parents:
diff changeset
949
anatofuz
parents:
diff changeset
950 An x86_64 process:
anatofuz
parents:
diff changeset
951
anatofuz
parents:
diff changeset
952 send packet: $qProcessInfo#00
anatofuz
parents:
diff changeset
953 read packet: $pid:d22c;parent-pid:d34d;real-uid:ecf;real-gid:b;effective-uid:ecf;effective-gid:b;cputype:1000007;cpusubtype:3;ostype:macosx;vendor:apple;endian:little;ptrsize:8;#00
anatofuz
parents:
diff changeset
954
anatofuz
parents:
diff changeset
955 Key value pairs include:
anatofuz
parents:
diff changeset
956
anatofuz
parents:
diff changeset
957 pid: the process id
anatofuz
parents:
diff changeset
958 parent-pid: the process of the parent process (often debugserver will become the parent when attaching)
anatofuz
parents:
diff changeset
959 real-uid: the real user id of the process
anatofuz
parents:
diff changeset
960 real-gid: the real group id of the process
anatofuz
parents:
diff changeset
961 effective-uid: the effective user id of the process
anatofuz
parents:
diff changeset
962 effective-gid: the effective group id of the process
anatofuz
parents:
diff changeset
963 cputype: the Mach-O CPU type of the process (base 16)
anatofuz
parents:
diff changeset
964 cpusubtype: the Mach-O CPU subtype of the process (base 16)
anatofuz
parents:
diff changeset
965 ostype: is a string the represents the OS being debugged (darwin, linux, freebsd)
anatofuz
parents:
diff changeset
966 vendor: is a string that represents the vendor (apple)
anatofuz
parents:
diff changeset
967 endian: is one of "little", "big", or "pdp"
anatofuz
parents:
diff changeset
968 ptrsize: is a number that represents how big pointers are in bytes
anatofuz
parents:
diff changeset
969
anatofuz
parents:
diff changeset
970
anatofuz
parents:
diff changeset
971 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
972 // "qShlibInfoAddr"
anatofuz
parents:
diff changeset
973 //
anatofuz
parents:
diff changeset
974 // BRIEF
anatofuz
parents:
diff changeset
975 // Get an address where the dynamic linker stores information about
anatofuz
parents:
diff changeset
976 // where shared libraries are loaded.
anatofuz
parents:
diff changeset
977 //
anatofuz
parents:
diff changeset
978 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
979 // High if you have a dynamic loader plug-in in LLDB for your target
anatofuz
parents:
diff changeset
980 // triple (see the "qHostInfo" packet) that can use this information.
anatofuz
parents:
diff changeset
981 // Many times address load randomization can make it hard to detect
anatofuz
parents:
diff changeset
982 // where the dynamic loader binary and data structures are located and
anatofuz
parents:
diff changeset
983 // some platforms know, or can find out where this information is.
anatofuz
parents:
diff changeset
984 //
anatofuz
parents:
diff changeset
985 // Low if you have a debug target where all object and symbol files
anatofuz
parents:
diff changeset
986 // contain static load addresses.
anatofuz
parents:
diff changeset
987 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
988
anatofuz
parents:
diff changeset
989 LLDB and GDB both support the "qShlibInfoAddr" packet which is a hint to each
anatofuz
parents:
diff changeset
990 debugger as to where to find the dynamic loader information. For darwin
anatofuz
parents:
diff changeset
991 binaries that run in user land this is the address of the "all_image_infos"
anatofuz
parents:
diff changeset
992 structure in the "/usr/lib/dyld" executable, or the result of a TASK_DYLD_INFO
anatofuz
parents:
diff changeset
993 call. The result is returned as big endian hex bytes that are the address
anatofuz
parents:
diff changeset
994 value:
anatofuz
parents:
diff changeset
995
anatofuz
parents:
diff changeset
996 send packet: $qShlibInfoAddr#00
anatofuz
parents:
diff changeset
997 read packet: $7fff5fc40040#00
anatofuz
parents:
diff changeset
998
anatofuz
parents:
diff changeset
999
anatofuz
parents:
diff changeset
1000
anatofuz
parents:
diff changeset
1001 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1002 // "qThreadStopInfo<tid>"
anatofuz
parents:
diff changeset
1003 //
anatofuz
parents:
diff changeset
1004 // BRIEF
anatofuz
parents:
diff changeset
1005 // Get information about why a thread, whose ID is "<tid>", is stopped.
anatofuz
parents:
diff changeset
1006 //
anatofuz
parents:
diff changeset
1007 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1008 // High if you need to support multi-threaded or multi-core debugging.
anatofuz
parents:
diff changeset
1009 // Many times one thread will hit a breakpoint and while the debugger
anatofuz
parents:
diff changeset
1010 // is in the process of suspending the other threads, other threads
anatofuz
parents:
diff changeset
1011 // will also hit a breakpoint. This packet allows LLDB to know why all
anatofuz
parents:
diff changeset
1012 // threads (live system debug) / cores (JTAG) in your program have
anatofuz
parents:
diff changeset
1013 // stopped and allows LLDB to display and control your program
anatofuz
parents:
diff changeset
1014 // correctly.
anatofuz
parents:
diff changeset
1015 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1016
anatofuz
parents:
diff changeset
1017 LLDB tries to use the "qThreadStopInfo" packet which is formatted as
anatofuz
parents:
diff changeset
1018 "qThreadStopInfo%x" where %x is the hex thread ID. This requests information
anatofuz
parents:
diff changeset
1019 about why a thread is stopped. The response is the same as the stop reply
anatofuz
parents:
diff changeset
1020 packets and tells us what happened to the other threads. The standard GDB
anatofuz
parents:
diff changeset
1021 remote packets love to think that there is only _one_ reason that _one_ thread
anatofuz
parents:
diff changeset
1022 stops at a time. This allows us to see why all threads stopped and allows us
anatofuz
parents:
diff changeset
1023 to implement better multi-threaded debugging support.
anatofuz
parents:
diff changeset
1024
anatofuz
parents:
diff changeset
1025 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1026 // "QThreadSuffixSupported"
anatofuz
parents:
diff changeset
1027 //
anatofuz
parents:
diff changeset
1028 // BRIEF
anatofuz
parents:
diff changeset
1029 // Try to enable thread suffix support for the 'g', 'G', 'p', and 'P'
anatofuz
parents:
diff changeset
1030 // packets.
anatofuz
parents:
diff changeset
1031 //
anatofuz
parents:
diff changeset
1032 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1033 // High. Adding a thread suffix allows us to read and write registers
anatofuz
parents:
diff changeset
1034 // more efficiently and stops us from having to select a thread with
anatofuz
parents:
diff changeset
1035 // one packet and then read registers with a second packet. It also
anatofuz
parents:
diff changeset
1036 // makes sure that no errors can occur where the debugger thinks it
anatofuz
parents:
diff changeset
1037 // already has a thread selected (see the "Hg" packet from the standard
anatofuz
parents:
diff changeset
1038 // GDB remote protocol documentation) yet the remote GDB server actually
anatofuz
parents:
diff changeset
1039 // has another thread selected.
anatofuz
parents:
diff changeset
1040 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1041
anatofuz
parents:
diff changeset
1042 When reading thread registers, you currently need to set the current
anatofuz
parents:
diff changeset
1043 thread, then read the registers. This is kind of cumbersome, so we added the
anatofuz
parents:
diff changeset
1044 ability to query if the remote GDB server supports adding a "thread:<tid>;"
anatofuz
parents:
diff changeset
1045 suffix to all packets that request information for a thread. To test if the
anatofuz
parents:
diff changeset
1046 remote GDB server supports this feature:
anatofuz
parents:
diff changeset
1047
anatofuz
parents:
diff changeset
1048 send packet: $QThreadSuffixSupported#00
anatofuz
parents:
diff changeset
1049 read packet: OK
anatofuz
parents:
diff changeset
1050
anatofuz
parents:
diff changeset
1051 If "OK" is returned, then the 'g', 'G', 'p' and 'P' packets can accept a
anatofuz
parents:
diff changeset
1052 thread suffix. So to send a 'g' packet (read all register values):
anatofuz
parents:
diff changeset
1053
anatofuz
parents:
diff changeset
1054 send packet: $g;thread:<tid>;#00
anatofuz
parents:
diff changeset
1055 read packet: ....
anatofuz
parents:
diff changeset
1056
anatofuz
parents:
diff changeset
1057 send packet: $G;thread:<tid>;#00
anatofuz
parents:
diff changeset
1058 read packet: ....
anatofuz
parents:
diff changeset
1059
anatofuz
parents:
diff changeset
1060 send packet: $p1a;thread:<tid>;#00
anatofuz
parents:
diff changeset
1061 read packet: ....
anatofuz
parents:
diff changeset
1062
anatofuz
parents:
diff changeset
1063 send packet: $P1a=1234abcd;thread:<tid>;#00
anatofuz
parents:
diff changeset
1064 read packet: ....
anatofuz
parents:
diff changeset
1065
anatofuz
parents:
diff changeset
1066
anatofuz
parents:
diff changeset
1067 otherwise, without this you would need to always send two packets:
anatofuz
parents:
diff changeset
1068
anatofuz
parents:
diff changeset
1069 send packet: $Hg<tid>#00
anatofuz
parents:
diff changeset
1070 read packet: ....
anatofuz
parents:
diff changeset
1071 send packet: $g#00
anatofuz
parents:
diff changeset
1072 read packet: ....
anatofuz
parents:
diff changeset
1073
anatofuz
parents:
diff changeset
1074 We also added support for allocating and deallocating memory. We use this to
anatofuz
parents:
diff changeset
1075 allocate memory so we can run JITed code.
anatofuz
parents:
diff changeset
1076
anatofuz
parents:
diff changeset
1077 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1078 // "_M<size>,<permissions>"
anatofuz
parents:
diff changeset
1079 //
anatofuz
parents:
diff changeset
1080 // BRIEF
anatofuz
parents:
diff changeset
1081 // Allocate memory on the remote target with the specified size and
anatofuz
parents:
diff changeset
1082 // permissions.
anatofuz
parents:
diff changeset
1083 //
anatofuz
parents:
diff changeset
1084 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1085 // High if you want LLDB to be able to JIT code and run that code. JIT
anatofuz
parents:
diff changeset
1086 // code also needs data which is also allocated and tracked.
anatofuz
parents:
diff changeset
1087 //
anatofuz
parents:
diff changeset
1088 // Low if you don't support running JIT'ed code.
anatofuz
parents:
diff changeset
1089 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1090
anatofuz
parents:
diff changeset
1091 The allocate memory packet starts with "_M<size>,<permissions>". It returns a
anatofuz
parents:
diff changeset
1092 raw big endian address value, or "" for unimplemented, or "EXX" for an error
anatofuz
parents:
diff changeset
1093 code. The packet is formatted as:
anatofuz
parents:
diff changeset
1094
anatofuz
parents:
diff changeset
1095 char packet[256];
anatofuz
parents:
diff changeset
1096 int packet_len;
anatofuz
parents:
diff changeset
1097 packet_len = ::snprintf (
anatofuz
parents:
diff changeset
1098 packet,
anatofuz
parents:
diff changeset
1099 sizeof(packet),
anatofuz
parents:
diff changeset
1100 "_M%zx,%s%s%s",
anatofuz
parents:
diff changeset
1101 (size_t)size,
anatofuz
parents:
diff changeset
1102 permissions & lldb::ePermissionsReadable ? "r" : "",
anatofuz
parents:
diff changeset
1103 permissions & lldb::ePermissionsWritable ? "w" : "",
anatofuz
parents:
diff changeset
1104 permissions & lldb::ePermissionsExecutable ? "x" : "");
anatofuz
parents:
diff changeset
1105
anatofuz
parents:
diff changeset
1106 You request a size and give the permissions. This packet does NOT need to be
anatofuz
parents:
diff changeset
1107 implemented if you don't want to support running JITed code. The return value
anatofuz
parents:
diff changeset
1108 is just the address of the newly allocated memory as raw big endian hex bytes.
anatofuz
parents:
diff changeset
1109
anatofuz
parents:
diff changeset
1110 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1111 // "_m<addr>"
anatofuz
parents:
diff changeset
1112 //
anatofuz
parents:
diff changeset
1113 // BRIEF
anatofuz
parents:
diff changeset
1114 // Deallocate memory that was previously allocated using an allocate
anatofuz
parents:
diff changeset
1115 // memory pack.
anatofuz
parents:
diff changeset
1116 //
anatofuz
parents:
diff changeset
1117 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1118 // High if you want LLDB to be able to JIT code and run that code. JIT
anatofuz
parents:
diff changeset
1119 // code also needs data which is also allocated and tracked.
anatofuz
parents:
diff changeset
1120 //
anatofuz
parents:
diff changeset
1121 // Low if you don't support running JIT'ed code.
anatofuz
parents:
diff changeset
1122 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1123
anatofuz
parents:
diff changeset
1124 The deallocate memory packet is "_m<addr>" where you pass in the address you
anatofuz
parents:
diff changeset
1125 got back from a previous call to the allocate memory packet. It returns "OK"
anatofuz
parents:
diff changeset
1126 if the memory was successfully deallocated, or "EXX" for an error, or "" if
anatofuz
parents:
diff changeset
1127 not supported.
anatofuz
parents:
diff changeset
1128
anatofuz
parents:
diff changeset
1129 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1130 // "qMemoryRegionInfo:<addr>"
anatofuz
parents:
diff changeset
1131 //
anatofuz
parents:
diff changeset
1132 // BRIEF
anatofuz
parents:
diff changeset
1133 // Get information about the address range that contains "<addr>"
anatofuz
parents:
diff changeset
1134 //
anatofuz
parents:
diff changeset
1135 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1136 // Medium. This is nice to have, but it isn't necessary. It helps LLDB
anatofuz
parents:
diff changeset
1137 // do stack unwinding when we branch into memory that isn't executable.
anatofuz
parents:
diff changeset
1138 // If we can detect that the code we are stopped in isn't executable,
anatofuz
parents:
diff changeset
1139 // then we can recover registers for stack frames above the current
anatofuz
parents:
diff changeset
1140 // frame. Otherwise we must assume we are in some JIT'ed code (not JIT
anatofuz
parents:
diff changeset
1141 // code that LLDB has made) and assume that no registers are available
anatofuz
parents:
diff changeset
1142 // in higher stack frames.
anatofuz
parents:
diff changeset
1143 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1144
anatofuz
parents:
diff changeset
1145 We added a way to get information for a memory region. The packet is:
anatofuz
parents:
diff changeset
1146
anatofuz
parents:
diff changeset
1147 qMemoryRegionInfo:<addr>
anatofuz
parents:
diff changeset
1148
anatofuz
parents:
diff changeset
1149 Where <addr> is a big endian hex address. The response is returned in a series
anatofuz
parents:
diff changeset
1150 of tuples like the data returned in a stop reply packet. The currently valid
anatofuz
parents:
diff changeset
1151 tuples to return are:
anatofuz
parents:
diff changeset
1152
anatofuz
parents:
diff changeset
1153 start:<start-addr>; // <start-addr> is a big endian hex address that is
anatofuz
parents:
diff changeset
1154 // the start address of the range that contains <addr>
anatofuz
parents:
diff changeset
1155
anatofuz
parents:
diff changeset
1156 size:<size>; // <size> is a big endian hex byte size of the address
anatofuz
parents:
diff changeset
1157 // of the range that contains <addr>
anatofuz
parents:
diff changeset
1158
anatofuz
parents:
diff changeset
1159 permissions:<permissions>; // <permissions> is a string that contains one
anatofuz
parents:
diff changeset
1160 // or more of the characters from "rwx"
anatofuz
parents:
diff changeset
1161
anatofuz
parents:
diff changeset
1162 name:<name>; // <name> is a hex encoded string that contains the name of
anatofuz
parents:
diff changeset
1163 // the memory region mapped at the given address. In case of
anatofuz
parents:
diff changeset
1164 // regions backed by a file it have to be the absolute path of
anatofuz
parents:
diff changeset
1165 // the file while for anonymous regions it have to be the name
anatofuz
parents:
diff changeset
1166 // associated to the region if that is available.
anatofuz
parents:
diff changeset
1167
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
1168 flags:<flags-string>; // where <flags-string> is a space separated string
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
1169 // of flag names. Currently the only supported flag
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
1170 // is "mt" for AArch64 memory tagging. lldb will
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
1171 // ignore any other flags in this field.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
1172
150
anatofuz
parents:
diff changeset
1173 error:<ascii-byte-error-string>; // where <ascii-byte-error-string> is
anatofuz
parents:
diff changeset
1174 // a hex encoded string value that
anatofuz
parents:
diff changeset
1175 // contains an error string
anatofuz
parents:
diff changeset
1176
anatofuz
parents:
diff changeset
1177 If the address requested is not in a mapped region (e.g. we've jumped through
anatofuz
parents:
diff changeset
1178 a NULL pointer and are at 0x0) currently lldb expects to get back the size
anatofuz
parents:
diff changeset
1179 of the unmapped region -- that is, the distance to the next valid region.
anatofuz
parents:
diff changeset
1180 For instance, with a macOS process which has nothing mapped in the first
anatofuz
parents:
diff changeset
1181 4GB of its address space, if we're asking about address 0x2,
anatofuz
parents:
diff changeset
1182
anatofuz
parents:
diff changeset
1183 qMemoryRegionInfo:2
anatofuz
parents:
diff changeset
1184 start:2;size:fffffffe;
anatofuz
parents:
diff changeset
1185
anatofuz
parents:
diff changeset
1186 The lack of 'permissions:' indicates that none of read/write/execute are valid
anatofuz
parents:
diff changeset
1187 for this region.
anatofuz
parents:
diff changeset
1188
anatofuz
parents:
diff changeset
1189 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1190 // "x" - Binary memory read
anatofuz
parents:
diff changeset
1191 //
anatofuz
parents:
diff changeset
1192 // Like the 'm' (read) and 'M' (write) packets, this is a partner to the
anatofuz
parents:
diff changeset
1193 // 'X' (write binary data) packet, 'x'.
anatofuz
parents:
diff changeset
1194 //
anatofuz
parents:
diff changeset
1195 // It is called like
anatofuz
parents:
diff changeset
1196 //
anatofuz
parents:
diff changeset
1197 // xADDRESS,LENGTH
anatofuz
parents:
diff changeset
1198 //
anatofuz
parents:
diff changeset
1199 // where both ADDRESS and LENGTH are big-endian base 16 values.
anatofuz
parents:
diff changeset
1200 //
anatofuz
parents:
diff changeset
1201 // To test if this packet is available, send a addr/len of 0:
anatofuz
parents:
diff changeset
1202 //
anatofuz
parents:
diff changeset
1203 // x0,0
anatofuz
parents:
diff changeset
1204 //
anatofuz
parents:
diff changeset
1205 // and you will get an "OK" response.
anatofuz
parents:
diff changeset
1206 //
anatofuz
parents:
diff changeset
1207 // The reply will be the data requested in 8-bit binary data format.
anatofuz
parents:
diff changeset
1208 // The standard quoting is applied to the payload -- characters
anatofuz
parents:
diff changeset
1209 // } # $ *
anatofuz
parents:
diff changeset
1210 // will all be escaped with '}' (0x7d) character and then XOR'ed with 0x20.
anatofuz
parents:
diff changeset
1211 //
anatofuz
parents:
diff changeset
1212 // A typical use to read 512 bytes at 0x1000 would look like
anatofuz
parents:
diff changeset
1213 //
anatofuz
parents:
diff changeset
1214 // x0x1000,0x200
anatofuz
parents:
diff changeset
1215 //
anatofuz
parents:
diff changeset
1216 // The "0x" prefixes are optional - like most of the gdb-remote packets,
anatofuz
parents:
diff changeset
1217 // omitting them will work fine; these numbers are always base 16.
anatofuz
parents:
diff changeset
1218 //
anatofuz
parents:
diff changeset
1219 // The length of the payload is not provided. A reliable, 8-bit clean,
anatofuz
parents:
diff changeset
1220 // transport layer is assumed.
anatofuz
parents:
diff changeset
1221 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1222
anatofuz
parents:
diff changeset
1223 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1224 // Detach and stay stopped:
anatofuz
parents:
diff changeset
1225 //
anatofuz
parents:
diff changeset
1226 // We extended the "D" packet to specify that the monitor should keep the
anatofuz
parents:
diff changeset
1227 // target suspended on detach. The normal behavior is to resume execution
anatofuz
parents:
diff changeset
1228 // on detach. We will send:
anatofuz
parents:
diff changeset
1229 //
anatofuz
parents:
diff changeset
1230 // qSupportsDetachAndStayStopped:
anatofuz
parents:
diff changeset
1231 //
anatofuz
parents:
diff changeset
1232 // to query whether the monitor supports the extended detach, and if it does,
anatofuz
parents:
diff changeset
1233 // when we want the monitor to detach but not resume the target, we will
anatofuz
parents:
diff changeset
1234 // send:
anatofuz
parents:
diff changeset
1235 //
anatofuz
parents:
diff changeset
1236 // D1
anatofuz
parents:
diff changeset
1237 //
anatofuz
parents:
diff changeset
1238 // In any case, if we want the normal detach behavior we will just send:
anatofuz
parents:
diff changeset
1239 //
anatofuz
parents:
diff changeset
1240 // D
anatofuz
parents:
diff changeset
1241 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1242
anatofuz
parents:
diff changeset
1243 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1244 // QSaveRegisterState
anatofuz
parents:
diff changeset
1245 // QSaveRegisterState;thread:XXXX;
anatofuz
parents:
diff changeset
1246 //
anatofuz
parents:
diff changeset
1247 // BRIEF
anatofuz
parents:
diff changeset
1248 // The QSaveRegisterState packet tells the remote debugserver to save
anatofuz
parents:
diff changeset
1249 // all registers and return a non-zero unique integer ID that
anatofuz
parents:
diff changeset
1250 // represents these save registers. If thread suffixes are enabled the
anatofuz
parents:
diff changeset
1251 // second form of this packet is used, otherwise the first form is
anatofuz
parents:
diff changeset
1252 // used. This packet is called prior to executing an expression, so
anatofuz
parents:
diff changeset
1253 // the remote GDB server should do anything it needs to in order to
anatofuz
parents:
diff changeset
1254 // ensure the registers that are saved are correct. On macOS this
anatofuz
parents:
diff changeset
1255 // involves calling "thread_abort_safely(mach_port_t thread)" to
anatofuz
parents:
diff changeset
1256 // ensure we get the correct registers for a thread in case it is
anatofuz
parents:
diff changeset
1257 // currently having code run on its behalf in the kernel.
anatofuz
parents:
diff changeset
1258 //
anatofuz
parents:
diff changeset
1259 // RESPONSE
anatofuz
parents:
diff changeset
1260 // unsigned - The save_id result is a non-zero unsigned integer value
anatofuz
parents:
diff changeset
1261 // that can be passed back to the GDB server using a
anatofuz
parents:
diff changeset
1262 // QRestoreRegisterState packet to restore the registers
anatofuz
parents:
diff changeset
1263 // one time.
anatofuz
parents:
diff changeset
1264 // "EXX" - or an error code in the form of EXX where XX is a
anatofuz
parents:
diff changeset
1265 // hex error code.
anatofuz
parents:
diff changeset
1266 //
anatofuz
parents:
diff changeset
1267 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1268 // Low, this is mostly a convenience packet to avoid having to send all
anatofuz
parents:
diff changeset
1269 // registers via a g packet. It should only be implemented if support
anatofuz
parents:
diff changeset
1270 // for the QRestoreRegisterState is added.
anatofuz
parents:
diff changeset
1271 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1272
anatofuz
parents:
diff changeset
1273 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1274 // QRestoreRegisterState:<save_id>
anatofuz
parents:
diff changeset
1275 // QRestoreRegisterState:<save_id>;thread:XXXX;
anatofuz
parents:
diff changeset
1276 //
anatofuz
parents:
diff changeset
1277 // BRIEF
anatofuz
parents:
diff changeset
1278 // The QRestoreRegisterState packet tells the remote debugserver to
anatofuz
parents:
diff changeset
1279 // restore all registers using the "save_id" which is an unsigned
anatofuz
parents:
diff changeset
1280 // integer that was returned from a previous call to
anatofuz
parents:
diff changeset
1281 // QSaveRegisterState. The restoration process can only be done once
anatofuz
parents:
diff changeset
1282 // as the data backing the register state will be freed upon the
anatofuz
parents:
diff changeset
1283 // completion of the QRestoreRegisterState command.
anatofuz
parents:
diff changeset
1284 //
anatofuz
parents:
diff changeset
1285 // If thread suffixes are enabled the second form of this packet is
anatofuz
parents:
diff changeset
1286 // used, otherwise the first form is used.
anatofuz
parents:
diff changeset
1287 //
anatofuz
parents:
diff changeset
1288 // RESPONSE
anatofuz
parents:
diff changeset
1289 // "OK" - if all registers were successfully restored
anatofuz
parents:
diff changeset
1290 // "EXX" - for any errors
anatofuz
parents:
diff changeset
1291 //
anatofuz
parents:
diff changeset
1292 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1293 // Low, this is mostly a convenience packet to avoid having to send all
anatofuz
parents:
diff changeset
1294 // registers via a g packet. It should only be implemented if support
anatofuz
parents:
diff changeset
1295 // for the QSaveRegisterState is added.
anatofuz
parents:
diff changeset
1296 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1297
anatofuz
parents:
diff changeset
1298 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1299 // qFileLoadAddress:<file_path>
anatofuz
parents:
diff changeset
1300 //
anatofuz
parents:
diff changeset
1301 // BRIEF
anatofuz
parents:
diff changeset
1302 // Get the load address of a memory mapped file.
anatofuz
parents:
diff changeset
1303 // The load address is defined as the address of the first memory
anatofuz
parents:
diff changeset
1304 // region what contains data mapped from the specified file.
anatofuz
parents:
diff changeset
1305 //
anatofuz
parents:
diff changeset
1306 // RESPONSE
anatofuz
parents:
diff changeset
1307 // <unsigned-hex64> - Load address of the file in big endian encoding
anatofuz
parents:
diff changeset
1308 // "E01" - the requested file isn't loaded
anatofuz
parents:
diff changeset
1309 // "EXX" - for any other errors
anatofuz
parents:
diff changeset
1310 //
anatofuz
parents:
diff changeset
1311 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1312 // Low, required if dynamic linker don't fill in the load address of
anatofuz
parents:
diff changeset
1313 // some object file in the rendezvous data structure.
anatofuz
parents:
diff changeset
1314 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1315
anatofuz
parents:
diff changeset
1316 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1317 // qModuleInfo:<module_path>;<arch triple>
anatofuz
parents:
diff changeset
1318 //
anatofuz
parents:
diff changeset
1319 // BRIEF
anatofuz
parents:
diff changeset
1320 // Get information for a module by given module path and architecture.
anatofuz
parents:
diff changeset
1321 //
anatofuz
parents:
diff changeset
1322 // RESPONSE
anatofuz
parents:
diff changeset
1323 // "(uuid|md5):...;triple:...;file_offset:...;file_size...;"
anatofuz
parents:
diff changeset
1324 // "EXX" - for any errors
anatofuz
parents:
diff changeset
1325 //
anatofuz
parents:
diff changeset
1326 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1327 // Optional, required if dynamic loader cannot fetch module's information like
anatofuz
parents:
diff changeset
1328 // UUID directly from inferior's memory.
anatofuz
parents:
diff changeset
1329 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1330
anatofuz
parents:
diff changeset
1331 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1332 // jModulesInfo:[{"file":"...",triple:"..."}, ...]
anatofuz
parents:
diff changeset
1333 //
anatofuz
parents:
diff changeset
1334 // BRIEF
anatofuz
parents:
diff changeset
1335 // Get information for a list of modules by given module path and
anatofuz
parents:
diff changeset
1336 // architecture.
anatofuz
parents:
diff changeset
1337 //
anatofuz
parents:
diff changeset
1338 // RESPONSE
anatofuz
parents:
diff changeset
1339 // A JSON array of dictionaries containing the following keys: uuid,
anatofuz
parents:
diff changeset
1340 // triple, file_path, file_offset, file_size. The meaning of the fields
anatofuz
parents:
diff changeset
1341 // is the same as in the qModuleInfo packet. The server signals the
anatofuz
parents:
diff changeset
1342 // failure to retrieve the module info for a file by ommiting the
anatofuz
parents:
diff changeset
1343 // corresponding array entry from the response. The server may also
anatofuz
parents:
diff changeset
1344 // include entries the client did not ask for, if it has reason to
anatofuz
parents:
diff changeset
1345 // the modules will be interesting to the client.
anatofuz
parents:
diff changeset
1346 //
anatofuz
parents:
diff changeset
1347 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1348 // Optional. If not implemented, qModuleInfo packet will be used, which
anatofuz
parents:
diff changeset
1349 // may be slower if the target contains a large number of modules and
anatofuz
parents:
diff changeset
1350 // the communication link has a non-negligible latency.
anatofuz
parents:
diff changeset
1351 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1352
anatofuz
parents:
diff changeset
1353 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1354 // Stop reply packet extensions
anatofuz
parents:
diff changeset
1355 //
anatofuz
parents:
diff changeset
1356 // BRIEF
anatofuz
parents:
diff changeset
1357 // This section describes some of the additional information you can
anatofuz
parents:
diff changeset
1358 // specify in stop reply packets that help LLDB to know more detailed
anatofuz
parents:
diff changeset
1359 // information about your threads.
anatofuz
parents:
diff changeset
1360 //
anatofuz
parents:
diff changeset
1361 // DESCRIPTION
anatofuz
parents:
diff changeset
1362 // Standard GDB remote stop reply packets are reply packets sent in
anatofuz
parents:
diff changeset
1363 // response to a packet that made the program run. They come in the
anatofuz
parents:
diff changeset
1364 // following forms:
anatofuz
parents:
diff changeset
1365 //
anatofuz
parents:
diff changeset
1366 // "SAA"
anatofuz
parents:
diff changeset
1367 // "S" means signal and "AA" is a hex signal number that describes why
anatofuz
parents:
diff changeset
1368 // the thread or stopped. It doesn't specify which thread, so the "T"
anatofuz
parents:
diff changeset
1369 // packet is recommended to use instead of the "S" packet.
anatofuz
parents:
diff changeset
1370 //
anatofuz
parents:
diff changeset
1371 // "TAAkey1:value1;key2:value2;..."
anatofuz
parents:
diff changeset
1372 // "T" means a thread stopped due to a unix signal where "AA" is a hex
anatofuz
parents:
diff changeset
1373 // signal number that describes why the program stopped. This is
anatofuz
parents:
diff changeset
1374 // followed by a series of key/value pairs:
anatofuz
parents:
diff changeset
1375 // - If key is a hex number, it is a register number and value is
anatofuz
parents:
diff changeset
1376 // the hex value of the register in debuggee endian byte order.
anatofuz
parents:
diff changeset
1377 // - If key == "thread", then the value is the big endian hex
anatofuz
parents:
diff changeset
1378 // thread-id of the stopped thread.
anatofuz
parents:
diff changeset
1379 // - If key == "core", then value is a hex number of the core on
anatofuz
parents:
diff changeset
1380 // which the stop was detected.
anatofuz
parents:
diff changeset
1381 // - If key == "watch" or key == "rwatch" or key == "awatch", then
anatofuz
parents:
diff changeset
1382 // value is the data address in big endian hex
anatofuz
parents:
diff changeset
1383 // - If key == "library", then value is ignore and "qXfer:libraries:read"
anatofuz
parents:
diff changeset
1384 // packets should be used to detect any newly loaded shared libraries
anatofuz
parents:
diff changeset
1385 //
anatofuz
parents:
diff changeset
1386 // "WAA"
anatofuz
parents:
diff changeset
1387 // "W" means the process exited and "AA" is the exit status.
anatofuz
parents:
diff changeset
1388 //
anatofuz
parents:
diff changeset
1389 // "XAA"
anatofuz
parents:
diff changeset
1390 // "X" means the process exited and "AA" is signal that caused the program
anatofuz
parents:
diff changeset
1391 // to exit.
anatofuz
parents:
diff changeset
1392 //
anatofuz
parents:
diff changeset
1393 // "O<ascii-hex-string>"
anatofuz
parents:
diff changeset
1394 // "O" means STDOUT has data that was written to its console and is
anatofuz
parents:
diff changeset
1395 // being delivered to the debugger. This packet happens asynchronously
anatofuz
parents:
diff changeset
1396 // and the debugger is expected to continue to wait for another stop reply
anatofuz
parents:
diff changeset
1397 // packet.
anatofuz
parents:
diff changeset
1398 //
anatofuz
parents:
diff changeset
1399 // LLDB EXTENSIONS
anatofuz
parents:
diff changeset
1400 //
anatofuz
parents:
diff changeset
1401 // We have extended the "T" packet to be able to also understand the
anatofuz
parents:
diff changeset
1402 // following keys and values:
anatofuz
parents:
diff changeset
1403 //
anatofuz
parents:
diff changeset
1404 // KEY VALUE DESCRIPTION
anatofuz
parents:
diff changeset
1405 // =========== ======== ================================================
anatofuz
parents:
diff changeset
1406 // "metype" unsigned mach exception type (the value of the EXC_XXX enumerations)
anatofuz
parents:
diff changeset
1407 // as an unsigned integer. For targets with mach
anatofuz
parents:
diff changeset
1408 // kernels only.
anatofuz
parents:
diff changeset
1409 //
anatofuz
parents:
diff changeset
1410 // "mecount" unsigned mach exception data count as an unsigned integer
anatofuz
parents:
diff changeset
1411 // For targets with mach kernels only.
anatofuz
parents:
diff changeset
1412 //
anatofuz
parents:
diff changeset
1413 // "medata" unsigned There should be "mecount" of these and it is the data
anatofuz
parents:
diff changeset
1414 // that goes along with a mach exception (as an unsigned
anatofuz
parents:
diff changeset
1415 // integer). For targets with mach kernels only.
anatofuz
parents:
diff changeset
1416 //
anatofuz
parents:
diff changeset
1417 // "name" string The name of the thread as a plain string. The string
anatofuz
parents:
diff changeset
1418 // must not contain an special packet characters or
anatofuz
parents:
diff changeset
1419 // contain a ':' or a ';'. Use "hexname" if the thread
anatofuz
parents:
diff changeset
1420 // name has special characters.
anatofuz
parents:
diff changeset
1421 //
anatofuz
parents:
diff changeset
1422 // "hexname" ascii-hex An ASCII hex string that contains the name of the thread
anatofuz
parents:
diff changeset
1423 //
anatofuz
parents:
diff changeset
1424 // "qaddr" hex Big endian hex value that contains the libdispatch
anatofuz
parents:
diff changeset
1425 // queue address for the queue of the thread.
anatofuz
parents:
diff changeset
1426 //
anatofuz
parents:
diff changeset
1427 // "reason" enum The enumeration must be one of:
anatofuz
parents:
diff changeset
1428 // "trace" the program stopped after a single instruction
anatofuz
parents:
diff changeset
1429 // was executed on a core. Usually done when single
anatofuz
parents:
diff changeset
1430 // stepping past a breakpoint
anatofuz
parents:
diff changeset
1431 // "breakpoint" a breakpoint set using a 'z' packet was hit.
anatofuz
parents:
diff changeset
1432 // "trap" stopped due to user interruption
anatofuz
parents:
diff changeset
1433 // "signal" stopped due to an actual unix signal, not
anatofuz
parents:
diff changeset
1434 // just the debugger using a unix signal to keep
anatofuz
parents:
diff changeset
1435 // the GDB remote client happy.
anatofuz
parents:
diff changeset
1436 // "watchpoint". Should be used in conjunction with
anatofuz
parents:
diff changeset
1437 // the "watch"/"rwatch"/"awatch" key value pairs.
anatofuz
parents:
diff changeset
1438 // "exception" an exception stop reason. Use with
anatofuz
parents:
diff changeset
1439 // the "description" key/value pair to describe the
anatofuz
parents:
diff changeset
1440 // exceptional event the user should see as the stop
anatofuz
parents:
diff changeset
1441 // reason.
anatofuz
parents:
diff changeset
1442 // "description" ascii-hex An ASCII hex string that contains a more descriptive
anatofuz
parents:
diff changeset
1443 // reason that the thread stopped. This is only needed
anatofuz
parents:
diff changeset
1444 // if none of the key/value pairs are enough to
anatofuz
parents:
diff changeset
1445 // describe why something stopped.
anatofuz
parents:
diff changeset
1446 //
anatofuz
parents:
diff changeset
1447 // "threads" comma-sep-base16 A list of thread ids for all threads (including
anatofuz
parents:
diff changeset
1448 // the thread that we're reporting as stopped) that
anatofuz
parents:
diff changeset
1449 // are live in the process right now. lldb may
anatofuz
parents:
diff changeset
1450 // request that this be included in the T packet via
anatofuz
parents:
diff changeset
1451 // the QListThreadsInStopReply packet earlier in
anatofuz
parents:
diff changeset
1452 // the debug session.
anatofuz
parents:
diff changeset
1453 //
anatofuz
parents:
diff changeset
1454 // Example:
anatofuz
parents:
diff changeset
1455 // threads:63387,633b2,63424,63462,63486;
anatofuz
parents:
diff changeset
1456 //
anatofuz
parents:
diff changeset
1457 // "thread-pcs" comma-sep-base16 A list of pc values for all threads that currently
anatofuz
parents:
diff changeset
1458 // exist in the process, including the thread that
anatofuz
parents:
diff changeset
1459 // this T packet is reporting as stopped.
anatofuz
parents:
diff changeset
1460 // This key-value pair will only be emitted when the
anatofuz
parents:
diff changeset
1461 // "threads" key is already included in the T packet.
anatofuz
parents:
diff changeset
1462 // The pc values correspond to the threads reported
anatofuz
parents:
diff changeset
1463 // in the "threads" list. The number of pcs in the
anatofuz
parents:
diff changeset
1464 // "thread-pcs" list will be the same as the number of
anatofuz
parents:
diff changeset
1465 // threads in the "threads" list.
anatofuz
parents:
diff changeset
1466 // lldb may request that this be included in the T
anatofuz
parents:
diff changeset
1467 // packet via the QListThreadsInStopReply packet
anatofuz
parents:
diff changeset
1468 // earlier in the debug session.
anatofuz
parents:
diff changeset
1469 //
anatofuz
parents:
diff changeset
1470 // Example:
anatofuz
parents:
diff changeset
1471 // thread-pcs:dec14,2cf872b0,2cf8681c,2d02d68c,2cf716a8;
anatofuz
parents:
diff changeset
1472 //
anatofuz
parents:
diff changeset
1473 // BEST PRACTICES:
anatofuz
parents:
diff changeset
1474 // Since register values can be supplied with this packet, it is often useful
anatofuz
parents:
diff changeset
1475 // to return the PC, SP, FP, LR (if any), and FLAGS registers so that separate
anatofuz
parents:
diff changeset
1476 // packets don't need to be sent to read each of these registers from each
anatofuz
parents:
diff changeset
1477 // thread.
anatofuz
parents:
diff changeset
1478 //
anatofuz
parents:
diff changeset
1479 // If a thread is stopped for no reason (like just because another thread
anatofuz
parents:
diff changeset
1480 // stopped, or because when one core stops all cores should stop), use a
anatofuz
parents:
diff changeset
1481 // "T" packet with "00" as the signal number and fill in as many key values
anatofuz
parents:
diff changeset
1482 // and registers as possible.
anatofuz
parents:
diff changeset
1483 //
anatofuz
parents:
diff changeset
1484 // LLDB likes to know why a thread stopped since many thread control
anatofuz
parents:
diff changeset
1485 // operations like stepping over a source line, actually are implemented
anatofuz
parents:
diff changeset
1486 // by running the process multiple times. If a breakpoint is hit while
anatofuz
parents:
diff changeset
1487 // trying to step over a source line and LLDB finds out that a breakpoint
anatofuz
parents:
diff changeset
1488 // is hit in the "reason", we will know to stop trying to do the step
anatofuz
parents:
diff changeset
1489 // over because something happened that should stop us from trying to
anatofuz
parents:
diff changeset
1490 // do the step. If we are at a breakpoint and we disable the breakpoint
anatofuz
parents:
diff changeset
1491 // at the current PC and do an instruction single step, knowing that
anatofuz
parents:
diff changeset
1492 // we stopped due to a "trace" helps us know that we can continue
anatofuz
parents:
diff changeset
1493 // running versus stopping due to a "breakpoint" (if we have two
anatofuz
parents:
diff changeset
1494 // breakpoint instruction on consecutive instructions). So the more info
anatofuz
parents:
diff changeset
1495 // we can get about the reason a thread stops, the better job LLDB can
anatofuz
parents:
diff changeset
1496 // do when controlling your process. A typical GDB server behavior is
anatofuz
parents:
diff changeset
1497 // to send a SIGTRAP for breakpoints _and_ also when instruction single
anatofuz
parents:
diff changeset
1498 // stepping, in this case the debugger doesn't really know why we
anatofuz
parents:
diff changeset
1499 // stopped and it can make it hard for the debugger to control your
anatofuz
parents:
diff changeset
1500 // program correctly. What if a real SIGTRAP was delivered to a thread
anatofuz
parents:
diff changeset
1501 // while we were trying to single step? We wouldn't know the difference
anatofuz
parents:
diff changeset
1502 // with a standard GDB remote server and we could do the wrong thing.
anatofuz
parents:
diff changeset
1503 //
anatofuz
parents:
diff changeset
1504 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1505 // High. Having the extra information in your stop reply packets makes
anatofuz
parents:
diff changeset
1506 // your debug session more reliable and informative.
anatofuz
parents:
diff changeset
1507 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1508
anatofuz
parents:
diff changeset
1509
anatofuz
parents:
diff changeset
1510 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1511 // PLATFORM EXTENSION - for use as a GDB remote platform
anatofuz
parents:
diff changeset
1512 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1513 // "qfProcessInfo"
anatofuz
parents:
diff changeset
1514 // "qsProcessInfo"
anatofuz
parents:
diff changeset
1515 //
anatofuz
parents:
diff changeset
1516 // BRIEF
anatofuz
parents:
diff changeset
1517 // Get the first process info (qfProcessInfo) or subsequent process
anatofuz
parents:
diff changeset
1518 // info (qsProcessInfo) for one or more processes on the remote
anatofuz
parents:
diff changeset
1519 // platform. The first call gets the first match and subsequent calls
anatofuz
parents:
diff changeset
1520 // to qsProcessInfo gets the subsequent matches. Return an error EXX,
anatofuz
parents:
diff changeset
1521 // where XX are two hex digits, when no more matches are available.
anatofuz
parents:
diff changeset
1522 //
anatofuz
parents:
diff changeset
1523 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1524 // Required. The qfProcessInfo packet can be followed by a ':' and
anatofuz
parents:
diff changeset
1525 // some key value pairs. The key value pairs in the command are:
anatofuz
parents:
diff changeset
1526 //
anatofuz
parents:
diff changeset
1527 // KEY VALUE DESCRIPTION
anatofuz
parents:
diff changeset
1528 // =========== ======== ================================================
anatofuz
parents:
diff changeset
1529 // "name" ascii-hex An ASCII hex string that contains the name of
anatofuz
parents:
diff changeset
1530 // the process that will be matched.
anatofuz
parents:
diff changeset
1531 // "name_match" enum One of: "equals", "starts_with", "ends_with",
anatofuz
parents:
diff changeset
1532 // "contains" or "regex"
anatofuz
parents:
diff changeset
1533 // "pid" integer A string value containing the decimal process ID
anatofuz
parents:
diff changeset
1534 // "parent_pid" integer A string value containing the decimal parent
anatofuz
parents:
diff changeset
1535 // process ID
anatofuz
parents:
diff changeset
1536 // "uid" integer A string value containing the decimal user ID
anatofuz
parents:
diff changeset
1537 // "gid" integer A string value containing the decimal group ID
anatofuz
parents:
diff changeset
1538 // "euid" integer A string value containing the decimal effective user ID
anatofuz
parents:
diff changeset
1539 // "egid" integer A string value containing the decimal effective group ID
anatofuz
parents:
diff changeset
1540 // "all_users" bool A boolean value that specifies if processes should
anatofuz
parents:
diff changeset
1541 // be listed for all users, not just the user that the
anatofuz
parents:
diff changeset
1542 // platform is running as
anatofuz
parents:
diff changeset
1543 // "triple" string An ASCII triple string ("x86_64",
anatofuz
parents:
diff changeset
1544 // "x86_64-apple-macosx", "armv7-apple-ios")
anatofuz
parents:
diff changeset
1545 // "args" string A string value containing the process arguments
anatofuz
parents:
diff changeset
1546 // separated by the character '-', where each argument is
anatofuz
parents:
diff changeset
1547 // hex-encoded. It includes argv[0].
anatofuz
parents:
diff changeset
1548 //
anatofuz
parents:
diff changeset
1549 // The response consists of key/value pairs where the key is separated from the
anatofuz
parents:
diff changeset
1550 // values with colons and each pair is terminated with a semi colon. For a list
anatofuz
parents:
diff changeset
1551 // of the key/value pairs in the response see the "qProcessInfoPID" packet
anatofuz
parents:
diff changeset
1552 // documentation.
anatofuz
parents:
diff changeset
1553 //
anatofuz
parents:
diff changeset
1554 // Sample packet/response:
anatofuz
parents:
diff changeset
1555 // send packet: $qfProcessInfo#00
anatofuz
parents:
diff changeset
1556 // read packet: $pid:60001;ppid:59948;uid:7746;gid:11;euid:7746;egid:11;name:6c6c6462;triple:x86_64-apple-macosx;#00
anatofuz
parents:
diff changeset
1557 // send packet: $qsProcessInfo#00
anatofuz
parents:
diff changeset
1558 // read packet: $pid:59992;ppid:192;uid:7746;gid:11;euid:7746;egid:11;name:6d64776f726b6572;triple:x86_64-apple-macosx;#00
anatofuz
parents:
diff changeset
1559 // send packet: $qsProcessInfo#00
anatofuz
parents:
diff changeset
1560 // read packet: $E04#00
anatofuz
parents:
diff changeset
1561 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1562
anatofuz
parents:
diff changeset
1563
anatofuz
parents:
diff changeset
1564 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1565 // PLATFORM EXTENSION - for use as a GDB remote platform
anatofuz
parents:
diff changeset
1566 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1567 // "qLaunchGDBServer"
anatofuz
parents:
diff changeset
1568 //
anatofuz
parents:
diff changeset
1569 // BRIEF
anatofuz
parents:
diff changeset
1570 // Have the remote platform launch a GDB server.
anatofuz
parents:
diff changeset
1571 //
anatofuz
parents:
diff changeset
1572 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1573 // Required. The qLaunchGDBServer packet must be followed by a ':' and
anatofuz
parents:
diff changeset
1574 // some key value pairs. The key value pairs in the command are:
anatofuz
parents:
diff changeset
1575 //
anatofuz
parents:
diff changeset
1576 // KEY VALUE DESCRIPTION
anatofuz
parents:
diff changeset
1577 // =========== ======== ================================================
anatofuz
parents:
diff changeset
1578 // "port" integer A string value containing the decimal port ID or
anatofuz
parents:
diff changeset
1579 // zero if the port should be bound and returned
anatofuz
parents:
diff changeset
1580 //
anatofuz
parents:
diff changeset
1581 // "host" integer The host that connections should be limited to
anatofuz
parents:
diff changeset
1582 // when the GDB server is connected to.
anatofuz
parents:
diff changeset
1583 //
anatofuz
parents:
diff changeset
1584 // The response consists of key/value pairs where the key is separated from the
anatofuz
parents:
diff changeset
1585 // values with colons and each pair is terminated with a semi colon.
anatofuz
parents:
diff changeset
1586 //
anatofuz
parents:
diff changeset
1587 // Sample packet/response:
anatofuz
parents:
diff changeset
1588 // send packet: $qLaunchGDBServer:port:0;host:lldb.apple.com;#00
anatofuz
parents:
diff changeset
1589 // read packet: $pid:60025;port:50776;#00
anatofuz
parents:
diff changeset
1590 //
anatofuz
parents:
diff changeset
1591 // The "pid" key/value pair is only specified if the remote platform launched
anatofuz
parents:
diff changeset
1592 // a separate process for the GDB remote server and can be omitted if no
anatofuz
parents:
diff changeset
1593 // process was separately launched.
anatofuz
parents:
diff changeset
1594 //
anatofuz
parents:
diff changeset
1595 // The "port" key/value pair in the response lets clients know what port number
anatofuz
parents:
diff changeset
1596 // to attach to in case zero was specified as the "port" in the sent command.
anatofuz
parents:
diff changeset
1597 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1598
anatofuz
parents:
diff changeset
1599
anatofuz
parents:
diff changeset
1600 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1601 // PLATFORM EXTENSION - for use as a GDB remote platform
anatofuz
parents:
diff changeset
1602 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1603 // "qProcessInfoPID:PID"
anatofuz
parents:
diff changeset
1604 //
anatofuz
parents:
diff changeset
1605 // BRIEF
anatofuz
parents:
diff changeset
1606 // Have the remote platform get detailed information on a process by
anatofuz
parents:
diff changeset
1607 // ID. PID is specified as a decimal integer.
anatofuz
parents:
diff changeset
1608 //
anatofuz
parents:
diff changeset
1609 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1610 // Optional.
anatofuz
parents:
diff changeset
1611 //
anatofuz
parents:
diff changeset
1612 // The response consists of key/value pairs where the key is separated from the
anatofuz
parents:
diff changeset
1613 // values with colons and each pair is terminated with a semi colon.
anatofuz
parents:
diff changeset
1614 //
anatofuz
parents:
diff changeset
1615 // The key value pairs in the response are:
anatofuz
parents:
diff changeset
1616 //
anatofuz
parents:
diff changeset
1617 // KEY VALUE DESCRIPTION
anatofuz
parents:
diff changeset
1618 // =========== ======== ================================================
anatofuz
parents:
diff changeset
1619 // "pid" integer Process ID as a decimal integer string
anatofuz
parents:
diff changeset
1620 // "ppid" integer Parent process ID as a decimal integer string
anatofuz
parents:
diff changeset
1621 // "uid" integer A string value containing the decimal user ID
anatofuz
parents:
diff changeset
1622 // "gid" integer A string value containing the decimal group ID
anatofuz
parents:
diff changeset
1623 // "euid" integer A string value containing the decimal effective user ID
anatofuz
parents:
diff changeset
1624 // "egid" integer A string value containing the decimal effective group ID
anatofuz
parents:
diff changeset
1625 // "name" ascii-hex An ASCII hex string that contains the name of the process
anatofuz
parents:
diff changeset
1626 // "triple" string A target triple ("x86_64-apple-macosx", "armv7-apple-ios")
anatofuz
parents:
diff changeset
1627 //
anatofuz
parents:
diff changeset
1628 // Sample packet/response:
anatofuz
parents:
diff changeset
1629 // send packet: $qProcessInfoPID:60050#00
anatofuz
parents:
diff changeset
1630 // read packet: $pid:60050;ppid:59948;uid:7746;gid:11;euid:7746;egid:11;name:6c6c6462;triple:x86_64-apple-macosx;#00
anatofuz
parents:
diff changeset
1631 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1632
anatofuz
parents:
diff changeset
1633 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1634 // "vAttachName"
anatofuz
parents:
diff changeset
1635 //
anatofuz
parents:
diff changeset
1636 // BRIEF
anatofuz
parents:
diff changeset
1637 // Same as vAttach, except instead of a "pid" you send a process name.
anatofuz
parents:
diff changeset
1638 //
anatofuz
parents:
diff changeset
1639 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1640 // Low. Only needed for "process attach -n". If the packet isn't supported
anatofuz
parents:
diff changeset
1641 // then "process attach -n" will fail gracefully. So you need only to support
anatofuz
parents:
diff changeset
1642 // it if attaching to a process by name makes sense for your environment.
anatofuz
parents:
diff changeset
1643 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1644
anatofuz
parents:
diff changeset
1645 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1646 // "vAttachWait"
anatofuz
parents:
diff changeset
1647 //
anatofuz
parents:
diff changeset
1648 // BRIEF
anatofuz
parents:
diff changeset
1649 // Same as vAttachName, except that the stub should wait for the next instance
anatofuz
parents:
diff changeset
1650 // of a process by that name to be launched and attach to that.
anatofuz
parents:
diff changeset
1651 //
anatofuz
parents:
diff changeset
1652 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1653 // Low. Only needed to support "process attach -w -n" which will fail
anatofuz
parents:
diff changeset
1654 // gracefully if the packet is not supported.
anatofuz
parents:
diff changeset
1655 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1656
anatofuz
parents:
diff changeset
1657 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1658 // "qAttachOrWaitSupported"
anatofuz
parents:
diff changeset
1659 //
anatofuz
parents:
diff changeset
1660 // BRIEF
anatofuz
parents:
diff changeset
1661 // This is a binary "is it supported" query. Return OK if you support
anatofuz
parents:
diff changeset
1662 // vAttachOrWait
anatofuz
parents:
diff changeset
1663 //
anatofuz
parents:
diff changeset
1664 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1665 // Low. This is required if you support vAttachOrWait, otherwise no support
anatofuz
parents:
diff changeset
1666 // is needed since the standard "I don't recognize this packet" response
anatofuz
parents:
diff changeset
1667 // will do the right thing.
anatofuz
parents:
diff changeset
1668 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1669
anatofuz
parents:
diff changeset
1670 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1671 // "vAttachOrWait"
anatofuz
parents:
diff changeset
1672 //
anatofuz
parents:
diff changeset
1673 // BRIEF
anatofuz
parents:
diff changeset
1674 // Same as vAttachWait, except that the stub will attach to a process
anatofuz
parents:
diff changeset
1675 // by name if it exists, and if it does not, it will wait for a process
anatofuz
parents:
diff changeset
1676 // of that name to appear and attach to it.
anatofuz
parents:
diff changeset
1677 //
anatofuz
parents:
diff changeset
1678 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1679 // Low. Only needed to implement "process attach -w -i false -n". If
anatofuz
parents:
diff changeset
1680 // you don't implement it but do implement -n AND lldb can somehow get
anatofuz
parents:
diff changeset
1681 // a process list from your device, it will fall back on scanning the
anatofuz
parents:
diff changeset
1682 // process list, and sending vAttach or vAttachWait depending on
anatofuz
parents:
diff changeset
1683 // whether the requested process exists already. This is racy,
anatofuz
parents:
diff changeset
1684 // however, so if you want to support this behavior it is better to
anatofuz
parents:
diff changeset
1685 // support this packet.
anatofuz
parents:
diff changeset
1686 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1687
anatofuz
parents:
diff changeset
1688 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1689 // "jThreadExtendedInfo"
anatofuz
parents:
diff changeset
1690 //
anatofuz
parents:
diff changeset
1691 // BRIEF
anatofuz
parents:
diff changeset
1692 // This packet, which takes its arguments as JSON and sends its reply as
anatofuz
parents:
diff changeset
1693 // JSON, allows the gdb remote stub to provide additional information
anatofuz
parents:
diff changeset
1694 // about a given thread.
anatofuz
parents:
diff changeset
1695 //
anatofuz
parents:
diff changeset
1696 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1697 // Low. This packet is only needed if the gdb remote stub wants to
anatofuz
parents:
diff changeset
1698 // provide interesting additional information about a thread for the
anatofuz
parents:
diff changeset
1699 // user.
anatofuz
parents:
diff changeset
1700 //
anatofuz
parents:
diff changeset
1701 // This packet takes its arguments in JSON form ( http://www.json.org ).
anatofuz
parents:
diff changeset
1702 // At a minimum, a thread must be specified, for example:
anatofuz
parents:
diff changeset
1703 //
anatofuz
parents:
diff changeset
1704 // jThreadExtendedInfo:{"thread":612910}
anatofuz
parents:
diff changeset
1705 //
anatofuz
parents:
diff changeset
1706 // Because this is a JSON string, the thread number is provided in base10.
anatofuz
parents:
diff changeset
1707 // Additional key-value pairs may be provided by lldb to the gdb remote
anatofuz
parents:
diff changeset
1708 // stub. For instance, on some versions of macOS, lldb can read offset
anatofuz
parents:
diff changeset
1709 // information out of the system libraries. Using those offsets, debugserver
anatofuz
parents:
diff changeset
1710 // is able to find the Thread Specific Address (TSD) for a thread and include
anatofuz
parents:
diff changeset
1711 // that in the return information. So lldb will send these additional fields
anatofuz
parents:
diff changeset
1712 // like so:
anatofuz
parents:
diff changeset
1713 //
anatofuz
parents:
diff changeset
1714 // jThreadExtendedInfo:{"plo_pthread_tsd_base_address_offset":0,"plo_pthread_tsd_base_offset":224,"plo_pthread_tsd_entry_size":8,"thread":612910}
anatofuz
parents:
diff changeset
1715 //
anatofuz
parents:
diff changeset
1716 // There are no requirements for what is included in the response. A simple
anatofuz
parents:
diff changeset
1717 // reply on a OS X Yosemite / iOS 8 may include the pthread_t value, the
anatofuz
parents:
diff changeset
1718 // Thread Specific Data (TSD) address, the dispatch_queue_t value if the thread
anatofuz
parents:
diff changeset
1719 // is associated with a GCD queue, and the requested Quality of Service (QoS)
anatofuz
parents:
diff changeset
1720 // information about that thread. For instance, a reply may look like:
anatofuz
parents:
diff changeset
1721 //
anatofuz
parents:
diff changeset
1722 // {"tsd_address":4371349728,"requested_qos":{"enum_value":33,"constant_name":"QOS_CLASS_USER_INTERACTIVE","printable_name":"User Interactive"},"pthread_t":4371349504,"dispatch_queue_t":140735087127872}
anatofuz
parents:
diff changeset
1723 //
anatofuz
parents:
diff changeset
1724 // tsd_address, pthread_t, and dispatch_queue_t are all simple key-value pairs.
anatofuz
parents:
diff changeset
1725 // The JSON standard requires that numbers be expressed in base 10 - so all of
anatofuz
parents:
diff changeset
1726 // these are. requested_qos is a dictionary with three key-value pairs in it -
anatofuz
parents:
diff changeset
1727 // so the UI layer may choose the form most appropriate for displaying to the user.
anatofuz
parents:
diff changeset
1728 //
anatofuz
parents:
diff changeset
1729 // Sending JSON over gdb-remote protocol introduces some problems. We may be
anatofuz
parents:
diff changeset
1730 // sending strings with arbitrary contents in them, including the '#', '$', and '*'
anatofuz
parents:
diff changeset
1731 // characters that have special meaning in gdb-remote protocol and cannot occur
anatofuz
parents:
diff changeset
1732 // in the middle of the string. The standard solution for this would be to require
anatofuz
parents:
diff changeset
1733 // ascii-hex encoding of all strings, or ascii-hex encode the entire JSON payload.
anatofuz
parents:
diff changeset
1734 //
anatofuz
parents:
diff changeset
1735 // Instead, the binary escaping convention is used for JSON data. This convention
anatofuz
parents:
diff changeset
1736 // (e.g. used for the X packet) says that if '#', '$', '*', or '}' are to occur in
anatofuz
parents:
diff changeset
1737 // the payload, the character '}' (0x7d) is emitted, then the metacharacter is emitted
anatofuz
parents:
diff changeset
1738 // xor'ed by 0x20. The '}' character occurs in every JSON payload at least once, and
anatofuz
parents:
diff changeset
1739 // '}' ^ 0x20 happens to be ']' so the raw packet characters for a request will look
anatofuz
parents:
diff changeset
1740 // like
anatofuz
parents:
diff changeset
1741 //
anatofuz
parents:
diff changeset
1742 // jThreadExtendedInfo:{"thread":612910}]
anatofuz
parents:
diff changeset
1743 //
anatofuz
parents:
diff changeset
1744 // on the wire.
anatofuz
parents:
diff changeset
1745 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1746
anatofuz
parents:
diff changeset
1747 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1748 // "QEnableCompression"
anatofuz
parents:
diff changeset
1749 //
anatofuz
parents:
diff changeset
1750 // BRIEF
anatofuz
parents:
diff changeset
1751 // This packet enables compression of the packets that the debug stub sends to lldb.
anatofuz
parents:
diff changeset
1752 // If the debug stub can support compression, it indictes this in the reply of the
anatofuz
parents:
diff changeset
1753 // "qSupported" packet. e.g.
anatofuz
parents:
diff changeset
1754 // LLDB SENDS: qSupported:xmlRegisters=i386,arm,mips
anatofuz
parents:
diff changeset
1755 // STUB REPLIES: qXfer:features:read+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;DefaultCompressionMinSize=384
anatofuz
parents:
diff changeset
1756 //
anatofuz
parents:
diff changeset
1757 // If lldb knows how to use any of these compression algorithms, it can ask that this
anatofuz
parents:
diff changeset
1758 // compression mode be enabled. It may optionally change the minimum packet size
anatofuz
parents:
diff changeset
1759 // where compression is used. Typically small packets do not benefit from compression,
anatofuz
parents:
diff changeset
1760 // as well as compression headers -- compression is most beneficial with larger packets.
anatofuz
parents:
diff changeset
1761 //
anatofuz
parents:
diff changeset
1762 // QEnableCompression:type:zlib-deflate;
anatofuz
parents:
diff changeset
1763 // or
anatofuz
parents:
diff changeset
1764 // QEnableCompression:type:zlib-deflate;minsize:512;
anatofuz
parents:
diff changeset
1765 //
anatofuz
parents:
diff changeset
1766 // The debug stub should reply with an uncompressed "OK" packet to indicate that the
anatofuz
parents:
diff changeset
1767 // request was accepted. All further packets the stub sends will use this compression.
anatofuz
parents:
diff changeset
1768 //
anatofuz
parents:
diff changeset
1769 // Packets are compressed as the last step before they are sent from the stub, and
anatofuz
parents:
diff changeset
1770 // decompressed as the first step after they are received. The packet format in compressed
anatofuz
parents:
diff changeset
1771 // mode becomes one of two:
anatofuz
parents:
diff changeset
1772 //
anatofuz
parents:
diff changeset
1773 // $N<uncompressed payload>#00
anatofuz
parents:
diff changeset
1774 //
anatofuz
parents:
diff changeset
1775 // $C<size of uncompressed payload in base10>:<compressed payload>#00
anatofuz
parents:
diff changeset
1776 //
anatofuz
parents:
diff changeset
1777 // Where "#00" is the actual checksum value if noack mode is not enabled. The checksum
anatofuz
parents:
diff changeset
1778 // value is for the "N<uncompressed payload>" or
anatofuz
parents:
diff changeset
1779 // "C<size of uncompressed payload in base10>:<compressed payload>" bytes in the packet.
anatofuz
parents:
diff changeset
1780 //
anatofuz
parents:
diff changeset
1781 // The size of the uncompressed payload in base10 is provided because it will simplify
anatofuz
parents:
diff changeset
1782 // decompression if the final buffer size needed is known ahead of time.
anatofuz
parents:
diff changeset
1783 //
anatofuz
parents:
diff changeset
1784 // Compression on low-latency connections is unlikely to be an improvement. Particularly
anatofuz
parents:
diff changeset
1785 // when the debug stub and lldb are running on the same host. It should only be used
anatofuz
parents:
diff changeset
1786 // for slow connections, and likely only for larger packets.
anatofuz
parents:
diff changeset
1787 //
anatofuz
parents:
diff changeset
1788 // Example compression algorithsm that may be used include
anatofuz
parents:
diff changeset
1789 //
anatofuz
parents:
diff changeset
1790 // zlib-deflate
anatofuz
parents:
diff changeset
1791 // The raw DEFLATE format as described in IETF RFC 1951. With the ZLIB library, you
anatofuz
parents:
diff changeset
1792 // can compress to this format with an initialization like
anatofuz
parents:
diff changeset
1793 // deflateInit2 (&stream, 5, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY)
anatofuz
parents:
diff changeset
1794 // and you can decompress with an initialization like
anatofuz
parents:
diff changeset
1795 // inflateInit2 (&stream, -15)
anatofuz
parents:
diff changeset
1796 //
anatofuz
parents:
diff changeset
1797 // lz4
anatofuz
parents:
diff changeset
1798 // https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)
anatofuz
parents:
diff changeset
1799 // https://github.com/Cyan4973/lz4
anatofuz
parents:
diff changeset
1800 // The libcompression APIs on darwin systems call this COMPRESSION_LZ4_RAW.
anatofuz
parents:
diff changeset
1801 //
anatofuz
parents:
diff changeset
1802 // lzfse
anatofuz
parents:
diff changeset
1803 // An Apple proprietary compression algorithm implemented in libcompression.
anatofuz
parents:
diff changeset
1804 //
anatofuz
parents:
diff changeset
1805 // lzma
anatofuz
parents:
diff changeset
1806 // libcompression implements "LZMA level 6", the default compression for the
anatofuz
parents:
diff changeset
1807 // open source LZMA implementation.
anatofuz
parents:
diff changeset
1808 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1809
anatofuz
parents:
diff changeset
1810 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1811 // "jGetLoadedDynamicLibrariesInfos"
anatofuz
parents:
diff changeset
1812 //
anatofuz
parents:
diff changeset
1813 // BRIEF
anatofuz
parents:
diff changeset
1814 // This packet asks the remote debug stub to send the details about libraries
anatofuz
parents:
diff changeset
1815 // being added/removed from the process as a performance optimization.
anatofuz
parents:
diff changeset
1816 //
anatofuz
parents:
diff changeset
1817 // There are three ways this packet can be used. All three return a dictionary of
anatofuz
parents:
diff changeset
1818 // binary images formatted the same way.
anatofuz
parents:
diff changeset
1819 //
anatofuz
parents:
diff changeset
1820 // On OS X 10.11, iOS 9, tvOS 9, watchOS 2 and earlier, the packet is used like
anatofuz
parents:
diff changeset
1821 // jGetLoadedDynamicLibrariesInfos:{"image_count":1,"image_list_address":140734800075128}
anatofuz
parents:
diff changeset
1822 // where the image_list_address is an array of {void* load_addr, void* mod_date, void* pathname}
anatofuz
parents:
diff changeset
1823 // in the inferior process memory (and image_count is the number of elements in this array).
anatofuz
parents:
diff changeset
1824 // lldb is using information from the dyld_all_image_infos structure to make these requests to
anatofuz
parents:
diff changeset
1825 // debugserver. This use is not supported on macOS 10.12, iOS 10, tvOS 10, watchOS 3 or newer.
anatofuz
parents:
diff changeset
1826 //
anatofuz
parents:
diff changeset
1827 // On macOS 10.12, iOS 10, tvOS 10, watchOS 3 and newer, there are two calls. One requests information
anatofuz
parents:
diff changeset
1828 // on all shared libraries:
anatofuz
parents:
diff changeset
1829 // jGetLoadedDynamicLibrariesInfos:{"fetch_all_solibs":true}
anatofuz
parents:
diff changeset
1830 // And the second requests information about a list of shared libraries, given their load addresses:
anatofuz
parents:
diff changeset
1831 // jGetLoadedDynamicLibrariesInfos:{"solib_addresses":[8382824135,3258302053,830202858503]}
anatofuz
parents:
diff changeset
1832 //
anatofuz
parents:
diff changeset
1833 // The second call is both a performance optimization (instead of having lldb read the mach-o header/load commands
anatofuz
parents:
diff changeset
1834 // out of memory with generic read packets) but also adds additional information in the form of the
anatofuz
parents:
diff changeset
1835 // filename of the shared libraries (which is not available in the mach-o header/load commands.)
anatofuz
parents:
diff changeset
1836 //
anatofuz
parents:
diff changeset
1837 // An example using the OS X 10.11 style call:
anatofuz
parents:
diff changeset
1838 //
anatofuz
parents:
diff changeset
1839 // LLDB SENDS: jGetLoadedDynamicLibrariesInfos:{"image_count":1,"image_list_address":140734800075128}
anatofuz
parents:
diff changeset
1840 // STUB REPLIES: ${"images":[{"load_address":4294967296,"mod_date":0,"pathname":"/tmp/a.out","uuid":"02CF262C-ED6F-3965-9E14-63538B465CFF","mach_header":{"magic":4277009103,"cputype":16777223,"cpusubtype":18446744071562067971,"filetype":2},"segments":{"name":"__PAGEZERO","vmaddr":0,"vmsize":4294967296,"fileoff":0,"filesize":0,"maxprot":0},{"name":"__TEXT","vmaddr":4294967296,"vmsize":4096,"fileoff":0,"filesize":4096,"maxprot":7},{"name":"__LINKEDIT","vmaddr":4294971392,"vmsize":4096,"fileoff":4096,"filesize":152,"maxprot":7}}]}#00
anatofuz
parents:
diff changeset
1841 //
anatofuz
parents:
diff changeset
1842 // Or pretty-printed,
anatofuz
parents:
diff changeset
1843 //
anatofuz
parents:
diff changeset
1844 // STUB REPLIES: ${"images":
anatofuz
parents:
diff changeset
1845 // [
anatofuz
parents:
diff changeset
1846 // {"load_address":4294967296,
anatofuz
parents:
diff changeset
1847 // "mod_date":0,
anatofuz
parents:
diff changeset
1848 // "pathname":"/tmp/a.out",
anatofuz
parents:
diff changeset
1849 // "uuid":"02CF262C-ED6F-3965-9E14-63538B465CFF",
anatofuz
parents:
diff changeset
1850 // "mach_header":
anatofuz
parents:
diff changeset
1851 // {"magic":4277009103,
anatofuz
parents:
diff changeset
1852 // "cputype":16777223,
anatofuz
parents:
diff changeset
1853 // "cpusubtype":18446744071562067971,
anatofuz
parents:
diff changeset
1854 // "filetype":2
anatofuz
parents:
diff changeset
1855 // },
anatofuz
parents:
diff changeset
1856 // "segments":
anatofuz
parents:
diff changeset
1857 // [
anatofuz
parents:
diff changeset
1858 // {"name":"__PAGEZERO",
anatofuz
parents:
diff changeset
1859 // "vmaddr":0,
anatofuz
parents:
diff changeset
1860 // "vmsize":4294967296,
anatofuz
parents:
diff changeset
1861 // "fileoff":0,
anatofuz
parents:
diff changeset
1862 // "filesize":0,
anatofuz
parents:
diff changeset
1863 // "maxprot":0
anatofuz
parents:
diff changeset
1864 // },
anatofuz
parents:
diff changeset
1865 // {"name":"__TEXT",
anatofuz
parents:
diff changeset
1866 // "vmaddr":4294967296,
anatofuz
parents:
diff changeset
1867 // "vmsize":4096,
anatofuz
parents:
diff changeset
1868 // "fileoff":0,
anatofuz
parents:
diff changeset
1869 // "filesize":4096,
anatofuz
parents:
diff changeset
1870 // "maxprot":7
anatofuz
parents:
diff changeset
1871 // },
anatofuz
parents:
diff changeset
1872 // {"name":"__LINKEDIT",
anatofuz
parents:
diff changeset
1873 // "vmaddr":4294971392,
anatofuz
parents:
diff changeset
1874 // "vmsize":4096,
anatofuz
parents:
diff changeset
1875 // "fileoff":4096,
anatofuz
parents:
diff changeset
1876 // "filesize":152,
anatofuz
parents:
diff changeset
1877 // "maxprot":7
anatofuz
parents:
diff changeset
1878 // }
anatofuz
parents:
diff changeset
1879 // ]
anatofuz
parents:
diff changeset
1880 // }
anatofuz
parents:
diff changeset
1881 // ]
anatofuz
parents:
diff changeset
1882 // }
anatofuz
parents:
diff changeset
1883 //
anatofuz
parents:
diff changeset
1884 //
anatofuz
parents:
diff changeset
1885 // This is similar to the qXfer:libraries:read packet, and it could
anatofuz
parents:
diff changeset
1886 // be argued that it should be merged into that packet. A separate
anatofuz
parents:
diff changeset
1887 // packet was created primarily because lldb needs to specify the
anatofuz
parents:
diff changeset
1888 // number of images to be read and the address from which the initial
anatofuz
parents:
diff changeset
1889 // information is read. Also the XML DTD would need to be extended
anatofuz
parents:
diff changeset
1890 // quite a bit to provide all the information that the DynamicLoaderMacOSX
anatofuz
parents:
diff changeset
1891 // would need to work correctly on this platform.
anatofuz
parents:
diff changeset
1892 //
anatofuz
parents:
diff changeset
1893 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1894 // On OS X 10.11, iOS 9, tvOS 9, watchOS 2 and older: Low. If this packet is absent,
anatofuz
parents:
diff changeset
1895 // lldb will read the Mach-O headers/load commands out of memory.
anatofuz
parents:
diff changeset
1896 // On macOS 10.12, iOS 10, tvOS 10, watchOS 3 and newer: High. If this packet is absent,
anatofuz
parents:
diff changeset
1897 // lldb will not know anything about shared libraries in the inferior, or where the main
anatofuz
parents:
diff changeset
1898 // executable loaded.
anatofuz
parents:
diff changeset
1899 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1900
anatofuz
parents:
diff changeset
1901 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1902 // "jThreadsInfo"
anatofuz
parents:
diff changeset
1903 //
anatofuz
parents:
diff changeset
1904 // BRIEF
anatofuz
parents:
diff changeset
1905 // Ask for the server for thread stop information of all threads.
anatofuz
parents:
diff changeset
1906 //
anatofuz
parents:
diff changeset
1907 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1908 // Low. This is a performance optimization, which speeds up debugging by avoiding
anatofuz
parents:
diff changeset
1909 // multiple round-trips for retrieving thread information. The information from this
anatofuz
parents:
diff changeset
1910 // packet can be retrieved using a combination of qThreadStopInfo and m packets.
anatofuz
parents:
diff changeset
1911 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1912
anatofuz
parents:
diff changeset
1913 The data in this packet is very similar to the stop reply packets, but is packaged in
anatofuz
parents:
diff changeset
1914 JSON and uses JSON arrays where applicable. The JSON output looks like:
anatofuz
parents:
diff changeset
1915 [
anatofuz
parents:
diff changeset
1916 { "tid":1580681,
anatofuz
parents:
diff changeset
1917 "metype":6,
anatofuz
parents:
diff changeset
1918 "medata":[2,0],
anatofuz
parents:
diff changeset
1919 "reason":"exception",
anatofuz
parents:
diff changeset
1920 "qaddr":140735118423168,
anatofuz
parents:
diff changeset
1921 "registers": {
anatofuz
parents:
diff changeset
1922 "0":"8000000000000000",
anatofuz
parents:
diff changeset
1923 "1":"0000000000000000",
anatofuz
parents:
diff changeset
1924 "2":"20fabf5fff7f0000",
anatofuz
parents:
diff changeset
1925 "3":"e8f8bf5fff7f0000",
anatofuz
parents:
diff changeset
1926 "4":"0100000000000000",
anatofuz
parents:
diff changeset
1927 "5":"d8f8bf5fff7f0000",
anatofuz
parents:
diff changeset
1928 "6":"b0f8bf5fff7f0000",
anatofuz
parents:
diff changeset
1929 "7":"20f4bf5fff7f0000",
anatofuz
parents:
diff changeset
1930 "8":"8000000000000000",
anatofuz
parents:
diff changeset
1931 "9":"61a8db78a61500db",
anatofuz
parents:
diff changeset
1932 "10":"3200000000000000",
anatofuz
parents:
diff changeset
1933 "11":"4602000000000000",
anatofuz
parents:
diff changeset
1934 "12":"0000000000000000",
anatofuz
parents:
diff changeset
1935 "13":"0000000000000000",
anatofuz
parents:
diff changeset
1936 "14":"0000000000000000",
anatofuz
parents:
diff changeset
1937 "15":"0000000000000000",
anatofuz
parents:
diff changeset
1938 "16":"960b000001000000",
anatofuz
parents:
diff changeset
1939 "17":"0202000000000000",
anatofuz
parents:
diff changeset
1940 "18":"2b00000000000000",
anatofuz
parents:
diff changeset
1941 "19":"0000000000000000",
anatofuz
parents:
diff changeset
1942 "20":"0000000000000000"
anatofuz
parents:
diff changeset
1943 },
anatofuz
parents:
diff changeset
1944 "memory":[
anatofuz
parents:
diff changeset
1945 {"address":140734799804592,"bytes":"c8f8bf5fff7f0000c9a59e8cff7f0000"},
anatofuz
parents:
diff changeset
1946 {"address":140734799804616,"bytes":"00000000000000000100000000000000"}
anatofuz
parents:
diff changeset
1947 ]
anatofuz
parents:
diff changeset
1948 }
anatofuz
parents:
diff changeset
1949 ]
anatofuz
parents:
diff changeset
1950
anatofuz
parents:
diff changeset
1951 It contains an array of dictionaries with all of the key value pairs that are
anatofuz
parents:
diff changeset
1952 normally in the stop reply packet, including the expedited registers. The registers are
anatofuz
parents:
diff changeset
1953 passed as hex-encoded JSON string in debuggee-endian byte order. Note that the register
anatofuz
parents:
diff changeset
1954 numbers are decimal numbers, unlike the stop-reply packet, where they are written in
anatofuz
parents:
diff changeset
1955 hex. The packet also contains expedited memory in the "memory" key. This allows the
anatofuz
parents:
diff changeset
1956 server to expedite memory that the client is likely to use (e.g., areas around the
anatofuz
parents:
diff changeset
1957 stack pointer, which are needed for computing backtraces) and it reduces the packet
anatofuz
parents:
diff changeset
1958 count.
anatofuz
parents:
diff changeset
1959
anatofuz
parents:
diff changeset
1960 On macOS with debugserver, we expedite the frame pointer backchain for a thread
anatofuz
parents:
diff changeset
1961 (up to 256 entries) by reading 2 pointers worth of bytes at the frame pointer (for
anatofuz
parents:
diff changeset
1962 the previous FP and PC), and follow the backchain. Most backtraces on macOS and
anatofuz
parents:
diff changeset
1963 iOS now don't require us to read any memory!
anatofuz
parents:
diff changeset
1964
anatofuz
parents:
diff changeset
1965 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1966 // "jGetSharedCacheInfo"
anatofuz
parents:
diff changeset
1967 //
anatofuz
parents:
diff changeset
1968 // BRIEF
anatofuz
parents:
diff changeset
1969 // This packet asks the remote debug stub to send the details about the inferior's
anatofuz
parents:
diff changeset
1970 // shared cache. The shared cache is a collection of common libraries/frameworks that
anatofuz
parents:
diff changeset
1971 // are mapped into every process at the same address on Darwin systems, and can be
anatofuz
parents:
diff changeset
1972 // identified by a load address and UUID.
anatofuz
parents:
diff changeset
1973 //
anatofuz
parents:
diff changeset
1974 //
anatofuz
parents:
diff changeset
1975 // LLDB SENDS: jGetSharedCacheInfo:{}
anatofuz
parents:
diff changeset
1976 // STUB REPLIES: ${"shared_cache_base_address":140735683125248,"shared_cache_uuid":"DDB8D70C-C9A2-3561-B2C8-BE48A4F33F96","no_shared_cache":false,"shared_cache_private_cache":false]}#00
anatofuz
parents:
diff changeset
1977 //
anatofuz
parents:
diff changeset
1978 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1979 // Low. When both lldb and the inferior process are running on the same computer, and lldb
anatofuz
parents:
diff changeset
1980 // and the inferior process have the same shared cache, lldb may (as an optimization) read
anatofuz
parents:
diff changeset
1981 // the shared cache out of its own memory instead of using gdb-remote read packets to read
anatofuz
parents:
diff changeset
1982 // them from the inferior process.
anatofuz
parents:
diff changeset
1983 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1984
anatofuz
parents:
diff changeset
1985 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1986 // "qQueryGDBServer"
anatofuz
parents:
diff changeset
1987 //
anatofuz
parents:
diff changeset
1988 // BRIEF
anatofuz
parents:
diff changeset
1989 // Ask the platform for the list of gdbservers we have to connect
anatofuz
parents:
diff changeset
1990 //
anatofuz
parents:
diff changeset
1991 // PRIORITY TO IMPLEMENT
anatofuz
parents:
diff changeset
1992 // Low. The packet is required to support connecting to gdbserver started
anatofuz
parents:
diff changeset
1993 // by the platform instance automatically.
anatofuz
parents:
diff changeset
1994 //----------------------------------------------------------------------
anatofuz
parents:
diff changeset
1995
anatofuz
parents:
diff changeset
1996 If the remote platform automatically started one or more gdbserver instance (without
anatofuz
parents:
diff changeset
1997 lldb asking it) then it have to return the list of port number or socket name for
anatofuz
parents:
diff changeset
1998 each of them what can be used by lldb to connect to those instances.
anatofuz
parents:
diff changeset
1999
anatofuz
parents:
diff changeset
2000 The data in this packet is a JSON array of JSON objects with the following keys:
anatofuz
parents:
diff changeset
2001 "port": <the port number to connect> (optional)
anatofuz
parents:
diff changeset
2002 "socket_name": <the name of the socket to connect> (optional)
anatofuz
parents:
diff changeset
2003
anatofuz
parents:
diff changeset
2004 Example packet:
anatofuz
parents:
diff changeset
2005 [
anatofuz
parents:
diff changeset
2006 { "port": 1234 },
anatofuz
parents:
diff changeset
2007 { "port": 5432 },
anatofuz
parents:
diff changeset
2008 { "socket_name": "foo" }
anatofuz
parents:
diff changeset
2009 ]