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