Imported Upstream version 7.8.1
[platform/upstream/gdb.git] / gdb / doc / gdb.info-5
1 This is gdb.info, produced by makeinfo version 5.2 from gdb.texinfo.
2
3 Copyright (C) 1988-2014 Free Software Foundation, Inc.
4
5    Permission is granted to copy, distribute and/or modify this document
6 under the terms of the GNU Free Documentation License, Version 1.3 or
7 any later version published by the Free Software Foundation; with the
8 Invariant Sections being "Free Software" and "Free Software Needs Free
9 Documentation", with the Front-Cover Texts being "A GNU Manual," and
10 with the Back-Cover Texts as in (a) below.
11
12    (a) The FSF's Back-Cover Text is: "You are free to copy and modify
13 this GNU Manual.  Buying copies from GNU Press supports the FSF in
14 developing GNU and promoting software freedom."
15 INFO-DIR-SECTION Software development
16 START-INFO-DIR-ENTRY
17 * Gdb: (gdb).                     The GNU debugger.
18 * gdbserver: (gdb) Server.        The GNU debugging server.
19 END-INFO-DIR-ENTRY
20
21    This file documents the GNU debugger GDB.
22
23    This is the Tenth Edition, of 'Debugging with GDB: the GNU
24 Source-Level Debugger' for GDB (GDB) Version 7.8.1.
25
26    Copyright (C) 1988-2014 Free Software Foundation, Inc.
27
28    Permission is granted to copy, distribute and/or modify this document
29 under the terms of the GNU Free Documentation License, Version 1.3 or
30 any later version published by the Free Software Foundation; with the
31 Invariant Sections being "Free Software" and "Free Software Needs Free
32 Documentation", with the Front-Cover Texts being "A GNU Manual," and
33 with the Back-Cover Texts as in (a) below.
34
35    (a) The FSF's Back-Cover Text is: "You are free to copy and modify
36 this GNU Manual.  Buying copies from GNU Press supports the FSF in
37 developing GNU and promoting software freedom."
38
39 \1f
40 File: gdb.info,  Node: GDB/MI Breakpoint Information,  Next: GDB/MI Frame Information,  Prev: GDB/MI Async Records,  Up: GDB/MI Output Records
41
42 27.5.4 GDB/MI Breakpoint Information
43 ------------------------------------
44
45 When GDB reports information about a breakpoint, a tracepoint, a
46 watchpoint, or a catchpoint, it uses a tuple with the following fields:
47
48 'number'
49      The breakpoint number.  For a breakpoint that represents one
50      location of a multi-location breakpoint, this will be a dotted
51      pair, like '1.2'.
52
53 'type'
54      The type of the breakpoint.  For ordinary breakpoints this will be
55      'breakpoint', but many values are possible.
56
57 'catch-type'
58      If the type of the breakpoint is 'catchpoint', then this indicates
59      the exact type of catchpoint.
60
61 'disp'
62      This is the breakpoint disposition--either 'del', meaning that the
63      breakpoint will be deleted at the next stop, or 'keep', meaning
64      that the breakpoint will not be deleted.
65
66 'enabled'
67      This indicates whether the breakpoint is enabled, in which case the
68      value is 'y', or disabled, in which case the value is 'n'.  Note
69      that this is not the same as the field 'enable'.
70
71 'addr'
72      The address of the breakpoint.  This may be a hexidecimal number,
73      giving the address; or the string '<PENDING>', for a pending
74      breakpoint; or the string '<MULTIPLE>', for a breakpoint with
75      multiple locations.  This field will not be present if no address
76      can be determined.  For example, a watchpoint does not have an
77      address.
78
79 'func'
80      If known, the function in which the breakpoint appears.  If not
81      known, this field is not present.
82
83 'filename'
84      The name of the source file which contains this function, if known.
85      If not known, this field is not present.
86
87 'fullname'
88      The full file name of the source file which contains this function,
89      if known.  If not known, this field is not present.
90
91 'line'
92      The line number at which this breakpoint appears, if known.  If not
93      known, this field is not present.
94
95 'at'
96      If the source file is not known, this field may be provided.  If
97      provided, this holds the address of the breakpoint, possibly
98      followed by a symbol name.
99
100 'pending'
101      If this breakpoint is pending, this field is present and holds the
102      text used to set the breakpoint, as entered by the user.
103
104 'evaluated-by'
105      Where this breakpoint's condition is evaluated, either 'host' or
106      'target'.
107
108 'thread'
109      If this is a thread-specific breakpoint, then this identifies the
110      thread in which the breakpoint can trigger.
111
112 'task'
113      If this breakpoint is restricted to a particular Ada task, then
114      this field will hold the task identifier.
115
116 'cond'
117      If the breakpoint is conditional, this is the condition expression.
118
119 'ignore'
120      The ignore count of the breakpoint.
121
122 'enable'
123      The enable count of the breakpoint.
124
125 'traceframe-usage'
126      FIXME.
127
128 'static-tracepoint-marker-string-id'
129      For a static tracepoint, the name of the static tracepoint marker.
130
131 'mask'
132      For a masked watchpoint, this is the mask.
133
134 'pass'
135      A tracepoint's pass count.
136
137 'original-location'
138      The location of the breakpoint as originally specified by the user.
139      This field is optional.
140
141 'times'
142      The number of times the breakpoint has been hit.
143
144 'installed'
145      This field is only given for tracepoints.  This is either 'y',
146      meaning that the tracepoint is installed, or 'n', meaning that it
147      is not.
148
149 'what'
150      Some extra data, the exact contents of which are type-dependent.
151
152    For example, here is what the output of '-break-insert' (*note GDB/MI
153 Breakpoint Commands::) might be:
154
155      -> -break-insert main
156      <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
157          enabled="y",addr="0x08048564",func="main",file="myprog.c",
158          fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
159          times="0"}
160      <- (gdb)
161
162 \1f
163 File: gdb.info,  Node: GDB/MI Frame Information,  Next: GDB/MI Thread Information,  Prev: GDB/MI Breakpoint Information,  Up: GDB/MI Output Records
164
165 27.5.5 GDB/MI Frame Information
166 -------------------------------
167
168 Response from many MI commands includes an information about stack
169 frame.  This information is a tuple that may have the following fields:
170
171 'level'
172      The level of the stack frame.  The innermost frame has the level of
173      zero.  This field is always present.
174
175 'func'
176      The name of the function corresponding to the frame.  This field
177      may be absent if GDB is unable to determine the function name.
178
179 'addr'
180      The code address for the frame.  This field is always present.
181
182 'file'
183      The name of the source files that correspond to the frame's code
184      address.  This field may be absent.
185
186 'line'
187      The source line corresponding to the frames' code address.  This
188      field may be absent.
189
190 'from'
191      The name of the binary file (either executable or shared library)
192      the corresponds to the frame's code address.  This field may be
193      absent.
194
195 \1f
196 File: gdb.info,  Node: GDB/MI Thread Information,  Next: GDB/MI Ada Exception Information,  Prev: GDB/MI Frame Information,  Up: GDB/MI Output Records
197
198 27.5.6 GDB/MI Thread Information
199 --------------------------------
200
201 Whenever GDB has to report an information about a thread, it uses a
202 tuple with the following fields:
203
204 'id'
205      The numeric id assigned to the thread by GDB.  This field is always
206      present.
207
208 'target-id'
209      Target-specific string identifying the thread.  This field is
210      always present.
211
212 'details'
213      Additional information about the thread provided by the target.  It
214      is supposed to be human-readable and not interpreted by the
215      frontend.  This field is optional.
216
217 'state'
218      Either 'stopped' or 'running', depending on whether the thread is
219      presently running.  This field is always present.
220
221 'core'
222      The value of this field is an integer number of the processor core
223      the thread was last seen on.  This field is optional.
224
225 \1f
226 File: gdb.info,  Node: GDB/MI Ada Exception Information,  Prev: GDB/MI Thread Information,  Up: GDB/MI Output Records
227
228 27.5.7 GDB/MI Ada Exception Information
229 ---------------------------------------
230
231 Whenever a '*stopped' record is emitted because the program stopped
232 after hitting an exception catchpoint (*note Set Catchpoints::), GDB
233 provides the name of the exception that was raised via the
234 'exception-name' field.
235
236 \1f
237 File: gdb.info,  Node: GDB/MI Simple Examples,  Next: GDB/MI Command Description Format,  Prev: GDB/MI Output Records,  Up: GDB/MI
238
239 27.6 Simple Examples of GDB/MI Interaction
240 ==========================================
241
242 This subsection presents several simple examples of interaction using
243 the GDB/MI interface.  In these examples, '->' means that the following
244 line is passed to GDB/MI as input, while '<-' means the output received
245 from GDB/MI.
246
247    Note the line breaks shown in the examples are here only for
248 readability, they don't appear in the real output.
249
250 Setting a Breakpoint
251 --------------------
252
253 Setting a breakpoint generates synchronous output which contains
254 detailed information of the breakpoint.
255
256      -> -break-insert main
257      <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
258          enabled="y",addr="0x08048564",func="main",file="myprog.c",
259          fullname="/home/nickrob/myprog.c",line="68",thread-groups=["i1"],
260          times="0"}
261      <- (gdb)
262
263 Program Execution
264 -----------------
265
266 Program execution generates asynchronous records and MI gives the reason
267 that execution stopped.
268
269      -> -exec-run
270      <- ^running
271      <- (gdb)
272      <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
273         frame={addr="0x08048564",func="main",
274         args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}],
275         file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"}
276      <- (gdb)
277      -> -exec-continue
278      <- ^running
279      <- (gdb)
280      <- *stopped,reason="exited-normally"
281      <- (gdb)
282
283 Quitting GDB
284 ------------
285
286 Quitting GDB just prints the result class '^exit'.
287
288      -> (gdb)
289      <- -gdb-exit
290      <- ^exit
291
292    Please note that '^exit' is printed immediately, but it might take
293 some time for GDB to actually exit.  During that time, GDB performs
294 necessary cleanups, including killing programs being debugged or
295 disconnecting from debug hardware, so the frontend should wait till GDB
296 exits and should only forcibly kill GDB if it fails to exit in
297 reasonable time.
298
299 A Bad Command
300 -------------
301
302 Here's what happens if you pass a non-existent command:
303
304      -> -rubbish
305      <- ^error,msg="Undefined MI command: rubbish"
306      <- (gdb)
307
308 \1f
309 File: gdb.info,  Node: GDB/MI Command Description Format,  Next: GDB/MI Breakpoint Commands,  Prev: GDB/MI Simple Examples,  Up: GDB/MI
310
311 27.7 GDB/MI Command Description Format
312 ======================================
313
314 The remaining sections describe blocks of commands.  Each block of
315 commands is laid out in a fashion similar to this section.
316
317 Motivation
318 ----------
319
320 The motivation for this collection of commands.
321
322 Introduction
323 ------------
324
325 A brief introduction to this collection of commands as a whole.
326
327 Commands
328 --------
329
330 For each command in the block, the following is described:
331
332 Synopsis
333 ........
334
335       -command ARGS...
336
337 Result
338 ......
339
340 GDB Command
341 ...........
342
343 The corresponding GDB CLI command(s), if any.
344
345 Example
346 .......
347
348 Example(s) formatted for readability.  Some of the described commands
349 have not been implemented yet and these are labeled N.A. (not
350 available).
351
352 \1f
353 File: gdb.info,  Node: GDB/MI Breakpoint Commands,  Next: GDB/MI Catchpoint Commands,  Prev: GDB/MI Command Description Format,  Up: GDB/MI
354
355 27.8 GDB/MI Breakpoint Commands
356 ===============================
357
358 This section documents GDB/MI commands for manipulating breakpoints.
359
360 The '-break-after' Command
361 --------------------------
362
363 Synopsis
364 ........
365
366       -break-after NUMBER COUNT
367
368    The breakpoint number NUMBER is not in effect until it has been hit
369 COUNT times.  To see how this is reflected in the output of the
370 '-break-list' command, see the description of the '-break-list' command
371 below.
372
373 GDB Command
374 ...........
375
376 The corresponding GDB command is 'ignore'.
377
378 Example
379 .......
380
381      (gdb)
382      -break-insert main
383      ^done,bkpt={number="1",type="breakpoint",disp="keep",
384      enabled="y",addr="0x000100d0",func="main",file="hello.c",
385      fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
386      times="0"}
387      (gdb)
388      -break-after 1 3
389      ~
390      ^done
391      (gdb)
392      -break-list
393      ^done,BreakpointTable={nr_rows="1",nr_cols="6",
394      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
395      {width="14",alignment="-1",col_name="type",colhdr="Type"},
396      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
397      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
398      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
399      {width="40",alignment="2",col_name="what",colhdr="What"}],
400      body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
401      addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
402      line="5",thread-groups=["i1"],times="0",ignore="3"}]}
403      (gdb)
404
405 The '-break-commands' Command
406 -----------------------------
407
408 Synopsis
409 ........
410
411       -break-commands NUMBER [ COMMAND1 ... COMMANDN ]
412
413    Specifies the CLI commands that should be executed when breakpoint
414 NUMBER is hit.  The parameters COMMAND1 to COMMANDN are the commands.
415 If no command is specified, any previously-set commands are cleared.
416 *Note Break Commands::.  Typical use of this functionality is tracing a
417 program, that is, printing of values of some variables whenever
418 breakpoint is hit and then continuing.
419
420 GDB Command
421 ...........
422
423 The corresponding GDB command is 'commands'.
424
425 Example
426 .......
427
428      (gdb)
429      -break-insert main
430      ^done,bkpt={number="1",type="breakpoint",disp="keep",
431      enabled="y",addr="0x000100d0",func="main",file="hello.c",
432      fullname="/home/foo/hello.c",line="5",thread-groups=["i1"],
433      times="0"}
434      (gdb)
435      -break-commands 1 "print v" "continue"
436      ^done
437      (gdb)
438
439 The '-break-condition' Command
440 ------------------------------
441
442 Synopsis
443 ........
444
445       -break-condition NUMBER EXPR
446
447    Breakpoint NUMBER will stop the program only if the condition in EXPR
448 is true.  The condition becomes part of the '-break-list' output (see
449 the description of the '-break-list' command below).
450
451 GDB Command
452 ...........
453
454 The corresponding GDB command is 'condition'.
455
456 Example
457 .......
458
459      (gdb)
460      -break-condition 1 1
461      ^done
462      (gdb)
463      -break-list
464      ^done,BreakpointTable={nr_rows="1",nr_cols="6",
465      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
466      {width="14",alignment="-1",col_name="type",colhdr="Type"},
467      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
468      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
469      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
470      {width="40",alignment="2",col_name="what",colhdr="What"}],
471      body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
472      addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
473      line="5",cond="1",thread-groups=["i1"],times="0",ignore="3"}]}
474      (gdb)
475
476 The '-break-delete' Command
477 ---------------------------
478
479 Synopsis
480 ........
481
482       -break-delete ( BREAKPOINT )+
483
484    Delete the breakpoint(s) whose number(s) are specified in the
485 argument list.  This is obviously reflected in the breakpoint list.
486
487 GDB Command
488 ...........
489
490 The corresponding GDB command is 'delete'.
491
492 Example
493 .......
494
495      (gdb)
496      -break-delete 1
497      ^done
498      (gdb)
499      -break-list
500      ^done,BreakpointTable={nr_rows="0",nr_cols="6",
501      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
502      {width="14",alignment="-1",col_name="type",colhdr="Type"},
503      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
504      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
505      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
506      {width="40",alignment="2",col_name="what",colhdr="What"}],
507      body=[]}
508      (gdb)
509
510 The '-break-disable' Command
511 ----------------------------
512
513 Synopsis
514 ........
515
516       -break-disable ( BREAKPOINT )+
517
518    Disable the named BREAKPOINT(s).  The field 'enabled' in the break
519 list is now set to 'n' for the named BREAKPOINT(s).
520
521 GDB Command
522 ...........
523
524 The corresponding GDB command is 'disable'.
525
526 Example
527 .......
528
529      (gdb)
530      -break-disable 2
531      ^done
532      (gdb)
533      -break-list
534      ^done,BreakpointTable={nr_rows="1",nr_cols="6",
535      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
536      {width="14",alignment="-1",col_name="type",colhdr="Type"},
537      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
538      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
539      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
540      {width="40",alignment="2",col_name="what",colhdr="What"}],
541      body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
542      addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
543      line="5",thread-groups=["i1"],times="0"}]}
544      (gdb)
545
546 The '-break-enable' Command
547 ---------------------------
548
549 Synopsis
550 ........
551
552       -break-enable ( BREAKPOINT )+
553
554    Enable (previously disabled) BREAKPOINT(s).
555
556 GDB Command
557 ...........
558
559 The corresponding GDB command is 'enable'.
560
561 Example
562 .......
563
564      (gdb)
565      -break-enable 2
566      ^done
567      (gdb)
568      -break-list
569      ^done,BreakpointTable={nr_rows="1",nr_cols="6",
570      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
571      {width="14",alignment="-1",col_name="type",colhdr="Type"},
572      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
573      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
574      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
575      {width="40",alignment="2",col_name="what",colhdr="What"}],
576      body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
577      addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
578      line="5",thread-groups=["i1"],times="0"}]}
579      (gdb)
580
581 The '-break-info' Command
582 -------------------------
583
584 Synopsis
585 ........
586
587       -break-info BREAKPOINT
588
589    Get information about a single breakpoint.
590
591    The result is a table of breakpoints.  *Note GDB/MI Breakpoint
592 Information::, for details on the format of each breakpoint in the
593 table.
594
595 GDB Command
596 ...........
597
598 The corresponding GDB command is 'info break BREAKPOINT'.
599
600 Example
601 .......
602
603 N.A.
604
605 The '-break-insert' Command
606 ---------------------------
607
608 Synopsis
609 ........
610
611       -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ]
612          [ -c CONDITION ] [ -i IGNORE-COUNT ]
613          [ -p THREAD-ID ] [ LOCATION ]
614
615 If specified, LOCATION, can be one of:
616
617    * function
618    * filename:linenum
619    * filename:function
620    * *address
621
622    The possible optional parameters of this command are:
623
624 '-t'
625      Insert a temporary breakpoint.
626 '-h'
627      Insert a hardware breakpoint.
628 '-f'
629      If LOCATION cannot be parsed (for example if it refers to unknown
630      files or functions), create a pending breakpoint.  Without this
631      flag, GDB will report an error, and won't create a breakpoint, if
632      LOCATION cannot be parsed.
633 '-d'
634      Create a disabled breakpoint.
635 '-a'
636      Create a tracepoint.  *Note Tracepoints::.  When this parameter is
637      used together with '-h', a fast tracepoint is created.
638 '-c CONDITION'
639      Make the breakpoint conditional on CONDITION.
640 '-i IGNORE-COUNT'
641      Initialize the IGNORE-COUNT.
642 '-p THREAD-ID'
643      Restrict the breakpoint to the specified THREAD-ID.
644
645 Result
646 ......
647
648 *Note GDB/MI Breakpoint Information::, for details on the format of the
649 resulting breakpoint.
650
651    Note: this format is open to change.
652
653 GDB Command
654 ...........
655
656 The corresponding GDB commands are 'break', 'tbreak', 'hbreak', and
657 'thbreak'.
658
659 Example
660 .......
661
662      (gdb)
663      -break-insert main
664      ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",
665      fullname="/home/foo/recursive2.c,line="4",thread-groups=["i1"],
666      times="0"}
667      (gdb)
668      -break-insert -t foo
669      ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",
670      fullname="/home/foo/recursive2.c,line="11",thread-groups=["i1"],
671      times="0"}
672      (gdb)
673      -break-list
674      ^done,BreakpointTable={nr_rows="2",nr_cols="6",
675      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
676      {width="14",alignment="-1",col_name="type",colhdr="Type"},
677      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
678      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
679      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
680      {width="40",alignment="2",col_name="what",colhdr="What"}],
681      body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
682      addr="0x0001072c", func="main",file="recursive2.c",
683      fullname="/home/foo/recursive2.c,"line="4",thread-groups=["i1"],
684      times="0"},
685      bkpt={number="2",type="breakpoint",disp="del",enabled="y",
686      addr="0x00010774",func="foo",file="recursive2.c",
687      fullname="/home/foo/recursive2.c",line="11",thread-groups=["i1"],
688      times="0"}]}
689      (gdb)
690
691 The '-dprintf-insert' Command
692 -----------------------------
693
694 Synopsis
695 ........
696
697       -dprintf-insert [ -t ] [ -f ] [ -d ]
698          [ -c CONDITION ] [ -i IGNORE-COUNT ]
699          [ -p THREAD-ID ] [ LOCATION ] [ FORMAT ]
700          [ ARGUMENT ]
701
702 If specified, LOCATION, can be one of:
703
704    * FUNCTION
705    * FILENAME:LINENUM
706    * FILENAME:function
707    * *ADDRESS
708
709    The possible optional parameters of this command are:
710
711 '-t'
712      Insert a temporary breakpoint.
713 '-f'
714      If LOCATION cannot be parsed (for example, if it refers to unknown
715      files or functions), create a pending breakpoint.  Without this
716      flag, GDB will report an error, and won't create a breakpoint, if
717      LOCATION cannot be parsed.
718 '-d'
719      Create a disabled breakpoint.
720 '-c CONDITION'
721      Make the breakpoint conditional on CONDITION.
722 '-i IGNORE-COUNT'
723      Set the ignore count of the breakpoint (*note ignore count:
724      Conditions.) to IGNORE-COUNT.
725 '-p THREAD-ID'
726      Restrict the breakpoint to the specified THREAD-ID.
727
728 Result
729 ......
730
731 *Note GDB/MI Breakpoint Information::, for details on the format of the
732 resulting breakpoint.
733
734 GDB Command
735 ...........
736
737 The corresponding GDB command is 'dprintf'.
738
739 Example
740 .......
741
742      (gdb)
743      4-dprintf-insert foo "At foo entry\n"
744      4^done,bkpt={number="1",type="dprintf",disp="keep",enabled="y",
745      addr="0x000000000040061b",func="foo",file="mi-dprintf.c",
746      fullname="mi-dprintf.c",line="25",thread-groups=["i1"],
747      times="0",script={"printf \"At foo entry\\n\"","continue"},
748      original-location="foo"}
749      (gdb)
750      5-dprintf-insert 26 "arg=%d, g=%d\n" arg g
751      5^done,bkpt={number="2",type="dprintf",disp="keep",enabled="y",
752      addr="0x000000000040062a",func="foo",file="mi-dprintf.c",
753      fullname="mi-dprintf.c",line="26",thread-groups=["i1"],
754      times="0",script={"printf \"arg=%d, g=%d\\n\", arg, g","continue"},
755      original-location="mi-dprintf.c:26"}
756      (gdb)
757
758 The '-break-list' Command
759 -------------------------
760
761 Synopsis
762 ........
763
764       -break-list
765
766    Displays the list of inserted breakpoints, showing the following
767 fields:
768
769 'Number'
770      number of the breakpoint
771 'Type'
772      type of the breakpoint: 'breakpoint' or 'watchpoint'
773 'Disposition'
774      should the breakpoint be deleted or disabled when it is hit: 'keep'
775      or 'nokeep'
776 'Enabled'
777      is the breakpoint enabled or no: 'y' or 'n'
778 'Address'
779      memory location at which the breakpoint is set
780 'What'
781      logical location of the breakpoint, expressed by function name,
782      file name, line number
783 'Thread-groups'
784      list of thread groups to which this breakpoint applies
785 'Times'
786      number of times the breakpoint has been hit
787
788    If there are no breakpoints or watchpoints, the 'BreakpointTable'
789 'body' field is an empty list.
790
791 GDB Command
792 ...........
793
794 The corresponding GDB command is 'info break'.
795
796 Example
797 .......
798
799      (gdb)
800      -break-list
801      ^done,BreakpointTable={nr_rows="2",nr_cols="6",
802      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
803      {width="14",alignment="-1",col_name="type",colhdr="Type"},
804      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
805      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
806      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
807      {width="40",alignment="2",col_name="what",colhdr="What"}],
808      body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
809      addr="0x000100d0",func="main",file="hello.c",line="5",thread-groups=["i1"],
810      times="0"},
811      bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
812      addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",
813      line="13",thread-groups=["i1"],times="0"}]}
814      (gdb)
815
816    Here's an example of the result when there are no breakpoints:
817
818      (gdb)
819      -break-list
820      ^done,BreakpointTable={nr_rows="0",nr_cols="6",
821      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
822      {width="14",alignment="-1",col_name="type",colhdr="Type"},
823      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
824      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
825      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
826      {width="40",alignment="2",col_name="what",colhdr="What"}],
827      body=[]}
828      (gdb)
829
830 The '-break-passcount' Command
831 ------------------------------
832
833 Synopsis
834 ........
835
836       -break-passcount TRACEPOINT-NUMBER PASSCOUNT
837
838    Set the passcount for tracepoint TRACEPOINT-NUMBER to PASSCOUNT.  If
839 the breakpoint referred to by TRACEPOINT-NUMBER is not a tracepoint,
840 error is emitted.  This corresponds to CLI command 'passcount'.
841
842 The '-break-watch' Command
843 --------------------------
844
845 Synopsis
846 ........
847
848       -break-watch [ -a | -r ]
849
850    Create a watchpoint.  With the '-a' option it will create an "access"
851 watchpoint, i.e., a watchpoint that triggers either on a read from or on
852 a write to the memory location.  With the '-r' option, the watchpoint
853 created is a "read" watchpoint, i.e., it will trigger only when the
854 memory location is accessed for reading.  Without either of the options,
855 the watchpoint created is a regular watchpoint, i.e., it will trigger
856 when the memory location is accessed for writing.  *Note Setting
857 Watchpoints: Set Watchpoints.
858
859    Note that '-break-list' will report a single list of watchpoints and
860 breakpoints inserted.
861
862 GDB Command
863 ...........
864
865 The corresponding GDB commands are 'watch', 'awatch', and 'rwatch'.
866
867 Example
868 .......
869
870 Setting a watchpoint on a variable in the 'main' function:
871
872      (gdb)
873      -break-watch x
874      ^done,wpt={number="2",exp="x"}
875      (gdb)
876      -exec-continue
877      ^running
878      (gdb)
879      *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"},
880      value={old="-268439212",new="55"},
881      frame={func="main",args=[],file="recursive2.c",
882      fullname="/home/foo/bar/recursive2.c",line="5"}
883      (gdb)
884
885    Setting a watchpoint on a variable local to a function.  GDB will
886 stop the program execution twice: first for the variable changing value,
887 then for the watchpoint going out of scope.
888
889      (gdb)
890      -break-watch C
891      ^done,wpt={number="5",exp="C"}
892      (gdb)
893      -exec-continue
894      ^running
895      (gdb)
896      *stopped,reason="watchpoint-trigger",
897      wpt={number="5",exp="C"},value={old="-276895068",new="3"},
898      frame={func="callee4",args=[],
899      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
900      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
901      (gdb)
902      -exec-continue
903      ^running
904      (gdb)
905      *stopped,reason="watchpoint-scope",wpnum="5",
906      frame={func="callee3",args=[{name="strarg",
907      value="0x11940 \"A string argument.\""}],
908      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
909      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
910      (gdb)
911
912    Listing breakpoints and watchpoints, at different points in the
913 program execution.  Note that once the watchpoint goes out of scope, it
914 is deleted.
915
916      (gdb)
917      -break-watch C
918      ^done,wpt={number="2",exp="C"}
919      (gdb)
920      -break-list
921      ^done,BreakpointTable={nr_rows="2",nr_cols="6",
922      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
923      {width="14",alignment="-1",col_name="type",colhdr="Type"},
924      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
925      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
926      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
927      {width="40",alignment="2",col_name="what",colhdr="What"}],
928      body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
929      addr="0x00010734",func="callee4",
930      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
931      fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",thread-groups=["i1"],
932      times="1"},
933      bkpt={number="2",type="watchpoint",disp="keep",
934      enabled="y",addr="",what="C",thread-groups=["i1"],times="0"}]}
935      (gdb)
936      -exec-continue
937      ^running
938      (gdb)
939      *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"},
940      value={old="-276895068",new="3"},
941      frame={func="callee4",args=[],
942      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
943      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
944      (gdb)
945      -break-list
946      ^done,BreakpointTable={nr_rows="2",nr_cols="6",
947      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
948      {width="14",alignment="-1",col_name="type",colhdr="Type"},
949      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
950      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
951      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
952      {width="40",alignment="2",col_name="what",colhdr="What"}],
953      body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
954      addr="0x00010734",func="callee4",
955      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
956      fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",thread-groups=["i1"],
957      times="1"},
958      bkpt={number="2",type="watchpoint",disp="keep",
959      enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"}]}
960      (gdb)
961      -exec-continue
962      ^running
963      ^done,reason="watchpoint-scope",wpnum="2",
964      frame={func="callee3",args=[{name="strarg",
965      value="0x11940 \"A string argument.\""}],
966      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
967      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
968      (gdb)
969      -break-list
970      ^done,BreakpointTable={nr_rows="1",nr_cols="6",
971      hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
972      {width="14",alignment="-1",col_name="type",colhdr="Type"},
973      {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
974      {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
975      {width="10",alignment="-1",col_name="addr",colhdr="Address"},
976      {width="40",alignment="2",col_name="what",colhdr="What"}],
977      body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
978      addr="0x00010734",func="callee4",
979      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
980      fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
981      thread-groups=["i1"],times="1"}]}
982      (gdb)
983
984 \1f
985 File: gdb.info,  Node: GDB/MI Catchpoint Commands,  Next: GDB/MI Program Context,  Prev: GDB/MI Breakpoint Commands,  Up: GDB/MI
986
987 27.9 GDB/MI Catchpoint Commands
988 ===============================
989
990 This section documents GDB/MI commands for manipulating catchpoints.
991
992 * Menu:
993
994 * Shared Library GDB/MI Catchpoint Commands::
995 * Ada Exception GDB/MI Catchpoint Commands::
996
997 \1f
998 File: gdb.info,  Node: Shared Library GDB/MI Catchpoint Commands,  Next: Ada Exception GDB/MI Catchpoint Commands,  Up: GDB/MI Catchpoint Commands
999
1000 27.9.1 Shared Library GDB/MI Catchpoints
1001 ----------------------------------------
1002
1003 The '-catch-load' Command
1004 -------------------------
1005
1006 Synopsis
1007 ........
1008
1009       -catch-load [ -t ] [ -d ] REGEXP
1010
1011    Add a catchpoint for library load events.  If the '-t' option is
1012 used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
1013 Breaks.).  If the '-d' option is used, the catchpoint is created in a
1014 disabled state.  The 'regexp' argument is a regular expression used to
1015 match the name of the loaded library.
1016
1017 GDB Command
1018 ...........
1019
1020 The corresponding GDB command is 'catch load'.
1021
1022 Example
1023 .......
1024
1025      -catch-load -t foo.so
1026      ^done,bkpt={number="1",type="catchpoint",disp="del",enabled="y",
1027      what="load of library matching foo.so",catch-type="load",times="0"}
1028      (gdb)
1029
1030 The '-catch-unload' Command
1031 ---------------------------
1032
1033 Synopsis
1034 ........
1035
1036       -catch-unload [ -t ] [ -d ] REGEXP
1037
1038    Add a catchpoint for library unload events.  If the '-t' option is
1039 used, the catchpoint is a temporary one (*note Setting Breakpoints: Set
1040 Breaks.).  If the '-d' option is used, the catchpoint is created in a
1041 disabled state.  The 'regexp' argument is a regular expression used to
1042 match the name of the unloaded library.
1043
1044 GDB Command
1045 ...........
1046
1047 The corresponding GDB command is 'catch unload'.
1048
1049 Example
1050 .......
1051
1052      -catch-unload -d bar.so
1053      ^done,bkpt={number="2",type="catchpoint",disp="keep",enabled="n",
1054      what="load of library matching bar.so",catch-type="unload",times="0"}
1055      (gdb)
1056
1057 \1f
1058 File: gdb.info,  Node: Ada Exception GDB/MI Catchpoint Commands,  Prev: Shared Library GDB/MI Catchpoint Commands,  Up: GDB/MI Catchpoint Commands
1059
1060 27.9.2 Ada Exception GDB/MI Catchpoints
1061 ---------------------------------------
1062
1063 The following GDB/MI commands can be used to create catchpoints that
1064 stop the execution when Ada exceptions are being raised.
1065
1066 The '-catch-assert' Command
1067 ---------------------------
1068
1069 Synopsis
1070 ........
1071
1072       -catch-assert [ -c CONDITION] [ -d ] [ -t ]
1073
1074    Add a catchpoint for failed Ada assertions.
1075
1076    The possible optional parameters for this command are:
1077
1078 '-c CONDITION'
1079      Make the catchpoint conditional on CONDITION.
1080 '-d'
1081      Create a disabled catchpoint.
1082 '-t'
1083      Create a temporary catchpoint.
1084
1085 GDB Command
1086 ...........
1087
1088 The corresponding GDB command is 'catch assert'.
1089
1090 Example
1091 .......
1092
1093      -catch-assert
1094      ^done,bkptno="5",bkpt={number="5",type="breakpoint",disp="keep",
1095      enabled="y",addr="0x0000000000404888",what="failed Ada assertions",
1096      thread-groups=["i1"],times="0",
1097      original-location="__gnat_debug_raise_assert_failure"}
1098      (gdb)
1099
1100 The '-catch-exception' Command
1101 ------------------------------
1102
1103 Synopsis
1104 ........
1105
1106       -catch-exception [ -c CONDITION] [ -d ] [ -e EXCEPTION-NAME ]
1107          [ -t ] [ -u ]
1108
1109    Add a catchpoint stopping when Ada exceptions are raised.  By
1110 default, the command stops the program when any Ada exception gets
1111 raised.  But it is also possible, by using some of the optional
1112 parameters described below, to create more selective catchpoints.
1113
1114    The possible optional parameters for this command are:
1115
1116 '-c CONDITION'
1117      Make the catchpoint conditional on CONDITION.
1118 '-d'
1119      Create a disabled catchpoint.
1120 '-e EXCEPTION-NAME'
1121      Only stop when EXCEPTION-NAME is raised.  This option cannot be
1122      used combined with '-u'.
1123 '-t'
1124      Create a temporary catchpoint.
1125 '-u'
1126      Stop only when an unhandled exception gets raised.  This option
1127      cannot be used combined with '-e'.
1128
1129 GDB Command
1130 ...........
1131
1132 The corresponding GDB commands are 'catch exception' and 'catch
1133 exception unhandled'.
1134
1135 Example
1136 .......
1137
1138      -catch-exception -e Program_Error
1139      ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
1140      enabled="y",addr="0x0000000000404874",
1141      what="`Program_Error' Ada exception", thread-groups=["i1"],
1142      times="0",original-location="__gnat_debug_raise_exception"}
1143      (gdb)
1144
1145 \1f
1146 File: gdb.info,  Node: GDB/MI Program Context,  Next: GDB/MI Thread Commands,  Prev: GDB/MI Catchpoint Commands,  Up: GDB/MI
1147
1148 27.10 GDB/MI Program Context
1149 ============================
1150
1151 The '-exec-arguments' Command
1152 -----------------------------
1153
1154 Synopsis
1155 ........
1156
1157       -exec-arguments ARGS
1158
1159    Set the inferior program arguments, to be used in the next
1160 '-exec-run'.
1161
1162 GDB Command
1163 ...........
1164
1165 The corresponding GDB command is 'set args'.
1166
1167 Example
1168 .......
1169
1170      (gdb)
1171      -exec-arguments -v word
1172      ^done
1173      (gdb)
1174
1175 The '-environment-cd' Command
1176 -----------------------------
1177
1178 Synopsis
1179 ........
1180
1181       -environment-cd PATHDIR
1182
1183    Set GDB's working directory.
1184
1185 GDB Command
1186 ...........
1187
1188 The corresponding GDB command is 'cd'.
1189
1190 Example
1191 .......
1192
1193      (gdb)
1194      -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
1195      ^done
1196      (gdb)
1197
1198 The '-environment-directory' Command
1199 ------------------------------------
1200
1201 Synopsis
1202 ........
1203
1204       -environment-directory [ -r ] [ PATHDIR ]+
1205
1206    Add directories PATHDIR to beginning of search path for source files.
1207 If the '-r' option is used, the search path is reset to the default
1208 search path.  If directories PATHDIR are supplied in addition to the
1209 '-r' option, the search path is first reset and then addition occurs as
1210 normal.  Multiple directories may be specified, separated by blanks.
1211 Specifying multiple directories in a single command results in the
1212 directories added to the beginning of the search path in the same order
1213 they were presented in the command.  If blanks are needed as part of a
1214 directory name, double-quotes should be used around the name.  In the
1215 command output, the path will show up separated by the system
1216 directory-separator character.  The directory-separator character must
1217 not be used in any directory name.  If no directories are specified, the
1218 current search path is displayed.
1219
1220 GDB Command
1221 ...........
1222
1223 The corresponding GDB command is 'dir'.
1224
1225 Example
1226 .......
1227
1228      (gdb)
1229      -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
1230      ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
1231      (gdb)
1232      -environment-directory ""
1233      ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
1234      (gdb)
1235      -environment-directory -r /home/jjohnstn/src/gdb /usr/src
1236      ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
1237      (gdb)
1238      -environment-directory -r
1239      ^done,source-path="$cdir:$cwd"
1240      (gdb)
1241
1242 The '-environment-path' Command
1243 -------------------------------
1244
1245 Synopsis
1246 ........
1247
1248       -environment-path [ -r ] [ PATHDIR ]+
1249
1250    Add directories PATHDIR to beginning of search path for object files.
1251 If the '-r' option is used, the search path is reset to the original
1252 search path that existed at gdb start-up.  If directories PATHDIR are
1253 supplied in addition to the '-r' option, the search path is first reset
1254 and then addition occurs as normal.  Multiple directories may be
1255 specified, separated by blanks.  Specifying multiple directories in a
1256 single command results in the directories added to the beginning of the
1257 search path in the same order they were presented in the command.  If
1258 blanks are needed as part of a directory name, double-quotes should be
1259 used around the name.  In the command output, the path will show up
1260 separated by the system directory-separator character.  The
1261 directory-separator character must not be used in any directory name.
1262 If no directories are specified, the current path is displayed.
1263
1264 GDB Command
1265 ...........
1266
1267 The corresponding GDB command is 'path'.
1268
1269 Example
1270 .......
1271
1272      (gdb)
1273      -environment-path
1274      ^done,path="/usr/bin"
1275      (gdb)
1276      -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
1277      ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
1278      (gdb)
1279      -environment-path -r /usr/local/bin
1280      ^done,path="/usr/local/bin:/usr/bin"
1281      (gdb)
1282
1283 The '-environment-pwd' Command
1284 ------------------------------
1285
1286 Synopsis
1287 ........
1288
1289       -environment-pwd
1290
1291    Show the current working directory.
1292
1293 GDB Command
1294 ...........
1295
1296 The corresponding GDB command is 'pwd'.
1297
1298 Example
1299 .......
1300
1301      (gdb)
1302      -environment-pwd
1303      ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
1304      (gdb)
1305
1306 \1f
1307 File: gdb.info,  Node: GDB/MI Thread Commands,  Next: GDB/MI Ada Tasking Commands,  Prev: GDB/MI Program Context,  Up: GDB/MI
1308
1309 27.11 GDB/MI Thread Commands
1310 ============================
1311
1312 The '-thread-info' Command
1313 --------------------------
1314
1315 Synopsis
1316 ........
1317
1318       -thread-info [ THREAD-ID ]
1319
1320    Reports information about either a specific thread, if the THREAD-ID
1321 parameter is present, or about all threads.  When printing information
1322 about all threads, also reports the current thread.
1323
1324 GDB Command
1325 ...........
1326
1327 The 'info thread' command prints the same information about all threads.
1328
1329 Result
1330 ......
1331
1332 The result is a list of threads.  The following attributes are defined
1333 for a given thread:
1334
1335 'current'
1336      This field exists only for the current thread.  It has the value
1337      '*'.
1338
1339 'id'
1340      The identifier that GDB uses to refer to the thread.
1341
1342 'target-id'
1343      The identifier that the target uses to refer to the thread.
1344
1345 'details'
1346      Extra information about the thread, in a target-specific format.
1347      This field is optional.
1348
1349 'name'
1350      The name of the thread.  If the user specified a name using the
1351      'thread name' command, then this name is given.  Otherwise, if GDB
1352      can extract the thread name from the target, then that name is
1353      given.  If GDB cannot find the thread name, then this field is
1354      omitted.
1355
1356 'frame'
1357      The stack frame currently executing in the thread.
1358
1359 'state'
1360      The thread's state.  The 'state' field may have the following
1361      values:
1362
1363      'stopped'
1364           The thread is stopped.  Frame information is available for
1365           stopped threads.
1366
1367      'running'
1368           The thread is running.  There's no frame information for
1369           running threads.
1370
1371 'core'
1372      If GDB can find the CPU core on which this thread is running, then
1373      this field is the core identifier.  This field is optional.
1374
1375 Example
1376 .......
1377
1378      -thread-info
1379      ^done,threads=[
1380      {id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
1381         frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",
1382                 args=[]},state="running"},
1383      {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
1384         frame={level="0",addr="0x0804891f",func="foo",
1385                 args=[{name="i",value="10"}],
1386                 file="/tmp/a.c",fullname="/tmp/a.c",line="158"},
1387                 state="running"}],
1388      current-thread-id="1"
1389      (gdb)
1390
1391 The '-thread-list-ids' Command
1392 ------------------------------
1393
1394 Synopsis
1395 ........
1396
1397       -thread-list-ids
1398
1399    Produces a list of the currently known GDB thread ids.  At the end of
1400 the list it also prints the total number of such threads.
1401
1402    This command is retained for historical reasons, the '-thread-info'
1403 command should be used instead.
1404
1405 GDB Command
1406 ...........
1407
1408 Part of 'info threads' supplies the same information.
1409
1410 Example
1411 .......
1412
1413      (gdb)
1414      -thread-list-ids
1415      ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
1416      current-thread-id="1",number-of-threads="3"
1417      (gdb)
1418
1419 The '-thread-select' Command
1420 ----------------------------
1421
1422 Synopsis
1423 ........
1424
1425       -thread-select THREADNUM
1426
1427    Make THREADNUM the current thread.  It prints the number of the new
1428 current thread, and the topmost frame for that thread.
1429
1430    This command is deprecated in favor of explicitly using the
1431 '--thread' option to each command.
1432
1433 GDB Command
1434 ...........
1435
1436 The corresponding GDB command is 'thread'.
1437
1438 Example
1439 .......
1440
1441      (gdb)
1442      -exec-next
1443      ^running
1444      (gdb)
1445      *stopped,reason="end-stepping-range",thread-id="2",line="187",
1446      file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
1447      (gdb)
1448      -thread-list-ids
1449      ^done,
1450      thread-ids={thread-id="3",thread-id="2",thread-id="1"},
1451      number-of-threads="3"
1452      (gdb)
1453      -thread-select 3
1454      ^done,new-thread-id="3",
1455      frame={level="0",func="vprintf",
1456      args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
1457      {name="arg",value="0x2"}],file="vprintf.c",line="31"}
1458      (gdb)
1459
1460 \1f
1461 File: gdb.info,  Node: GDB/MI Ada Tasking Commands,  Next: GDB/MI Program Execution,  Prev: GDB/MI Thread Commands,  Up: GDB/MI
1462
1463 27.12 GDB/MI Ada Tasking Commands
1464 =================================
1465
1466 The '-ada-task-info' Command
1467 ----------------------------
1468
1469 Synopsis
1470 ........
1471
1472       -ada-task-info [ TASK-ID ]
1473
1474    Reports information about either a specific Ada task, if the TASK-ID
1475 parameter is present, or about all Ada tasks.
1476
1477 GDB Command
1478 ...........
1479
1480 The 'info tasks' command prints the same information about all Ada tasks
1481 (*note Ada Tasks::).
1482
1483 Result
1484 ......
1485
1486 The result is a table of Ada tasks.  The following columns are defined
1487 for each Ada task:
1488
1489 'current'
1490      This field exists only for the current thread.  It has the value
1491      '*'.
1492
1493 'id'
1494      The identifier that GDB uses to refer to the Ada task.
1495
1496 'task-id'
1497      The identifier that the target uses to refer to the Ada task.
1498
1499 'thread-id'
1500      The identifier of the thread corresponding to the Ada task.
1501
1502      This field should always exist, as Ada tasks are always implemented
1503      on top of a thread.  But if GDB cannot find this corresponding
1504      thread for any reason, the field is omitted.
1505
1506 'parent-id'
1507      This field exists only when the task was created by another task.
1508      In this case, it provides the ID of the parent task.
1509
1510 'priority'
1511      The base priority of the task.
1512
1513 'state'
1514      The current state of the task.  For a detailed description of the
1515      possible states, see *note Ada Tasks::.
1516
1517 'name'
1518      The name of the task.
1519
1520 Example
1521 .......
1522
1523      -ada-task-info
1524      ^done,tasks={nr_rows="3",nr_cols="8",
1525      hdr=[{width="1",alignment="-1",col_name="current",colhdr=""},
1526      {width="3",alignment="1",col_name="id",colhdr="ID"},
1527      {width="9",alignment="1",col_name="task-id",colhdr="TID"},
1528      {width="4",alignment="1",col_name="thread-id",colhdr=""},
1529      {width="4",alignment="1",col_name="parent-id",colhdr="P-ID"},
1530      {width="3",alignment="1",col_name="priority",colhdr="Pri"},
1531      {width="22",alignment="-1",col_name="state",colhdr="State"},
1532      {width="1",alignment="2",col_name="name",colhdr="Name"}],
1533      body=[{current="*",id="1",task-id="   644010",thread-id="1",priority="48",
1534      state="Child Termination Wait",name="main_task"}]}
1535      (gdb)
1536
1537 \1f
1538 File: gdb.info,  Node: GDB/MI Program Execution,  Next: GDB/MI Stack Manipulation,  Prev: GDB/MI Ada Tasking Commands,  Up: GDB/MI
1539
1540 27.13 GDB/MI Program Execution
1541 ==============================
1542
1543 These are the asynchronous commands which generate the out-of-band
1544 record '*stopped'.  Currently GDB only really executes asynchronously
1545 with remote targets and this interaction is mimicked in other cases.
1546
1547 The '-exec-continue' Command
1548 ----------------------------
1549
1550 Synopsis
1551 ........
1552
1553       -exec-continue [--reverse] [--all|--thread-group N]
1554
1555    Resumes the execution of the inferior program, which will continue to
1556 execute until it reaches a debugger stop event.  If the '--reverse'
1557 option is specified, execution resumes in reverse until it reaches a
1558 stop event.  Stop events may include
1559    * breakpoints or watchpoints
1560    * signals or exceptions
1561    * the end of the process (or its beginning under '--reverse')
1562    * the end or beginning of a replay log if one is being used.
1563    In all-stop mode (*note All-Stop Mode::), may resume only one thread,
1564 or all threads, depending on the value of the 'scheduler-locking'
1565 variable.  If '--all' is specified, all threads (in all inferiors) will
1566 be resumed.  The '--all' option is ignored in all-stop mode.  If the
1567 '--thread-group' options is specified, then all threads in that thread
1568 group are resumed.
1569
1570 GDB Command
1571 ...........
1572
1573 The corresponding GDB corresponding is 'continue'.
1574
1575 Example
1576 .......
1577
1578      -exec-continue
1579      ^running
1580      (gdb)
1581      @Hello world
1582      *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame={
1583      func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
1584      line="13"}
1585      (gdb)
1586
1587 The '-exec-finish' Command
1588 --------------------------
1589
1590 Synopsis
1591 ........
1592
1593       -exec-finish [--reverse]
1594
1595    Resumes the execution of the inferior program until the current
1596 function is exited.  Displays the results returned by the function.  If
1597 the '--reverse' option is specified, resumes the reverse execution of
1598 the inferior program until the point where current function was called.
1599
1600 GDB Command
1601 ...........
1602
1603 The corresponding GDB command is 'finish'.
1604
1605 Example
1606 .......
1607
1608 Function returning 'void'.
1609
1610      -exec-finish
1611      ^running
1612      (gdb)
1613      @hello from foo
1614      *stopped,reason="function-finished",frame={func="main",args=[],
1615      file="hello.c",fullname="/home/foo/bar/hello.c",line="7"}
1616      (gdb)
1617
1618    Function returning other than 'void'.  The name of the internal GDB
1619 variable storing the result is printed, together with the value itself.
1620
1621      -exec-finish
1622      ^running
1623      (gdb)
1624      *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
1625      args=[{name="a",value="1"],{name="b",value="9"}},
1626      file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1627      gdb-result-var="$1",return-value="0"
1628      (gdb)
1629
1630 The '-exec-interrupt' Command
1631 -----------------------------
1632
1633 Synopsis
1634 ........
1635
1636       -exec-interrupt [--all|--thread-group N]
1637
1638    Interrupts the background execution of the target.  Note how the
1639 token associated with the stop message is the one for the execution
1640 command that has been interrupted.  The token for the interrupt itself
1641 only appears in the '^done' output.  If the user is trying to interrupt
1642 a non-running program, an error message will be printed.
1643
1644    Note that when asynchronous execution is enabled, this command is
1645 asynchronous just like other execution commands.  That is, first the
1646 '^done' response will be printed, and the target stop will be reported
1647 after that using the '*stopped' notification.
1648
1649    In non-stop mode, only the context thread is interrupted by default.
1650 All threads (in all inferiors) will be interrupted if the '--all' option
1651 is specified.  If the '--thread-group' option is specified, all threads
1652 in that group will be interrupted.
1653
1654 GDB Command
1655 ...........
1656
1657 The corresponding GDB command is 'interrupt'.
1658
1659 Example
1660 .......
1661
1662      (gdb)
1663      111-exec-continue
1664      111^running
1665
1666      (gdb)
1667      222-exec-interrupt
1668      222^done
1669      (gdb)
1670      111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
1671      frame={addr="0x00010140",func="foo",args=[],file="try.c",
1672      fullname="/home/foo/bar/try.c",line="13"}
1673      (gdb)
1674
1675      (gdb)
1676      -exec-interrupt
1677      ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
1678      (gdb)
1679
1680 The '-exec-jump' Command
1681 ------------------------
1682
1683 Synopsis
1684 ........
1685
1686       -exec-jump LOCATION
1687
1688    Resumes execution of the inferior program at the location specified
1689 by parameter.  *Note Specify Location::, for a description of the
1690 different forms of LOCATION.
1691
1692 GDB Command
1693 ...........
1694
1695 The corresponding GDB command is 'jump'.
1696
1697 Example
1698 .......
1699
1700      -exec-jump foo.c:10
1701      *running,thread-id="all"
1702      ^running
1703
1704 The '-exec-next' Command
1705 ------------------------
1706
1707 Synopsis
1708 ........
1709
1710       -exec-next [--reverse]
1711
1712    Resumes execution of the inferior program, stopping when the
1713 beginning of the next source line is reached.
1714
1715    If the '--reverse' option is specified, resumes reverse execution of
1716 the inferior program, stopping at the beginning of the previous source
1717 line.  If you issue this command on the first line of a function, it
1718 will take you back to the caller of that function, to the source line
1719 where the function was called.
1720
1721 GDB Command
1722 ...........
1723
1724 The corresponding GDB command is 'next'.
1725
1726 Example
1727 .......
1728
1729      -exec-next
1730      ^running
1731      (gdb)
1732      *stopped,reason="end-stepping-range",line="8",file="hello.c"
1733      (gdb)
1734
1735 The '-exec-next-instruction' Command
1736 ------------------------------------
1737
1738 Synopsis
1739 ........
1740
1741       -exec-next-instruction [--reverse]
1742
1743    Executes one machine instruction.  If the instruction is a function
1744 call, continues until the function returns.  If the program stops at an
1745 instruction in the middle of a source line, the address will be printed
1746 as well.
1747
1748    If the '--reverse' option is specified, resumes reverse execution of
1749 the inferior program, stopping at the previous instruction.  If the
1750 previously executed instruction was a return from another function, it
1751 will continue to execute in reverse until the call to that function
1752 (from the current stack frame) is reached.
1753
1754 GDB Command
1755 ...........
1756
1757 The corresponding GDB command is 'nexti'.
1758
1759 Example
1760 .......
1761
1762      (gdb)
1763      -exec-next-instruction
1764      ^running
1765
1766      (gdb)
1767      *stopped,reason="end-stepping-range",
1768      addr="0x000100d4",line="5",file="hello.c"
1769      (gdb)
1770
1771 The '-exec-return' Command
1772 --------------------------
1773
1774 Synopsis
1775 ........
1776
1777       -exec-return
1778
1779    Makes current function return immediately.  Doesn't execute the
1780 inferior.  Displays the new current frame.
1781
1782 GDB Command
1783 ...........
1784
1785 The corresponding GDB command is 'return'.
1786
1787 Example
1788 .......
1789
1790      (gdb)
1791      200-break-insert callee4
1792      200^done,bkpt={number="1",addr="0x00010734",
1793      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
1794      (gdb)
1795      000-exec-run
1796      000^running
1797      (gdb)
1798      000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
1799      frame={func="callee4",args=[],
1800      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1801      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
1802      (gdb)
1803      205-break-delete
1804      205^done
1805      (gdb)
1806      111-exec-return
1807      111^done,frame={level="0",func="callee3",
1808      args=[{name="strarg",
1809      value="0x11940 \"A string argument.\""}],
1810      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1811      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
1812      (gdb)
1813
1814 The '-exec-run' Command
1815 -----------------------
1816
1817 Synopsis
1818 ........
1819
1820       -exec-run [ --all | --thread-group N ] [ --start ]
1821
1822    Starts execution of the inferior from the beginning.  The inferior
1823 executes until either a breakpoint is encountered or the program exits.
1824 In the latter case the output will include an exit code, if the program
1825 has exited exceptionally.
1826
1827    When neither the '--all' nor the '--thread-group' option is
1828 specified, the current inferior is started.  If the '--thread-group'
1829 option is specified, it should refer to a thread group of type
1830 'process', and that thread group will be started.  If the '--all' option
1831 is specified, then all inferiors will be started.
1832
1833    Using the '--start' option instructs the debugger to stop the
1834 execution at the start of the inferior's main subprogram, following the
1835 same behavior as the 'start' command (*note Starting::).
1836
1837 GDB Command
1838 ...........
1839
1840 The corresponding GDB command is 'run'.
1841
1842 Examples
1843 ........
1844
1845      (gdb)
1846      -break-insert main
1847      ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
1848      (gdb)
1849      -exec-run
1850      ^running
1851      (gdb)
1852      *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
1853      frame={func="main",args=[],file="recursive2.c",
1854      fullname="/home/foo/bar/recursive2.c",line="4"}
1855      (gdb)
1856
1857 Program exited normally:
1858
1859      (gdb)
1860      -exec-run
1861      ^running
1862      (gdb)
1863      x = 55
1864      *stopped,reason="exited-normally"
1865      (gdb)
1866
1867 Program exited exceptionally:
1868
1869      (gdb)
1870      -exec-run
1871      ^running
1872      (gdb)
1873      x = 55
1874      *stopped,reason="exited",exit-code="01"
1875      (gdb)
1876
1877    Another way the program can terminate is if it receives a signal such
1878 as 'SIGINT'.  In this case, GDB/MI displays this:
1879
1880      (gdb)
1881      *stopped,reason="exited-signalled",signal-name="SIGINT",
1882      signal-meaning="Interrupt"
1883
1884 The '-exec-step' Command
1885 ------------------------
1886
1887 Synopsis
1888 ........
1889
1890       -exec-step [--reverse]
1891
1892    Resumes execution of the inferior program, stopping when the
1893 beginning of the next source line is reached, if the next source line is
1894 not a function call.  If it is, stop at the first instruction of the
1895 called function.  If the '--reverse' option is specified, resumes
1896 reverse execution of the inferior program, stopping at the beginning of
1897 the previously executed source line.
1898
1899 GDB Command
1900 ...........
1901
1902 The corresponding GDB command is 'step'.
1903
1904 Example
1905 .......
1906
1907 Stepping into a function:
1908
1909      -exec-step
1910      ^running
1911      (gdb)
1912      *stopped,reason="end-stepping-range",
1913      frame={func="foo",args=[{name="a",value="10"},
1914      {name="b",value="0"}],file="recursive2.c",
1915      fullname="/home/foo/bar/recursive2.c",line="11"}
1916      (gdb)
1917
1918    Regular stepping:
1919
1920      -exec-step
1921      ^running
1922      (gdb)
1923      *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
1924      (gdb)
1925
1926 The '-exec-step-instruction' Command
1927 ------------------------------------
1928
1929 Synopsis
1930 ........
1931
1932       -exec-step-instruction [--reverse]
1933
1934    Resumes the inferior which executes one machine instruction.  If the
1935 '--reverse' option is specified, resumes reverse execution of the
1936 inferior program, stopping at the previously executed instruction.  The
1937 output, once GDB has stopped, will vary depending on whether we have
1938 stopped in the middle of a source line or not.  In the former case, the
1939 address at which the program stopped will be printed as well.
1940
1941 GDB Command
1942 ...........
1943
1944 The corresponding GDB command is 'stepi'.
1945
1946 Example
1947 .......
1948
1949      (gdb)
1950      -exec-step-instruction
1951      ^running
1952
1953      (gdb)
1954      *stopped,reason="end-stepping-range",
1955      frame={func="foo",args=[],file="try.c",
1956      fullname="/home/foo/bar/try.c",line="10"}
1957      (gdb)
1958      -exec-step-instruction
1959      ^running
1960
1961      (gdb)
1962      *stopped,reason="end-stepping-range",
1963      frame={addr="0x000100f4",func="foo",args=[],file="try.c",
1964      fullname="/home/foo/bar/try.c",line="10"}
1965      (gdb)
1966
1967 The '-exec-until' Command
1968 -------------------------
1969
1970 Synopsis
1971 ........
1972
1973       -exec-until [ LOCATION ]
1974
1975    Executes the inferior until the LOCATION specified in the argument is
1976 reached.  If there is no argument, the inferior executes until a source
1977 line greater than the current one is reached.  The reason for stopping
1978 in this case will be 'location-reached'.
1979
1980 GDB Command
1981 ...........
1982
1983 The corresponding GDB command is 'until'.
1984
1985 Example
1986 .......
1987
1988      (gdb)
1989      -exec-until recursive2.c:6
1990      ^running
1991      (gdb)
1992      x = 55
1993      *stopped,reason="location-reached",frame={func="main",args=[],
1994      file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"}
1995      (gdb)
1996
1997 \1f
1998 File: gdb.info,  Node: GDB/MI Stack Manipulation,  Next: GDB/MI Variable Objects,  Prev: GDB/MI Program Execution,  Up: GDB/MI
1999
2000 27.14 GDB/MI Stack Manipulation Commands
2001 ========================================
2002
2003 The '-enable-frame-filters' Command
2004 -----------------------------------
2005
2006      -enable-frame-filters
2007
2008    GDB allows Python-based frame filters to affect the output of the MI
2009 commands relating to stack traces.  As there is no way to implement this
2010 in a fully backward-compatible way, a front end must request that this
2011 functionality be enabled.
2012
2013    Once enabled, this feature cannot be disabled.
2014
2015    Note that if Python support has not been compiled into GDB, this
2016 command will still succeed (and do nothing).
2017
2018 The '-stack-info-frame' Command
2019 -------------------------------
2020
2021 Synopsis
2022 ........
2023
2024       -stack-info-frame
2025
2026    Get info on the selected frame.
2027
2028 GDB Command
2029 ...........
2030
2031 The corresponding GDB command is 'info frame' or 'frame' (without
2032 arguments).
2033
2034 Example
2035 .......
2036
2037      (gdb)
2038      -stack-info-frame
2039      ^done,frame={level="1",addr="0x0001076c",func="callee3",
2040      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
2041      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"}
2042      (gdb)
2043
2044 The '-stack-info-depth' Command
2045 -------------------------------
2046
2047 Synopsis
2048 ........
2049
2050       -stack-info-depth [ MAX-DEPTH ]
2051
2052    Return the depth of the stack.  If the integer argument MAX-DEPTH is
2053 specified, do not count beyond MAX-DEPTH frames.
2054
2055 GDB Command
2056 ...........
2057
2058 There's no equivalent GDB command.
2059
2060 Example
2061 .......
2062
2063 For a stack with frame levels 0 through 11:
2064
2065      (gdb)
2066      -stack-info-depth
2067      ^done,depth="12"
2068      (gdb)
2069      -stack-info-depth 4
2070      ^done,depth="4"
2071      (gdb)
2072      -stack-info-depth 12
2073      ^done,depth="12"
2074      (gdb)
2075      -stack-info-depth 11
2076      ^done,depth="11"
2077      (gdb)
2078      -stack-info-depth 13
2079      ^done,depth="12"
2080      (gdb)
2081
2082 The '-stack-list-arguments' Command
2083 -----------------------------------
2084
2085 Synopsis
2086 ........
2087
2088       -stack-list-arguments [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
2089          [ LOW-FRAME HIGH-FRAME ]
2090
2091    Display a list of the arguments for the frames between LOW-FRAME and
2092 HIGH-FRAME (inclusive).  If LOW-FRAME and HIGH-FRAME are not provided,
2093 list the arguments for the whole call stack.  If the two arguments are
2094 equal, show the single frame at the corresponding level.  It is an error
2095 if LOW-FRAME is larger than the actual number of frames.  On the other
2096 hand, HIGH-FRAME may be larger than the actual number of frames, in
2097 which case only existing frames will be returned.
2098
2099    If PRINT-VALUES is 0 or '--no-values', print only the names of the
2100 variables; if it is 1 or '--all-values', print also their values; and if
2101 it is 2 or '--simple-values', print the name, type and value for simple
2102 data types, and the name and type for arrays, structures and unions.  If
2103 the option '--no-frame-filters' is supplied, then Python frame filters
2104 will not be executed.
2105
2106    If the '--skip-unavailable' option is specified, arguments that are
2107 not available are not listed.  Partially available arguments are still
2108 displayed, however.
2109
2110    Use of this command to obtain arguments in a single frame is
2111 deprecated in favor of the '-stack-list-variables' command.
2112
2113 GDB Command
2114 ...........
2115
2116 GDB does not have an equivalent command.  'gdbtk' has a 'gdb_get_args'
2117 command which partially overlaps with the functionality of
2118 '-stack-list-arguments'.
2119
2120 Example
2121 .......
2122
2123      (gdb)
2124      -stack-list-frames
2125      ^done,
2126      stack=[
2127      frame={level="0",addr="0x00010734",func="callee4",
2128      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
2129      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"},
2130      frame={level="1",addr="0x0001076c",func="callee3",
2131      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
2132      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"},
2133      frame={level="2",addr="0x0001078c",func="callee2",
2134      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
2135      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"},
2136      frame={level="3",addr="0x000107b4",func="callee1",
2137      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
2138      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"},
2139      frame={level="4",addr="0x000107e0",func="main",
2140      file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
2141      fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"}]
2142      (gdb)
2143      -stack-list-arguments 0
2144      ^done,
2145      stack-args=[
2146      frame={level="0",args=[]},
2147      frame={level="1",args=[name="strarg"]},
2148      frame={level="2",args=[name="intarg",name="strarg"]},
2149      frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
2150      frame={level="4",args=[]}]
2151      (gdb)
2152      -stack-list-arguments 1
2153      ^done,
2154      stack-args=[
2155      frame={level="0",args=[]},
2156      frame={level="1",
2157       args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
2158      frame={level="2",args=[
2159      {name="intarg",value="2"},
2160      {name="strarg",value="0x11940 \"A string argument.\""}]},
2161      {frame={level="3",args=[
2162      {name="intarg",value="2"},
2163      {name="strarg",value="0x11940 \"A string argument.\""},
2164      {name="fltarg",value="3.5"}]},
2165      frame={level="4",args=[]}]
2166      (gdb)
2167      -stack-list-arguments 0 2 2
2168      ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
2169      (gdb)
2170      -stack-list-arguments 1 2 2
2171      ^done,stack-args=[frame={level="2",
2172      args=[{name="intarg",value="2"},
2173      {name="strarg",value="0x11940 \"A string argument.\""}]}]
2174      (gdb)
2175
2176 The '-stack-list-frames' Command
2177 --------------------------------
2178
2179 Synopsis
2180 ........
2181
2182       -stack-list-frames [ --no-frame-filters LOW-FRAME HIGH-FRAME ]
2183
2184    List the frames currently on the stack.  For each frame it displays
2185 the following info:
2186
2187 'LEVEL'
2188      The frame number, 0 being the topmost frame, i.e., the innermost
2189      function.
2190 'ADDR'
2191      The '$pc' value for that frame.
2192 'FUNC'
2193      Function name.
2194 'FILE'
2195      File name of the source file where the function lives.
2196 'FULLNAME'
2197      The full file name of the source file where the function lives.
2198 'LINE'
2199      Line number corresponding to the '$pc'.
2200 'FROM'
2201      The shared library where this function is defined.  This is only
2202      given if the frame's function is not known.
2203
2204    If invoked without arguments, this command prints a backtrace for the
2205 whole stack.  If given two integer arguments, it shows the frames whose
2206 levels are between the two arguments (inclusive).  If the two arguments
2207 are equal, it shows the single frame at the corresponding level.  It is
2208 an error if LOW-FRAME is larger than the actual number of frames.  On
2209 the other hand, HIGH-FRAME may be larger than the actual number of
2210 frames, in which case only existing frames will be returned.  If the
2211 option '--no-frame-filters' is supplied, then Python frame filters will
2212 not be executed.
2213
2214 GDB Command
2215 ...........
2216
2217 The corresponding GDB commands are 'backtrace' and 'where'.
2218
2219 Example
2220 .......
2221
2222 Full stack backtrace:
2223
2224      (gdb)
2225      -stack-list-frames
2226      ^done,stack=
2227      [frame={level="0",addr="0x0001076c",func="foo",
2228        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"},
2229      frame={level="1",addr="0x000107a4",func="foo",
2230        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2231      frame={level="2",addr="0x000107a4",func="foo",
2232        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2233      frame={level="3",addr="0x000107a4",func="foo",
2234        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2235      frame={level="4",addr="0x000107a4",func="foo",
2236        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2237      frame={level="5",addr="0x000107a4",func="foo",
2238        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2239      frame={level="6",addr="0x000107a4",func="foo",
2240        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2241      frame={level="7",addr="0x000107a4",func="foo",
2242        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2243      frame={level="8",addr="0x000107a4",func="foo",
2244        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2245      frame={level="9",addr="0x000107a4",func="foo",
2246        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2247      frame={level="10",addr="0x000107a4",func="foo",
2248        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2249      frame={level="11",addr="0x00010738",func="main",
2250        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"}]
2251      (gdb)
2252
2253    Show frames between LOW_FRAME and HIGH_FRAME:
2254
2255      (gdb)
2256      -stack-list-frames 3 5
2257      ^done,stack=
2258      [frame={level="3",addr="0x000107a4",func="foo",
2259        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2260      frame={level="4",addr="0x000107a4",func="foo",
2261        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
2262      frame={level="5",addr="0x000107a4",func="foo",
2263        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}]
2264      (gdb)
2265
2266    Show a single frame:
2267
2268      (gdb)
2269      -stack-list-frames 3 3
2270      ^done,stack=
2271      [frame={level="3",addr="0x000107a4",func="foo",
2272        file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}]
2273      (gdb)
2274
2275 The '-stack-list-locals' Command
2276 --------------------------------
2277
2278 Synopsis
2279 ........
2280
2281       -stack-list-locals [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
2282
2283    Display the local variable names for the selected frame.  If
2284 PRINT-VALUES is 0 or '--no-values', print only the names of the
2285 variables; if it is 1 or '--all-values', print also their values; and if
2286 it is 2 or '--simple-values', print the name, type and value for simple
2287 data types, and the name and type for arrays, structures and unions.  In
2288 this last case, a frontend can immediately display the value of simple
2289 data types and create variable objects for other data types when the
2290 user wishes to explore their values in more detail.  If the option
2291 '--no-frame-filters' is supplied, then Python frame filters will not be
2292 executed.
2293
2294    If the '--skip-unavailable' option is specified, local variables that
2295 are not available are not listed.  Partially available local variables
2296 are still displayed, however.
2297
2298    This command is deprecated in favor of the '-stack-list-variables'
2299 command.
2300
2301 GDB Command
2302 ...........
2303
2304 'info locals' in GDB, 'gdb_get_locals' in 'gdbtk'.
2305
2306 Example
2307 .......
2308
2309      (gdb)
2310      -stack-list-locals 0
2311      ^done,locals=[name="A",name="B",name="C"]
2312      (gdb)
2313      -stack-list-locals --all-values
2314      ^done,locals=[{name="A",value="1"},{name="B",value="2"},
2315        {name="C",value="{1, 2, 3}"}]
2316      -stack-list-locals --simple-values
2317      ^done,locals=[{name="A",type="int",value="1"},
2318        {name="B",type="int",value="2"},{name="C",type="int [3]"}]
2319      (gdb)
2320
2321 The '-stack-list-variables' Command
2322 -----------------------------------
2323
2324 Synopsis
2325 ........
2326
2327       -stack-list-variables [ --no-frame-filters ] [ --skip-unavailable ] PRINT-VALUES
2328
2329    Display the names of local variables and function arguments for the
2330 selected frame.  If PRINT-VALUES is 0 or '--no-values', print only the
2331 names of the variables; if it is 1 or '--all-values', print also their
2332 values; and if it is 2 or '--simple-values', print the name, type and
2333 value for simple data types, and the name and type for arrays,
2334 structures and unions.  If the option '--no-frame-filters' is supplied,
2335 then Python frame filters will not be executed.
2336
2337    If the '--skip-unavailable' option is specified, local variables and
2338 arguments that are not available are not listed.  Partially available
2339 arguments and local variables are still displayed, however.
2340
2341 Example
2342 .......
2343
2344      (gdb)
2345      -stack-list-variables --thread 1 --frame 0 --all-values
2346      ^done,variables=[{name="x",value="11"},{name="s",value="{a = 1, b = 2}"}]
2347      (gdb)
2348
2349 The '-stack-select-frame' Command
2350 ---------------------------------
2351
2352 Synopsis
2353 ........
2354
2355       -stack-select-frame FRAMENUM
2356
2357    Change the selected frame.  Select a different frame FRAMENUM on the
2358 stack.
2359
2360    This command in deprecated in favor of passing the '--frame' option
2361 to every command.
2362
2363 GDB Command
2364 ...........
2365
2366 The corresponding GDB commands are 'frame', 'up', 'down',
2367 'select-frame', 'up-silent', and 'down-silent'.
2368
2369 Example
2370 .......
2371
2372      (gdb)
2373      -stack-select-frame 2
2374      ^done
2375      (gdb)
2376
2377 \1f
2378 File: gdb.info,  Node: GDB/MI Variable Objects,  Next: GDB/MI Data Manipulation,  Prev: GDB/MI Stack Manipulation,  Up: GDB/MI
2379
2380 27.15 GDB/MI Variable Objects
2381 =============================
2382
2383 Introduction to Variable Objects
2384 --------------------------------
2385
2386 Variable objects are "object-oriented" MI interface for examining and
2387 changing values of expressions.  Unlike some other MI interfaces that
2388 work with expressions, variable objects are specifically designed for
2389 simple and efficient presentation in the frontend.  A variable object is
2390 identified by string name.  When a variable object is created, the
2391 frontend specifies the expression for that variable object.  The
2392 expression can be a simple variable, or it can be an arbitrary complex
2393 expression, and can even involve CPU registers.  After creating a
2394 variable object, the frontend can invoke other variable object
2395 operations--for example to obtain or change the value of a variable
2396 object, or to change display format.
2397
2398    Variable objects have hierarchical tree structure.  Any variable
2399 object that corresponds to a composite type, such as structure in C, has
2400 a number of child variable objects, for example corresponding to each
2401 element of a structure.  A child variable object can itself have
2402 children, recursively.  Recursion ends when we reach leaf variable
2403 objects, which always have built-in types.  Child variable objects are
2404 created only by explicit request, so if a frontend is not interested in
2405 the children of a particular variable object, no child will be created.
2406
2407    For a leaf variable object it is possible to obtain its value as a
2408 string, or set the value from a string.  String value can be also
2409 obtained for a non-leaf variable object, but it's generally a string
2410 that only indicates the type of the object, and does not list its
2411 contents.  Assignment to a non-leaf variable object is not allowed.
2412
2413    A frontend does not need to read the values of all variable objects
2414 each time the program stops.  Instead, MI provides an update command
2415 that lists all variable objects whose values has changed since the last
2416 update operation.  This considerably reduces the amount of data that
2417 must be transferred to the frontend.  As noted above, children variable
2418 objects are created on demand, and only leaf variable objects have a
2419 real value.  As result, gdb will read target memory only for leaf
2420 variables that frontend has created.
2421
2422    The automatic update is not always desirable.  For example, a
2423 frontend might want to keep a value of some expression for future
2424 reference, and never update it.  For another example, fetching memory is
2425 relatively slow for embedded targets, so a frontend might want to
2426 disable automatic update for the variables that are either not visible
2427 on the screen, or "closed".  This is possible using so called "frozen
2428 variable objects".  Such variable objects are never implicitly updated.
2429
2430    Variable objects can be either "fixed" or "floating".  For the fixed
2431 variable object, the expression is parsed when the variable object is
2432 created, including associating identifiers to specific variables.  The
2433 meaning of expression never changes.  For a floating variable object the
2434 values of variables whose names appear in the expressions are
2435 re-evaluated every time in the context of the current frame.  Consider
2436 this example:
2437
2438      void do_work(...)
2439      {
2440              struct work_state state;
2441
2442              if (...)
2443                 do_work(...);
2444      }
2445
2446    If a fixed variable object for the 'state' variable is created in
2447 this function, and we enter the recursive call, the variable object will
2448 report the value of 'state' in the top-level 'do_work' invocation.  On
2449 the other hand, a floating variable object will report the value of
2450 'state' in the current frame.
2451
2452    If an expression specified when creating a fixed variable object
2453 refers to a local variable, the variable object becomes bound to the
2454 thread and frame in which the variable object is created.  When such
2455 variable object is updated, GDB makes sure that the thread/frame
2456 combination the variable object is bound to still exists, and
2457 re-evaluates the variable object in context of that thread/frame.
2458
2459    The following is the complete set of GDB/MI operations defined to
2460 access this functionality:
2461
2462 *Operation*                   *Description*
2463                               
2464 '-enable-pretty-printing'     enable Python-based pretty-printing
2465 '-var-create'                 create a variable object
2466 '-var-delete'                 delete the variable object and/or its
2467                               children
2468 '-var-set-format'             set the display format of this variable
2469 '-var-show-format'            show the display format of this variable
2470 '-var-info-num-children'      tells how many children this object has
2471 '-var-list-children'          return a list of the object's children
2472 '-var-info-type'              show the type of this variable object
2473 '-var-info-expression'        print parent-relative expression that
2474                               this variable object represents
2475 '-var-info-path-expression'   print full expression that this variable
2476                               object represents
2477 '-var-show-attributes'        is this variable editable?  does it exist
2478                               here?
2479 '-var-evaluate-expression'    get the value of this variable
2480 '-var-assign'                 set the value of this variable
2481 '-var-update'                 update the variable and its children
2482 '-var-set-frozen'             set frozeness attribute
2483 '-var-set-update-range'       set range of children to display on
2484                               update
2485
2486    In the next subsection we describe each operation in detail and
2487 suggest how it can be used.
2488
2489 Description And Use of Operations on Variable Objects
2490 -----------------------------------------------------
2491
2492 The '-enable-pretty-printing' Command
2493 -------------------------------------
2494
2495      -enable-pretty-printing
2496
2497    GDB allows Python-based visualizers to affect the output of the MI
2498 variable object commands.  However, because there was no way to
2499 implement this in a fully backward-compatible way, a front end must
2500 request that this functionality be enabled.
2501
2502    Once enabled, this feature cannot be disabled.
2503
2504    Note that if Python support has not been compiled into GDB, this
2505 command will still succeed (and do nothing).
2506
2507    This feature is currently (as of GDB 7.0) experimental, and may work
2508 differently in future versions of GDB.
2509
2510 The '-var-create' Command
2511 -------------------------
2512
2513 Synopsis
2514 ........
2515
2516       -var-create {NAME | "-"}
2517          {FRAME-ADDR | "*" | "@"} EXPRESSION
2518
2519    This operation creates a variable object, which allows the monitoring
2520 of a variable, the result of an expression, a memory cell or a CPU
2521 register.
2522
2523    The NAME parameter is the string by which the object can be
2524 referenced.  It must be unique.  If '-' is specified, the varobj system
2525 will generate a string "varNNNNNN" automatically.  It will be unique
2526 provided that one does not specify NAME of that format.  The command
2527 fails if a duplicate name is found.
2528
2529    The frame under which the expression should be evaluated can be
2530 specified by FRAME-ADDR.  A '*' indicates that the current frame should
2531 be used.  A '@' indicates that a floating variable object must be
2532 created.
2533
2534    EXPRESSION is any expression valid on the current language set (must
2535 not begin with a '*'), or one of the following:
2536
2537    * '*ADDR', where ADDR is the address of a memory cell
2538
2539    * '*ADDR-ADDR' -- a memory address range (TBD)
2540
2541    * '$REGNAME' -- a CPU register name
2542
2543    A varobj's contents may be provided by a Python-based pretty-printer.
2544 In this case the varobj is known as a "dynamic varobj".  Dynamic varobjs
2545 have slightly different semantics in some cases.  If the
2546 '-enable-pretty-printing' command is not sent, then GDB will never
2547 create a dynamic varobj.  This ensures backward compatibility for
2548 existing clients.
2549
2550 Result
2551 ......
2552
2553 This operation returns attributes of the newly-created varobj.  These
2554 are:
2555
2556 'name'
2557      The name of the varobj.
2558
2559 'numchild'
2560      The number of children of the varobj.  This number is not
2561      necessarily reliable for a dynamic varobj.  Instead, you must
2562      examine the 'has_more' attribute.
2563
2564 'value'
2565      The varobj's scalar value.  For a varobj whose type is some sort of
2566      aggregate (e.g., a 'struct'), or for a dynamic varobj, this value
2567      will not be interesting.
2568
2569 'type'
2570      The varobj's type.  This is a string representation of the type, as
2571      would be printed by the GDB CLI. If 'print object' (*note set print
2572      object: Print Settings.) is set to 'on', the _actual_ (derived)
2573      type of the object is shown rather than the _declared_ one.
2574
2575 'thread-id'
2576      If a variable object is bound to a specific thread, then this is
2577      the thread's identifier.
2578
2579 'has_more'
2580      For a dynamic varobj, this indicates whether there appear to be any
2581      children available.  For a non-dynamic varobj, this will be 0.
2582
2583 'dynamic'
2584      This attribute will be present and have the value '1' if the varobj
2585      is a dynamic varobj.  If the varobj is not a dynamic varobj, then
2586      this attribute will not be present.
2587
2588 'displayhint'
2589      A dynamic varobj can supply a display hint to the front end.  The
2590      value comes directly from the Python pretty-printer object's
2591      'display_hint' method.  *Note Pretty Printing API::.
2592
2593    Typical output will look like this:
2594
2595       name="NAME",numchild="N",type="TYPE",thread-id="M",
2596        has_more="HAS_MORE"
2597
2598 The '-var-delete' Command
2599 -------------------------
2600
2601 Synopsis
2602 ........
2603
2604       -var-delete [ -c ] NAME
2605
2606    Deletes a previously created variable object and all of its children.
2607 With the '-c' option, just deletes the children.
2608
2609    Returns an error if the object NAME is not found.
2610
2611 The '-var-set-format' Command
2612 -----------------------------
2613
2614 Synopsis
2615 ........
2616
2617       -var-set-format NAME FORMAT-SPEC
2618
2619    Sets the output format for the value of the object NAME to be
2620 FORMAT-SPEC.
2621
2622    The syntax for the FORMAT-SPEC is as follows:
2623
2624       FORMAT-SPEC ==>
2625       {binary | decimal | hexadecimal | octal | natural}
2626
2627    The natural format is the default format choosen automatically based
2628 on the variable type (like decimal for an 'int', hex for pointers,
2629 etc.).
2630
2631    For a variable with children, the format is set only on the variable
2632 itself, and the children are not affected.
2633
2634 The '-var-show-format' Command
2635 ------------------------------
2636
2637 Synopsis
2638 ........
2639
2640       -var-show-format NAME
2641
2642    Returns the format used to display the value of the object NAME.
2643
2644       FORMAT ==>
2645       FORMAT-SPEC
2646
2647 The '-var-info-num-children' Command
2648 ------------------------------------
2649
2650 Synopsis
2651 ........
2652
2653       -var-info-num-children NAME
2654
2655    Returns the number of children of a variable object NAME:
2656
2657       numchild=N
2658
2659    Note that this number is not completely reliable for a dynamic
2660 varobj.  It will return the current number of children, but more
2661 children may be available.
2662
2663 The '-var-list-children' Command
2664 --------------------------------
2665
2666 Synopsis
2667 ........
2668
2669       -var-list-children [PRINT-VALUES] NAME [FROM TO]
2670
2671    Return a list of the children of the specified variable object and
2672 create variable objects for them, if they do not already exist.  With a
2673 single argument or if PRINT-VALUES has a value of 0 or '--no-values',
2674 print only the names of the variables; if PRINT-VALUES is 1 or
2675 '--all-values', also print their values; and if it is 2 or
2676 '--simple-values' print the name and value for simple data types and
2677 just the name for arrays, structures and unions.
2678
2679    FROM and TO, if specified, indicate the range of children to report.
2680 If FROM or TO is less than zero, the range is reset and all children
2681 will be reported.  Otherwise, children starting at FROM (zero-based) and
2682 up to and excluding TO will be reported.
2683
2684    If a child range is requested, it will only affect the current call
2685 to '-var-list-children', but not future calls to '-var-update'.  For
2686 this, you must instead use '-var-set-update-range'.  The intent of this
2687 approach is to enable a front end to implement any update approach it
2688 likes; for example, scrolling a view may cause the front end to request
2689 more children with '-var-list-children', and then the front end could
2690 call '-var-set-update-range' with a different range to ensure that
2691 future updates are restricted to just the visible items.
2692
2693    For each child the following results are returned:
2694
2695 NAME
2696      Name of the variable object created for this child.
2697
2698 EXP
2699      The expression to be shown to the user by the front end to
2700      designate this child.  For example this may be the name of a
2701      structure member.
2702
2703      For a dynamic varobj, this value cannot be used to form an
2704      expression.  There is no way to do this at all with a dynamic
2705      varobj.
2706
2707      For C/C++ structures there are several pseudo children returned to
2708      designate access qualifiers.  For these pseudo children EXP is
2709      'public', 'private', or 'protected'.  In this case the type and
2710      value are not present.
2711
2712      A dynamic varobj will not report the access qualifying
2713      pseudo-children, regardless of the language.  This information is
2714      not available at all with a dynamic varobj.
2715
2716 NUMCHILD
2717      Number of children this child has.  For a dynamic varobj, this will
2718      be 0.
2719
2720 TYPE
2721      The type of the child.  If 'print object' (*note set print object:
2722      Print Settings.) is set to 'on', the _actual_ (derived) type of the
2723      object is shown rather than the _declared_ one.
2724
2725 VALUE
2726      If values were requested, this is the value.
2727
2728 THREAD-ID
2729      If this variable object is associated with a thread, this is the
2730      thread id.  Otherwise this result is not present.
2731
2732 FROZEN
2733      If the variable object is frozen, this variable will be present
2734      with a value of 1.
2735
2736 DISPLAYHINT
2737      A dynamic varobj can supply a display hint to the front end.  The
2738      value comes directly from the Python pretty-printer object's
2739      'display_hint' method.  *Note Pretty Printing API::.
2740
2741 DYNAMIC
2742      This attribute will be present and have the value '1' if the varobj
2743      is a dynamic varobj.  If the varobj is not a dynamic varobj, then
2744      this attribute will not be present.
2745
2746    The result may have its own attributes:
2747
2748 'displayhint'
2749      A dynamic varobj can supply a display hint to the front end.  The
2750      value comes directly from the Python pretty-printer object's
2751      'display_hint' method.  *Note Pretty Printing API::.
2752
2753 'has_more'
2754      This is an integer attribute which is nonzero if there are children
2755      remaining after the end of the selected range.
2756
2757 Example
2758 .......
2759
2760      (gdb)
2761       -var-list-children n
2762       ^done,numchild=N,children=[child={name=NAME,exp=EXP,
2763       numchild=N,type=TYPE},(repeats N times)]
2764      (gdb)
2765       -var-list-children --all-values n
2766       ^done,numchild=N,children=[child={name=NAME,exp=EXP,
2767       numchild=N,value=VALUE,type=TYPE},(repeats N times)]
2768
2769 The '-var-info-type' Command
2770 ----------------------------
2771
2772 Synopsis
2773 ........
2774
2775       -var-info-type NAME
2776
2777    Returns the type of the specified variable NAME.  The type is
2778 returned as a string in the same format as it is output by the GDB CLI:
2779
2780       type=TYPENAME
2781
2782 The '-var-info-expression' Command
2783 ----------------------------------
2784
2785 Synopsis
2786 ........
2787
2788       -var-info-expression NAME
2789
2790    Returns a string that is suitable for presenting this variable object
2791 in user interface.  The string is generally not valid expression in the
2792 current language, and cannot be evaluated.
2793
2794    For example, if 'a' is an array, and variable object 'A' was created
2795 for 'a', then we'll get this output:
2796
2797      (gdb) -var-info-expression A.1
2798      ^done,lang="C",exp="1"
2799
2800 Here, the value of 'lang' is the language name, which can be found in
2801 *note Supported Languages::.
2802
2803    Note that the output of the '-var-list-children' command also
2804 includes those expressions, so the '-var-info-expression' command is of
2805 limited use.
2806
2807 The '-var-info-path-expression' Command
2808 ---------------------------------------
2809
2810 Synopsis
2811 ........
2812
2813       -var-info-path-expression NAME
2814
2815    Returns an expression that can be evaluated in the current context
2816 and will yield the same value that a variable object has.  Compare this
2817 with the '-var-info-expression' command, which result can be used only
2818 for UI presentation.  Typical use of the '-var-info-path-expression'
2819 command is creating a watchpoint from a variable object.
2820
2821    This command is currently not valid for children of a dynamic varobj,
2822 and will give an error when invoked on one.
2823
2824    For example, suppose 'C' is a C++ class, derived from class 'Base',
2825 and that the 'Base' class has a member called 'm_size'.  Assume a
2826 variable 'c' is has the type of 'C' and a variable object 'C' was
2827 created for variable 'c'.  Then, we'll get this output:
2828      (gdb) -var-info-path-expression C.Base.public.m_size
2829      ^done,path_expr=((Base)c).m_size)
2830
2831 The '-var-show-attributes' Command
2832 ----------------------------------
2833
2834 Synopsis
2835 ........
2836
2837       -var-show-attributes NAME
2838
2839    List attributes of the specified variable object NAME:
2840
2841       status=ATTR [ ( ,ATTR )* ]
2842
2843 where ATTR is '{ { editable | noneditable } | TBD }'.
2844
2845 The '-var-evaluate-expression' Command
2846 --------------------------------------
2847
2848 Synopsis
2849 ........
2850
2851       -var-evaluate-expression [-f FORMAT-SPEC] NAME
2852
2853    Evaluates the expression that is represented by the specified
2854 variable object and returns its value as a string.  The format of the
2855 string can be specified with the '-f' option.  The possible values of
2856 this option are the same as for '-var-set-format' (*note
2857 -var-set-format::).  If the '-f' option is not specified, the current
2858 display format will be used.  The current display format can be changed
2859 using the '-var-set-format' command.
2860
2861       value=VALUE
2862
2863    Note that one must invoke '-var-list-children' for a variable before
2864 the value of a child variable can be evaluated.
2865
2866 The '-var-assign' Command
2867 -------------------------
2868
2869 Synopsis
2870 ........
2871
2872       -var-assign NAME EXPRESSION
2873
2874    Assigns the value of EXPRESSION to the variable object specified by
2875 NAME.  The object must be 'editable'.  If the variable's value is
2876 altered by the assign, the variable will show up in any subsequent
2877 '-var-update' list.
2878
2879 Example
2880 .......
2881
2882      (gdb)
2883      -var-assign var1 3
2884      ^done,value="3"
2885      (gdb)
2886      -var-update *
2887      ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
2888      (gdb)
2889
2890 The '-var-update' Command
2891 -------------------------
2892
2893 Synopsis
2894 ........
2895
2896       -var-update [PRINT-VALUES] {NAME | "*"}
2897
2898    Reevaluate the expressions corresponding to the variable object NAME
2899 and all its direct and indirect children, and return the list of
2900 variable objects whose values have changed; NAME must be a root variable
2901 object.  Here, "changed" means that the result of
2902 '-var-evaluate-expression' before and after the '-var-update' is
2903 different.  If '*' is used as the variable object names, all existing
2904 variable objects are updated, except for frozen ones (*note
2905 -var-set-frozen::).  The option PRINT-VALUES determines whether both
2906 names and values, or just names are printed.  The possible values of
2907 this option are the same as for '-var-list-children' (*note
2908 -var-list-children::).  It is recommended to use the '--all-values'
2909 option, to reduce the number of MI commands needed on each program stop.
2910
2911    With the '*' parameter, if a variable object is bound to a currently
2912 running thread, it will not be updated, without any diagnostic.
2913
2914    If '-var-set-update-range' was previously used on a varobj, then only
2915 the selected range of children will be reported.
2916
2917    '-var-update' reports all the changed varobjs in a tuple named
2918 'changelist'.
2919
2920    Each item in the change list is itself a tuple holding:
2921
2922 'name'
2923      The name of the varobj.
2924
2925 'value'
2926      If values were requested for this update, then this field will be
2927      present and will hold the value of the varobj.
2928
2929 'in_scope'
2930      This field is a string which may take one of three values:
2931
2932      '"true"'
2933           The variable object's current value is valid.
2934
2935      '"false"'
2936           The variable object does not currently hold a valid value but
2937           it may hold one in the future if its associated expression
2938           comes back into scope.
2939
2940      '"invalid"'
2941           The variable object no longer holds a valid value.  This can
2942           occur when the executable file being debugged has changed,
2943           either through recompilation or by using the GDB 'file'
2944           command.  The front end should normally choose to delete these
2945           variable objects.
2946
2947      In the future new values may be added to this list so the front
2948      should be prepared for this possibility.  *Note GDB/MI Development
2949      and Front Ends: GDB/MI Development and Front Ends.
2950
2951 'type_changed'
2952      This is only present if the varobj is still valid.  If the type
2953      changed, then this will be the string 'true'; otherwise it will be
2954      'false'.
2955
2956      When a varobj's type changes, its children are also likely to have
2957      become incorrect.  Therefore, the varobj's children are
2958      automatically deleted when this attribute is 'true'.  Also, the
2959      varobj's update range, when set using the '-var-set-update-range'
2960      command, is unset.
2961
2962 'new_type'
2963      If the varobj's type changed, then this field will be present and
2964      will hold the new type.
2965
2966 'new_num_children'
2967      For a dynamic varobj, if the number of children changed, or if the
2968      type changed, this will be the new number of children.
2969
2970      The 'numchild' field in other varobj responses is generally not
2971      valid for a dynamic varobj - it will show the number of children
2972      that GDB knows about, but because dynamic varobjs lazily
2973      instantiate their children, this will not reflect the number of
2974      children which may be available.
2975
2976      The 'new_num_children' attribute only reports changes to the number
2977      of children known by GDB.  This is the only way to detect whether
2978      an update has removed children (which necessarily can only happen
2979      at the end of the update range).
2980
2981 'displayhint'
2982      The display hint, if any.
2983
2984 'has_more'
2985      This is an integer value, which will be 1 if there are more
2986      children available outside the varobj's update range.
2987
2988 'dynamic'
2989      This attribute will be present and have the value '1' if the varobj
2990      is a dynamic varobj.  If the varobj is not a dynamic varobj, then
2991      this attribute will not be present.
2992
2993 'new_children'
2994      If new children were added to a dynamic varobj within the selected
2995      update range (as set by '-var-set-update-range'), then they will be
2996      listed in this attribute.
2997
2998 Example
2999 .......
3000
3001      (gdb)
3002      -var-assign var1 3
3003      ^done,value="3"
3004      (gdb)
3005      -var-update --all-values var1
3006      ^done,changelist=[{name="var1",value="3",in_scope="true",
3007      type_changed="false"}]
3008      (gdb)
3009
3010 The '-var-set-frozen' Command
3011 -----------------------------
3012
3013 Synopsis
3014 ........
3015
3016       -var-set-frozen NAME FLAG
3017
3018    Set the frozenness flag on the variable object NAME.  The FLAG
3019 parameter should be either '1' to make the variable frozen or '0' to
3020 make it unfrozen.  If a variable object is frozen, then neither itself,
3021 nor any of its children, are implicitly updated by '-var-update' of a
3022 parent variable or by '-var-update *'.  Only '-var-update' of the
3023 variable itself will update its value and values of its children.  After
3024 a variable object is unfrozen, it is implicitly updated by all
3025 subsequent '-var-update' operations.  Unfreezing a variable does not
3026 update it, only subsequent '-var-update' does.
3027
3028 Example
3029 .......
3030
3031      (gdb)
3032      -var-set-frozen V 1
3033      ^done
3034      (gdb)
3035
3036 The '-var-set-update-range' command
3037 -----------------------------------
3038
3039 Synopsis
3040 ........
3041
3042       -var-set-update-range NAME FROM TO
3043
3044    Set the range of children to be returned by future invocations of
3045 '-var-update'.
3046
3047    FROM and TO indicate the range of children to report.  If FROM or TO
3048 is less than zero, the range is reset and all children will be reported.
3049 Otherwise, children starting at FROM (zero-based) and up to and
3050 excluding TO will be reported.
3051
3052 Example
3053 .......
3054
3055      (gdb)
3056      -var-set-update-range V 1 2
3057      ^done
3058
3059 The '-var-set-visualizer' command
3060 ---------------------------------
3061
3062 Synopsis
3063 ........
3064
3065       -var-set-visualizer NAME VISUALIZER
3066
3067    Set a visualizer for the variable object NAME.
3068
3069    VISUALIZER is the visualizer to use.  The special value 'None' means
3070 to disable any visualizer in use.
3071
3072    If not 'None', VISUALIZER must be a Python expression.  This
3073 expression must evaluate to a callable object which accepts a single
3074 argument.  GDB will call this object with the value of the varobj NAME
3075 as an argument (this is done so that the same Python pretty-printing
3076 code can be used for both the CLI and MI). When called, this object must
3077 return an object which conforms to the pretty-printing interface (*note
3078 Pretty Printing API::).
3079
3080    The pre-defined function 'gdb.default_visualizer' may be used to
3081 select a visualizer by following the built-in process (*note Selecting
3082 Pretty-Printers::).  This is done automatically when a varobj is
3083 created, and so ordinarily is not needed.
3084
3085    This feature is only available if Python support is enabled.  The MI
3086 command '-list-features' (*note GDB/MI Support Commands::) can be used
3087 to check this.
3088
3089 Example
3090 .......
3091
3092 Resetting the visualizer:
3093
3094      (gdb)
3095      -var-set-visualizer V None
3096      ^done
3097
3098    Reselecting the default (type-based) visualizer:
3099
3100      (gdb)
3101      -var-set-visualizer V gdb.default_visualizer
3102      ^done
3103
3104    Suppose 'SomeClass' is a visualizer class.  A lambda expression can
3105 be used to instantiate this class for a varobj:
3106
3107      (gdb)
3108      -var-set-visualizer V "lambda val: SomeClass()"
3109      ^done
3110
3111 \1f
3112 File: gdb.info,  Node: GDB/MI Data Manipulation,  Next: GDB/MI Tracepoint Commands,  Prev: GDB/MI Variable Objects,  Up: GDB/MI
3113
3114 27.16 GDB/MI Data Manipulation
3115 ==============================
3116
3117 This section describes the GDB/MI commands that manipulate data: examine
3118 memory and registers, evaluate expressions, etc.
3119
3120 The '-data-disassemble' Command
3121 -------------------------------
3122
3123 Synopsis
3124 ........
3125
3126       -data-disassemble
3127          [ -s START-ADDR -e END-ADDR ]
3128        | [ -f FILENAME -l LINENUM [ -n LINES ] ]
3129        -- MODE
3130
3131 Where:
3132
3133 'START-ADDR'
3134      is the beginning address (or '$pc')
3135 'END-ADDR'
3136      is the end address
3137 'FILENAME'
3138      is the name of the file to disassemble
3139 'LINENUM'
3140      is the line number to disassemble around
3141 'LINES'
3142      is the number of disassembly lines to be produced.  If it is -1,
3143      the whole function will be disassembled, in case no END-ADDR is
3144      specified.  If END-ADDR is specified as a non-zero value, and LINES
3145      is lower than the number of disassembly lines between START-ADDR
3146      and END-ADDR, only LINES lines are displayed; if LINES is higher
3147      than the number of lines between START-ADDR and END-ADDR, only the
3148      lines up to END-ADDR are displayed.
3149 'MODE'
3150      is either 0 (meaning only disassembly), 1 (meaning mixed source and
3151      disassembly), 2 (meaning disassembly with raw opcodes), or 3
3152      (meaning mixed source and disassembly with raw opcodes).
3153
3154 Result
3155 ......
3156
3157 The result of the '-data-disassemble' command will be a list named
3158 'asm_insns', the contents of this list depend on the MODE used with the
3159 '-data-disassemble' command.
3160
3161    For modes 0 and 2 the 'asm_insns' list contains tuples with the
3162 following fields:
3163
3164 'address'
3165      The address at which this instruction was disassembled.
3166
3167 'func-name'
3168      The name of the function this instruction is within.
3169
3170 'offset'
3171      The decimal offset in bytes from the start of 'func-name'.
3172
3173 'inst'
3174      The text disassembly for this 'address'.
3175
3176 'opcodes'
3177      This field is only present for mode 2.  This contains the raw
3178      opcode bytes for the 'inst' field.
3179
3180    For modes 1 and 3 the 'asm_insns' list contains tuples named
3181 'src_and_asm_line', each of which has the following fields:
3182
3183 'line'
3184      The line number within 'file'.
3185
3186 'file'
3187      The file name from the compilation unit.  This might be an absolute
3188      file name or a relative file name depending on the compile command
3189      used.
3190
3191 'fullname'
3192      Absolute file name of 'file'.  It is converted to a canonical form
3193      using the source file search path (*note Specifying Source
3194      Directories: Source Path.) and after resolving all the symbolic
3195      links.
3196
3197      If the source file is not found this field will contain the path as
3198      present in the debug information.
3199
3200 'line_asm_insn'
3201      This is a list of tuples containing the disassembly for 'line' in
3202      'file'.  The fields of each tuple are the same as for
3203      '-data-disassemble' in MODE 0 and 2, so 'address', 'func-name',
3204      'offset', 'inst', and optionally 'opcodes'.
3205
3206    Note that whatever included in the 'inst' field, is not manipulated
3207 directly by GDB/MI, i.e., it is not possible to adjust its format.
3208
3209 GDB Command
3210 ...........
3211
3212 The corresponding GDB command is 'disassemble'.
3213
3214 Example
3215 .......
3216
3217 Disassemble from the current value of '$pc' to '$pc + 20':
3218
3219      (gdb)
3220      -data-disassemble -s $pc -e "$pc + 20" -- 0
3221      ^done,
3222      asm_insns=[
3223      {address="0x000107c0",func-name="main",offset="4",
3224      inst="mov  2, %o0"},
3225      {address="0x000107c4",func-name="main",offset="8",
3226      inst="sethi  %hi(0x11800), %o2"},
3227      {address="0x000107c8",func-name="main",offset="12",
3228      inst="or  %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
3229      {address="0x000107cc",func-name="main",offset="16",
3230      inst="sethi  %hi(0x11800), %o2"},
3231      {address="0x000107d0",func-name="main",offset="20",
3232      inst="or  %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
3233      (gdb)
3234
3235    Disassemble the whole 'main' function.  Line 32 is part of 'main'.
3236
3237      -data-disassemble -f basics.c -l 32 -- 0
3238      ^done,asm_insns=[
3239      {address="0x000107bc",func-name="main",offset="0",
3240      inst="save  %sp, -112, %sp"},
3241      {address="0x000107c0",func-name="main",offset="4",
3242      inst="mov   2, %o0"},
3243      {address="0x000107c4",func-name="main",offset="8",
3244      inst="sethi %hi(0x11800), %o2"},
3245      [...]
3246      {address="0x0001081c",func-name="main",offset="96",inst="ret "},
3247      {address="0x00010820",func-name="main",offset="100",inst="restore "}]
3248      (gdb)
3249
3250    Disassemble 3 instructions from the start of 'main':
3251
3252      (gdb)
3253      -data-disassemble -f basics.c -l 32 -n 3 -- 0
3254      ^done,asm_insns=[
3255      {address="0x000107bc",func-name="main",offset="0",
3256      inst="save  %sp, -112, %sp"},
3257      {address="0x000107c0",func-name="main",offset="4",
3258      inst="mov  2, %o0"},
3259      {address="0x000107c4",func-name="main",offset="8",
3260      inst="sethi  %hi(0x11800), %o2"}]
3261      (gdb)
3262
3263    Disassemble 3 instructions from the start of 'main' in mixed mode:
3264
3265      (gdb)
3266      -data-disassemble -f basics.c -l 32 -n 3 -- 1
3267      ^done,asm_insns=[
3268      src_and_asm_line={line="31",
3269      file="../../../src/gdb/testsuite/gdb.mi/basics.c",
3270      fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
3271      line_asm_insn=[{address="0x000107bc",
3272      func-name="main",offset="0",inst="save  %sp, -112, %sp"}]},
3273      src_and_asm_line={line="32",
3274      file="../../../src/gdb/testsuite/gdb.mi/basics.c",
3275      fullname="/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c",
3276      line_asm_insn=[{address="0x000107c0",
3277      func-name="main",offset="4",inst="mov  2, %o0"},
3278      {address="0x000107c4",func-name="main",offset="8",
3279      inst="sethi  %hi(0x11800), %o2"}]}]
3280      (gdb)
3281
3282 The '-data-evaluate-expression' Command
3283 ---------------------------------------
3284
3285 Synopsis
3286 ........
3287
3288       -data-evaluate-expression EXPR
3289
3290    Evaluate EXPR as an expression.  The expression could contain an
3291 inferior function call.  The function call will execute synchronously.
3292 If the expression contains spaces, it must be enclosed in double quotes.
3293
3294 GDB Command
3295 ...........
3296
3297 The corresponding GDB commands are 'print', 'output', and 'call'.  In
3298 'gdbtk' only, there's a corresponding 'gdb_eval' command.
3299
3300 Example
3301 .......
3302
3303 In the following example, the numbers that precede the commands are the
3304 "tokens" described in *note GDB/MI Command Syntax: GDB/MI Command
3305 Syntax.  Notice how GDB/MI returns the same tokens in its output.
3306
3307      211-data-evaluate-expression A
3308      211^done,value="1"
3309      (gdb)
3310      311-data-evaluate-expression &A
3311      311^done,value="0xefffeb7c"
3312      (gdb)
3313      411-data-evaluate-expression A+3
3314      411^done,value="4"
3315      (gdb)
3316      511-data-evaluate-expression "A + 3"
3317      511^done,value="4"
3318      (gdb)
3319
3320 The '-data-list-changed-registers' Command
3321 ------------------------------------------
3322
3323 Synopsis
3324 ........
3325
3326       -data-list-changed-registers
3327
3328    Display a list of the registers that have changed.
3329
3330 GDB Command
3331 ...........
3332
3333 GDB doesn't have a direct analog for this command; 'gdbtk' has the
3334 corresponding command 'gdb_changed_register_list'.
3335
3336 Example
3337 .......
3338
3339 On a PPC MBX board:
3340
3341      (gdb)
3342      -exec-continue
3343      ^running
3344
3345      (gdb)
3346      *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={
3347      func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
3348      line="5"}
3349      (gdb)
3350      -data-list-changed-registers
3351      ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
3352      "10","11","13","14","15","16","17","18","19","20","21","22","23",
3353      "24","25","26","27","28","30","31","64","65","66","67","69"]
3354      (gdb)
3355
3356 The '-data-list-register-names' Command
3357 ---------------------------------------
3358
3359 Synopsis
3360 ........
3361
3362       -data-list-register-names [ ( REGNO )+ ]
3363
3364    Show a list of register names for the current target.  If no
3365 arguments are given, it shows a list of the names of all the registers.
3366 If integer numbers are given as arguments, it will print a list of the
3367 names of the registers corresponding to the arguments.  To ensure
3368 consistency between a register name and its number, the output list may
3369 include empty register names.
3370
3371 GDB Command
3372 ...........
3373
3374 GDB does not have a command which corresponds to
3375 '-data-list-register-names'.  In 'gdbtk' there is a corresponding
3376 command 'gdb_regnames'.
3377
3378 Example
3379 .......
3380
3381 For the PPC MBX board:
3382      (gdb)
3383      -data-list-register-names
3384      ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
3385      "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
3386      "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
3387      "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
3388      "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
3389      "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
3390      "", "pc","ps","cr","lr","ctr","xer"]
3391      (gdb)
3392      -data-list-register-names 1 2 3
3393      ^done,register-names=["r1","r2","r3"]
3394      (gdb)
3395
3396 The '-data-list-register-values' Command
3397 ----------------------------------------
3398
3399 Synopsis
3400 ........
3401
3402       -data-list-register-values
3403          [ --skip-unavailable ] FMT [ ( REGNO )*]
3404
3405    Display the registers' contents.  The format according to which the
3406 registers' contents are to be returned is given by FMT, followed by an
3407 optional list of numbers specifying the registers to display.  A missing
3408 list of numbers indicates that the contents of all the registers must be
3409 returned.  The '--skip-unavailable' option indicates that only the
3410 available registers are to be returned.
3411
3412    Allowed formats for FMT are:
3413
3414 'x'
3415      Hexadecimal
3416 'o'
3417      Octal
3418 't'
3419      Binary
3420 'd'
3421      Decimal
3422 'r'
3423      Raw
3424 'N'
3425      Natural
3426
3427 GDB Command
3428 ...........
3429
3430 The corresponding GDB commands are 'info reg', 'info all-reg', and (in
3431 'gdbtk') 'gdb_fetch_registers'.
3432
3433 Example
3434 .......
3435
3436 For a PPC MBX board (note: line breaks are for readability only, they
3437 don't appear in the actual output):
3438
3439      (gdb)
3440      -data-list-register-values r 64 65
3441      ^done,register-values=[{number="64",value="0xfe00a300"},
3442      {number="65",value="0x00029002"}]
3443      (gdb)
3444      -data-list-register-values x
3445      ^done,register-values=[{number="0",value="0xfe0043c8"},
3446      {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
3447      {number="3",value="0x0"},{number="4",value="0xa"},
3448      {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
3449      {number="7",value="0xfe011e98"},{number="8",value="0x2"},
3450      {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
3451      {number="11",value="0x1"},{number="12",value="0x0"},
3452      {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
3453      {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
3454      {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
3455      {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
3456      {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
3457      {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
3458      {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
3459      {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
3460      {number="29",value="0x0"},{number="30",value="0xfe010000"},
3461      {number="31",value="0x0"},{number="32",value="0x0"},
3462      {number="33",value="0x0"},{number="34",value="0x0"},
3463      {number="35",value="0x0"},{number="36",value="0x0"},
3464      {number="37",value="0x0"},{number="38",value="0x0"},
3465      {number="39",value="0x0"},{number="40",value="0x0"},
3466      {number="41",value="0x0"},{number="42",value="0x0"},
3467      {number="43",value="0x0"},{number="44",value="0x0"},
3468      {number="45",value="0x0"},{number="46",value="0x0"},
3469      {number="47",value="0x0"},{number="48",value="0x0"},
3470      {number="49",value="0x0"},{number="50",value="0x0"},
3471      {number="51",value="0x0"},{number="52",value="0x0"},
3472      {number="53",value="0x0"},{number="54",value="0x0"},
3473      {number="55",value="0x0"},{number="56",value="0x0"},
3474      {number="57",value="0x0"},{number="58",value="0x0"},
3475      {number="59",value="0x0"},{number="60",value="0x0"},
3476      {number="61",value="0x0"},{number="62",value="0x0"},
3477      {number="63",value="0x0"},{number="64",value="0xfe00a300"},
3478      {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
3479      {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
3480      {number="69",value="0x20002b03"}]
3481      (gdb)
3482
3483 The '-data-read-memory' Command
3484 -------------------------------
3485
3486 This command is deprecated, use '-data-read-memory-bytes' instead.
3487
3488 Synopsis
3489 ........
3490
3491       -data-read-memory [ -o BYTE-OFFSET ]
3492         ADDRESS WORD-FORMAT WORD-SIZE
3493         NR-ROWS NR-COLS [ ASCHAR ]
3494
3495 where:
3496
3497 'ADDRESS'
3498      An expression specifying the address of the first memory word to be
3499      read.  Complex expressions containing embedded white space should
3500      be quoted using the C convention.
3501
3502 'WORD-FORMAT'
3503      The format to be used to print the memory words.  The notation is
3504      the same as for GDB's 'print' command (*note Output Formats: Output
3505      Formats.).
3506
3507 'WORD-SIZE'
3508      The size of each memory word in bytes.
3509
3510 'NR-ROWS'
3511      The number of rows in the output table.
3512
3513 'NR-COLS'
3514      The number of columns in the output table.
3515
3516 'ASCHAR'
3517      If present, indicates that each row should include an ASCII dump.
3518      The value of ASCHAR is used as a padding character when a byte is
3519      not a member of the printable ASCII character set (printable ASCII
3520      characters are those whose code is between 32 and 126,
3521      inclusively).
3522
3523 'BYTE-OFFSET'
3524      An offset to add to the ADDRESS before fetching memory.
3525
3526    This command displays memory contents as a table of NR-ROWS by
3527 NR-COLS words, each word being WORD-SIZE bytes.  In total, 'NR-ROWS *
3528 NR-COLS * WORD-SIZE' bytes are read (returned as 'total-bytes').  Should
3529 less than the requested number of bytes be returned by the target, the
3530 missing words are identified using 'N/A'.  The number of bytes read from
3531 the target is returned in 'nr-bytes' and the starting address used to
3532 read memory in 'addr'.
3533
3534    The address of the next/previous row or page is available in
3535 'next-row' and 'prev-row', 'next-page' and 'prev-page'.
3536
3537 GDB Command
3538 ...........
3539
3540 The corresponding GDB command is 'x'.  'gdbtk' has 'gdb_get_mem' memory
3541 read command.
3542
3543 Example
3544 .......
3545
3546 Read six bytes of memory starting at 'bytes+6' but then offset by '-6'
3547 bytes.  Format as three rows of two columns.  One byte per word.
3548 Display each word in hex.
3549
3550      (gdb)
3551      9-data-read-memory -o -6 -- bytes+6 x 1 3 2
3552      9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
3553      next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
3554      prev-page="0x0000138a",memory=[
3555      {addr="0x00001390",data=["0x00","0x01"]},
3556      {addr="0x00001392",data=["0x02","0x03"]},
3557      {addr="0x00001394",data=["0x04","0x05"]}]
3558      (gdb)
3559
3560    Read two bytes of memory starting at address 'shorts + 64' and
3561 display as a single word formatted in decimal.
3562
3563      (gdb)
3564      5-data-read-memory shorts+64 d 2 1 1
3565      5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
3566      next-row="0x00001512",prev-row="0x0000150e",
3567      next-page="0x00001512",prev-page="0x0000150e",memory=[
3568      {addr="0x00001510",data=["128"]}]
3569      (gdb)
3570
3571    Read thirty two bytes of memory starting at 'bytes+16' and format as
3572 eight rows of four columns.  Include a string encoding with 'x' used as
3573 the non-printable character.
3574
3575      (gdb)
3576      4-data-read-memory bytes+16 x 1 8 4 x
3577      4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
3578      next-row="0x000013c0",prev-row="0x0000139c",
3579      next-page="0x000013c0",prev-page="0x00001380",memory=[
3580      {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
3581      {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
3582      {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
3583      {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
3584      {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
3585      {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
3586      {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
3587      {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
3588      (gdb)
3589
3590 The '-data-read-memory-bytes' Command
3591 -------------------------------------
3592
3593 Synopsis
3594 ........
3595
3596       -data-read-memory-bytes [ -o BYTE-OFFSET ]
3597         ADDRESS COUNT
3598
3599 where:
3600
3601 'ADDRESS'
3602      An expression specifying the address of the first memory word to be
3603      read.  Complex expressions containing embedded white space should
3604      be quoted using the C convention.
3605
3606 'COUNT'
3607      The number of bytes to read.  This should be an integer literal.
3608
3609 'BYTE-OFFSET'
3610      The offsets in bytes relative to ADDRESS at which to start reading.
3611      This should be an integer literal.  This option is provided so that
3612      a frontend is not required to first evaluate address and then
3613      perform address arithmetics itself.
3614
3615    This command attempts to read all accessible memory regions in the
3616 specified range.  First, all regions marked as unreadable in the memory
3617 map (if one is defined) will be skipped.  *Note Memory Region
3618 Attributes::.  Second, GDB will attempt to read the remaining regions.
3619 For each one, if reading full region results in an errors, GDB will try
3620 to read a subset of the region.
3621
3622    In general, every single byte in the region may be readable or not,
3623 and the only way to read every readable byte is to try a read at every
3624 address, which is not practical.  Therefore, GDB will attempt to read
3625 all accessible bytes at either beginning or the end of the region, using
3626 a binary division scheme.  This heuristic works well for reading accross
3627 a memory map boundary.  Note that if a region has a readable range that
3628 is neither at the beginning or the end, GDB will not read it.
3629
3630    The result record (*note GDB/MI Result Records::) that is output of
3631 the command includes a field named 'memory' whose content is a list of
3632 tuples.  Each tuple represent a successfully read memory block and has
3633 the following fields:
3634
3635 'begin'
3636      The start address of the memory block, as hexadecimal literal.
3637
3638 'end'
3639      The end address of the memory block, as hexadecimal literal.
3640
3641 'offset'
3642      The offset of the memory block, as hexadecimal literal, relative to
3643      the start address passed to '-data-read-memory-bytes'.
3644
3645 'contents'
3646      The contents of the memory block, in hex.
3647
3648 GDB Command
3649 ...........
3650
3651 The corresponding GDB command is 'x'.
3652
3653 Example
3654 .......
3655
3656      (gdb)
3657      -data-read-memory-bytes &a 10
3658      ^done,memory=[{begin="0xbffff154",offset="0x00000000",
3659                    end="0xbffff15e",
3660                    contents="01000000020000000300"}]
3661      (gdb)
3662
3663 The '-data-write-memory-bytes' Command
3664 --------------------------------------
3665
3666 Synopsis
3667 ........
3668
3669       -data-write-memory-bytes ADDRESS CONTENTS
3670       -data-write-memory-bytes ADDRESS CONTENTS [COUNT]
3671
3672 where:
3673
3674 'ADDRESS'
3675      An expression specifying the address of the first memory word to be
3676      read.  Complex expressions containing embedded white space should
3677      be quoted using the C convention.
3678
3679 'CONTENTS'
3680      The hex-encoded bytes to write.
3681
3682 'COUNT'
3683      Optional argument indicating the number of bytes to be written.  If
3684      COUNT is greater than CONTENTS' length, GDB will repeatedly write
3685      CONTENTS until it fills COUNT bytes.
3686
3687 GDB Command
3688 ...........
3689
3690 There's no corresponding GDB command.
3691
3692 Example
3693 .......
3694
3695      (gdb)
3696      -data-write-memory-bytes &a "aabbccdd"
3697      ^done
3698      (gdb)
3699
3700      (gdb)
3701      -data-write-memory-bytes &a "aabbccdd" 16e
3702      ^done
3703      (gdb)
3704
3705 \1f
3706 File: gdb.info,  Node: GDB/MI Tracepoint Commands,  Next: GDB/MI Symbol Query,  Prev: GDB/MI Data Manipulation,  Up: GDB/MI
3707
3708 27.17 GDB/MI Tracepoint Commands
3709 ================================
3710
3711 The commands defined in this section implement MI support for
3712 tracepoints.  For detailed introduction, see *note Tracepoints::.
3713
3714 The '-trace-find' Command
3715 -------------------------
3716
3717 Synopsis
3718 ........
3719
3720       -trace-find MODE [PARAMETERS...]
3721
3722    Find a trace frame using criteria defined by MODE and PARAMETERS.
3723 The following table lists permissible modes and their parameters.  For
3724 details of operation, see *note tfind::.
3725
3726 'none'
3727      No parameters are required.  Stops examining trace frames.
3728
3729 'frame-number'
3730      An integer is required as parameter.  Selects tracepoint frame with
3731      that index.
3732
3733 'tracepoint-number'
3734      An integer is required as parameter.  Finds next trace frame that
3735      corresponds to tracepoint with the specified number.
3736
3737 'pc'
3738      An address is required as parameter.  Finds next trace frame that
3739      corresponds to any tracepoint at the specified address.
3740
3741 'pc-inside-range'
3742      Two addresses are required as parameters.  Finds next trace frame
3743      that corresponds to a tracepoint at an address inside the specified
3744      range.  Both bounds are considered to be inside the range.
3745
3746 'pc-outside-range'
3747      Two addresses are required as parameters.  Finds next trace frame
3748      that corresponds to a tracepoint at an address outside the
3749      specified range.  Both bounds are considered to be inside the
3750      range.
3751
3752 'line'
3753      Line specification is required as parameter.  *Note Specify
3754      Location::.  Finds next trace frame that corresponds to a
3755      tracepoint at the specified location.
3756
3757    If 'none' was passed as MODE, the response does not have fields.
3758 Otherwise, the response may have the following fields:
3759
3760 'found'
3761      This field has either '0' or '1' as the value, depending on whether
3762      a matching tracepoint was found.
3763
3764 'traceframe'
3765      The index of the found traceframe.  This field is present iff the
3766      'found' field has value of '1'.
3767
3768 'tracepoint'
3769      The index of the found tracepoint.  This field is present iff the
3770      'found' field has value of '1'.
3771
3772 'frame'
3773      The information about the frame corresponding to the found trace
3774      frame.  This field is present only if a trace frame was found.
3775      *Note GDB/MI Frame Information::, for description of this field.
3776
3777 GDB Command
3778 ...........
3779
3780 The corresponding GDB command is 'tfind'.
3781
3782 -trace-define-variable
3783 ----------------------
3784
3785 Synopsis
3786 ........
3787
3788       -trace-define-variable NAME [ VALUE ]
3789
3790    Create trace variable NAME if it does not exist.  If VALUE is
3791 specified, sets the initial value of the specified trace variable to
3792 that value.  Note that the NAME should start with the '$' character.
3793
3794 GDB Command
3795 ...........
3796
3797 The corresponding GDB command is 'tvariable'.
3798
3799 The '-trace-frame-collected' Command
3800 ------------------------------------
3801
3802 Synopsis
3803 ........
3804
3805       -trace-frame-collected
3806          [--var-print-values VAR_PVAL]
3807          [--comp-print-values COMP_PVAL]
3808          [--registers-format REGFORMAT]
3809          [--memory-contents]
3810
3811    This command returns the set of collected objects, register names,
3812 trace state variable names, memory ranges and computed expressions that
3813 have been collected at a particular trace frame.  The optional
3814 parameters to the command affect the output format in different ways.
3815 See the output description table below for more details.
3816
3817    The reported names can be used in the normal manner to create varobjs
3818 and inspect the objects themselves.  The items returned by this command
3819 are categorized so that it is clear which is a variable, which is a
3820 register, which is a trace state variable, which is a memory range and
3821 which is a computed expression.
3822
3823    For instance, if the actions were
3824      collect myVar, myArray[myIndex], myObj.field, myPtr->field, myCount + 2
3825      collect *(int*)0xaf02bef0@40
3826
3827 the object collected in its entirety would be 'myVar'.  The object
3828 'myArray' would be partially collected, because only the element at
3829 index 'myIndex' would be collected.  The remaining objects would be
3830 computed expressions.
3831
3832    An example output would be:
3833
3834      (gdb)
3835      -trace-frame-collected
3836      ^done,
3837        explicit-variables=[{name="myVar",value="1"}],
3838        computed-expressions=[{name="myArray[myIndex]",value="0"},
3839                              {name="myObj.field",value="0"},
3840                              {name="myPtr->field",value="1"},
3841                              {name="myCount + 2",value="3"},
3842                              {name="$tvar1 + 1",value="43970027"}],
3843        registers=[{number="0",value="0x7fe2c6e79ec8"},
3844                   {number="1",value="0x0"},
3845                   {number="2",value="0x4"},
3846                   ...
3847                   {number="125",value="0x0"}],
3848        tvars=[{name="$tvar1",current="43970026"}],
3849        memory=[{address="0x0000000000602264",length="4"},
3850                {address="0x0000000000615bc0",length="4"}]
3851      (gdb)
3852
3853    Where:
3854
3855 'explicit-variables'
3856      The set of objects that have been collected in their entirety (as
3857      opposed to collecting just a few elements of an array or a few
3858      struct members).  For each object, its name and value are printed.
3859      The '--var-print-values' option affects how or whether the value
3860      field is output.  If VAR_PVAL is 0, then print only the names; if
3861      it is 1, print also their values; and if it is 2, print the name,
3862      type and value for simple data types, and the name and type for
3863      arrays, structures and unions.
3864
3865 'computed-expressions'
3866      The set of computed expressions that have been collected at the
3867      current trace frame.  The '--comp-print-values' option affects this
3868      set like the '--var-print-values' option affects the
3869      'explicit-variables' set.  See above.
3870
3871 'registers'
3872      The registers that have been collected at the current trace frame.
3873      For each register collected, the name and current value are
3874      returned.  The value is formatted according to the
3875      '--registers-format' option.  See the '-data-list-register-values'
3876      command for a list of the allowed formats.  The default is 'x'.
3877
3878 'tvars'
3879      The trace state variables that have been collected at the current
3880      trace frame.  For each trace state variable collected, the name and
3881      current value are returned.
3882
3883 'memory'
3884      The set of memory ranges that have been collected at the current
3885      trace frame.  Its content is a list of tuples.  Each tuple
3886      represents a collected memory range and has the following fields:
3887
3888      'address'
3889           The start address of the memory range, as hexadecimal literal.
3890
3891      'length'
3892           The length of the memory range, as decimal literal.
3893
3894      'contents'
3895           The contents of the memory block, in hex.  This field is only
3896           present if the '--memory-contents' option is specified.
3897
3898 GDB Command
3899 ...........
3900
3901 There is no corresponding GDB command.
3902
3903 Example
3904 .......
3905
3906 -trace-list-variables
3907 ---------------------
3908
3909 Synopsis
3910 ........
3911
3912       -trace-list-variables
3913
3914    Return a table of all defined trace variables.  Each element of the
3915 table has the following fields:
3916
3917 'name'
3918      The name of the trace variable.  This field is always present.
3919
3920 'initial'
3921      The initial value.  This is a 64-bit signed integer.  This field is
3922      always present.
3923
3924 'current'
3925      The value the trace variable has at the moment.  This is a 64-bit
3926      signed integer.  This field is absent iff current value is not
3927      defined, for example if the trace was never run, or is presently
3928      running.
3929
3930 GDB Command
3931 ...........
3932
3933 The corresponding GDB command is 'tvariables'.
3934
3935 Example
3936 .......
3937
3938      (gdb)
3939      -trace-list-variables
3940      ^done,trace-variables={nr_rows="1",nr_cols="3",
3941      hdr=[{width="15",alignment="-1",col_name="name",colhdr="Name"},
3942           {width="11",alignment="-1",col_name="initial",colhdr="Initial"},
3943           {width="11",alignment="-1",col_name="current",colhdr="Current"}],
3944      body=[variable={name="$trace_timestamp",initial="0"}
3945            variable={name="$foo",initial="10",current="15"}]}
3946      (gdb)
3947
3948 -trace-save
3949 -----------
3950
3951 Synopsis
3952 ........
3953
3954       -trace-save [-r ] FILENAME
3955
3956    Saves the collected trace data to FILENAME.  Without the '-r' option,
3957 the data is downloaded from the target and saved in a local file.  With
3958 the '-r' option the target is asked to perform the save.
3959
3960 GDB Command
3961 ...........
3962
3963 The corresponding GDB command is 'tsave'.
3964
3965 -trace-start
3966 ------------
3967
3968 Synopsis
3969 ........
3970
3971       -trace-start
3972
3973    Starts a tracing experiments.  The result of this command does not
3974 have any fields.
3975
3976 GDB Command
3977 ...........
3978
3979 The corresponding GDB command is 'tstart'.
3980
3981 -trace-status
3982 -------------
3983
3984 Synopsis
3985 ........
3986
3987       -trace-status
3988
3989    Obtains the status of a tracing experiment.  The result may include
3990 the following fields:
3991
3992 'supported'
3993      May have a value of either '0', when no tracing operations are
3994      supported, '1', when all tracing operations are supported, or
3995      'file' when examining trace file.  In the latter case, examining of
3996      trace frame is possible but new tracing experiement cannot be
3997      started.  This field is always present.
3998
3999 'running'
4000      May have a value of either '0' or '1' depending on whether tracing
4001      experiement is in progress on target.  This field is present if
4002      'supported' field is not '0'.
4003
4004 'stop-reason'
4005      Report the reason why the tracing was stopped last time.  This
4006      field may be absent iff tracing was never stopped on target yet.
4007      The value of 'request' means the tracing was stopped as result of
4008      the '-trace-stop' command.  The value of 'overflow' means the
4009      tracing buffer is full.  The value of 'disconnection' means tracing
4010      was automatically stopped when GDB has disconnected.  The value of
4011      'passcount' means tracing was stopped when a tracepoint was passed
4012      a maximal number of times for that tracepoint.  This field is
4013      present if 'supported' field is not '0'.
4014
4015 'stopping-tracepoint'
4016      The number of tracepoint whose passcount as exceeded.  This field
4017      is present iff the 'stop-reason' field has the value of
4018      'passcount'.
4019
4020 'frames'
4021 'frames-created'
4022      The 'frames' field is a count of the total number of trace frames
4023      in the trace buffer, while 'frames-created' is the total created
4024      during the run, including ones that were discarded, such as when a
4025      circular trace buffer filled up.  Both fields are optional.
4026
4027 'buffer-size'
4028 'buffer-free'
4029      These fields tell the current size of the tracing buffer and the
4030      remaining space.  These fields are optional.
4031
4032 'circular'
4033      The value of the circular trace buffer flag.  '1' means that the
4034      trace buffer is circular and old trace frames will be discarded if
4035      necessary to make room, '0' means that the trace buffer is linear
4036      and may fill up.
4037
4038 'disconnected'
4039      The value of the disconnected tracing flag.  '1' means that tracing
4040      will continue after GDB disconnects, '0' means that the trace run
4041      will stop.
4042
4043 'trace-file'
4044      The filename of the trace file being examined.  This field is
4045      optional, and only present when examining a trace file.
4046
4047 GDB Command
4048 ...........
4049
4050 The corresponding GDB command is 'tstatus'.
4051
4052 -trace-stop
4053 -----------
4054
4055 Synopsis
4056 ........
4057
4058       -trace-stop
4059
4060    Stops a tracing experiment.  The result of this command has the same
4061 fields as '-trace-status', except that the 'supported' and 'running'
4062 fields are not output.
4063
4064 GDB Command
4065 ...........
4066
4067 The corresponding GDB command is 'tstop'.
4068
4069 \1f
4070 File: gdb.info,  Node: GDB/MI Symbol Query,  Next: GDB/MI File Commands,  Prev: GDB/MI Tracepoint Commands,  Up: GDB/MI
4071
4072 27.18 GDB/MI Symbol Query Commands
4073 ==================================
4074
4075 The '-symbol-list-lines' Command
4076 --------------------------------
4077
4078 Synopsis
4079 ........
4080
4081       -symbol-list-lines FILENAME
4082
4083    Print the list of lines that contain code and their associated
4084 program addresses for the given source filename.  The entries are sorted
4085 in ascending PC order.
4086
4087 GDB Command
4088 ...........
4089
4090 There is no corresponding GDB command.
4091
4092 Example
4093 .......
4094
4095      (gdb)
4096      -symbol-list-lines basics.c
4097      ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
4098      (gdb)
4099
4100 \1f
4101 File: gdb.info,  Node: GDB/MI File Commands,  Next: GDB/MI Target Manipulation,  Prev: GDB/MI Symbol Query,  Up: GDB/MI
4102
4103 27.19 GDB/MI File Commands
4104 ==========================
4105
4106 This section describes the GDB/MI commands to specify executable file
4107 names and to read in and obtain symbol table information.
4108
4109 The '-file-exec-and-symbols' Command
4110 ------------------------------------
4111
4112 Synopsis
4113 ........
4114
4115       -file-exec-and-symbols FILE
4116
4117    Specify the executable file to be debugged.  This file is the one
4118 from which the symbol table is also read.  If no file is specified, the
4119 command clears the executable and symbol information.  If breakpoints
4120 are set when using this command with no arguments, GDB will produce
4121 error messages.  Otherwise, no output is produced, except a completion
4122 notification.
4123
4124 GDB Command
4125 ...........
4126
4127 The corresponding GDB command is 'file'.
4128
4129 Example
4130 .......
4131
4132      (gdb)
4133      -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
4134      ^done
4135      (gdb)
4136
4137 The '-file-exec-file' Command
4138 -----------------------------
4139
4140 Synopsis
4141 ........
4142
4143       -file-exec-file FILE
4144
4145    Specify the executable file to be debugged.  Unlike
4146 '-file-exec-and-symbols', the symbol table is _not_ read from this file.
4147 If used without argument, GDB clears the information about the
4148 executable file.  No output is produced, except a completion
4149 notification.
4150
4151 GDB Command
4152 ...........
4153
4154 The corresponding GDB command is 'exec-file'.
4155
4156 Example
4157 .......
4158
4159      (gdb)
4160      -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
4161      ^done
4162      (gdb)
4163
4164 The '-file-list-exec-source-file' Command
4165 -----------------------------------------
4166
4167 Synopsis
4168 ........
4169
4170       -file-list-exec-source-file
4171
4172    List the line number, the current source file, and the absolute path
4173 to the current source file for the current executable.  The macro
4174 information field has a value of '1' or '0' depending on whether or not
4175 the file includes preprocessor macro information.
4176
4177 GDB Command
4178 ...........
4179
4180 The GDB equivalent is 'info source'
4181
4182 Example
4183 .......
4184
4185      (gdb)
4186      123-file-list-exec-source-file
4187      123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1"
4188      (gdb)
4189
4190 The '-file-list-exec-source-files' Command
4191 ------------------------------------------
4192
4193 Synopsis
4194 ........
4195
4196       -file-list-exec-source-files
4197
4198    List the source files for the current executable.
4199
4200    It will always output both the filename and fullname (absolute file
4201 name) of a source file.
4202
4203 GDB Command
4204 ...........
4205
4206 The GDB equivalent is 'info sources'.  'gdbtk' has an analogous command
4207 'gdb_listfiles'.
4208
4209 Example
4210 .......
4211
4212      (gdb)
4213      -file-list-exec-source-files
4214      ^done,files=[
4215      {file=foo.c,fullname=/home/foo.c},
4216      {file=/home/bar.c,fullname=/home/bar.c},
4217      {file=gdb_could_not_find_fullpath.c}]
4218      (gdb)
4219
4220 The '-file-symbol-file' Command
4221 -------------------------------
4222
4223 Synopsis
4224 ........
4225
4226       -file-symbol-file FILE
4227
4228    Read symbol table info from the specified FILE argument.  When used
4229 without arguments, clears GDB's symbol table info.  No output is
4230 produced, except for a completion notification.
4231
4232 GDB Command
4233 ...........
4234
4235 The corresponding GDB command is 'symbol-file'.
4236
4237 Example
4238 .......
4239
4240      (gdb)
4241      -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
4242      ^done
4243      (gdb)
4244
4245 \1f
4246 File: gdb.info,  Node: GDB/MI Target Manipulation,  Next: GDB/MI File Transfer Commands,  Prev: GDB/MI File Commands,  Up: GDB/MI
4247
4248 27.20 GDB/MI Target Manipulation Commands
4249 =========================================
4250
4251 The '-target-attach' Command
4252 ----------------------------
4253
4254 Synopsis
4255 ........
4256
4257       -target-attach PID | GID | FILE
4258
4259    Attach to a process PID or a file FILE outside of GDB, or a thread
4260 group GID.  If attaching to a thread group, the id previously returned
4261 by '-list-thread-groups --available' must be used.
4262
4263 GDB Command
4264 ...........
4265
4266 The corresponding GDB command is 'attach'.
4267
4268 Example
4269 .......
4270
4271      (gdb)
4272      -target-attach 34
4273      =thread-created,id="1"
4274      *stopped,thread-id="1",frame={addr="0xb7f7e410",func="bar",args=[]}
4275      ^done
4276      (gdb)
4277
4278 The '-target-detach' Command
4279 ----------------------------
4280
4281 Synopsis
4282 ........
4283
4284       -target-detach [ PID | GID ]
4285
4286    Detach from the remote target which normally resumes its execution.
4287 If either PID or GID is specified, detaches from either the specified
4288 process, or specified thread group.  There's no output.
4289
4290 GDB Command
4291 ...........
4292
4293 The corresponding GDB command is 'detach'.
4294
4295 Example
4296 .......
4297
4298      (gdb)
4299      -target-detach
4300      ^done
4301      (gdb)
4302
4303 The '-target-disconnect' Command
4304 --------------------------------
4305
4306 Synopsis
4307 ........
4308
4309       -target-disconnect
4310
4311    Disconnect from the remote target.  There's no output and the target
4312 is generally not resumed.
4313
4314 GDB Command
4315 ...........
4316
4317 The corresponding GDB command is 'disconnect'.
4318
4319 Example
4320 .......
4321
4322      (gdb)
4323      -target-disconnect
4324      ^done
4325      (gdb)
4326
4327 The '-target-download' Command
4328 ------------------------------
4329
4330 Synopsis
4331 ........
4332
4333       -target-download
4334
4335    Loads the executable onto the remote target.  It prints out an update
4336 message every half second, which includes the fields:
4337
4338 'section'
4339      The name of the section.
4340 'section-sent'
4341      The size of what has been sent so far for that section.
4342 'section-size'
4343      The size of the section.
4344 'total-sent'
4345      The total size of what was sent so far (the current and the
4346      previous sections).
4347 'total-size'
4348      The size of the overall executable to download.
4349
4350 Each message is sent as status record (*note GDB/MI Output Syntax:
4351 GDB/MI Output Syntax.).
4352
4353    In addition, it prints the name and size of the sections, as they are
4354 downloaded.  These messages include the following fields:
4355
4356 'section'
4357      The name of the section.
4358 'section-size'
4359      The size of the section.
4360 'total-size'
4361      The size of the overall executable to download.
4362
4363 At the end, a summary is printed.
4364
4365 GDB Command
4366 ...........
4367
4368 The corresponding GDB command is 'load'.
4369
4370 Example
4371 .......
4372
4373 Note: each status message appears on a single line.  Here the messages
4374 have been broken down so that they can fit onto a page.
4375
4376      (gdb)
4377      -target-download
4378      +download,{section=".text",section-size="6668",total-size="9880"}
4379      +download,{section=".text",section-sent="512",section-size="6668",
4380      total-sent="512",total-size="9880"}
4381      +download,{section=".text",section-sent="1024",section-size="6668",
4382      total-sent="1024",total-size="9880"}
4383      +download,{section=".text",section-sent="1536",section-size="6668",
4384      total-sent="1536",total-size="9880"}
4385      +download,{section=".text",section-sent="2048",section-size="6668",
4386      total-sent="2048",total-size="9880"}
4387      +download,{section=".text",section-sent="2560",section-size="6668",
4388      total-sent="2560",total-size="9880"}
4389      +download,{section=".text",section-sent="3072",section-size="6668",
4390      total-sent="3072",total-size="9880"}
4391      +download,{section=".text",section-sent="3584",section-size="6668",
4392      total-sent="3584",total-size="9880"}
4393      +download,{section=".text",section-sent="4096",section-size="6668",
4394      total-sent="4096",total-size="9880"}
4395      +download,{section=".text",section-sent="4608",section-size="6668",
4396      total-sent="4608",total-size="9880"}
4397      +download,{section=".text",section-sent="5120",section-size="6668",
4398      total-sent="5120",total-size="9880"}
4399      +download,{section=".text",section-sent="5632",section-size="6668",
4400      total-sent="5632",total-size="9880"}
4401      +download,{section=".text",section-sent="6144",section-size="6668",
4402      total-sent="6144",total-size="9880"}
4403      +download,{section=".text",section-sent="6656",section-size="6668",
4404      total-sent="6656",total-size="9880"}
4405      +download,{section=".init",section-size="28",total-size="9880"}
4406      +download,{section=".fini",section-size="28",total-size="9880"}
4407      +download,{section=".data",section-size="3156",total-size="9880"}
4408      +download,{section=".data",section-sent="512",section-size="3156",
4409      total-sent="7236",total-size="9880"}
4410      +download,{section=".data",section-sent="1024",section-size="3156",
4411      total-sent="7748",total-size="9880"}
4412      +download,{section=".data",section-sent="1536",section-size="3156",
4413      total-sent="8260",total-size="9880"}
4414      +download,{section=".data",section-sent="2048",section-size="3156",
4415      total-sent="8772",total-size="9880"}
4416      +download,{section=".data",section-sent="2560",section-size="3156",
4417      total-sent="9284",total-size="9880"}
4418      +download,{section=".data",section-sent="3072",section-size="3156",
4419      total-sent="9796",total-size="9880"}
4420      ^done,address="0x10004",load-size="9880",transfer-rate="6586",
4421      write-rate="429"
4422      (gdb)
4423
4424 GDB Command
4425 ...........
4426
4427 No equivalent.
4428
4429 Example
4430 .......
4431
4432 N.A.
4433
4434 The '-target-select' Command
4435 ----------------------------
4436
4437 Synopsis
4438 ........
4439
4440       -target-select TYPE PARAMETERS ...
4441
4442    Connect GDB to the remote target.  This command takes two args:
4443
4444 'TYPE'
4445      The type of target, for instance 'remote', etc.
4446 'PARAMETERS'
4447      Device names, host names and the like.  *Note Commands for Managing
4448      Targets: Target Commands, for more details.
4449
4450    The output is a connection notification, followed by the address at
4451 which the target program is, in the following form:
4452
4453      ^connected,addr="ADDRESS",func="FUNCTION NAME",
4454        args=[ARG LIST]
4455
4456 GDB Command
4457 ...........
4458
4459 The corresponding GDB command is 'target'.
4460
4461 Example
4462 .......
4463
4464      (gdb)
4465      -target-select remote /dev/ttya
4466      ^connected,addr="0xfe00a300",func="??",args=[]
4467      (gdb)
4468
4469 \1f
4470 File: gdb.info,  Node: GDB/MI File Transfer Commands,  Next: GDB/MI Ada Exceptions Commands,  Prev: GDB/MI Target Manipulation,  Up: GDB/MI
4471
4472 27.21 GDB/MI File Transfer Commands
4473 ===================================
4474
4475 The '-target-file-put' Command
4476 ------------------------------
4477
4478 Synopsis
4479 ........
4480
4481       -target-file-put HOSTFILE TARGETFILE
4482
4483    Copy file HOSTFILE from the host system (the machine running GDB) to
4484 TARGETFILE on the target system.
4485
4486 GDB Command
4487 ...........
4488
4489 The corresponding GDB command is 'remote put'.
4490
4491 Example
4492 .......
4493
4494      (gdb)
4495      -target-file-put localfile remotefile
4496      ^done
4497      (gdb)
4498
4499 The '-target-file-get' Command
4500 ------------------------------
4501
4502 Synopsis
4503 ........
4504
4505       -target-file-get TARGETFILE HOSTFILE
4506
4507    Copy file TARGETFILE from the target system to HOSTFILE on the host
4508 system.
4509
4510 GDB Command
4511 ...........
4512
4513 The corresponding GDB command is 'remote get'.
4514
4515 Example
4516 .......
4517
4518      (gdb)
4519      -target-file-get remotefile localfile
4520      ^done
4521      (gdb)
4522
4523 The '-target-file-delete' Command
4524 ---------------------------------
4525
4526 Synopsis
4527 ........
4528
4529       -target-file-delete TARGETFILE
4530
4531    Delete TARGETFILE from the target system.
4532
4533 GDB Command
4534 ...........
4535
4536 The corresponding GDB command is 'remote delete'.
4537
4538 Example
4539 .......
4540
4541      (gdb)
4542      -target-file-delete remotefile
4543      ^done
4544      (gdb)
4545
4546 \1f
4547 File: gdb.info,  Node: GDB/MI Ada Exceptions Commands,  Next: GDB/MI Support Commands,  Prev: GDB/MI File Transfer Commands,  Up: GDB/MI
4548
4549 27.22 Ada Exceptions GDB/MI Commands
4550 ====================================
4551
4552 The '-info-ada-exceptions' Command
4553 ----------------------------------
4554
4555 Synopsis
4556 ........
4557
4558       -info-ada-exceptions [ REGEXP]
4559
4560    List all Ada exceptions defined within the program being debugged.
4561 With a regular expression REGEXP, only those exceptions whose names
4562 match REGEXP are listed.
4563
4564 GDB Command
4565 ...........
4566
4567 The corresponding GDB command is 'info exceptions'.
4568
4569 Result
4570 ......
4571
4572 The result is a table of Ada exceptions.  The following columns are
4573 defined for each exception:
4574
4575 'name'
4576      The name of the exception.
4577
4578 'address'
4579      The address of the exception.
4580
4581 Example
4582 .......
4583
4584      -info-ada-exceptions aint
4585      ^done,ada-exceptions={nr_rows="2",nr_cols="2",
4586      hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
4587      {width="1",alignment="-1",col_name="address",colhdr="Address"}],
4588      body=[{name="constraint_error",address="0x0000000000613da0"},
4589      {name="const.aint_global_e",address="0x0000000000613b00"}]}
4590
4591 Catching Ada Exceptions
4592 -----------------------
4593
4594 The commands describing how to ask GDB to stop when a program raises an
4595 exception are described at *note Ada Exception GDB/MI Catchpoint
4596 Commands::.
4597
4598 \1f
4599 File: gdb.info,  Node: GDB/MI Support Commands,  Next: GDB/MI Miscellaneous Commands,  Prev: GDB/MI Ada Exceptions Commands,  Up: GDB/MI
4600
4601 27.23 GDB/MI Support Commands
4602 =============================
4603
4604 Since new commands and features get regularly added to GDB/MI, some
4605 commands are available to help front-ends query the debugger about
4606 support for these capabilities.  Similarly, it is also possible to query
4607 GDB about target support of certain features.
4608
4609 The '-info-gdb-mi-command' Command
4610 ----------------------------------
4611
4612 Synopsis
4613 ........
4614
4615       -info-gdb-mi-command CMD_NAME
4616
4617    Query support for the GDB/MI command named CMD_NAME.
4618
4619    Note that the dash ('-') starting all GDB/MI commands is technically
4620 not part of the command name (*note GDB/MI Input Syntax::), and thus
4621 should be omitted in CMD_NAME.  However, for ease of use, this command
4622 also accepts the form with the leading dash.
4623
4624 GDB Command
4625 ...........
4626
4627 There is no corresponding GDB command.
4628
4629 Result
4630 ......
4631
4632 The result is a tuple.  There is currently only one field:
4633
4634 'exists'
4635      This field is equal to '"true"' if the GDB/MI command exists,
4636      '"false"' otherwise.
4637
4638 Example
4639 .......
4640
4641 Here is an example where the GDB/MI command does not exist:
4642
4643      -info-gdb-mi-command unsupported-command
4644      ^done,command={exists="false"}
4645
4646 And here is an example where the GDB/MI command is known to the
4647 debugger:
4648
4649      -info-gdb-mi-command symbol-list-lines
4650      ^done,command={exists="true"}
4651
4652 The '-list-features' Command
4653 ----------------------------
4654
4655 Returns a list of particular features of the MI protocol that this
4656 version of gdb implements.  A feature can be a command, or a new field
4657 in an output of some command, or even an important bugfix.  While a
4658 frontend can sometimes detect presence of a feature at runtime, it is
4659 easier to perform detection at debugger startup.
4660
4661    The command returns a list of strings, with each string naming an
4662 available feature.  Each returned string is just a name, it does not
4663 have any internal structure.  The list of possible feature names is
4664 given below.
4665
4666    Example output:
4667
4668      (gdb) -list-features
4669      ^done,result=["feature1","feature2"]
4670
4671    The current list of features is:
4672
4673 'frozen-varobjs'
4674      Indicates support for the '-var-set-frozen' command, as well as
4675      possible presense of the 'frozen' field in the output of
4676      '-varobj-create'.
4677 'pending-breakpoints'
4678      Indicates support for the '-f' option to the '-break-insert'
4679      command.
4680 'python'
4681      Indicates Python scripting support, Python-based pretty-printing
4682      commands, and possible presence of the 'display_hint' field in the
4683      output of '-var-list-children'
4684 'thread-info'
4685      Indicates support for the '-thread-info' command.
4686 'data-read-memory-bytes'
4687      Indicates support for the '-data-read-memory-bytes' and the
4688      '-data-write-memory-bytes' commands.
4689 'breakpoint-notifications'
4690      Indicates that changes to breakpoints and breakpoints created via
4691      the CLI will be announced via async records.
4692 'ada-task-info'
4693      Indicates support for the '-ada-task-info' command.
4694 'language-option'
4695      Indicates that all GDB/MI commands accept the '--language' option
4696      (*note Context management::).
4697 'info-gdb-mi-command'
4698      Indicates support for the '-info-gdb-mi-command' command.
4699 'undefined-command-error-code'
4700      Indicates support for the "undefined-command" error code in error
4701      result records, produced when trying to execute an undefined GDB/MI
4702      command (*note GDB/MI Result Records::).
4703 'exec-run-start-option'
4704      Indicates that the '-exec-run' command supports the '--start'
4705      option (*note GDB/MI Program Execution::).
4706
4707 The '-list-target-features' Command
4708 -----------------------------------
4709
4710 Returns a list of particular features that are supported by the target.
4711 Those features affect the permitted MI commands, but unlike the features
4712 reported by the '-list-features' command, the features depend on which
4713 target GDB is using at the moment.  Whenever a target can change, due to
4714 commands such as '-target-select', '-target-attach' or '-exec-run', the
4715 list of target features may change, and the frontend should obtain it
4716 again.  Example output:
4717
4718      (gdb) -list-target-features
4719      ^done,result=["async"]
4720
4721    The current list of features is:
4722
4723 'async'
4724      Indicates that the target is capable of asynchronous command
4725      execution, which means that GDB will accept further commands while
4726      the target is running.
4727
4728 'reverse'
4729      Indicates that the target is capable of reverse execution.  *Note
4730      Reverse Execution::, for more information.
4731
4732 \1f
4733 File: gdb.info,  Node: GDB/MI Miscellaneous Commands,  Prev: GDB/MI Support Commands,  Up: GDB/MI
4734
4735 27.24 Miscellaneous GDB/MI Commands
4736 ===================================
4737
4738 The '-gdb-exit' Command
4739 -----------------------
4740
4741 Synopsis
4742 ........
4743
4744       -gdb-exit
4745
4746    Exit GDB immediately.
4747
4748 GDB Command
4749 ...........
4750
4751 Approximately corresponds to 'quit'.
4752
4753 Example
4754 .......
4755
4756      (gdb)
4757      -gdb-exit
4758      ^exit
4759
4760 The '-gdb-set' Command
4761 ----------------------
4762
4763 Synopsis
4764 ........
4765
4766       -gdb-set
4767
4768    Set an internal GDB variable.
4769
4770 GDB Command
4771 ...........
4772
4773 The corresponding GDB command is 'set'.
4774
4775 Example
4776 .......
4777
4778      (gdb)
4779      -gdb-set $foo=3
4780      ^done
4781      (gdb)
4782
4783 The '-gdb-show' Command
4784 -----------------------
4785
4786 Synopsis
4787 ........
4788
4789       -gdb-show
4790
4791    Show the current value of a GDB variable.
4792
4793 GDB Command
4794 ...........
4795
4796 The corresponding GDB command is 'show'.
4797
4798 Example
4799 .......
4800
4801      (gdb)
4802      -gdb-show annotate
4803      ^done,value="0"
4804      (gdb)
4805
4806 The '-gdb-version' Command
4807 --------------------------
4808
4809 Synopsis
4810 ........
4811
4812       -gdb-version
4813
4814    Show version information for GDB.  Used mostly in testing.
4815
4816 GDB Command
4817 ...........
4818
4819 The GDB equivalent is 'show version'.  GDB by default shows this
4820 information when you start an interactive session.
4821
4822 Example
4823 .......
4824
4825      (gdb)
4826      -gdb-version
4827      ~GNU gdb 5.2.1
4828      ~Copyright 2000 Free Software Foundation, Inc.
4829      ~GDB is free software, covered by the GNU General Public License, and
4830      ~you are welcome to change it and/or distribute copies of it under
4831      ~ certain conditions.
4832      ~Type "show copying" to see the conditions.
4833      ~There is absolutely no warranty for GDB.  Type "show warranty" for
4834      ~ details.
4835      ~This GDB was configured as
4836       "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
4837      ^done
4838      (gdb)
4839
4840 The '-list-thread-groups' Command
4841 ---------------------------------
4842
4843 Synopsis
4844 --------
4845
4846      -list-thread-groups [ --available ] [ --recurse 1 ] [ GROUP ... ]
4847
4848    Lists thread groups (*note Thread groups::).  When a single thread
4849 group is passed as the argument, lists the children of that group.  When
4850 several thread group are passed, lists information about those thread
4851 groups.  Without any parameters, lists information about all top-level
4852 thread groups.
4853
4854    Normally, thread groups that are being debugged are reported.  With
4855 the '--available' option, GDB reports thread groups available on the
4856 target.
4857
4858    The output of this command may have either a 'threads' result or a
4859 'groups' result.  The 'thread' result has a list of tuples as value,
4860 with each tuple describing a thread (*note GDB/MI Thread Information::).
4861 The 'groups' result has a list of tuples as value, each tuple describing
4862 a thread group.  If top-level groups are requested (that is, no
4863 parameter is passed), or when several groups are passed, the output
4864 always has a 'groups' result.  The format of the 'group' result is
4865 described below.
4866
4867    To reduce the number of roundtrips it's possible to list thread
4868 groups together with their children, by passing the '--recurse' option
4869 and the recursion depth.  Presently, only recursion depth of 1 is
4870 permitted.  If this option is present, then every reported thread group
4871 will also include its children, either as 'group' or 'threads' field.
4872
4873    In general, any combination of option and parameters is permitted,
4874 with the following caveats:
4875
4876    * When a single thread group is passed, the output will typically be
4877      the 'threads' result.  Because threads may not contain anything,
4878      the 'recurse' option will be ignored.
4879
4880    * When the '--available' option is passed, limited information may be
4881      available.  In particular, the list of threads of a process might
4882      be inaccessible.  Further, specifying specific thread groups might
4883      not give any performance advantage over listing all thread groups.
4884      The frontend should assume that '-list-thread-groups --available'
4885      is always an expensive operation and cache the results.
4886
4887    The 'groups' result is a list of tuples, where each tuple may have
4888 the following fields:
4889
4890 'id'
4891      Identifier of the thread group.  This field is always present.  The
4892      identifier is an opaque string; frontends should not try to convert
4893      it to an integer, even though it might look like one.
4894
4895 'type'
4896      The type of the thread group.  At present, only 'process' is a
4897      valid type.
4898
4899 'pid'
4900      The target-specific process identifier.  This field is only present
4901      for thread groups of type 'process' and only if the process exists.
4902
4903 'num_children'
4904      The number of children this thread group has.  This field may be
4905      absent for an available thread group.
4906
4907 'threads'
4908      This field has a list of tuples as value, each tuple describing a
4909      thread.  It may be present if the '--recurse' option is specified,
4910      and it's actually possible to obtain the threads.
4911
4912 'cores'
4913      This field is a list of integers, each identifying a core that one
4914      thread of the group is running on.  This field may be absent if
4915      such information is not available.
4916
4917 'executable'
4918      The name of the executable file that corresponds to this thread
4919      group.  The field is only present for thread groups of type
4920      'process', and only if there is a corresponding executable file.
4921
4922 Example
4923 -------
4924
4925      gdb
4926      -list-thread-groups
4927      ^done,groups=[{id="17",type="process",pid="yyy",num_children="2"}]
4928      -list-thread-groups 17
4929      ^done,threads=[{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
4930         frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]},state="running"},
4931      {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
4932         frame={level="0",addr="0x0804891f",func="foo",args=[{name="i",value="10"}],
4933                 file="/tmp/a.c",fullname="/tmp/a.c",line="158"},state="running"}]]
4934      -list-thread-groups --available
4935      ^done,groups=[{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]}]
4936      -list-thread-groups --available --recurse 1
4937       ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
4938                      threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
4939                               {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},..]
4940      -list-thread-groups --available --recurse 1 17 18
4941      ^done,groups=[{id="17", types="process",pid="yyy",num_children="2",cores=[1,2],
4942                     threads=[{id="1",target-id="Thread 0xb7e14b90",cores=[1]},
4943                              {id="2",target-id="Thread 0xb7e14b90",cores=[2]}]},...]
4944
4945 The '-info-os' Command
4946 ----------------------
4947
4948 Synopsis
4949 ........
4950
4951      -info-os [ TYPE ]
4952
4953    If no argument is supplied, the command returns a table of available
4954 operating-system-specific information types.  If one of these types is
4955 supplied as an argument TYPE, then the command returns a table of data
4956 of that type.
4957
4958    The types of information available depend on the target operating
4959 system.
4960
4961 GDB Command
4962 ...........
4963
4964 The corresponding GDB command is 'info os'.
4965
4966 Example
4967 .......
4968
4969 When run on a GNU/Linux system, the output will look something like
4970 this:
4971
4972      gdb
4973      -info-os
4974      ^done,OSDataTable={nr_rows="9",nr_cols="3",
4975      hdr=[{width="10",alignment="-1",col_name="col0",colhdr="Type"},
4976           {width="10",alignment="-1",col_name="col1",colhdr="Description"},
4977           {width="10",alignment="-1",col_name="col2",colhdr="Title"}],
4978      body=[item={col0="processes",col1="Listing of all processes",
4979                  col2="Processes"},
4980            item={col0="procgroups",col1="Listing of all process groups",
4981                  col2="Process groups"},
4982            item={col0="threads",col1="Listing of all threads",
4983                  col2="Threads"},
4984            item={col0="files",col1="Listing of all file descriptors",
4985                  col2="File descriptors"},
4986            item={col0="sockets",col1="Listing of all internet-domain sockets",
4987                  col2="Sockets"},
4988            item={col0="shm",col1="Listing of all shared-memory regions",
4989                  col2="Shared-memory regions"},
4990            item={col0="semaphores",col1="Listing of all semaphores",
4991                  col2="Semaphores"},
4992            item={col0="msg",col1="Listing of all message queues",
4993                  col2="Message queues"},
4994            item={col0="modules",col1="Listing of all loaded kernel modules",
4995                  col2="Kernel modules"}]}
4996      gdb
4997      -info-os processes
4998      ^done,OSDataTable={nr_rows="190",nr_cols="4",
4999      hdr=[{width="10",alignment="-1",col_name="col0",colhdr="pid"},
5000           {width="10",alignment="-1",col_name="col1",colhdr="user"},
5001           {width="10",alignment="-1",col_name="col2",colhdr="command"},
5002           {width="10",alignment="-1",col_name="col3",colhdr="cores"}],
5003      body=[item={col0="1",col1="root",col2="/sbin/init",col3="0"},
5004            item={col0="2",col1="root",col2="[kthreadd]",col3="1"},
5005            item={col0="3",col1="root",col2="[ksoftirqd/0]",col3="0"},
5006            ...
5007            item={col0="26446",col1="stan",col2="bash",col3="0"},
5008            item={col0="28152",col1="stan",col2="bash",col3="1"}]}
5009      (gdb)
5010
5011    (Note that the MI output here includes a '"Title"' column that does
5012 not appear in command-line 'info os'; this column is useful for MI
5013 clients that want to enumerate the types of data, such as in a popup
5014 menu, but is needless clutter on the command line, and 'info os' omits
5015 it.)
5016
5017 The '-add-inferior' Command
5018 ---------------------------
5019
5020 Synopsis
5021 --------
5022
5023      -add-inferior
5024
5025    Creates a new inferior (*note Inferiors and Programs::).  The created
5026 inferior is not associated with any executable.  Such association may be
5027 established with the '-file-exec-and-symbols' command (*note GDB/MI File
5028 Commands::).  The command response has a single field, 'inferior', whose
5029 value is the identifier of the thread group corresponding to the new
5030 inferior.
5031
5032 Example
5033 -------
5034
5035      gdb
5036      -add-inferior
5037      ^done,inferior="i3"
5038
5039 The '-interpreter-exec' Command
5040 -------------------------------
5041
5042 Synopsis
5043 --------
5044
5045      -interpreter-exec INTERPRETER COMMAND
5046
5047    Execute the specified COMMAND in the given INTERPRETER.
5048
5049 GDB Command
5050 -----------
5051
5052 The corresponding GDB command is 'interpreter-exec'.
5053
5054 Example
5055 -------
5056
5057      (gdb)
5058      -interpreter-exec console "break main"
5059      &"During symbol reading, couldn't parse type; debugger out of date?.\n"
5060      &"During symbol reading, bad structure-type format.\n"
5061      ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
5062      ^done
5063      (gdb)
5064
5065 The '-inferior-tty-set' Command
5066 -------------------------------
5067
5068 Synopsis
5069 --------
5070
5071      -inferior-tty-set /dev/pts/1
5072
5073    Set terminal for future runs of the program being debugged.
5074
5075 GDB Command
5076 -----------
5077
5078 The corresponding GDB command is 'set inferior-tty' /dev/pts/1.
5079
5080 Example
5081 -------
5082
5083      (gdb)
5084      -inferior-tty-set /dev/pts/1
5085      ^done
5086      (gdb)
5087
5088 The '-inferior-tty-show' Command
5089 --------------------------------
5090
5091 Synopsis
5092 --------
5093
5094      -inferior-tty-show
5095
5096    Show terminal for future runs of program being debugged.
5097
5098 GDB Command
5099 -----------
5100
5101 The corresponding GDB command is 'show inferior-tty'.
5102
5103 Example
5104 -------
5105
5106      (gdb)
5107      -inferior-tty-set /dev/pts/1
5108      ^done
5109      (gdb)
5110      -inferior-tty-show
5111      ^done,inferior_tty_terminal="/dev/pts/1"
5112      (gdb)
5113
5114 The '-enable-timings' Command
5115 -----------------------------
5116
5117 Synopsis
5118 --------
5119
5120      -enable-timings [yes | no]
5121
5122    Toggle the printing of the wallclock, user and system times for an MI
5123 command as a field in its output.  This command is to help frontend
5124 developers optimize the performance of their code.  No argument is
5125 equivalent to 'yes'.
5126
5127 GDB Command
5128 -----------
5129
5130 No equivalent.
5131
5132 Example
5133 -------
5134
5135      (gdb)
5136      -enable-timings
5137      ^done
5138      (gdb)
5139      -break-insert main
5140      ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5141      addr="0x080484ed",func="main",file="myprog.c",
5142      fullname="/home/nickrob/myprog.c",line="73",thread-groups=["i1"],
5143      times="0"},
5144      time={wallclock="0.05185",user="0.00800",system="0.00000"}
5145      (gdb)
5146      -enable-timings no
5147      ^done
5148      (gdb)
5149      -exec-run
5150      ^running
5151      (gdb)
5152      *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
5153      frame={addr="0x080484ed",func="main",args=[{name="argc",value="1"},
5154      {name="argv",value="0xbfb60364"}],file="myprog.c",
5155      fullname="/home/nickrob/myprog.c",line="73"}
5156      (gdb)
5157
5158 \1f
5159 File: gdb.info,  Node: Annotations,  Next: JIT Interface,  Prev: GDB/MI,  Up: Top
5160
5161 28 GDB Annotations
5162 ******************
5163
5164 This chapter describes annotations in GDB.  Annotations were designed to
5165 interface GDB to graphical user interfaces or other similar programs
5166 which want to interact with GDB at a relatively high level.
5167
5168    The annotation mechanism has largely been superseded by GDB/MI (*note
5169 GDB/MI::).
5170
5171 * Menu:
5172
5173 * Annotations Overview::  What annotations are; the general syntax.
5174 * Server Prefix::       Issuing a command without affecting user state.
5175 * Prompting::           Annotations marking GDB's need for input.
5176 * Errors::              Annotations for error messages.
5177 * Invalidation::        Some annotations describe things now invalid.
5178 * Annotations for Running::
5179                         Whether the program is running, how it stopped, etc.
5180 * Source Annotations::  Annotations describing source code.
5181
5182 \1f
5183 File: gdb.info,  Node: Annotations Overview,  Next: Server Prefix,  Up: Annotations
5184
5185 28.1 What is an Annotation?
5186 ===========================
5187
5188 Annotations start with a newline character, two 'control-z' characters,
5189 and the name of the annotation.  If there is no additional information
5190 associated with this annotation, the name of the annotation is followed
5191 immediately by a newline.  If there is additional information, the name
5192 of the annotation is followed by a space, the additional information,
5193 and a newline.  The additional information cannot contain newline
5194 characters.
5195
5196    Any output not beginning with a newline and two 'control-z'
5197 characters denotes literal output from GDB.  Currently there is no need
5198 for GDB to output a newline followed by two 'control-z' characters, but
5199 if there was such a need, the annotations could be extended with an
5200 'escape' annotation which means those three characters as output.
5201
5202    The annotation LEVEL, which is specified using the '--annotate'
5203 command line option (*note Mode Options::), controls how much
5204 information GDB prints together with its prompt, values of expressions,
5205 source lines, and other types of output.  Level 0 is for no annotations,
5206 level 1 is for use when GDB is run as a subprocess of GNU Emacs, level 3
5207 is the maximum annotation suitable for programs that control GDB, and
5208 level 2 annotations have been made obsolete (*note Limitations of the
5209 Annotation Interface: (annotate)Limitations.).
5210
5211 'set annotate LEVEL'
5212      The GDB command 'set annotate' sets the level of annotations to the
5213      specified LEVEL.
5214
5215 'show annotate'
5216      Show the current annotation level.
5217
5218    This chapter describes level 3 annotations.
5219
5220    A simple example of starting up GDB with annotations is:
5221
5222      $ gdb --annotate=3
5223      GNU gdb 6.0
5224      Copyright 2003 Free Software Foundation, Inc.
5225      GDB is free software, covered by the GNU General Public License,
5226      and you are welcome to change it and/or distribute copies of it
5227      under certain conditions.
5228      Type "show copying" to see the conditions.
5229      There is absolutely no warranty for GDB.  Type "show warranty"
5230      for details.
5231      This GDB was configured as "i386-pc-linux-gnu"
5232
5233      ^Z^Zpre-prompt
5234      (gdb)
5235      ^Z^Zprompt
5236      quit
5237
5238      ^Z^Zpost-prompt
5239      $
5240
5241    Here 'quit' is input to GDB; the rest is output from GDB.  The three
5242 lines beginning '^Z^Z' (where '^Z' denotes a 'control-z' character) are
5243 annotations; the rest is output from GDB.
5244
5245 \1f
5246 File: gdb.info,  Node: Server Prefix,  Next: Prompting,  Prev: Annotations Overview,  Up: Annotations
5247
5248 28.2 The Server Prefix
5249 ======================
5250
5251 If you prefix a command with 'server ' then it will not affect the
5252 command history, nor will it affect GDB's notion of which command to
5253 repeat if <RET> is pressed on a line by itself.  This means that
5254 commands can be run behind a user's back by a front-end in a transparent
5255 manner.
5256
5257    The 'server ' prefix does not affect the recording of values into the
5258 value history; to print a value without recording it into the value
5259 history, use the 'output' command instead of the 'print' command.
5260
5261    Using this prefix also disables confirmation requests (*note
5262 confirmation requests::).
5263
5264 \1f
5265 File: gdb.info,  Node: Prompting,  Next: Errors,  Prev: Server Prefix,  Up: Annotations
5266
5267 28.3 Annotation for GDB Input
5268 =============================
5269
5270 When GDB prompts for input, it annotates this fact so it is possible to
5271 know when to send output, when the output from a given command is over,
5272 etc.
5273
5274    Different kinds of input each have a different "input type".  Each
5275 input type has three annotations: a 'pre-' annotation, which denotes the
5276 beginning of any prompt which is being output, a plain annotation, which
5277 denotes the end of the prompt, and then a 'post-' annotation which
5278 denotes the end of any echo which may (or may not) be associated with
5279 the input.  For example, the 'prompt' input type features the following
5280 annotations:
5281
5282      ^Z^Zpre-prompt
5283      ^Z^Zprompt
5284      ^Z^Zpost-prompt
5285
5286    The input types are
5287
5288 'prompt'
5289      When GDB is prompting for a command (the main GDB prompt).
5290
5291 'commands'
5292      When GDB prompts for a set of commands, like in the 'commands'
5293      command.  The annotations are repeated for each command which is
5294      input.
5295
5296 'overload-choice'
5297      When GDB wants the user to select between various overloaded
5298      functions.
5299
5300 'query'
5301      When GDB wants the user to confirm a potentially dangerous
5302      operation.
5303
5304 'prompt-for-continue'
5305      When GDB is asking the user to press return to continue.  Note:
5306      Don't expect this to work well; instead use 'set height 0' to
5307      disable prompting.  This is because the counting of lines is buggy
5308      in the presence of annotations.
5309
5310 \1f
5311 File: gdb.info,  Node: Errors,  Next: Invalidation,  Prev: Prompting,  Up: Annotations
5312
5313 28.4 Errors
5314 ===========
5315
5316      ^Z^Zquit
5317
5318    This annotation occurs right before GDB responds to an interrupt.
5319
5320      ^Z^Zerror
5321
5322    This annotation occurs right before GDB responds to an error.
5323
5324    Quit and error annotations indicate that any annotations which GDB
5325 was in the middle of may end abruptly.  For example, if a
5326 'value-history-begin' annotation is followed by a 'error', one cannot
5327 expect to receive the matching 'value-history-end'.  One cannot expect
5328 not to receive it either, however; an error annotation does not
5329 necessarily mean that GDB is immediately returning all the way to the
5330 top level.
5331
5332    A quit or error annotation may be preceded by
5333
5334      ^Z^Zerror-begin
5335
5336    Any output between that and the quit or error annotation is the error
5337 message.
5338
5339    Warning messages are not yet annotated.
5340
5341 \1f
5342 File: gdb.info,  Node: Invalidation,  Next: Annotations for Running,  Prev: Errors,  Up: Annotations
5343
5344 28.5 Invalidation Notices
5345 =========================
5346
5347 The following annotations say that certain pieces of state may have
5348 changed.
5349
5350 '^Z^Zframes-invalid'
5351
5352      The frames (for example, output from the 'backtrace' command) may
5353      have changed.
5354
5355 '^Z^Zbreakpoints-invalid'
5356
5357      The breakpoints may have changed.  For example, the user just added
5358      or deleted a breakpoint.
5359
5360 \1f
5361 File: gdb.info,  Node: Annotations for Running,  Next: Source Annotations,  Prev: Invalidation,  Up: Annotations
5362
5363 28.6 Running the Program
5364 ========================
5365
5366 When the program starts executing due to a GDB command such as 'step' or
5367 'continue',
5368
5369      ^Z^Zstarting
5370
5371    is output.  When the program stops,
5372
5373      ^Z^Zstopped
5374
5375    is output.  Before the 'stopped' annotation, a variety of annotations
5376 describe how the program stopped.
5377
5378 '^Z^Zexited EXIT-STATUS'
5379      The program exited, and EXIT-STATUS is the exit status (zero for
5380      successful exit, otherwise nonzero).
5381
5382 '^Z^Zsignalled'
5383      The program exited with a signal.  After the '^Z^Zsignalled', the
5384      annotation continues:
5385
5386           INTRO-TEXT
5387           ^Z^Zsignal-name
5388           NAME
5389           ^Z^Zsignal-name-end
5390           MIDDLE-TEXT
5391           ^Z^Zsignal-string
5392           STRING
5393           ^Z^Zsignal-string-end
5394           END-TEXT
5395
5396      where NAME is the name of the signal, such as 'SIGILL' or
5397      'SIGSEGV', and STRING is the explanation of the signal, such as
5398      'Illegal Instruction' or 'Segmentation fault'.  The arguments
5399      INTRO-TEXT, MIDDLE-TEXT, and END-TEXT are for the user's benefit
5400      and have no particular format.
5401
5402 '^Z^Zsignal'
5403      The syntax of this annotation is just like 'signalled', but GDB is
5404      just saying that the program received the signal, not that it was
5405      terminated with it.
5406
5407 '^Z^Zbreakpoint NUMBER'
5408      The program hit breakpoint number NUMBER.
5409
5410 '^Z^Zwatchpoint NUMBER'
5411      The program hit watchpoint number NUMBER.
5412
5413 \1f
5414 File: gdb.info,  Node: Source Annotations,  Prev: Annotations for Running,  Up: Annotations
5415
5416 28.7 Displaying Source
5417 ======================
5418
5419 The following annotation is used instead of displaying source code:
5420
5421      ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
5422
5423    where FILENAME is an absolute file name indicating which source file,
5424 LINE is the line number within that file (where 1 is the first line in
5425 the file), CHARACTER is the character position within the file (where 0
5426 is the first character in the file) (for most debug formats this will
5427 necessarily point to the beginning of a line), MIDDLE is 'middle' if
5428 ADDR is in the middle of the line, or 'beg' if ADDR is at the beginning
5429 of the line, and ADDR is the address in the target program associated
5430 with the source which is being displayed.  The ADDR is in the form '0x'
5431 followed by one or more lowercase hex digits (note that this does not
5432 depend on the language).
5433
5434 \1f
5435 File: gdb.info,  Node: JIT Interface,  Next: In-Process Agent,  Prev: Annotations,  Up: Top
5436
5437 29 JIT Compilation Interface
5438 ****************************
5439
5440 This chapter documents GDB's "just-in-time" (JIT) compilation interface.
5441 A JIT compiler is a program or library that generates native executable
5442 code at runtime and executes it, usually in order to achieve good
5443 performance while maintaining platform independence.
5444
5445    Programs that use JIT compilation are normally difficult to debug
5446 because portions of their code are generated at runtime, instead of
5447 being loaded from object files, which is where GDB normally finds the
5448 program's symbols and debug information.  In order to debug programs
5449 that use JIT compilation, GDB has an interface that allows the program
5450 to register in-memory symbol files with GDB at runtime.
5451
5452    If you are using GDB to debug a program that uses this interface,
5453 then it should work transparently so long as you have not stripped the
5454 binary.  If you are developing a JIT compiler, then the interface is
5455 documented in the rest of this chapter.  At this time, the only known
5456 client of this interface is the LLVM JIT.
5457
5458    Broadly speaking, the JIT interface mirrors the dynamic loader
5459 interface.  The JIT compiler communicates with GDB by writing data into
5460 a global variable and calling a fuction at a well-known symbol.  When
5461 GDB attaches, it reads a linked list of symbol files from the global
5462 variable to find existing code, and puts a breakpoint in the function so
5463 that it can find out about additional code.
5464
5465 * Menu:
5466
5467 * Declarations::                Relevant C struct declarations
5468 * Registering Code::            Steps to register code
5469 * Unregistering Code::          Steps to unregister code
5470 * Custom Debug Info::           Emit debug information in a custom format
5471
5472 \1f
5473 File: gdb.info,  Node: Declarations,  Next: Registering Code,  Up: JIT Interface
5474
5475 29.1 JIT Declarations
5476 =====================
5477
5478 These are the relevant struct declarations that a C program should
5479 include to implement the interface:
5480
5481      typedef enum
5482      {
5483        JIT_NOACTION = 0,
5484        JIT_REGISTER_FN,
5485        JIT_UNREGISTER_FN
5486      } jit_actions_t;
5487
5488      struct jit_code_entry
5489      {
5490        struct jit_code_entry *next_entry;
5491        struct jit_code_entry *prev_entry;
5492        const char *symfile_addr;
5493        uint64_t symfile_size;
5494      };
5495
5496      struct jit_descriptor
5497      {
5498        uint32_t version;
5499        /* This type should be jit_actions_t, but we use uint32_t
5500           to be explicit about the bitwidth.  */
5501        uint32_t action_flag;
5502        struct jit_code_entry *relevant_entry;
5503        struct jit_code_entry *first_entry;
5504      };
5505
5506      /* GDB puts a breakpoint in this function.  */
5507      void __attribute__((noinline)) __jit_debug_register_code() { };
5508
5509      /* Make sure to specify the version statically, because the
5510         debugger may check the version before we can set it.  */
5511      struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
5512
5513    If the JIT is multi-threaded, then it is important that the JIT
5514 synchronize any modifications to this global data properly, which can
5515 easily be done by putting a global mutex around modifications to these
5516 structures.
5517
5518 \1f
5519 File: gdb.info,  Node: Registering Code,  Next: Unregistering Code,  Prev: Declarations,  Up: JIT Interface
5520
5521 29.2 Registering Code
5522 =====================
5523
5524 To register code with GDB, the JIT should follow this protocol:
5525
5526    * Generate an object file in memory with symbols and other desired
5527      debug information.  The file must include the virtual addresses of
5528      the sections.
5529
5530    * Create a code entry for the file, which gives the start and size of
5531      the symbol file.
5532
5533    * Add it to the linked list in the JIT descriptor.
5534
5535    * Point the relevant_entry field of the descriptor at the entry.
5536
5537    * Set 'action_flag' to 'JIT_REGISTER' and call
5538      '__jit_debug_register_code'.
5539
5540    When GDB is attached and the breakpoint fires, GDB uses the
5541 'relevant_entry' pointer so it doesn't have to walk the list looking for
5542 new code.  However, the linked list must still be maintained in order to
5543 allow GDB to attach to a running process and still find the symbol
5544 files.
5545
5546 \1f
5547 File: gdb.info,  Node: Unregistering Code,  Next: Custom Debug Info,  Prev: Registering Code,  Up: JIT Interface
5548
5549 29.3 Unregistering Code
5550 =======================
5551
5552 If code is freed, then the JIT should use the following protocol:
5553
5554    * Remove the code entry corresponding to the code from the linked
5555      list.
5556
5557    * Point the 'relevant_entry' field of the descriptor at the code
5558      entry.
5559
5560    * Set 'action_flag' to 'JIT_UNREGISTER' and call
5561      '__jit_debug_register_code'.
5562
5563    If the JIT frees or recompiles code without unregistering it, then
5564 GDB and the JIT will leak the memory used for the associated symbol
5565 files.
5566
5567 \1f
5568 File: gdb.info,  Node: Custom Debug Info,  Prev: Unregistering Code,  Up: JIT Interface
5569
5570 29.4 Custom Debug Info
5571 ======================
5572
5573 Generating debug information in platform-native file formats (like ELF
5574 or COFF) may be an overkill for JIT compilers; especially if all the
5575 debug info is used for is displaying a meaningful backtrace.  The issue
5576 can be resolved by having the JIT writers decide on a debug info format
5577 and also provide a reader that parses the debug info generated by the
5578 JIT compiler.  This section gives a brief overview on writing such a
5579 parser.  More specific details can be found in the source file
5580 'gdb/jit-reader.in', which is also installed as a header at
5581 'INCLUDEDIR/gdb/jit-reader.h' for easy inclusion.
5582
5583    The reader is implemented as a shared object (so this functionality
5584 is not available on platforms which don't allow loading shared objects
5585 at runtime).  Two GDB commands, 'jit-reader-load' and
5586 'jit-reader-unload' are provided, to be used to load and unload the
5587 readers from a preconfigured directory.  Once loaded, the shared object
5588 is used the parse the debug information emitted by the JIT compiler.
5589
5590 * Menu:
5591
5592 * Using JIT Debug Info Readers::       How to use supplied readers correctly
5593 * Writing JIT Debug Info Readers::     Creating a debug-info reader
5594
5595 \1f
5596 File: gdb.info,  Node: Using JIT Debug Info Readers,  Next: Writing JIT Debug Info Readers,  Up: Custom Debug Info
5597
5598 29.4.1 Using JIT Debug Info Readers
5599 -----------------------------------
5600
5601 Readers can be loaded and unloaded using the 'jit-reader-load' and
5602 'jit-reader-unload' commands.
5603
5604 'jit-reader-load READER'
5605      Load the JIT reader named READER, which is a shared object
5606      specified as either an absolute or a relative file name.  In the
5607      latter case, GDB will try to load the reader from a pre-configured
5608      directory, usually 'LIBDIR/gdb/' on a UNIX system (here LIBDIR is
5609      the system library directory, often '/usr/local/lib').
5610
5611      Only one reader can be active at a time; trying to load a second
5612      reader when one is already loaded will result in GDB reporting an
5613      error.  A new JIT reader can be loaded by first unloading the
5614      current one using 'jit-reader-unload' and then invoking
5615      'jit-reader-load'.
5616
5617 'jit-reader-unload'
5618      Unload the currently loaded JIT reader.
5619
5620 \1f
5621 File: gdb.info,  Node: Writing JIT Debug Info Readers,  Prev: Using JIT Debug Info Readers,  Up: Custom Debug Info
5622
5623 29.4.2 Writing JIT Debug Info Readers
5624 -------------------------------------
5625
5626 As mentioned, a reader is essentially a shared object conforming to a
5627 certain ABI. This ABI is described in 'jit-reader.h'.
5628
5629    'jit-reader.h' defines the structures, macros and functions required
5630 to write a reader.  It is installed (along with GDB), in
5631 'INCLUDEDIR/gdb' where INCLUDEDIR is the system include directory.
5632
5633    Readers need to be released under a GPL compatible license.  A reader
5634 can be declared as released under such a license by placing the macro
5635 'GDB_DECLARE_GPL_COMPATIBLE_READER' in a source file.
5636
5637    The entry point for readers is the symbol 'gdb_init_reader', which is
5638 expected to be a function with the prototype
5639
5640      extern struct gdb_reader_funcs *gdb_init_reader (void);
5641
5642    'struct gdb_reader_funcs' contains a set of pointers to callback
5643 functions.  These functions are executed to read the debug info
5644 generated by the JIT compiler ('read'), to unwind stack frames
5645 ('unwind') and to create canonical frame IDs ('get_Frame_id').  It also
5646 has a callback that is called when the reader is being unloaded
5647 ('destroy').  The struct looks like this
5648
5649      struct gdb_reader_funcs
5650      {
5651        /* Must be set to GDB_READER_INTERFACE_VERSION.  */
5652        int reader_version;
5653
5654        /* For use by the reader.  */
5655        void *priv_data;
5656
5657        gdb_read_debug_info *read;
5658        gdb_unwind_frame *unwind;
5659        gdb_get_frame_id *get_frame_id;
5660        gdb_destroy_reader *destroy;
5661      };
5662
5663    The callbacks are provided with another set of callbacks by GDB to do
5664 their job.  For 'read', these callbacks are passed in a 'struct
5665 gdb_symbol_callbacks' and for 'unwind' and 'get_frame_id', in a 'struct
5666 gdb_unwind_callbacks'.  'struct gdb_symbol_callbacks' has callbacks to
5667 create new object files and new symbol tables inside those object files.
5668 'struct gdb_unwind_callbacks' has callbacks to read registers off the
5669 current frame and to write out the values of the registers in the
5670 previous frame.  Both have a callback ('target_read') to read bytes off
5671 the target's address space.
5672
5673 \1f
5674 File: gdb.info,  Node: In-Process Agent,  Next: GDB Bugs,  Prev: JIT Interface,  Up: Top
5675
5676 30 In-Process Agent
5677 *******************
5678
5679 The traditional debugging model is conceptually low-speed, but works
5680 fine, because most bugs can be reproduced in debugging-mode execution.
5681 However, as multi-core or many-core processors are becoming mainstream,
5682 and multi-threaded programs become more and more popular, there should
5683 be more and more bugs that only manifest themselves at normal-mode
5684 execution, for example, thread races, because debugger's interference
5685 with the program's timing may conceal the bugs.  On the other hand, in
5686 some applications, it is not feasible for the debugger to interrupt the
5687 program's execution long enough for the developer to learn anything
5688 helpful about its behavior.  If the program's correctness depends on its
5689 real-time behavior, delays introduced by a debugger might cause the
5690 program to fail, even when the code itself is correct.  It is useful to
5691 be able to observe the program's behavior without interrupting it.
5692
5693    Therefore, traditional debugging model is too intrusive to reproduce
5694 some bugs.  In order to reduce the interference with the program, we can
5695 reduce the number of operations performed by debugger.  The "In-Process
5696 Agent", a shared library, is running within the same process with
5697 inferior, and is able to perform some debugging operations itself.  As a
5698 result, debugger is only involved when necessary, and performance of
5699 debugging can be improved accordingly.  Note that interference with
5700 program can be reduced but can't be removed completely, because the
5701 in-process agent will still stop or slow down the program.
5702
5703    The in-process agent can interpret and execute Agent Expressions
5704 (*note Agent Expressions::) during performing debugging operations.  The
5705 agent expressions can be used for different purposes, such as collecting
5706 data in tracepoints, and condition evaluation in breakpoints.
5707
5708    You can control whether the in-process agent is used as an aid for
5709 debugging with the following commands:
5710
5711 'set agent on'
5712      Causes the in-process agent to perform some operations on behalf of
5713      the debugger.  Just which operations requested by the user will be
5714      done by the in-process agent depends on the its capabilities.  For
5715      example, if you request to evaluate breakpoint conditions in the
5716      in-process agent, and the in-process agent has such capability as
5717      well, then breakpoint conditions will be evaluated in the
5718      in-process agent.
5719
5720 'set agent off'
5721      Disables execution of debugging operations by the in-process agent.
5722      All of the operations will be performed by GDB.
5723
5724 'show agent'
5725      Display the current setting of execution of debugging operations by
5726      the in-process agent.
5727
5728 * Menu:
5729
5730 * In-Process Agent Protocol::
5731
5732 \1f
5733 File: gdb.info,  Node: In-Process Agent Protocol,  Up: In-Process Agent
5734
5735 30.1 In-Process Agent Protocol
5736 ==============================
5737
5738 The in-process agent is able to communicate with both GDB and GDBserver
5739 (*note In-Process Agent::).  This section documents the protocol used
5740 for communications between GDB or GDBserver and the IPA. In general, GDB
5741 or GDBserver sends commands (*note IPA Protocol Commands::) and data to
5742 in-process agent, and then in-process agent replies back with the return
5743 result of the command, or some other information.  The data sent to
5744 in-process agent is composed of primitive data types, such as 4-byte or
5745 8-byte type, and composite types, which are called objects (*note IPA
5746 Protocol Objects::).
5747
5748 * Menu:
5749
5750 * IPA Protocol Objects::
5751 * IPA Protocol Commands::
5752
5753 \1f
5754 File: gdb.info,  Node: IPA Protocol Objects,  Next: IPA Protocol Commands,  Up: In-Process Agent Protocol
5755
5756 30.1.1 IPA Protocol Objects
5757 ---------------------------
5758
5759 The commands sent to and results received from agent may contain some
5760 complex data types called "objects".
5761
5762    The in-process agent is running on the same machine with GDB or
5763 GDBserver, so it doesn't have to handle as much differences between two
5764 ends as remote protocol (*note Remote Protocol::) tries to handle.
5765 However, there are still some differences of two ends in two processes:
5766
5767   1. word size.  On some 64-bit machines, GDB or GDBserver can be
5768      compiled as a 64-bit executable, while in-process agent is a 32-bit
5769      one.
5770   2. ABI. Some machines may have multiple types of ABI, GDB or GDBserver
5771      is compiled with one, and in-process agent is compiled with the
5772      other one.
5773
5774    Here are the IPA Protocol Objects:
5775
5776   1. agent expression object.  It represents an agent expression (*note
5777      Agent Expressions::).
5778   2. tracepoint action object.  It represents a tracepoint action (*note
5779      Tracepoint Action Lists: Tracepoint Actions.) to collect registers,
5780      memory, static trace data and to evaluate expression.
5781   3. tracepoint object.  It represents a tracepoint (*note
5782      Tracepoints::).
5783
5784    The following table describes important attributes of each IPA
5785 protocol object:
5786
5787 Name                   Size           Description
5788 ---------------------------------------------------------------------------
5789 _agent expression
5790 object_
5791 length                 4              length of bytes code
5792 byte code              LENGTH         contents of byte code
5793 _tracepoint action
5794 for collecting
5795 memory_
5796 'M'                    1              type of tracepoint action
5797 addr                   8              if BASEREG is '-1', ADDR is the
5798                                       address of the lowest byte to
5799                                       collect, otherwise ADDR is the
5800                                       offset of BASEREG for memory
5801                                       collecting.
5802 len                    8              length of memory for collecting
5803 basereg                4              the register number containing the
5804                                       starting memory address for
5805                                       collecting.
5806 _tracepoint action
5807 for collecting
5808 registers_
5809 'R'                    1              type of tracepoint action
5810 _tracepoint action
5811 for collecting
5812 static trace data_
5813 'L'                    1              type of tracepoint action
5814 _tracepoint action
5815 for expression
5816 evaluation_
5817 'X'                    1              type of tracepoint action
5818 agent expression       length of      *note agent expression object::
5819 _tracepoint object_
5820 number                 4              number of tracepoint
5821 address                8              address of tracepoint inserted on
5822 type                   4              type of tracepoint
5823 enabled                1              enable or disable of tracepoint
5824 step_count             8              step
5825 pass_count             8              pass
5826 numactions             4              number of tracepoint actions
5827 hit count              8              hit count
5828 trace frame usage      8              trace frame usage
5829 compiled_cond          8              compiled condition
5830 orig_size              8              orig size
5831 condition              4 if           zero if condition is NULL,
5832                        condition is   otherwise is *note agent
5833                        NULL           expression object::
5834                        otherwise
5835                        length of
5836                        *note agent
5837                        expression
5838                        object::
5839 actions                variable       numactions number of *note
5840                                       tracepoint action object::
5841
5842 \1f
5843 File: gdb.info,  Node: IPA Protocol Commands,  Prev: IPA Protocol Objects,  Up: In-Process Agent Protocol
5844
5845 30.1.2 IPA Protocol Commands
5846 ----------------------------
5847
5848 The spaces in each command are delimiters to ease reading this commands
5849 specification.  They don't exist in real commands.
5850
5851 'FastTrace:TRACEPOINT_OBJECT GDB_JUMP_PAD_HEAD'
5852      Installs a new fast tracepoint described by TRACEPOINT_OBJECT
5853      (*note tracepoint object::).  The GDB_JUMP_PAD_HEAD, 8-byte long,
5854      is the head of "jumppad", which is used to jump to data collection
5855      routine in IPA finally.
5856
5857      Replies:
5858      'OK TARGET_ADDRESS GDB_JUMP_PAD_HEAD FJUMP_SIZE FJUMP'
5859           TARGET_ADDRESS is address of tracepoint in the inferior.  The
5860           GDB_JUMP_PAD_HEAD is updated head of jumppad.  Both of
5861           TARGET_ADDRESS and GDB_JUMP_PAD_HEAD are 8-byte long.  The
5862           FJUMP contains a sequence of instructions jump to jumppad
5863           entry.  The FJUMP_SIZE, 4-byte long, is the size of FJUMP.
5864      'E NN'
5865           for an error
5866
5867 'close'
5868      Closes the in-process agent.  This command is sent when GDB or
5869      GDBserver is about to kill inferiors.
5870
5871 'qTfSTM'
5872      *Note qTfSTM::.
5873 'qTsSTM'
5874      *Note qTsSTM::.
5875 'qTSTMat'
5876      *Note qTSTMat::.
5877 'probe_marker_at:ADDRESS'
5878      Asks in-process agent to probe the marker at ADDRESS.
5879
5880      Replies:
5881      'E NN'
5882           for an error
5883 'unprobe_marker_at:ADDRESS'
5884      Asks in-process agent to unprobe the marker at ADDRESS.
5885
5886 \1f
5887 File: gdb.info,  Node: GDB Bugs,  Next: Command Line Editing,  Prev: In-Process Agent,  Up: Top
5888
5889 31 Reporting Bugs in GDB
5890 ************************
5891
5892 Your bug reports play an essential role in making GDB reliable.
5893
5894    Reporting a bug may help you by bringing a solution to your problem,
5895 or it may not.  But in any case the principal function of a bug report
5896 is to help the entire community by making the next version of GDB work
5897 better.  Bug reports are your contribution to the maintenance of GDB.
5898
5899    In order for a bug report to serve its purpose, you must include the
5900 information that enables us to fix the bug.
5901
5902 * Menu:
5903
5904 * Bug Criteria::                Have you found a bug?
5905 * Bug Reporting::               How to report bugs
5906
5907 \1f
5908 File: gdb.info,  Node: Bug Criteria,  Next: Bug Reporting,  Up: GDB Bugs
5909
5910 31.1 Have You Found a Bug?
5911 ==========================
5912
5913 If you are not sure whether you have found a bug, here are some
5914 guidelines:
5915
5916    * If the debugger gets a fatal signal, for any input whatever, that
5917      is a GDB bug.  Reliable debuggers never crash.
5918
5919    * If GDB produces an error message for valid input, that is a bug.
5920      (Note that if you're cross debugging, the problem may also be
5921      somewhere in the connection to the target.)
5922
5923    * If GDB does not produce an error message for invalid input, that is
5924      a bug.  However, you should note that your idea of "invalid input"
5925      might be our idea of "an extension" or "support for traditional
5926      practice".
5927
5928    * If you are an experienced user of debugging tools, your suggestions
5929      for improvement of GDB are welcome in any case.
5930
5931 \1f
5932 File: gdb.info,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: GDB Bugs
5933
5934 31.2 How to Report Bugs
5935 =======================
5936
5937 A number of companies and individuals offer support for GNU products.
5938 If you obtained GDB from a support organization, we recommend you
5939 contact that organization first.
5940
5941    You can find contact information for many support companies and
5942 individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
5943
5944    In any event, we also recommend that you submit bug reports for GDB.
5945 The preferred method is to submit them directly using GDB's Bugs web
5946 page (http://www.gnu.org/software/gdb/bugs/).  Alternatively, the e-mail
5947 gateway <bug-gdb@gnu.org> can be used.
5948
5949    *Do not send bug reports to 'info-gdb', or to 'help-gdb', or to any
5950 newsgroups.*  Most users of GDB do not want to receive bug reports.
5951 Those that do have arranged to receive 'bug-gdb'.
5952
5953    The mailing list 'bug-gdb' has a newsgroup 'gnu.gdb.bug' which serves
5954 as a repeater.  The mailing list and the newsgroup carry exactly the
5955 same messages.  Often people think of posting bug reports to the
5956 newsgroup instead of mailing them.  This appears to work, but it has one
5957 problem which can be crucial: a newsgroup posting often lacks a mail
5958 path back to the sender.  Thus, if we need to ask for more information,
5959 we may be unable to reach you.  For this reason, it is better to send
5960 bug reports to the mailing list.
5961
5962    The fundamental principle of reporting bugs usefully is this: *report
5963 all the facts*.  If you are not sure whether to state a fact or leave it
5964 out, state it!
5965
5966    Often people omit facts because they think they know what causes the
5967 problem and assume that some details do not matter.  Thus, you might
5968 assume that the name of the variable you use in an example does not
5969 matter.  Well, probably it does not, but one cannot be sure.  Perhaps
5970 the bug is a stray memory reference which happens to fetch from the
5971 location where that name is stored in memory; perhaps, if the name were
5972 different, the contents of that location would fool the debugger into
5973 doing the right thing despite the bug.  Play it safe and give a
5974 specific, complete example.  That is the easiest thing for you to do,
5975 and the most helpful.
5976
5977    Keep in mind that the purpose of a bug report is to enable us to fix
5978 the bug.  It may be that the bug has been reported previously, but
5979 neither you nor we can know that unless your bug report is complete and
5980 self-contained.
5981
5982    Sometimes people give a few sketchy facts and ask, "Does this ring a
5983 bell?"  Those bug reports are useless, and we urge everyone to _refuse
5984 to respond to them_ except to chide the sender to report bugs properly.
5985
5986    To enable us to fix the bug, you should include all these things:
5987
5988    * The version of GDB.  GDB announces it if you start with no
5989      arguments; you can also print it at any time using 'show version'.
5990
5991      Without this, we will not know whether there is any point in
5992      looking for the bug in the current version of GDB.
5993
5994    * The type of machine you are using, and the operating system name
5995      and version number.
5996
5997    * The details of the GDB build-time configuration.  GDB shows these
5998      details if you invoke it with the '--configuration' command-line
5999      option, or if you type 'show configuration' at GDB's prompt.
6000
6001    * What compiler (and its version) was used to compile GDB--e.g.
6002      "gcc-2.8.1".
6003
6004    * What compiler (and its version) was used to compile the program you
6005      are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP C
6006      Compiler".  For GCC, you can say 'gcc --version' to get this
6007      information; for other compilers, see the documentation for those
6008      compilers.
6009
6010    * The command arguments you gave the compiler to compile your example
6011      and observe the bug.  For example, did you use '-O'?  To guarantee
6012      you will not omit something important, list them all.  A copy of
6013      the Makefile (or the output from make) is sufficient.
6014
6015      If we were to try to guess the arguments, we would probably guess
6016      wrong and then we might not encounter the bug.
6017
6018    * A complete input script, and all necessary source files, that will
6019      reproduce the bug.
6020
6021    * A description of what behavior you observe that you believe is
6022      incorrect.  For example, "It gets a fatal signal."
6023
6024      Of course, if the bug is that GDB gets a fatal signal, then we will
6025      certainly notice it.  But if the bug is incorrect output, we might
6026      not notice unless it is glaringly wrong.  You might as well not
6027      give us a chance to make a mistake.
6028
6029      Even if the problem you experience is a fatal signal, you should
6030      still say so explicitly.  Suppose something strange is going on,
6031      such as, your copy of GDB is out of synch, or you have encountered
6032      a bug in the C library on your system.  (This has happened!)  Your
6033      copy might crash and ours would not.  If you told us to expect a
6034      crash, then when ours fails to crash, we would know that the bug
6035      was not happening for us.  If you had not told us to expect a
6036      crash, then we would not be able to draw any conclusion from our
6037      observations.
6038
6039      To collect all this information, you can use a session recording
6040      program such as 'script', which is available on many Unix systems.
6041      Just run your GDB session inside 'script' and then include the
6042      'typescript' file with your bug report.
6043
6044      Another way to record a GDB session is to run GDB inside Emacs and
6045      then save the entire buffer to a file.
6046
6047    * If you wish to suggest changes to the GDB source, send us context
6048      diffs.  If you even discuss something in the GDB source, refer to
6049      it by context, not by line number.
6050
6051      The line numbers in our development sources will not match those in
6052      your sources.  Your line numbers would convey no useful information
6053      to us.
6054
6055    Here are some things that are not necessary:
6056
6057    * A description of the envelope of the bug.
6058
6059      Often people who encounter a bug spend a lot of time investigating
6060      which changes to the input file will make the bug go away and which
6061      changes will not affect it.
6062
6063      This is often time consuming and not very useful, because the way
6064      we will find the bug is by running a single example under the
6065      debugger with breakpoints, not by pure deduction from a series of
6066      examples.  We recommend that you save your time for something else.
6067
6068      Of course, if you can find a simpler example to report _instead_ of
6069      the original one, that is a convenience for us.  Errors in the
6070      output will be easier to spot, running under the debugger will take
6071      less time, and so on.
6072
6073      However, simplification is not vital; if you do not want to do
6074      this, report the bug anyway and send us the entire test case you
6075      used.
6076
6077    * A patch for the bug.
6078
6079      A patch for the bug does help us if it is a good one.  But do not
6080      omit the necessary information, such as the test case, on the
6081      assumption that a patch is all we need.  We might see problems with
6082      your patch and decide to fix the problem another way, or we might
6083      not understand it at all.
6084
6085      Sometimes with a program as complicated as GDB it is very hard to
6086      construct an example that will make the program follow a certain
6087      path through the code.  If you do not send us the example, we will
6088      not be able to construct one, so we will not be able to verify that
6089      the bug is fixed.
6090
6091      And if we cannot understand what bug you are trying to fix, or why
6092      your patch should be an improvement, we will not install it.  A
6093      test case will help us to understand.
6094
6095    * A guess about what the bug is or what it depends on.
6096
6097      Such guesses are usually wrong.  Even we cannot guess right about
6098      such things without first using the debugger to find the facts.
6099
6100 \1f
6101 File: gdb.info,  Node: Command Line Editing,  Next: Using History Interactively,  Prev: GDB Bugs,  Up: Top
6102
6103 32 Command Line Editing
6104 ***********************
6105
6106 This chapter describes the basic features of the GNU command line
6107 editing interface.
6108
6109 * Menu:
6110
6111 * Introduction and Notation::   Notation used in this text.
6112 * Readline Interaction::        The minimum set of commands for editing a line.
6113 * Readline Init File::          Customizing Readline from a user's view.
6114 * Bindable Readline Commands::  A description of most of the Readline commands
6115                                 available for binding
6116 * Readline vi Mode::            A short description of how to make Readline
6117                                 behave like the vi editor.
6118
6119 \1f
6120 File: gdb.info,  Node: Introduction and Notation,  Next: Readline Interaction,  Up: Command Line Editing
6121
6122 32.1 Introduction to Line Editing
6123 =================================
6124
6125 The following paragraphs describe the notation used to represent
6126 keystrokes.
6127
6128    The text 'C-k' is read as 'Control-K' and describes the character
6129 produced when the <k> key is pressed while the Control key is depressed.
6130
6131    The text 'M-k' is read as 'Meta-K' and describes the character
6132 produced when the Meta key (if you have one) is depressed, and the <k>
6133 key is pressed.  The Meta key is labeled <ALT> on many keyboards.  On
6134 keyboards with two keys labeled <ALT> (usually to either side of the
6135 space bar), the <ALT> on the left side is generally set to work as a
6136 Meta key.  The <ALT> key on the right may also be configured to work as
6137 a Meta key or may be configured as some other modifier, such as a
6138 Compose key for typing accented characters.
6139
6140    If you do not have a Meta or <ALT> key, or another key working as a
6141 Meta key, the identical keystroke can be generated by typing <ESC>
6142 _first_, and then typing <k>.  Either process is known as "metafying"
6143 the <k> key.
6144
6145    The text 'M-C-k' is read as 'Meta-Control-k' and describes the
6146 character produced by "metafying" 'C-k'.
6147
6148    In addition, several keys have their own names.  Specifically, <DEL>,
6149 <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves when seen
6150 in this text, or in an init file (*note Readline Init File::).  If your
6151 keyboard lacks a <LFD> key, typing <C-j> will produce the desired
6152 character.  The <RET> key may be labeled <Return> or <Enter> on some
6153 keyboards.
6154
6155 \1f
6156 File: gdb.info,  Node: Readline Interaction,  Next: Readline Init File,  Prev: Introduction and Notation,  Up: Command Line Editing
6157
6158 32.2 Readline Interaction
6159 =========================
6160
6161 Often during an interactive session you type in a long line of text,
6162 only to notice that the first word on the line is misspelled.  The
6163 Readline library gives you a set of commands for manipulating the text
6164 as you type it in, allowing you to just fix your typo, and not forcing
6165 you to retype the majority of the line.  Using these editing commands,
6166 you move the cursor to the place that needs correction, and delete or
6167 insert the text of the corrections.  Then, when you are satisfied with
6168 the line, you simply press <RET>.  You do not have to be at the end of
6169 the line to press <RET>; the entire line is accepted regardless of the
6170 location of the cursor within the line.
6171
6172 * Menu:
6173
6174 * Readline Bare Essentials::    The least you need to know about Readline.
6175 * Readline Movement Commands::  Moving about the input line.
6176 * Readline Killing Commands::   How to delete text, and how to get it back!
6177 * Readline Arguments::          Giving numeric arguments to commands.
6178 * Searching::                   Searching through previous lines.
6179
6180 \1f
6181 File: gdb.info,  Node: Readline Bare Essentials,  Next: Readline Movement Commands,  Up: Readline Interaction
6182
6183 32.2.1 Readline Bare Essentials
6184 -------------------------------
6185
6186 In order to enter characters into the line, simply type them.  The typed
6187 character appears where the cursor was, and then the cursor moves one
6188 space to the right.  If you mistype a character, you can use your erase
6189 character to back up and delete the mistyped character.
6190
6191    Sometimes you may mistype a character, and not notice the error until
6192 you have typed several other characters.  In that case, you can type
6193 'C-b' to move the cursor to the left, and then correct your mistake.
6194 Afterwards, you can move the cursor to the right with 'C-f'.
6195
6196    When you add text in the middle of a line, you will notice that
6197 characters to the right of the cursor are 'pushed over' to make room for
6198 the text that you have inserted.  Likewise, when you delete text behind
6199 the cursor, characters to the right of the cursor are 'pulled back' to
6200 fill in the blank space created by the removal of the text.  A list of
6201 the bare essentials for editing the text of an input line follows.
6202
6203 'C-b'
6204      Move back one character.
6205 'C-f'
6206      Move forward one character.
6207 <DEL> or <Backspace>
6208      Delete the character to the left of the cursor.
6209 'C-d'
6210      Delete the character underneath the cursor.
6211 Printing characters
6212      Insert the character into the line at the cursor.
6213 'C-_' or 'C-x C-u'
6214      Undo the last editing command.  You can undo all the way back to an
6215      empty line.
6216
6217 (Depending on your configuration, the <Backspace> key be set to delete
6218 the character to the left of the cursor and the <DEL> key set to delete
6219 the character underneath the cursor, like 'C-d', rather than the
6220 character to the left of the cursor.)
6221
6222 \1f
6223 File: gdb.info,  Node: Readline Movement Commands,  Next: Readline Killing Commands,  Prev: Readline Bare Essentials,  Up: Readline Interaction
6224
6225 32.2.2 Readline Movement Commands
6226 ---------------------------------
6227
6228 The above table describes the most basic keystrokes that you need in
6229 order to do editing of the input line.  For your convenience, many other
6230 commands have been added in addition to 'C-b', 'C-f', 'C-d', and <DEL>.
6231 Here are some commands for moving more rapidly about the line.
6232
6233 'C-a'
6234      Move to the start of the line.
6235 'C-e'
6236      Move to the end of the line.
6237 'M-f'
6238      Move forward a word, where a word is composed of letters and
6239      digits.
6240 'M-b'
6241      Move backward a word.
6242 'C-l'
6243      Clear the screen, reprinting the current line at the top.
6244
6245    Notice how 'C-f' moves forward a character, while 'M-f' moves forward
6246 a word.  It is a loose convention that control keystrokes operate on
6247 characters while meta keystrokes operate on words.
6248
6249 \1f
6250 File: gdb.info,  Node: Readline Killing Commands,  Next: Readline Arguments,  Prev: Readline Movement Commands,  Up: Readline Interaction
6251
6252 32.2.3 Readline Killing Commands
6253 --------------------------------
6254
6255 "Killing" text means to delete the text from the line, but to save it
6256 away for later use, usually by "yanking" (re-inserting) it back into the
6257 line.  ('Cut' and 'paste' are more recent jargon for 'kill' and 'yank'.)
6258
6259    If the description for a command says that it 'kills' text, then you
6260 can be sure that you can get the text back in a different (or the same)
6261 place later.
6262
6263    When you use a kill command, the text is saved in a "kill-ring".  Any
6264 number of consecutive kills save all of the killed text together, so
6265 that when you yank it back, you get it all.  The kill ring is not line
6266 specific; the text that you killed on a previously typed line is
6267 available to be yanked back later, when you are typing another line.
6268
6269    Here is the list of commands for killing text.
6270
6271 'C-k'
6272      Kill the text from the current cursor position to the end of the
6273      line.
6274
6275 'M-d'
6276      Kill from the cursor to the end of the current word, or, if between
6277      words, to the end of the next word.  Word boundaries are the same
6278      as those used by 'M-f'.
6279
6280 'M-<DEL>'
6281      Kill from the cursor the start of the current word, or, if between
6282      words, to the start of the previous word.  Word boundaries are the
6283      same as those used by 'M-b'.
6284
6285 'C-w'
6286      Kill from the cursor to the previous whitespace.  This is different
6287      than 'M-<DEL>' because the word boundaries differ.
6288
6289    Here is how to "yank" the text back into the line.  Yanking means to
6290 copy the most-recently-killed text from the kill buffer.
6291
6292 'C-y'
6293      Yank the most recently killed text back into the buffer at the
6294      cursor.
6295
6296 'M-y'
6297      Rotate the kill-ring, and yank the new top.  You can only do this
6298      if the prior command is 'C-y' or 'M-y'.
6299
6300 \1f
6301 File: gdb.info,  Node: Readline Arguments,  Next: Searching,  Prev: Readline Killing Commands,  Up: Readline Interaction
6302
6303 32.2.4 Readline Arguments
6304 -------------------------
6305
6306 You can pass numeric arguments to Readline commands.  Sometimes the
6307 argument acts as a repeat count, other times it is the sign of the
6308 argument that is significant.  If you pass a negative argument to a
6309 command which normally acts in a forward direction, that command will
6310 act in a backward direction.  For example, to kill text back to the
6311 start of the line, you might type 'M-- C-k'.
6312
6313    The general way to pass numeric arguments to a command is to type
6314 meta digits before the command.  If the first 'digit' typed is a minus
6315 sign ('-'), then the sign of the argument will be negative.  Once you
6316 have typed one meta digit to get the argument started, you can type the
6317 remainder of the digits, and then the command.  For example, to give the
6318 'C-d' command an argument of 10, you could type 'M-1 0 C-d', which will
6319 delete the next ten characters on the input line.
6320
6321 \1f
6322 File: gdb.info,  Node: Searching,  Prev: Readline Arguments,  Up: Readline Interaction
6323
6324 32.2.5 Searching for Commands in the History
6325 --------------------------------------------
6326
6327 Readline provides commands for searching through the command history for
6328 lines containing a specified string.  There are two search modes:
6329 "incremental" and "non-incremental".
6330
6331    Incremental searches begin before the user has finished typing the
6332 search string.  As each character of the search string is typed,
6333 Readline displays the next entry from the history matching the string
6334 typed so far.  An incremental search requires only as many characters as
6335 needed to find the desired history entry.  To search backward in the
6336 history for a particular string, type 'C-r'.  Typing 'C-s' searches
6337 forward through the history.  The characters present in the value of the
6338 'isearch-terminators' variable are used to terminate an incremental
6339 search.  If that variable has not been assigned a value, the <ESC> and
6340 'C-J' characters will terminate an incremental search.  'C-g' will abort
6341 an incremental search and restore the original line.  When the search is
6342 terminated, the history entry containing the search string becomes the
6343 current line.
6344
6345    To find other matching entries in the history list, type 'C-r' or
6346 'C-s' as appropriate.  This will search backward or forward in the
6347 history for the next entry matching the search string typed so far.  Any
6348 other key sequence bound to a Readline command will terminate the search
6349 and execute that command.  For instance, a <RET> will terminate the
6350 search and accept the line, thereby executing the command from the
6351 history list.  A movement command will terminate the search, make the
6352 last line found the current line, and begin editing.
6353
6354    Readline remembers the last incremental search string.  If two 'C-r's
6355 are typed without any intervening characters defining a new search
6356 string, any remembered search string is used.
6357
6358    Non-incremental searches read the entire search string before
6359 starting to search for matching history lines.  The search string may be
6360 typed by the user or be part of the contents of the current line.
6361
6362 \1f
6363 File: gdb.info,  Node: Readline Init File,  Next: Bindable Readline Commands,  Prev: Readline Interaction,  Up: Command Line Editing
6364
6365 32.3 Readline Init File
6366 =======================
6367
6368 Although the Readline library comes with a set of Emacs-like keybindings
6369 installed by default, it is possible to use a different set of
6370 keybindings.  Any user can customize programs that use Readline by
6371 putting commands in an "inputrc" file, conventionally in his home
6372 directory.  The name of this file is taken from the value of the
6373 environment variable 'INPUTRC'.  If that variable is unset, the default
6374 is '~/.inputrc'.  If that file does not exist or cannot be read, the
6375 ultimate default is '/etc/inputrc'.
6376
6377    When a program which uses the Readline library starts up, the init
6378 file is read, and the key bindings are set.
6379
6380    In addition, the 'C-x C-r' command re-reads this init file, thus
6381 incorporating any changes that you might have made to it.
6382
6383 * Menu:
6384
6385 * Readline Init File Syntax::   Syntax for the commands in the inputrc file.
6386
6387 * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
6388
6389 * Sample Init File::            An example inputrc file.
6390
6391 \1f
6392 File: gdb.info,  Node: Readline Init File Syntax,  Next: Conditional Init Constructs,  Up: Readline Init File
6393
6394 32.3.1 Readline Init File Syntax
6395 --------------------------------
6396
6397 There are only a few basic constructs allowed in the Readline init file.
6398 Blank lines are ignored.  Lines beginning with a '#' are comments.
6399 Lines beginning with a '$' indicate conditional constructs (*note
6400 Conditional Init Constructs::).  Other lines denote variable settings
6401 and key bindings.
6402
6403 Variable Settings
6404      You can modify the run-time behavior of Readline by altering the
6405      values of variables in Readline using the 'set' command within the
6406      init file.  The syntax is simple:
6407
6408           set VARIABLE VALUE
6409
6410      Here, for example, is how to change from the default Emacs-like key
6411      binding to use 'vi' line editing commands:
6412
6413           set editing-mode vi
6414
6415      Variable names and values, where appropriate, are recognized
6416      without regard to case.  Unrecognized variable names are ignored.
6417
6418      Boolean variables (those that can be set to on or off) are set to
6419      on if the value is null or empty, ON (case-insensitive), or 1.  Any
6420      other value results in the variable being set to off.
6421
6422      A great deal of run-time behavior is changeable with the following
6423      variables.
6424
6425      'bell-style'
6426           Controls what happens when Readline wants to ring the terminal
6427           bell.  If set to 'none', Readline never rings the bell.  If
6428           set to 'visible', Readline uses a visible bell if one is
6429           available.  If set to 'audible' (the default), Readline
6430           attempts to ring the terminal's bell.
6431
6432      'bind-tty-special-chars'
6433           If set to 'on', Readline attempts to bind the control
6434           characters treated specially by the kernel's terminal driver
6435           to their Readline equivalents.
6436
6437      'comment-begin'
6438           The string to insert at the beginning of the line when the
6439           'insert-comment' command is executed.  The default value is
6440           '"#"'.
6441
6442      'completion-display-width'
6443           The number of screen columns used to display possible matches
6444           when performing completion.  The value is ignored if it is
6445           less than 0 or greater than the terminal screen width.  A
6446           value of 0 will cause matches to be displayed one per line.
6447           The default value is -1.
6448
6449      'completion-ignore-case'
6450           If set to 'on', Readline performs filename matching and
6451           completion in a case-insensitive fashion.  The default value
6452           is 'off'.
6453
6454      'completion-map-case'
6455           If set to 'on', and COMPLETION-IGNORE-CASE is enabled,
6456           Readline treats hyphens ('-') and underscores ('_') as
6457           equivalent when performing case-insensitive filename matching
6458           and completion.
6459
6460      'completion-prefix-display-length'
6461           The length in characters of the common prefix of a list of
6462           possible completions that is displayed without modification.
6463           When set to a value greater than zero, common prefixes longer
6464           than this value are replaced with an ellipsis when displaying
6465           possible completions.
6466
6467      'completion-query-items'
6468           The number of possible completions that determines when the
6469           user is asked whether the list of possibilities should be
6470           displayed.  If the number of possible completions is greater
6471           than this value, Readline will ask the user whether or not he
6472           wishes to view them; otherwise, they are simply listed.  This
6473           variable must be set to an integer value greater than or equal
6474           to 0.  A negative value means Readline should never ask.  The
6475           default limit is '100'.
6476
6477      'convert-meta'
6478           If set to 'on', Readline will convert characters with the
6479           eighth bit set to an ASCII key sequence by stripping the
6480           eighth bit and prefixing an <ESC> character, converting them
6481           to a meta-prefixed key sequence.  The default value is 'on'.
6482
6483      'disable-completion'
6484           If set to 'On', Readline will inhibit word completion.
6485           Completion characters will be inserted into the line as if
6486           they had been mapped to 'self-insert'.  The default is 'off'.
6487
6488      'editing-mode'
6489           The 'editing-mode' variable controls which default set of key
6490           bindings is used.  By default, Readline starts up in Emacs
6491           editing mode, where the keystrokes are most similar to Emacs.
6492           This variable can be set to either 'emacs' or 'vi'.
6493
6494      'echo-control-characters'
6495           When set to 'on', on operating systems that indicate they
6496           support it, readline echoes a character corresponding to a
6497           signal generated from the keyboard.  The default is 'on'.
6498
6499      'enable-keypad'
6500           When set to 'on', Readline will try to enable the application
6501           keypad when it is called.  Some systems need this to enable
6502           the arrow keys.  The default is 'off'.
6503
6504      'enable-meta-key'
6505           When set to 'on', Readline will try to enable any meta
6506           modifier key the terminal claims to support when it is called.
6507           On many terminals, the meta key is used to send eight-bit
6508           characters.  The default is 'on'.
6509
6510      'expand-tilde'
6511           If set to 'on', tilde expansion is performed when Readline
6512           attempts word completion.  The default is 'off'.
6513
6514      'history-preserve-point'
6515           If set to 'on', the history code attempts to place the point
6516           (the current cursor position) at the same location on each
6517           history line retrieved with 'previous-history' or
6518           'next-history'.  The default is 'off'.
6519
6520      'history-size'
6521           Set the maximum number of history entries saved in the history
6522           list.  If set to zero, the number of entries in the history
6523           list is not limited.
6524
6525      'horizontal-scroll-mode'
6526           This variable can be set to either 'on' or 'off'.  Setting it
6527           to 'on' means that the text of the lines being edited will
6528           scroll horizontally on a single screen line when they are
6529           longer than the width of the screen, instead of wrapping onto
6530           a new screen line.  By default, this variable is set to 'off'.
6531
6532      'input-meta'
6533           If set to 'on', Readline will enable eight-bit input (it will
6534           not clear the eighth bit in the characters it reads),
6535           regardless of what the terminal claims it can support.  The
6536           default value is 'off'.  The name 'meta-flag' is a synonym for
6537           this variable.
6538
6539      'isearch-terminators'
6540           The string of characters that should terminate an incremental
6541           search without subsequently executing the character as a
6542           command (*note Searching::).  If this variable has not been
6543           given a value, the characters <ESC> and 'C-J' will terminate
6544           an incremental search.
6545
6546      'keymap'
6547           Sets Readline's idea of the current keymap for key binding
6548           commands.  Acceptable 'keymap' names are 'emacs',
6549           'emacs-standard', 'emacs-meta', 'emacs-ctlx', 'vi', 'vi-move',
6550           'vi-command', and 'vi-insert'.  'vi' is equivalent to
6551           'vi-command'; 'emacs' is equivalent to 'emacs-standard'.  The
6552           default value is 'emacs'.  The value of the 'editing-mode'
6553           variable also affects the default keymap.
6554
6555      'mark-directories'
6556           If set to 'on', completed directory names have a slash
6557           appended.  The default is 'on'.
6558
6559      'mark-modified-lines'
6560           This variable, when set to 'on', causes Readline to display an
6561           asterisk ('*') at the start of history lines which have been
6562           modified.  This variable is 'off' by default.
6563
6564      'mark-symlinked-directories'
6565           If set to 'on', completed names which are symbolic links to
6566           directories have a slash appended (subject to the value of
6567           'mark-directories').  The default is 'off'.
6568
6569      'match-hidden-files'
6570           This variable, when set to 'on', causes Readline to match
6571           files whose names begin with a '.' (hidden files) when
6572           performing filename completion.  If set to 'off', the leading
6573           '.' must be supplied by the user in the filename to be
6574           completed.  This variable is 'on' by default.
6575
6576      'menu-complete-display-prefix'
6577           If set to 'on', menu completion displays the common prefix of
6578           the list of possible completions (which may be empty) before
6579           cycling through the list.  The default is 'off'.
6580
6581      'output-meta'
6582           If set to 'on', Readline will display characters with the
6583           eighth bit set directly rather than as a meta-prefixed escape
6584           sequence.  The default is 'off'.
6585
6586      'page-completions'
6587           If set to 'on', Readline uses an internal 'more'-like pager to
6588           display a screenful of possible completions at a time.  This
6589           variable is 'on' by default.
6590
6591      'print-completions-horizontally'
6592           If set to 'on', Readline will display completions with matches
6593           sorted horizontally in alphabetical order, rather than down
6594           the screen.  The default is 'off'.
6595
6596      'revert-all-at-newline'
6597           If set to 'on', Readline will undo all changes to history
6598           lines before returning when 'accept-line' is executed.  By
6599           default, history lines may be modified and retain individual
6600           undo lists across calls to 'readline'.  The default is 'off'.
6601
6602      'show-all-if-ambiguous'
6603           This alters the default behavior of the completion functions.
6604           If set to 'on', words which have more than one possible
6605           completion cause the matches to be listed immediately instead
6606           of ringing the bell.  The default value is 'off'.
6607
6608      'show-all-if-unmodified'
6609           This alters the default behavior of the completion functions
6610           in a fashion similar to SHOW-ALL-IF-AMBIGUOUS.  If set to
6611           'on', words which have more than one possible completion
6612           without any possible partial completion (the possible
6613           completions don't share a common prefix) cause the matches to
6614           be listed immediately instead of ringing the bell.  The
6615           default value is 'off'.
6616
6617      'skip-completed-text'
6618           If set to 'on', this alters the default completion behavior
6619           when inserting a single match into the line.  It's only active
6620           when performing completion in the middle of a word.  If
6621           enabled, readline does not insert characters from the
6622           completion that match characters after point in the word being
6623           completed, so portions of the word following the cursor are
6624           not duplicated.  For instance, if this is enabled, attempting
6625           completion when the cursor is after the 'e' in 'Makefile' will
6626           result in 'Makefile' rather than 'Makefilefile', assuming
6627           there is a single possible completion.  The default value is
6628           'off'.
6629
6630      'visible-stats'
6631           If set to 'on', a character denoting a file's type is appended
6632           to the filename when listing possible completions.  The
6633           default is 'off'.
6634
6635 Key Bindings
6636      The syntax for controlling key bindings in the init file is simple.
6637      First you need to find the name of the command that you want to
6638      change.  The following sections contain tables of the command name,
6639      the default keybinding, if any, and a short description of what the
6640      command does.
6641
6642      Once you know the name of the command, simply place on a line in
6643      the init file the name of the key you wish to bind the command to,
6644      a colon, and then the name of the command.  There can be no space
6645      between the key name and the colon - that will be interpreted as
6646      part of the key name.  The name of the key can be expressed in
6647      different ways, depending on what you find most comfortable.
6648
6649      In addition to command names, readline allows keys to be bound to a
6650      string that is inserted when the key is pressed (a MACRO).
6651
6652      KEYNAME: FUNCTION-NAME or MACRO
6653           KEYNAME is the name of a key spelled out in English.  For
6654           example:
6655                Control-u: universal-argument
6656                Meta-Rubout: backward-kill-word
6657                Control-o: "> output"
6658
6659           In the above example, 'C-u' is bound to the function
6660           'universal-argument', 'M-DEL' is bound to the function
6661           'backward-kill-word', and 'C-o' is bound to run the macro
6662           expressed on the right hand side (that is, to insert the text
6663           '> output' into the line).
6664
6665           A number of symbolic character names are recognized while
6666           processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
6667           NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
6668
6669      "KEYSEQ": FUNCTION-NAME or MACRO
6670           KEYSEQ differs from KEYNAME above in that strings denoting an
6671           entire key sequence can be specified, by placing the key
6672           sequence in double quotes.  Some GNU Emacs style key escapes
6673           can be used, as in the following example, but the special
6674           character names are not recognized.
6675
6676                "\C-u": universal-argument
6677                "\C-x\C-r": re-read-init-file
6678                "\e[11~": "Function Key 1"
6679
6680           In the above example, 'C-u' is again bound to the function
6681           'universal-argument' (just as it was in the first example),
6682           ''C-x' 'C-r'' is bound to the function 're-read-init-file',
6683           and '<ESC> <[> <1> <1> <~>' is bound to insert the text
6684           'Function Key 1'.
6685
6686      The following GNU Emacs style escape sequences are available when
6687      specifying key sequences:
6688
6689      '\C-'
6690           control prefix
6691      '\M-'
6692           meta prefix
6693      '\e'
6694           an escape character
6695      '\\'
6696           backslash
6697      '\"'
6698           <">, a double quotation mark
6699      '\''
6700           <'>, a single quote or apostrophe
6701
6702      In addition to the GNU Emacs style escape sequences, a second set
6703      of backslash escapes is available:
6704
6705      '\a'
6706           alert (bell)
6707      '\b'
6708           backspace
6709      '\d'
6710           delete
6711      '\f'
6712           form feed
6713      '\n'
6714           newline
6715      '\r'
6716           carriage return
6717      '\t'
6718           horizontal tab
6719      '\v'
6720           vertical tab
6721      '\NNN'
6722           the eight-bit character whose value is the octal value NNN
6723           (one to three digits)
6724      '\xHH'
6725           the eight-bit character whose value is the hexadecimal value
6726           HH (one or two hex digits)
6727
6728      When entering the text of a macro, single or double quotes must be
6729      used to indicate a macro definition.  Unquoted text is assumed to
6730      be a function name.  In the macro body, the backslash escapes
6731      described above are expanded.  Backslash will quote any other
6732      character in the macro text, including '"' and '''.  For example,
6733      the following binding will make ''C-x' \' insert a single '\' into
6734      the line:
6735           "\C-x\\": "\\"
6736
6737 \1f
6738 File: gdb.info,  Node: Conditional Init Constructs,  Next: Sample Init File,  Prev: Readline Init File Syntax,  Up: Readline Init File
6739
6740 32.3.2 Conditional Init Constructs
6741 ----------------------------------
6742
6743 Readline implements a facility similar in spirit to the conditional
6744 compilation features of the C preprocessor which allows key bindings and
6745 variable settings to be performed as the result of tests.  There are
6746 four parser directives used.
6747
6748 '$if'
6749      The '$if' construct allows bindings to be made based on the editing
6750      mode, the terminal being used, or the application using Readline.
6751      The text of the test extends to the end of the line; no characters
6752      are required to isolate it.
6753
6754      'mode'
6755           The 'mode=' form of the '$if' directive is used to test
6756           whether Readline is in 'emacs' or 'vi' mode.  This may be used
6757           in conjunction with the 'set keymap' command, for instance, to
6758           set bindings in the 'emacs-standard' and 'emacs-ctlx' keymaps
6759           only if Readline is starting out in 'emacs' mode.
6760
6761      'term'
6762           The 'term=' form may be used to include terminal-specific key
6763           bindings, perhaps to bind the key sequences output by the
6764           terminal's function keys.  The word on the right side of the
6765           '=' is tested against both the full name of the terminal and
6766           the portion of the terminal name before the first '-'.  This
6767           allows 'sun' to match both 'sun' and 'sun-cmd', for instance.
6768
6769      'application'
6770           The APPLICATION construct is used to include
6771           application-specific settings.  Each program using the
6772           Readline library sets the APPLICATION NAME, and you can test
6773           for a particular value.  This could be used to bind key
6774           sequences to functions useful for a specific program.  For
6775           instance, the following command adds a key sequence that
6776           quotes the current or previous word in Bash:
6777                $if Bash
6778                # Quote the current or previous word
6779                "\C-xq": "\eb\"\ef\""
6780                $endif
6781
6782 '$endif'
6783      This command, as seen in the previous example, terminates an '$if'
6784      command.
6785
6786 '$else'
6787      Commands in this branch of the '$if' directive are executed if the
6788      test fails.
6789
6790 '$include'
6791      This directive takes a single filename as an argument and reads
6792      commands and bindings from that file.  For example, the following
6793      directive reads from '/etc/inputrc':
6794           $include /etc/inputrc
6795
6796 \1f
6797 File: gdb.info,  Node: Sample Init File,  Prev: Conditional Init Constructs,  Up: Readline Init File
6798
6799 32.3.3 Sample Init File
6800 -----------------------
6801
6802 Here is an example of an INPUTRC file.  This illustrates key binding,
6803 variable assignment, and conditional syntax.
6804
6805      # This file controls the behaviour of line input editing for
6806      # programs that use the GNU Readline library.  Existing
6807      # programs include FTP, Bash, and GDB.
6808      #
6809      # You can re-read the inputrc file with C-x C-r.
6810      # Lines beginning with '#' are comments.
6811      #
6812      # First, include any systemwide bindings and variable
6813      # assignments from /etc/Inputrc
6814      $include /etc/Inputrc
6815
6816      #
6817      # Set various bindings for emacs mode.
6818
6819      set editing-mode emacs
6820
6821      $if mode=emacs
6822
6823      Meta-Control-h:    backward-kill-word      Text after the function name is ignored
6824
6825      #
6826      # Arrow keys in keypad mode
6827      #
6828      #"\M-OD":        backward-char
6829      #"\M-OC":        forward-char
6830      #"\M-OA":        previous-history
6831      #"\M-OB":        next-history
6832      #
6833      # Arrow keys in ANSI mode
6834      #
6835      "\M-[D":        backward-char
6836      "\M-[C":        forward-char
6837      "\M-[A":        previous-history
6838      "\M-[B":        next-history
6839      #
6840      # Arrow keys in 8 bit keypad mode
6841      #
6842      #"\M-\C-OD":       backward-char
6843      #"\M-\C-OC":       forward-char
6844      #"\M-\C-OA":       previous-history
6845      #"\M-\C-OB":       next-history
6846      #
6847      # Arrow keys in 8 bit ANSI mode
6848      #
6849      #"\M-\C-[D":       backward-char
6850      #"\M-\C-[C":       forward-char
6851      #"\M-\C-[A":       previous-history
6852      #"\M-\C-[B":       next-history
6853
6854      C-q: quoted-insert
6855
6856      $endif
6857
6858      # An old-style binding.  This happens to be the default.
6859      TAB: complete
6860
6861      # Macros that are convenient for shell interaction
6862      $if Bash
6863      # edit the path
6864      "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
6865      # prepare to type a quoted word --
6866      # insert open and close double quotes
6867      # and move to just after the open quote
6868      "\C-x\"": "\"\"\C-b"
6869      # insert a backslash (testing backslash escapes
6870      # in sequences and macros)
6871      "\C-x\\": "\\"
6872      # Quote the current or previous word
6873      "\C-xq": "\eb\"\ef\""
6874      # Add a binding to refresh the line, which is unbound
6875      "\C-xr": redraw-current-line
6876      # Edit variable on current line.
6877      "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
6878      $endif
6879
6880      # use a visible bell if one is available
6881      set bell-style visible
6882
6883      # don't strip characters to 7 bits when reading
6884      set input-meta on
6885
6886      # allow iso-latin1 characters to be inserted rather
6887      # than converted to prefix-meta sequences
6888      set convert-meta off
6889
6890      # display characters with the eighth bit set directly
6891      # rather than as meta-prefixed characters
6892      set output-meta on
6893
6894      # if there are more than 150 possible completions for
6895      # a word, ask the user if he wants to see all of them
6896      set completion-query-items 150
6897
6898      # For FTP
6899      $if Ftp
6900      "\C-xg": "get \M-?"
6901      "\C-xt": "put \M-?"
6902      "\M-.": yank-last-arg
6903      $endif
6904
6905 \1f
6906 File: gdb.info,  Node: Bindable Readline Commands,  Next: Readline vi Mode,  Prev: Readline Init File,  Up: Command Line Editing
6907
6908 32.4 Bindable Readline Commands
6909 ===============================
6910
6911 * Menu:
6912
6913 * Commands For Moving::         Moving about the line.
6914 * Commands For History::        Getting at previous lines.
6915 * Commands For Text::           Commands for changing text.
6916 * Commands For Killing::        Commands for killing and yanking.
6917 * Numeric Arguments::           Specifying numeric arguments, repeat counts.
6918 * Commands For Completion::     Getting Readline to do the typing for you.
6919 * Keyboard Macros::             Saving and re-executing typed characters
6920 * Miscellaneous Commands::      Other miscellaneous commands.
6921
6922 This section describes Readline commands that may be bound to key
6923 sequences.  Command names without an accompanying key sequence are
6924 unbound by default.
6925
6926    In the following descriptions, "point" refers to the current cursor
6927 position, and "mark" refers to a cursor position saved by the 'set-mark'
6928 command.  The text between the point and mark is referred to as the
6929 "region".
6930
6931 \1f
6932 File: gdb.info,  Node: Commands For Moving,  Next: Commands For History,  Up: Bindable Readline Commands
6933
6934 32.4.1 Commands For Moving
6935 --------------------------
6936
6937 'beginning-of-line (C-a)'
6938      Move to the start of the current line.
6939
6940 'end-of-line (C-e)'
6941      Move to the end of the line.
6942
6943 'forward-char (C-f)'
6944      Move forward a character.
6945
6946 'backward-char (C-b)'
6947      Move back a character.
6948
6949 'forward-word (M-f)'
6950      Move forward to the end of the next word.  Words are composed of
6951      letters and digits.
6952
6953 'backward-word (M-b)'
6954      Move back to the start of the current or previous word.  Words are
6955      composed of letters and digits.
6956
6957 'clear-screen (C-l)'
6958      Clear the screen and redraw the current line, leaving the current
6959      line at the top of the screen.
6960
6961 'redraw-current-line ()'
6962      Refresh the current line.  By default, this is unbound.
6963
6964 \1f
6965 File: gdb.info,  Node: Commands For History,  Next: Commands For Text,  Prev: Commands For Moving,  Up: Bindable Readline Commands
6966
6967 32.4.2 Commands For Manipulating The History
6968 --------------------------------------------
6969
6970 'accept-line (Newline or Return)'
6971      Accept the line regardless of where the cursor is.  If this line is
6972      non-empty, it may be added to the history list for future recall
6973      with 'add_history()'.  If this line is a modified history line, the
6974      history line is restored to its original state.
6975
6976 'previous-history (C-p)'
6977      Move 'back' through the history list, fetching the previous
6978      command.
6979
6980 'next-history (C-n)'
6981      Move 'forward' through the history list, fetching the next command.
6982
6983 'beginning-of-history (M-<)'
6984      Move to the first line in the history.
6985
6986 'end-of-history (M->)'
6987      Move to the end of the input history, i.e., the line currently
6988      being entered.
6989
6990 'reverse-search-history (C-r)'
6991      Search backward starting at the current line and moving 'up'
6992      through the history as necessary.  This is an incremental search.
6993
6994 'forward-search-history (C-s)'
6995      Search forward starting at the current line and moving 'down'
6996      through the the history as necessary.  This is an incremental
6997      search.
6998
6999 'non-incremental-reverse-search-history (M-p)'
7000      Search backward starting at the current line and moving 'up'
7001      through the history as necessary using a non-incremental search for
7002      a string supplied by the user.
7003
7004 'non-incremental-forward-search-history (M-n)'
7005      Search forward starting at the current line and moving 'down'
7006      through the the history as necessary using a non-incremental search
7007      for a string supplied by the user.
7008
7009 'history-search-forward ()'
7010      Search forward through the history for the string of characters
7011      between the start of the current line and the point.  This is a
7012      non-incremental search.  By default, this command is unbound.
7013
7014 'history-search-backward ()'
7015      Search backward through the history for the string of characters
7016      between the start of the current line and the point.  This is a
7017      non-incremental search.  By default, this command is unbound.
7018
7019 'yank-nth-arg (M-C-y)'
7020      Insert the first argument to the previous command (usually the
7021      second word on the previous line) at point.  With an argument N,
7022      insert the Nth word from the previous command (the words in the
7023      previous command begin with word 0).  A negative argument inserts
7024      the Nth word from the end of the previous command.  Once the
7025      argument N is computed, the argument is extracted as if the '!N'
7026      history expansion had been specified.
7027
7028 'yank-last-arg (M-. or M-_)'
7029      Insert last argument to the previous command (the last word of the
7030      previous history entry).  With a numeric argument, behave exactly
7031      like 'yank-nth-arg'.  Successive calls to 'yank-last-arg' move back
7032      through the history list, inserting the last word (or the word
7033      specified by the argument to the first call) of each line in turn.
7034      Any numeric argument supplied to these successive calls determines
7035      the direction to move through the history.  A negative argument
7036      switches the direction through the history (back or forward).  The
7037      history expansion facilities are used to extract the last argument,
7038      as if the '!$' history expansion had been specified.
7039
7040 \1f
7041 File: gdb.info,  Node: Commands For Text,  Next: Commands For Killing,  Prev: Commands For History,  Up: Bindable Readline Commands
7042
7043 32.4.3 Commands For Changing Text
7044 ---------------------------------
7045
7046 'delete-char (C-d)'
7047      Delete the character at point.  If point is at the beginning of the
7048      line, there are no characters in the line, and the last character
7049      typed was not bound to 'delete-char', then return EOF.
7050
7051 'backward-delete-char (Rubout)'
7052      Delete the character behind the cursor.  A numeric argument means
7053      to kill the characters instead of deleting them.
7054
7055 'forward-backward-delete-char ()'
7056      Delete the character under the cursor, unless the cursor is at the
7057      end of the line, in which case the character behind the cursor is
7058      deleted.  By default, this is not bound to a key.
7059
7060 'quoted-insert (C-q or C-v)'
7061      Add the next character typed to the line verbatim.  This is how to
7062      insert key sequences like 'C-q', for example.
7063
7064 'tab-insert (M-<TAB>)'
7065      Insert a tab character.
7066
7067 'self-insert (a, b, A, 1, !, ...)'
7068      Insert yourself.
7069
7070 'transpose-chars (C-t)'
7071      Drag the character before the cursor forward over the character at
7072      the cursor, moving the cursor forward as well.  If the insertion
7073      point is at the end of the line, then this transposes the last two
7074      characters of the line.  Negative arguments have no effect.
7075
7076 'transpose-words (M-t)'
7077      Drag the word before point past the word after point, moving point
7078      past that word as well.  If the insertion point is at the end of
7079      the line, this transposes the last two words on the line.
7080
7081 'upcase-word (M-u)'
7082      Uppercase the current (or following) word.  With a negative
7083      argument, uppercase the previous word, but do not move the cursor.
7084
7085 'downcase-word (M-l)'
7086      Lowercase the current (or following) word.  With a negative
7087      argument, lowercase the previous word, but do not move the cursor.
7088
7089 'capitalize-word (M-c)'
7090      Capitalize the current (or following) word.  With a negative
7091      argument, capitalize the previous word, but do not move the cursor.
7092
7093 'overwrite-mode ()'
7094      Toggle overwrite mode.  With an explicit positive numeric argument,
7095      switches to overwrite mode.  With an explicit non-positive numeric
7096      argument, switches to insert mode.  This command affects only
7097      'emacs' mode; 'vi' mode does overwrite differently.  Each call to
7098      'readline()' starts in insert mode.
7099
7100      In overwrite mode, characters bound to 'self-insert' replace the
7101      text at point rather than pushing the text to the right.
7102      Characters bound to 'backward-delete-char' replace the character
7103      before point with a space.
7104
7105      By default, this command is unbound.
7106
7107 \1f
7108 File: gdb.info,  Node: Commands For Killing,  Next: Numeric Arguments,  Prev: Commands For Text,  Up: Bindable Readline Commands
7109
7110 32.4.4 Killing And Yanking
7111 --------------------------
7112
7113 'kill-line (C-k)'
7114      Kill the text from point to the end of the line.
7115
7116 'backward-kill-line (C-x Rubout)'
7117      Kill backward to the beginning of the line.
7118
7119 'unix-line-discard (C-u)'
7120      Kill backward from the cursor to the beginning of the current line.
7121
7122 'kill-whole-line ()'
7123      Kill all characters on the current line, no matter where point is.
7124      By default, this is unbound.
7125
7126 'kill-word (M-d)'
7127      Kill from point to the end of the current word, or if between
7128      words, to the end of the next word.  Word boundaries are the same
7129      as 'forward-word'.
7130
7131 'backward-kill-word (M-<DEL>)'
7132      Kill the word behind point.  Word boundaries are the same as
7133      'backward-word'.
7134
7135 'unix-word-rubout (C-w)'
7136      Kill the word behind point, using white space as a word boundary.
7137      The killed text is saved on the kill-ring.
7138
7139 'unix-filename-rubout ()'
7140      Kill the word behind point, using white space and the slash
7141      character as the word boundaries.  The killed text is saved on the
7142      kill-ring.
7143
7144 'delete-horizontal-space ()'
7145      Delete all spaces and tabs around point.  By default, this is
7146      unbound.
7147
7148 'kill-region ()'
7149      Kill the text in the current region.  By default, this command is
7150      unbound.
7151
7152 'copy-region-as-kill ()'
7153      Copy the text in the region to the kill buffer, so it can be yanked
7154      right away.  By default, this command is unbound.
7155
7156 'copy-backward-word ()'
7157      Copy the word before point to the kill buffer.  The word boundaries
7158      are the same as 'backward-word'.  By default, this command is
7159      unbound.
7160
7161 'copy-forward-word ()'
7162      Copy the word following point to the kill buffer.  The word
7163      boundaries are the same as 'forward-word'.  By default, this
7164      command is unbound.
7165
7166 'yank (C-y)'
7167      Yank the top of the kill ring into the buffer at point.
7168
7169 'yank-pop (M-y)'
7170      Rotate the kill-ring, and yank the new top.  You can only do this
7171      if the prior command is 'yank' or 'yank-pop'.
7172
7173 \1f
7174 File: gdb.info,  Node: Numeric Arguments,  Next: Commands For Completion,  Prev: Commands For Killing,  Up: Bindable Readline Commands
7175
7176 32.4.5 Specifying Numeric Arguments
7177 -----------------------------------
7178
7179 'digit-argument (M-0, M-1, ... M--)'
7180      Add this digit to the argument already accumulating, or start a new
7181      argument.  'M--' starts a negative argument.
7182
7183 'universal-argument ()'
7184      This is another way to specify an argument.  If this command is
7185      followed by one or more digits, optionally with a leading minus
7186      sign, those digits define the argument.  If the command is followed
7187      by digits, executing 'universal-argument' again ends the numeric
7188      argument, but is otherwise ignored.  As a special case, if this
7189      command is immediately followed by a character that is neither a
7190      digit or minus sign, the argument count for the next command is
7191      multiplied by four.  The argument count is initially one, so
7192      executing this function the first time makes the argument count
7193      four, a second time makes the argument count sixteen, and so on.
7194      By default, this is not bound to a key.
7195
7196 \1f
7197 File: gdb.info,  Node: Commands For Completion,  Next: Keyboard Macros,  Prev: Numeric Arguments,  Up: Bindable Readline Commands
7198
7199 32.4.6 Letting Readline Type For You
7200 ------------------------------------
7201
7202 'complete (<TAB>)'
7203      Attempt to perform completion on the text before point.  The actual
7204      completion performed is application-specific.  The default is
7205      filename completion.
7206
7207 'possible-completions (M-?)'
7208      List the possible completions of the text before point.  When
7209      displaying completions, Readline sets the number of columns used
7210      for display to the value of 'completion-display-width', the value
7211      of the environment variable 'COLUMNS', or the screen width, in that
7212      order.
7213
7214 'insert-completions (M-*)'
7215      Insert all completions of the text before point that would have
7216      been generated by 'possible-completions'.
7217
7218 'menu-complete ()'
7219      Similar to 'complete', but replaces the word to be completed with a
7220      single match from the list of possible completions.  Repeated
7221      execution of 'menu-complete' steps through the list of possible
7222      completions, inserting each match in turn.  At the end of the list
7223      of completions, the bell is rung (subject to the setting of
7224      'bell-style') and the original text is restored.  An argument of N
7225      moves N positions forward in the list of matches; a negative
7226      argument may be used to move backward through the list.  This
7227      command is intended to be bound to <TAB>, but is unbound by
7228      default.
7229
7230 'menu-complete-backward ()'
7231      Identical to 'menu-complete', but moves backward through the list
7232      of possible completions, as if 'menu-complete' had been given a
7233      negative argument.
7234
7235 'delete-char-or-list ()'
7236      Deletes the character under the cursor if not at the beginning or
7237      end of the line (like 'delete-char').  If at the end of the line,
7238      behaves identically to 'possible-completions'.  This command is
7239      unbound by default.
7240
7241 \1f
7242 File: gdb.info,  Node: Keyboard Macros,  Next: Miscellaneous Commands,  Prev: Commands For Completion,  Up: Bindable Readline Commands
7243
7244 32.4.7 Keyboard Macros
7245 ----------------------
7246
7247 'start-kbd-macro (C-x ()'
7248      Begin saving the characters typed into the current keyboard macro.
7249
7250 'end-kbd-macro (C-x ))'
7251      Stop saving the characters typed into the current keyboard macro
7252      and save the definition.
7253
7254 'call-last-kbd-macro (C-x e)'
7255      Re-execute the last keyboard macro defined, by making the
7256      characters in the macro appear as if typed at the keyboard.
7257
7258 \1f
7259 File: gdb.info,  Node: Miscellaneous Commands,  Prev: Keyboard Macros,  Up: Bindable Readline Commands
7260
7261 32.4.8 Some Miscellaneous Commands
7262 ----------------------------------
7263
7264 're-read-init-file (C-x C-r)'
7265      Read in the contents of the INPUTRC file, and incorporate any
7266      bindings or variable assignments found there.
7267
7268 'abort (C-g)'
7269      Abort the current editing command and ring the terminal's bell
7270      (subject to the setting of 'bell-style').
7271
7272 'do-uppercase-version (M-a, M-b, M-X, ...)'
7273      If the metafied character X is lowercase, run the command that is
7274      bound to the corresponding uppercase character.
7275
7276 'prefix-meta (<ESC>)'
7277      Metafy the next character typed.  This is for keyboards without a
7278      meta key.  Typing '<ESC> f' is equivalent to typing 'M-f'.
7279
7280 'undo (C-_ or C-x C-u)'
7281      Incremental undo, separately remembered for each line.
7282
7283 'revert-line (M-r)'
7284      Undo all changes made to this line.  This is like executing the
7285      'undo' command enough times to get back to the beginning.
7286
7287 'tilde-expand (M-~)'
7288      Perform tilde expansion on the current word.
7289
7290 'set-mark (C-@)'
7291      Set the mark to the point.  If a numeric argument is supplied, the
7292      mark is set to that position.
7293
7294 'exchange-point-and-mark (C-x C-x)'
7295      Swap the point with the mark.  The current cursor position is set
7296      to the saved position, and the old cursor position is saved as the
7297      mark.
7298
7299 'character-search (C-])'
7300      A character is read and point is moved to the next occurrence of
7301      that character.  A negative count searches for previous
7302      occurrences.
7303
7304 'character-search-backward (M-C-])'
7305      A character is read and point is moved to the previous occurrence
7306      of that character.  A negative count searches for subsequent
7307      occurrences.
7308
7309 'skip-csi-sequence ()'
7310      Read enough characters to consume a multi-key sequence such as
7311      those defined for keys like Home and End.  Such sequences begin
7312      with a Control Sequence Indicator (CSI), usually ESC-[.  If this
7313      sequence is bound to "\e[", keys producing such sequences will have
7314      no effect unless explicitly bound to a readline command, instead of
7315      inserting stray characters into the editing buffer.  This is
7316      unbound by default, but usually bound to ESC-[.
7317
7318 'insert-comment (M-#)'
7319      Without a numeric argument, the value of the 'comment-begin'
7320      variable is inserted at the beginning of the current line.  If a
7321      numeric argument is supplied, this command acts as a toggle: if the
7322      characters at the beginning of the line do not match the value of
7323      'comment-begin', the value is inserted, otherwise the characters in
7324      'comment-begin' are deleted from the beginning of the line.  In
7325      either case, the line is accepted as if a newline had been typed.
7326
7327 'dump-functions ()'
7328      Print all of the functions and their key bindings to the Readline
7329      output stream.  If a numeric argument is supplied, the output is
7330      formatted in such a way that it can be made part of an INPUTRC
7331      file.  This command is unbound by default.
7332
7333 'dump-variables ()'
7334      Print all of the settable variables and their values to the
7335      Readline output stream.  If a numeric argument is supplied, the
7336      output is formatted in such a way that it can be made part of an
7337      INPUTRC file.  This command is unbound by default.
7338
7339 'dump-macros ()'
7340      Print all of the Readline key sequences bound to macros and the
7341      strings they output.  If a numeric argument is supplied, the output
7342      is formatted in such a way that it can be made part of an INPUTRC
7343      file.  This command is unbound by default.
7344
7345 'emacs-editing-mode (C-e)'
7346      When in 'vi' command mode, this causes a switch to 'emacs' editing
7347      mode.
7348
7349 'vi-editing-mode (M-C-j)'
7350      When in 'emacs' editing mode, this causes a switch to 'vi' editing
7351      mode.
7352
7353 \1f
7354 File: gdb.info,  Node: Readline vi Mode,  Prev: Bindable Readline Commands,  Up: Command Line Editing
7355
7356 32.5 Readline vi Mode
7357 =====================
7358
7359 While the Readline library does not have a full set of 'vi' editing
7360 functions, it does contain enough to allow simple editing of the line.
7361 The Readline 'vi' mode behaves as specified in the POSIX standard.
7362
7363    In order to switch interactively between 'emacs' and 'vi' editing
7364 modes, use the command 'M-C-j' (bound to emacs-editing-mode when in 'vi'
7365 mode and to vi-editing-mode in 'emacs' mode).  The Readline default is
7366 'emacs' mode.
7367
7368    When you enter a line in 'vi' mode, you are already placed in
7369 'insertion' mode, as if you had typed an 'i'.  Pressing <ESC> switches
7370 you into 'command' mode, where you can edit the text of the line with
7371 the standard 'vi' movement keys, move to previous history lines with 'k'
7372 and subsequent lines with 'j', and so forth.
7373
7374 \1f
7375 File: gdb.info,  Node: Using History Interactively,  Next: In Memoriam,  Prev: Command Line Editing,  Up: Top
7376
7377 33 Using History Interactively
7378 ******************************
7379
7380 This chapter describes how to use the GNU History Library interactively,
7381 from a user's standpoint.  It should be considered a user's guide.  For
7382 information on using the GNU History Library in your own programs, *note
7383 (history)Programming with GNU History::.
7384
7385 * Menu:
7386
7387 * History Interaction::         What it feels like using History as a user.
7388
7389 \1f
7390 File: gdb.info,  Node: History Interaction,  Up: Using History Interactively
7391
7392 33.1 History Expansion
7393 ======================
7394
7395 The History library provides a history expansion feature that is similar
7396 to the history expansion provided by 'csh'.  This section describes the
7397 syntax used to manipulate the history information.
7398
7399    History expansions introduce words from the history list into the
7400 input stream, making it easy to repeat commands, insert the arguments to
7401 a previous command into the current input line, or fix errors in
7402 previous commands quickly.
7403
7404    History expansion takes place in two parts.  The first is to
7405 determine which line from the history list should be used during
7406 substitution.  The second is to select portions of that line for
7407 inclusion into the current one.  The line selected from the history is
7408 called the "event", and the portions of that line that are acted upon
7409 are called "words".  Various "modifiers" are available to manipulate the
7410 selected words.  The line is broken into words in the same fashion that
7411 Bash does, so that several words surrounded by quotes are considered one
7412 word.  History expansions are introduced by the appearance of the
7413 history expansion character, which is '!' by default.
7414
7415 * Menu:
7416
7417 * Event Designators::   How to specify which history line to use.
7418 * Word Designators::    Specifying which words are of interest.
7419 * Modifiers::           Modifying the results of substitution.
7420
7421 \1f
7422 File: gdb.info,  Node: Event Designators,  Next: Word Designators,  Up: History Interaction
7423
7424 33.1.1 Event Designators
7425 ------------------------
7426
7427 An event designator is a reference to a command line entry in the
7428 history list.  Unless the reference is absolute, events are relative to
7429 the current position in the history list.
7430
7431 '!'
7432      Start a history substitution, except when followed by a space, tab,
7433      the end of the line, or '='.
7434
7435 '!N'
7436      Refer to command line N.
7437
7438 '!-N'
7439      Refer to the command N lines back.
7440
7441 '!!'
7442      Refer to the previous command.  This is a synonym for '!-1'.
7443
7444 '!STRING'
7445      Refer to the most recent command preceding the current position in
7446      the history list starting with STRING.
7447
7448 '!?STRING[?]'
7449      Refer to the most recent command preceding the current position in
7450      the history list containing STRING.  The trailing '?' may be
7451      omitted if the STRING is followed immediately by a newline.
7452
7453 '^STRING1^STRING2^'
7454      Quick Substitution.  Repeat the last command, replacing STRING1
7455      with STRING2.  Equivalent to '!!:s/STRING1/STRING2/'.
7456
7457 '!#'
7458      The entire command line typed so far.
7459
7460 \1f
7461 File: gdb.info,  Node: Word Designators,  Next: Modifiers,  Prev: Event Designators,  Up: History Interaction
7462
7463 33.1.2 Word Designators
7464 -----------------------
7465
7466 Word designators are used to select desired words from the event.  A ':'
7467 separates the event specification from the word designator.  It may be
7468 omitted if the word designator begins with a '^', '$', '*', '-', or '%'.
7469 Words are numbered from the beginning of the line, with the first word
7470 being denoted by 0 (zero).  Words are inserted into the current line
7471 separated by single spaces.
7472
7473    For example,
7474
7475 '!!'
7476      designates the preceding command.  When you type this, the
7477      preceding command is repeated in toto.
7478
7479 '!!:$'
7480      designates the last argument of the preceding command.  This may be
7481      shortened to '!$'.
7482
7483 '!fi:2'
7484      designates the second argument of the most recent command starting
7485      with the letters 'fi'.
7486
7487    Here are the word designators:
7488
7489 '0 (zero)'
7490      The '0'th word.  For many applications, this is the command word.
7491
7492 'N'
7493      The Nth word.
7494
7495 '^'
7496      The first argument; that is, word 1.
7497
7498 '$'
7499      The last argument.
7500
7501 '%'
7502      The word matched by the most recent '?STRING?' search.
7503
7504 'X-Y'
7505      A range of words; '-Y' abbreviates '0-Y'.
7506
7507 '*'
7508      All of the words, except the '0'th.  This is a synonym for '1-$'.
7509      It is not an error to use '*' if there is just one word in the
7510      event; the empty string is returned in that case.
7511
7512 'X*'
7513      Abbreviates 'X-$'
7514
7515 'X-'
7516      Abbreviates 'X-$' like 'X*', but omits the last word.
7517
7518    If a word designator is supplied without an event specification, the
7519 previous command is used as the event.
7520
7521 \1f
7522 File: gdb.info,  Node: Modifiers,  Prev: Word Designators,  Up: History Interaction
7523
7524 33.1.3 Modifiers
7525 ----------------
7526
7527 After the optional word designator, you can add a sequence of one or
7528 more of the following modifiers, each preceded by a ':'.
7529
7530 'h'
7531      Remove a trailing pathname component, leaving only the head.
7532
7533 't'
7534      Remove all leading pathname components, leaving the tail.
7535
7536 'r'
7537      Remove a trailing suffix of the form '.SUFFIX', leaving the
7538      basename.
7539
7540 'e'
7541      Remove all but the trailing suffix.
7542
7543 'p'
7544      Print the new command but do not execute it.
7545
7546 's/OLD/NEW/'
7547      Substitute NEW for the first occurrence of OLD in the event line.
7548      Any delimiter may be used in place of '/'.  The delimiter may be
7549      quoted in OLD and NEW with a single backslash.  If '&' appears in
7550      NEW, it is replaced by OLD.  A single backslash will quote the '&'.
7551      The final delimiter is optional if it is the last character on the
7552      input line.
7553
7554 '&'
7555      Repeat the previous substitution.
7556
7557 'g'
7558 'a'
7559      Cause changes to be applied over the entire event line.  Used in
7560      conjunction with 's', as in 'gs/OLD/NEW/', or with '&'.
7561
7562 'G'
7563      Apply the following 's' modifier once to each word in the event.
7564
7565 \1f
7566 File: gdb.info,  Node: In Memoriam,  Next: Formatting Documentation,  Prev: Using History Interactively,  Up: Top
7567
7568 Appendix A In Memoriam
7569 **********************
7570
7571 The GDB project mourns the loss of the following long-time contributors:
7572
7573 'Fred Fish'
7574      Fred was a long-standing contributor to GDB (1991-2006), and to
7575      Free Software in general.  Outside of GDB, he was known in the
7576      Amiga world for his series of Fish Disks, and the GeekGadget
7577      project.
7578
7579 'Michael Snyder'
7580      Michael was one of the Global Maintainers of the GDB project, with
7581      contributions recorded as early as 1996, until 2011.  In addition
7582      to his day to day participation, he was a large driving force
7583      behind adding Reverse Debugging to GDB.
7584
7585    Beyond their technical contributions to the project, they were also
7586 enjoyable members of the Free Software Community.  We will miss them.
7587
7588 \1f
7589 File: gdb.info,  Node: Formatting Documentation,  Next: Installing GDB,  Prev: In Memoriam,  Up: Top
7590
7591 Appendix B Formatting Documentation
7592 ***********************************
7593
7594 The GDB 4 release includes an already-formatted reference card, ready
7595 for printing with PostScript or Ghostscript, in the 'gdb' subdirectory
7596 of the main source directory(1).  If you can use PostScript or
7597 Ghostscript with your printer, you can print the reference card
7598 immediately with 'refcard.ps'.
7599
7600    The release also includes the source for the reference card.  You can
7601 format it, using TeX, by typing:
7602
7603      make refcard.dvi
7604
7605    The GDB reference card is designed to print in "landscape" mode on US
7606 "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
7607 high.  You will need to specify this form of printing as an option to
7608 your DVI output program.
7609
7610    All the documentation for GDB comes as part of the machine-readable
7611 distribution.  The documentation is written in Texinfo format, which is
7612 a documentation system that uses a single source file to produce both
7613 on-line information and a printed manual.  You can use one of the Info
7614 formatting commands to create the on-line version of the documentation
7615 and TeX (or 'texi2roff') to typeset the printed version.
7616
7617    GDB includes an already formatted copy of the on-line Info version of
7618 this manual in the 'gdb' subdirectory.  The main Info file is
7619 'gdb-7.8.1/gdb/gdb.info', and it refers to subordinate files matching
7620 'gdb.info*' in the same directory.  If necessary, you can print out
7621 these files, or read them with any editor; but they are easier to read
7622 using the 'info' subsystem in GNU Emacs or the standalone 'info'
7623 program, available as part of the GNU Texinfo distribution.
7624
7625    If you want to format these Info files yourself, you need one of the
7626 Info formatting programs, such as 'texinfo-format-buffer' or 'makeinfo'.
7627
7628    If you have 'makeinfo' installed, and are in the top level GDB source
7629 directory ('gdb-7.8.1', in the case of version 7.8.1), you can make the
7630 Info file by typing:
7631
7632      cd gdb
7633      make gdb.info
7634
7635    If you want to typeset and print copies of this manual, you need TeX,
7636 a program to print its DVI output files, and 'texinfo.tex', the Texinfo
7637 definitions file.
7638
7639    TeX is a typesetting program; it does not print files directly, but
7640 produces output files called DVI files.  To print a typeset document,
7641 you need a program to print DVI files.  If your system has TeX
7642 installed, chances are it has such a program.  The precise command to
7643 use depends on your system; 'lpr -d' is common; another (for PostScript
7644 devices) is 'dvips'.  The DVI print command may require a file name
7645 without any extension or a '.dvi' extension.
7646
7647    TeX also requires a macro definitions file called 'texinfo.tex'.
7648 This file tells TeX how to typeset a document written in Texinfo format.
7649 On its own, TeX cannot either read or typeset a Texinfo file.
7650 'texinfo.tex' is distributed with GDB and is located in the
7651 'gdb-VERSION-NUMBER/texinfo' directory.
7652
7653    If you have TeX and a DVI printer program installed, you can typeset
7654 and print this manual.  First switch to the 'gdb' subdirectory of the
7655 main source directory (for example, to 'gdb-7.8.1/gdb') and type:
7656
7657      make gdb.dvi
7658
7659    Then give 'gdb.dvi' to your DVI printing program.
7660
7661    ---------- Footnotes ----------
7662
7663    (1) In 'gdb-7.8.1/gdb/refcard.ps' of the version 7.8.1 release.
7664
7665 \1f
7666 File: gdb.info,  Node: Installing GDB,  Next: Maintenance Commands,  Prev: Formatting Documentation,  Up: Top
7667
7668 Appendix C Installing GDB
7669 *************************
7670
7671 * Menu:
7672
7673 * Requirements::                Requirements for building GDB
7674 * Running Configure::           Invoking the GDB 'configure' script
7675 * Separate Objdir::             Compiling GDB in another directory
7676 * Config Names::                Specifying names for hosts and targets
7677 * Configure Options::           Summary of options for configure
7678 * System-wide configuration::   Having a system-wide init file
7679
7680 \1f
7681 File: gdb.info,  Node: Requirements,  Next: Running Configure,  Up: Installing GDB
7682
7683 C.1 Requirements for Building GDB
7684 =================================
7685
7686 Building GDB requires various tools and packages to be available.  Other
7687 packages will be used only if they are found.
7688
7689 Tools/Packages Necessary for Building GDB
7690 =========================================
7691
7692 ISO C90 compiler
7693      GDB is written in ISO C90.  It should be buildable with any working
7694      C90 compiler, e.g. GCC.
7695
7696 Tools/Packages Optional for Building GDB
7697 ========================================
7698
7699 Expat
7700      GDB can use the Expat XML parsing library.  This library may be
7701      included with your operating system distribution; if it is not, you
7702      can get the latest version from <http://expat.sourceforge.net>.
7703      The 'configure' script will search for this library in several
7704      standard locations; if it is installed in an unusual path, you can
7705      use the '--with-libexpat-prefix' option to specify its location.
7706
7707      Expat is used for:
7708
7709         * Remote protocol memory maps (*note Memory Map Format::)
7710         * Target descriptions (*note Target Descriptions::)
7711         * Remote shared library lists (*Note Library List Format::, or
7712           alternatively *note Library List Format for SVR4 Targets::)
7713         * MS-Windows shared libraries (*note Shared Libraries::)
7714         * Traceframe info (*note Traceframe Info Format::)
7715         * Branch trace (*note Branch Trace Format::)
7716
7717 zlib
7718      GDB will use the 'zlib' library, if available, to read compressed
7719      debug sections.  Some linkers, such as GNU gold, are capable of
7720      producing binaries with compressed debug sections.  If GDB is
7721      compiled with 'zlib', it will be able to read the debug information
7722      in such binaries.
7723
7724      The 'zlib' library is likely included with your operating system
7725      distribution; if it is not, you can get the latest version from
7726      <http://zlib.net>.
7727
7728 iconv
7729      GDB's features related to character sets (*note Character Sets::)
7730      require a functioning 'iconv' implementation.  If you are on a GNU
7731      system, then this is provided by the GNU C Library.  Some other
7732      systems also provide a working 'iconv'.
7733
7734      If GDB is using the 'iconv' program which is installed in a
7735      non-standard place, you will need to tell GDB where to find it.
7736      This is done with '--with-iconv-bin' which specifies the directory
7737      that contains the 'iconv' program.
7738
7739      On systems without 'iconv', you can install GNU Libiconv.  If you
7740      have previously installed Libiconv, you can use the
7741      '--with-libiconv-prefix' option to configure.
7742
7743      GDB's top-level 'configure' and 'Makefile' will arrange to build
7744      Libiconv if a directory named 'libiconv' appears in the top-most
7745      source directory.  If Libiconv is built this way, and if the
7746      operating system does not provide a suitable 'iconv'
7747      implementation, then the just-built library will automatically be
7748      used by GDB.  One easy way to set this up is to download GNU
7749      Libiconv, unpack it, and then rename the directory holding the
7750      Libiconv source code to 'libiconv'.
7751
7752 \1f
7753 File: gdb.info,  Node: Running Configure,  Next: Separate Objdir,  Prev: Requirements,  Up: Installing GDB
7754
7755 C.2 Invoking the GDB 'configure' Script
7756 =======================================
7757
7758 GDB comes with a 'configure' script that automates the process of
7759 preparing GDB for installation; you can then use 'make' to build the
7760 'gdb' program.
7761
7762    The GDB distribution includes all the source code you need for GDB in
7763 a single directory, whose name is usually composed by appending the
7764 version number to 'gdb'.
7765
7766    For example, the GDB version 7.8.1 distribution is in the 'gdb-7.8.1'
7767 directory.  That directory contains:
7768
7769 'gdb-7.8.1/configure (and supporting files)'
7770      script for configuring GDB and all its supporting libraries
7771
7772 'gdb-7.8.1/gdb'
7773      the source specific to GDB itself
7774
7775 'gdb-7.8.1/bfd'
7776      source for the Binary File Descriptor library
7777
7778 'gdb-7.8.1/include'
7779      GNU include files
7780
7781 'gdb-7.8.1/libiberty'
7782      source for the '-liberty' free software library
7783
7784 'gdb-7.8.1/opcodes'
7785      source for the library of opcode tables and disassemblers
7786
7787 'gdb-7.8.1/readline'
7788      source for the GNU command-line interface
7789
7790 'gdb-7.8.1/glob'
7791      source for the GNU filename pattern-matching subroutine
7792
7793 'gdb-7.8.1/mmalloc'
7794      source for the GNU memory-mapped malloc package
7795
7796    The simplest way to configure and build GDB is to run 'configure'
7797 from the 'gdb-VERSION-NUMBER' source directory, which in this example is
7798 the 'gdb-7.8.1' directory.
7799
7800    First switch to the 'gdb-VERSION-NUMBER' source directory if you are
7801 not already in it; then run 'configure'.  Pass the identifier for the
7802 platform on which GDB will run as an argument.
7803
7804    For example:
7805
7806      cd gdb-7.8.1
7807      ./configure HOST
7808      make
7809
7810 where HOST is an identifier such as 'sun4' or 'decstation', that
7811 identifies the platform where GDB will run.  (You can often leave off
7812 HOST; 'configure' tries to guess the correct value by examining your
7813 system.)
7814
7815    Running 'configure HOST' and then running 'make' builds the 'bfd',
7816 'readline', 'mmalloc', and 'libiberty' libraries, then 'gdb' itself.
7817 The configured source files, and the binaries, are left in the
7818 corresponding source directories.
7819
7820    'configure' is a Bourne-shell ('/bin/sh') script; if your system does
7821 not recognize this automatically when you run a different shell, you may
7822 need to run 'sh' on it explicitly:
7823
7824      sh configure HOST
7825
7826    If you run 'configure' from a directory that contains source
7827 directories for multiple libraries or programs, such as the 'gdb-7.8.1'
7828 source directory for version 7.8.1, 'configure' creates configuration
7829 files for every directory level underneath (unless you tell it not to,
7830 with the '--norecursion' option).
7831
7832    You should run the 'configure' script from the top directory in the
7833 source tree, the 'gdb-VERSION-NUMBER' directory.  If you run 'configure'
7834 from one of the subdirectories, you will configure only that
7835 subdirectory.  That is usually not what you want.  In particular, if you
7836 run the first 'configure' from the 'gdb' subdirectory of the
7837 'gdb-VERSION-NUMBER' directory, you will omit the configuration of
7838 'bfd', 'readline', and other sibling directories of the 'gdb'
7839 subdirectory.  This leads to build errors about missing include files
7840 such as 'bfd/bfd.h'.
7841
7842    You can install 'gdb' anywhere; it has no hardwired paths.  However,
7843 you should make sure that the shell on your path (named by the 'SHELL'
7844 environment variable) is publicly readable.  Remember that GDB uses the
7845 shell to start your program--some systems refuse to let GDB debug child
7846 processes whose programs are not readable.
7847
7848 \1f
7849 File: gdb.info,  Node: Separate Objdir,  Next: Config Names,  Prev: Running Configure,  Up: Installing GDB
7850
7851 C.3 Compiling GDB in Another Directory
7852 ======================================
7853
7854 If you want to run GDB versions for several host or target machines, you
7855 need a different 'gdb' compiled for each combination of host and target.
7856 'configure' is designed to make this easy by allowing you to generate
7857 each configuration in a separate subdirectory, rather than in the source
7858 directory.  If your 'make' program handles the 'VPATH' feature (GNU
7859 'make' does), running 'make' in each of these directories builds the
7860 'gdb' program specified there.
7861
7862    To build 'gdb' in a separate directory, run 'configure' with the
7863 '--srcdir' option to specify where to find the source.  (You also need
7864 to specify a path to find 'configure' itself from your working
7865 directory.  If the path to 'configure' would be the same as the argument
7866 to '--srcdir', you can leave out the '--srcdir' option; it is assumed.)
7867
7868    For example, with version 7.8.1, you can build GDB in a separate
7869 directory for a Sun 4 like this:
7870
7871      cd gdb-7.8.1
7872      mkdir ../gdb-sun4
7873      cd ../gdb-sun4
7874      ../gdb-7.8.1/configure sun4
7875      make
7876
7877    When 'configure' builds a configuration using a remote source
7878 directory, it creates a tree for the binaries with the same structure
7879 (and using the same names) as the tree under the source directory.  In
7880 the example, you'd find the Sun 4 library 'libiberty.a' in the directory
7881 'gdb-sun4/libiberty', and GDB itself in 'gdb-sun4/gdb'.
7882
7883    Make sure that your path to the 'configure' script has just one
7884 instance of 'gdb' in it.  If your path to 'configure' looks like
7885 '../gdb-7.8.1/gdb/configure', you are configuring only one subdirectory
7886 of GDB, not the whole package.  This leads to build errors about missing
7887 include files such as 'bfd/bfd.h'.
7888
7889    One popular reason to build several GDB configurations in separate
7890 directories is to configure GDB for cross-compiling (where GDB runs on
7891 one machine--the "host"--while debugging programs that run on another
7892 machine--the "target").  You specify a cross-debugging target by giving
7893 the '--target=TARGET' option to 'configure'.
7894
7895    When you run 'make' to build a program or library, you must run it in
7896 a configured directory--whatever directory you were in when you called
7897 'configure' (or one of its subdirectories).
7898
7899    The 'Makefile' that 'configure' generates in each source directory
7900 also runs recursively.  If you type 'make' in a source directory such as
7901 'gdb-7.8.1' (or in a separate configured directory configured with
7902 '--srcdir=DIRNAME/gdb-7.8.1'), you will build all the required
7903 libraries, and then build GDB.
7904
7905    When you have multiple hosts or targets configured in separate
7906 directories, you can run 'make' on them in parallel (for example, if
7907 they are NFS-mounted on each of the hosts); they will not interfere with
7908 each other.
7909
7910 \1f
7911 File: gdb.info,  Node: Config Names,  Next: Configure Options,  Prev: Separate Objdir,  Up: Installing GDB
7912
7913 C.4 Specifying Names for Hosts and Targets
7914 ==========================================
7915
7916 The specifications used for hosts and targets in the 'configure' script
7917 are based on a three-part naming scheme, but some short predefined
7918 aliases are also supported.  The full naming scheme encodes three pieces
7919 of information in the following pattern:
7920
7921      ARCHITECTURE-VENDOR-OS
7922
7923    For example, you can use the alias 'sun4' as a HOST argument, or as
7924 the value for TARGET in a '--target=TARGET' option.  The equivalent full
7925 name is 'sparc-sun-sunos4'.
7926
7927    The 'configure' script accompanying GDB does not provide any query
7928 facility to list all supported host and target names or aliases.
7929 'configure' calls the Bourne shell script 'config.sub' to map
7930 abbreviations to full names; you can read the script, if you wish, or
7931 you can use it to test your guesses on abbreviations--for example:
7932
7933      % sh config.sub i386-linux
7934      i386-pc-linux-gnu
7935      % sh config.sub alpha-linux
7936      alpha-unknown-linux-gnu
7937      % sh config.sub hp9k700
7938      hppa1.1-hp-hpux
7939      % sh config.sub sun4
7940      sparc-sun-sunos4.1.1
7941      % sh config.sub sun3
7942      m68k-sun-sunos4.1.1
7943      % sh config.sub i986v
7944      Invalid configuration `i986v': machine `i986v' not recognized
7945
7946 'config.sub' is also distributed in the GDB source directory
7947 ('gdb-7.8.1', for version 7.8.1).
7948
7949 \1f
7950 File: gdb.info,  Node: Configure Options,  Next: System-wide configuration,  Prev: Config Names,  Up: Installing GDB
7951
7952 C.5 'configure' Options
7953 =======================
7954
7955 Here is a summary of the 'configure' options and arguments that are most
7956 often useful for building GDB.  'configure' also has several other
7957 options not listed here.  *note (configure.info)What Configure Does::,
7958 for a full explanation of 'configure'.
7959
7960      configure [--help]
7961                [--prefix=DIR]
7962                [--exec-prefix=DIR]
7963                [--srcdir=DIRNAME]
7964                [--norecursion] [--rm]
7965                [--target=TARGET]
7966                HOST
7967
7968 You may introduce options with a single '-' rather than '--' if you
7969 prefer; but you may abbreviate option names if you use '--'.
7970
7971 '--help'
7972      Display a quick summary of how to invoke 'configure'.
7973
7974 '--prefix=DIR'
7975      Configure the source to install programs and files under directory
7976      'DIR'.
7977
7978 '--exec-prefix=DIR'
7979      Configure the source to install programs under directory 'DIR'.
7980
7981 '--srcdir=DIRNAME'
7982      *Warning: using this option requires GNU 'make', or another 'make'
7983      that implements the 'VPATH' feature.*
7984      Use this option to make configurations in directories separate from
7985      the GDB source directories.  Among other things, you can use this
7986      to build (or maintain) several configurations simultaneously, in
7987      separate directories.  'configure' writes configuration-specific
7988      files in the current directory, but arranges for them to use the
7989      source in the directory DIRNAME.  'configure' creates directories
7990      under the working directory in parallel to the source directories
7991      below DIRNAME.
7992
7993 '--norecursion'
7994      Configure only the directory level where 'configure' is executed;
7995      do not propagate configuration to subdirectories.
7996
7997 '--target=TARGET'
7998      Configure GDB for cross-debugging programs running on the specified
7999      TARGET.  Without this option, GDB is configured to debug programs
8000      that run on the same machine (HOST) as GDB itself.
8001
8002      There is no convenient way to generate a list of all available
8003      targets.
8004
8005 'HOST ...'
8006      Configure GDB to run on the specified HOST.
8007
8008      There is no convenient way to generate a list of all available
8009      hosts.
8010
8011    There are many other options available as well, but they are
8012 generally needed for special purposes only.
8013
8014 \1f
8015 File: gdb.info,  Node: System-wide configuration,  Prev: Configure Options,  Up: Installing GDB
8016
8017 C.6 System-wide configuration and settings
8018 ==========================================
8019
8020 GDB can be configured to have a system-wide init file; this file will be
8021 read and executed at startup (*note What GDB does during startup:
8022 Startup.).
8023
8024    Here is the corresponding configure option:
8025
8026 '--with-system-gdbinit=FILE'
8027      Specify that the default location of the system-wide init file is
8028      FILE.
8029
8030    If GDB has been configured with the option '--prefix=$prefix', it may
8031 be subject to relocation.  Two possible cases:
8032
8033    * If the default location of this init file contains '$prefix', it
8034      will be subject to relocation.  Suppose that the configure options
8035      are '--prefix=$prefix --with-system-gdbinit=$prefix/etc/gdbinit';
8036      if GDB is moved from '$prefix' to '$install', the system init file
8037      is looked for as '$install/etc/gdbinit' instead of
8038      '$prefix/etc/gdbinit'.
8039
8040    * By contrast, if the default location does not contain the prefix,
8041      it will not be relocated.  E.g. if GDB has been configured with
8042      '--prefix=/usr/local --with-system-gdbinit=/usr/share/gdb/gdbinit',
8043      then GDB will always look for '/usr/share/gdb/gdbinit', wherever
8044      GDB is installed.
8045
8046    If the configured location of the system-wide init file (as given by
8047 the '--with-system-gdbinit' option at configure time) is in the
8048 data-directory (as specified by '--with-gdb-datadir' at configure time)
8049 or in one of its subdirectories, then GDB will look for the system-wide
8050 init file in the directory specified by the '--data-directory'
8051 command-line option.  Note that the system-wide init file is only read
8052 once, during GDB initialization.  If the data-directory is changed after
8053 GDB has started with the 'set data-directory' command, the file will not
8054 be reread.
8055
8056 * Menu:
8057
8058 * System-wide Configuration Scripts::  Installed System-wide Configuration Scripts
8059
8060 \1f
8061 File: gdb.info,  Node: System-wide Configuration Scripts,  Up: System-wide configuration
8062
8063 C.6.1 Installed System-wide Configuration Scripts
8064 -------------------------------------------------
8065
8066 The 'system-gdbinit' directory, located inside the data-directory (as
8067 specified by '--with-gdb-datadir' at configure time) contains a number
8068 of scripts which can be used as system-wide init files.  To
8069 automatically source those scripts at startup, GDB should be configured
8070 with '--with-system-gdbinit'.  Otherwise, any user should be able to
8071 source them by hand as needed.
8072
8073    The following scripts are currently available:
8074
8075    * 'elinos.py' This script is useful when debugging a program on an
8076      ELinOS target.  It takes advantage of the environment variables
8077      defined in a standard ELinOS environment in order to determine the
8078      location of the system shared libraries, and then sets the
8079      'solib-absolute-prefix' and 'solib-search-path' variables
8080      appropriately.
8081
8082    * 'wrs-linux.py' This script is useful when debugging a program on a
8083      target running Wind River Linux.  It expects the 'ENV_PREFIX' to be
8084      set to the host-side sysroot used by the target system.
8085
8086 \1f
8087 File: gdb.info,  Node: Maintenance Commands,  Next: Remote Protocol,  Prev: Installing GDB,  Up: Top
8088
8089 Appendix D Maintenance Commands
8090 *******************************
8091
8092 In addition to commands intended for GDB users, GDB includes a number of
8093 commands intended for GDB developers, that are not documented elsewhere
8094 in this manual.  These commands are provided here for reference.  (For
8095 commands that turn on debugging messages, see *note Debugging Output::.)
8096
8097 'maint agent [-at LOCATION,] EXPRESSION'
8098 'maint agent-eval [-at LOCATION,] EXPRESSION'
8099      Translate the given EXPRESSION into remote agent bytecodes.  This
8100      command is useful for debugging the Agent Expression mechanism
8101      (*note Agent Expressions::).  The 'agent' version produces an
8102      expression useful for data collection, such as by tracepoints,
8103      while 'maint agent-eval' produces an expression that evaluates
8104      directly to a result.  For instance, a collection expression for
8105      'globa + globb' will include bytecodes to record four bytes of
8106      memory at each of the addresses of 'globa' and 'globb', while
8107      discarding the result of the addition, while an evaluation
8108      expression will do the addition and return the sum.  If '-at' is
8109      given, generate remote agent bytecode for LOCATION.  If not,
8110      generate remote agent bytecode for current frame PC address.
8111
8112 'maint agent-printf FORMAT,EXPR,...'
8113      Translate the given format string and list of argument expressions
8114      into remote agent bytecodes and display them as a disassembled
8115      list.  This command is useful for debugging the agent version of
8116      dynamic printf (*note Dynamic Printf::).
8117
8118 'maint info breakpoints'
8119      Using the same format as 'info breakpoints', display both the
8120      breakpoints you've set explicitly, and those GDB is using for
8121      internal purposes.  Internal breakpoints are shown with negative
8122      breakpoint numbers.  The type column identifies what kind of
8123      breakpoint is shown:
8124
8125      'breakpoint'
8126           Normal, explicitly set breakpoint.
8127
8128      'watchpoint'
8129           Normal, explicitly set watchpoint.
8130
8131      'longjmp'
8132           Internal breakpoint, used to handle correctly stepping through
8133           'longjmp' calls.
8134
8135      'longjmp resume'
8136           Internal breakpoint at the target of a 'longjmp'.
8137
8138      'until'
8139           Temporary internal breakpoint used by the GDB 'until' command.
8140
8141      'finish'
8142           Temporary internal breakpoint used by the GDB 'finish'
8143           command.
8144
8145      'shlib events'
8146           Shared library events.
8147
8148 'maint info bfds'
8149      This prints information about each 'bfd' object that is known to
8150      GDB.  *Note BFD: (bfd)Top.
8151
8152 'set displaced-stepping'
8153 'show displaced-stepping'
8154      Control whether or not GDB will do "displaced stepping" if the
8155      target supports it.  Displaced stepping is a way to single-step
8156      over breakpoints without removing them from the inferior, by
8157      executing an out-of-line copy of the instruction that was
8158      originally at the breakpoint location.  It is also known as
8159      out-of-line single-stepping.
8160
8161      'set displaced-stepping on'
8162           If the target architecture supports it, GDB will use displaced
8163           stepping to step over breakpoints.
8164
8165      'set displaced-stepping off'
8166           GDB will not use displaced stepping to step over breakpoints,
8167           even if such is supported by the target architecture.
8168
8169      'set displaced-stepping auto'
8170           This is the default mode.  GDB will use displaced stepping
8171           only if non-stop mode is active (*note Non-Stop Mode::) and
8172           the target architecture supports displaced stepping.
8173
8174 'maint check-psymtabs'
8175      Check the consistency of currently expanded psymtabs versus
8176      symtabs.  Use this to check, for example, whether a symbol is in
8177      one but not the other.
8178
8179 'maint check-symtabs'
8180      Check the consistency of currently expanded symtabs.
8181
8182 'maint expand-symtabs [REGEXP]'
8183      Expand symbol tables.  If REGEXP is specified, only expand symbol
8184      tables for file names matching REGEXP.
8185
8186 'maint cplus first_component NAME'
8187      Print the first C++ class/namespace component of NAME.
8188
8189 'maint cplus namespace'
8190      Print the list of possible C++ namespaces.
8191
8192 'maint demangle NAME'
8193      Demangle a C++ or Objective-C mangled NAME.
8194
8195 'maint deprecate COMMAND [REPLACEMENT]'
8196 'maint undeprecate COMMAND'
8197      Deprecate or undeprecate the named COMMAND.  Deprecated commands
8198      cause GDB to issue a warning when you use them.  The optional
8199      argument REPLACEMENT says which newer command should be used in
8200      favor of the deprecated one; if it is given, GDB will mention the
8201      replacement as part of the warning.
8202
8203 'maint dump-me'
8204      Cause a fatal signal in the debugger and force it to dump its core.
8205      This is supported only on systems which support aborting a program
8206      with the 'SIGQUIT' signal.
8207
8208 'maint internal-error [MESSAGE-TEXT]'
8209 'maint internal-warning [MESSAGE-TEXT]'
8210      Cause GDB to call the internal function 'internal_error' or
8211      'internal_warning' and hence behave as though an internal error or
8212      internal warning has been detected.  In addition to reporting the
8213      internal problem, these functions give the user the opportunity to
8214      either quit GDB or create a core file of the current GDB session.
8215
8216      These commands take an optional parameter MESSAGE-TEXT that is used
8217      as the text of the error or warning message.
8218
8219      Here's an example of using 'internal-error':
8220
8221           (gdb) maint internal-error testing, 1, 2
8222           .../maint.c:121: internal-error: testing, 1, 2
8223           A problem internal to GDB has been detected.  Further
8224           debugging may prove unreliable.
8225           Quit this debugging session? (y or n) n
8226           Create a core file? (y or n) n
8227           (gdb)
8228
8229 'maint set internal-error ACTION [ask|yes|no]'
8230 'maint show internal-error ACTION'
8231 'maint set internal-warning ACTION [ask|yes|no]'
8232 'maint show internal-warning ACTION'
8233      When GDB reports an internal problem (error or warning) it gives
8234      the user the opportunity to both quit GDB and create a core file of
8235      the current GDB session.  These commands let you override the
8236      default behaviour for each particular ACTION, described in the
8237      table below.
8238
8239      'quit'
8240           You can specify that GDB should always (yes) or never (no)
8241           quit.  The default is to ask the user what to do.
8242
8243      'corefile'
8244           You can specify that GDB should always (yes) or never (no)
8245           create a core file.  The default is to ask the user what to
8246           do.
8247
8248 'maint packet TEXT'
8249      If GDB is talking to an inferior via the serial protocol, then this
8250      command sends the string TEXT to the inferior, and displays the
8251      response packet.  GDB supplies the initial '$' character, the
8252      terminating '#' character, and the checksum.
8253
8254 'maint print architecture [FILE]'
8255      Print the entire architecture configuration.  The optional argument
8256      FILE names the file where the output goes.
8257
8258 'maint print c-tdesc'
8259      Print the current target description (*note Target Descriptions::)
8260      as a C source file.  The created source file can be used in GDB
8261      when an XML parser is not available to parse the description.
8262
8263 'maint print dummy-frames'
8264      Prints the contents of GDB's internal dummy-frame stack.
8265
8266           (gdb) b add
8267           ...
8268           (gdb) print add(2,3)
8269           Breakpoint 2, add (a=2, b=3) at ...
8270           58      return (a + b);
8271           The program being debugged stopped while in a function called from GDB.
8272           ...
8273           (gdb) maint print dummy-frames
8274           0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6
8275            top=0x0200bdd4 id={stack=0x200bddc,code=0x101405c}
8276            call_lo=0x01014000 call_hi=0x01014001
8277           (gdb)
8278
8279      Takes an optional file parameter.
8280
8281 'maint print registers [FILE]'
8282 'maint print raw-registers [FILE]'
8283 'maint print cooked-registers [FILE]'
8284 'maint print register-groups [FILE]'
8285 'maint print remote-registers [FILE]'
8286      Print GDB's internal register data structures.
8287
8288      The command 'maint print raw-registers' includes the contents of
8289      the raw register cache; the command 'maint print cooked-registers'
8290      includes the (cooked) value of all registers, including registers
8291      which aren't available on the target nor visible to user; the
8292      command 'maint print register-groups' includes the groups that each
8293      register is a member of; and the command 'maint print
8294      remote-registers' includes the remote target's register numbers and
8295      offsets in the 'G' packets.
8296
8297      These commands take an optional parameter, a file name to which to
8298      write the information.
8299
8300 'maint print reggroups [FILE]'
8301      Print GDB's internal register group data structures.  The optional
8302      argument FILE tells to what file to write the information.
8303
8304      The register groups info looks like this:
8305
8306           (gdb) maint print reggroups
8307            Group      Type
8308            general    user
8309            float      user
8310            all        user
8311            vector     user
8312            system     user
8313            save       internal
8314            restore    internal
8315
8316 'flushregs'
8317      This command forces GDB to flush its internal register cache.
8318
8319 'maint print objfiles [REGEXP]'
8320      Print a dump of all known object files.  If REGEXP is specified,
8321      only print object files whose names match REGEXP.  For each object
8322      file, this command prints its name, address in memory, and all of
8323      its psymtabs and symtabs.
8324
8325 'maint print section-scripts [REGEXP]'
8326      Print a dump of scripts specified in the '.debug_gdb_section'
8327      section.  If REGEXP is specified, only print scripts loaded by
8328      object files matching REGEXP.  For each script, this command prints
8329      its name as specified in the objfile, and the full path if known.
8330      *Note dotdebug_gdb_scripts section::.
8331
8332 'maint print statistics'
8333      This command prints, for each object file in the program, various
8334      data about that object file followed by the byte cache ("bcache")
8335      statistics for the object file.  The objfile data includes the
8336      number of minimal, partial, full, and stabs symbols, the number of
8337      types defined by the objfile, the number of as yet unexpanded psym
8338      tables, the number of line tables and string tables, and the amount
8339      of memory used by the various tables.  The bcache statistics
8340      include the counts, sizes, and counts of duplicates of all and
8341      unique objects, max, average, and median entry size, total memory
8342      used and its overhead and savings, and various measures of the hash
8343      table size and chain lengths.
8344
8345 'maint print target-stack'
8346      A "target" is an interface between the debugger and a particular
8347      kind of file or process.  Targets can be stacked in "strata", so
8348      that more than one target can potentially respond to a request.  In
8349      particular, memory accesses will walk down the stack of targets
8350      until they find a target that is interested in handling that
8351      particular address.
8352
8353      This command prints a short description of each layer that was
8354      pushed on the "target stack", starting from the top layer down to
8355      the bottom one.
8356
8357 'maint print type EXPR'
8358      Print the type chain for a type specified by EXPR.  The argument
8359      can be either a type name or a symbol.  If it is a symbol, the type
8360      of that symbol is described.  The type chain produced by this
8361      command is a recursive definition of the data type as stored in
8362      GDB's data structures, including its flags and contained types.
8363
8364 'maint set dwarf2 always-disassemble'
8365 'maint show dwarf2 always-disassemble'
8366      Control the behavior of 'info address' when using DWARF debugging
8367      information.
8368
8369      The default is 'off', which means that GDB should try to describe a
8370      variable's location in an easily readable format.  When 'on', GDB
8371      will instead display the DWARF location expression in an
8372      assembly-like format.  Note that some locations are too complex for
8373      GDB to describe simply; in this case you will always see the
8374      disassembly form.
8375
8376      Here is an example of the resulting disassembly:
8377
8378           (gdb) info addr argc
8379           Symbol "argc" is a complex DWARF expression:
8380                1: DW_OP_fbreg 0
8381
8382      For more information on these expressions, see the DWARF standard
8383      (http://www.dwarfstd.org/).
8384
8385 'maint set dwarf2 max-cache-age'
8386 'maint show dwarf2 max-cache-age'
8387      Control the DWARF 2 compilation unit cache.
8388
8389      In object files with inter-compilation-unit references, such as
8390      those produced by the GCC option '-feliminate-dwarf2-dups', the
8391      DWARF 2 reader needs to frequently refer to previously read
8392      compilation units.  This setting controls how long a compilation
8393      unit will remain in the cache if it is not referenced.  A higher
8394      limit means that cached compilation units will be stored in memory
8395      longer, and more total memory will be used.  Setting it to zero
8396      disables caching, which will slow down GDB startup, but reduce
8397      memory consumption.
8398
8399 'maint set profile'
8400 'maint show profile'
8401      Control profiling of GDB.
8402
8403      Profiling will be disabled until you use the 'maint set profile'
8404      command to enable it.  When you enable profiling, the system will
8405      begin collecting timing and execution count data; when you disable
8406      profiling or exit GDB, the results will be written to a log file.
8407      Remember that if you use profiling, GDB will overwrite the
8408      profiling log file (often called 'gmon.out').  If you have a record
8409      of important profiling data in a 'gmon.out' file, be sure to move
8410      it to a safe location.
8411
8412      Configuring with '--enable-profiling' arranges for GDB to be
8413      compiled with the '-pg' compiler option.
8414
8415 'maint set show-debug-regs'
8416 'maint show show-debug-regs'
8417      Control whether to show variables that mirror the hardware debug
8418      registers.  Use 'on' to enable, 'off' to disable.  If enabled, the
8419      debug registers values are shown when GDB inserts or removes a
8420      hardware breakpoint or watchpoint, and when the inferior triggers a
8421      hardware-assisted breakpoint or watchpoint.
8422
8423 'maint set show-all-tib'
8424 'maint show show-all-tib'
8425      Control whether to show all non zero areas within a 1k block
8426      starting at thread local base, when using the 'info w32
8427      thread-information-block' command.
8428
8429 'maint set target-async'
8430 'maint show target-async'
8431      This controls whether GDB targets operate in synchronous or
8432      asynchronous mode (*note Background Execution::).  Normally the
8433      default is asynchronous, if it is available; but this can be
8434      changed to more easily debug problems occurring only in synchronous
8435      mode.
8436
8437 'maint set per-command'
8438 'maint show per-command'
8439
8440      GDB can display the resources used by each command.  This is useful
8441      in debugging performance problems.
8442
8443      'maint set per-command space [on|off]'
8444      'maint show per-command space'
8445           Enable or disable the printing of the memory used by GDB for
8446           each command.  If enabled, GDB will display how much memory
8447           each command took, following the command's own output.  This
8448           can also be requested by invoking GDB with the '--statistics'
8449           command-line switch (*note Mode Options::).
8450
8451      'maint set per-command time [on|off]'
8452      'maint show per-command time'
8453           Enable or disable the printing of the execution time of GDB
8454           for each command.  If enabled, GDB will display how much time
8455           it took to execute each command, following the command's own
8456           output.  Both CPU time and wallclock time are printed.
8457           Printing both is useful when trying to determine whether the
8458           cost is CPU or, e.g., disk/network latency.  Note that the CPU
8459           time printed is for GDB only, it does not include the
8460           execution time of the inferior because there's no mechanism
8461           currently to compute how much time was spent by GDB and how
8462           much time was spent by the program been debugged.  This can
8463           also be requested by invoking GDB with the '--statistics'
8464           command-line switch (*note Mode Options::).
8465
8466      'maint set per-command symtab [on|off]'
8467      'maint show per-command symtab'
8468           Enable or disable the printing of basic symbol table
8469           statistics for each command.  If enabled, GDB will display the
8470           following information:
8471
8472             a. number of symbol tables
8473             b. number of primary symbol tables
8474             c. number of blocks in the blockvector
8475
8476 'maint space VALUE'
8477      An alias for 'maint set per-command space'.  A non-zero value
8478      enables it, zero disables it.
8479
8480 'maint time VALUE'
8481      An alias for 'maint set per-command time'.  A non-zero value
8482      enables it, zero disables it.
8483
8484 'maint translate-address [SECTION] ADDR'
8485      Find the symbol stored at the location specified by the address
8486      ADDR and an optional section name SECTION.  If found, GDB prints
8487      the name of the closest symbol and an offset from the symbol's
8488      location to the specified address.  This is similar to the 'info
8489      address' command (*note Symbols::), except that this command also
8490      allows to find symbols in other sections.
8491
8492      If section was not specified, the section in which the symbol was
8493      found is also printed.  For dynamically linked executables, the
8494      name of executable or shared library containing the symbol is
8495      printed as well.
8496
8497    The following command is useful for non-interactive invocations of
8498 GDB, such as in the test suite.
8499
8500 'set watchdog NSEC'
8501      Set the maximum number of seconds GDB will wait for the target
8502      operation to finish.  If this time expires, GDB reports and error
8503      and the command is aborted.
8504
8505 'show watchdog'
8506      Show the current setting of the target wait timeout.
8507
8508 \1f
8509 File: gdb.info,  Node: Remote Protocol,  Next: Agent Expressions,  Prev: Maintenance Commands,  Up: Top
8510
8511 Appendix E GDB Remote Serial Protocol
8512 *************************************
8513
8514 * Menu:
8515
8516 * Overview::
8517 * Packets::
8518 * Stop Reply Packets::
8519 * General Query Packets::
8520 * Architecture-Specific Protocol Details::
8521 * Tracepoint Packets::
8522 * Host I/O Packets::
8523 * Interrupts::
8524 * Notification Packets::
8525 * Remote Non-Stop::
8526 * Packet Acknowledgment::
8527 * Examples::
8528 * File-I/O Remote Protocol Extension::
8529 * Library List Format::
8530 * Library List Format for SVR4 Targets::
8531 * Memory Map Format::
8532 * Thread List Format::
8533 * Traceframe Info Format::
8534 * Branch Trace Format::
8535
8536 \1f
8537 File: gdb.info,  Node: Overview,  Next: Packets,  Up: Remote Protocol
8538
8539 E.1 Overview
8540 ============
8541
8542 There may be occasions when you need to know something about the
8543 protocol--for example, if there is only one serial port to your target
8544 machine, you might want your program to do something special if it
8545 recognizes a packet meant for GDB.
8546
8547    In the examples below, '->' and '<-' are used to indicate transmitted
8548 and received data, respectively.
8549
8550    All GDB commands and responses (other than acknowledgments and
8551 notifications, see *note Notification Packets::) are sent as a PACKET.
8552 A PACKET is introduced with the character '$', the actual PACKET-DATA,
8553 and the terminating character '#' followed by a two-digit CHECKSUM:
8554
8555      $PACKET-DATA#CHECKSUM
8556
8557 The two-digit CHECKSUM is computed as the modulo 256 sum of all
8558 characters between the leading '$' and the trailing '#' (an eight bit
8559 unsigned checksum).
8560
8561    Implementors should note that prior to GDB 5.0 the protocol
8562 specification also included an optional two-digit SEQUENCE-ID:
8563
8564      $SEQUENCE-ID:PACKET-DATA#CHECKSUM
8565
8566 That SEQUENCE-ID was appended to the acknowledgment.  GDB has never
8567 output SEQUENCE-IDs.  Stubs that handle packets added since GDB 5.0 must
8568 not accept SEQUENCE-ID.
8569
8570    When either the host or the target machine receives a packet, the
8571 first response expected is an acknowledgment: either '+' (to indicate
8572 the package was received correctly) or '-' (to request retransmission):
8573
8574      -> $PACKET-DATA#CHECKSUM
8575      <- +
8576
8577    The '+'/'-' acknowledgments can be disabled once a connection is
8578 established.  *Note Packet Acknowledgment::, for details.
8579
8580    The host (GDB) sends COMMANDs, and the target (the debugging stub
8581 incorporated in your program) sends a RESPONSE.  In the case of step and
8582 continue COMMANDs, the response is only sent when the operation has
8583 completed, and the target has again stopped all threads in all attached
8584 processes.  This is the default all-stop mode behavior, but the remote
8585 protocol also supports GDB's non-stop execution mode; see *note Remote
8586 Non-Stop::, for details.
8587
8588    PACKET-DATA consists of a sequence of characters with the exception
8589 of '#' and '$' (see 'X' packet for additional exceptions).
8590
8591    Fields within the packet should be separated using ',' ';' or ':'.
8592 Except where otherwise noted all numbers are represented in HEX with
8593 leading zeros suppressed.
8594
8595    Implementors should note that prior to GDB 5.0, the character ':'
8596 could not appear as the third character in a packet (as it would
8597 potentially conflict with the SEQUENCE-ID).
8598
8599    Binary data in most packets is encoded either as two hexadecimal
8600 digits per byte of binary data.  This allowed the traditional remote
8601 protocol to work over connections which were only seven-bit clean.  Some
8602 packets designed more recently assume an eight-bit clean connection, and
8603 use a more efficient encoding to send and receive binary data.
8604
8605    The binary data representation uses '7d' (ASCII '}') as an escape
8606 character.  Any escaped byte is transmitted as the escape character
8607 followed by the original character XORed with '0x20'.  For example, the
8608 byte '0x7d' would be transmitted as the two bytes '0x7d 0x5d'.  The
8609 bytes '0x23' (ASCII '#'), '0x24' (ASCII '$'), and '0x7d' (ASCII '}')
8610 must always be escaped.  Responses sent by the stub must also escape
8611 '0x2a' (ASCII '*'), so that it is not interpreted as the start of a
8612 run-length encoded sequence (described next).
8613
8614    Response DATA can be run-length encoded to save space.  Run-length
8615 encoding replaces runs of identical characters with one instance of the
8616 repeated character, followed by a '*' and a repeat count.  The repeat
8617 count is itself sent encoded, to avoid binary characters in DATA: a
8618 value of N is sent as 'N+29'.  For a repeat count greater or equal to 3,
8619 this produces a printable ASCII character, e.g. a space (ASCII code 32)
8620 for a repeat count of 3.  (This is because run-length encoding starts to
8621 win for counts 3 or more.)  Thus, for example, '0* ' is a run-length
8622 encoding of "0000": the space character after '*' means repeat the
8623 leading '0' '32 - 29 = 3' more times.
8624
8625    The printable characters '#' and '$' or with a numeric value greater
8626 than 126 must not be used.  Runs of six repeats ('#') or seven repeats
8627 ('$') can be expanded using a repeat count of only five ('"').  For
8628 example, '00000000' can be encoded as '0*"00'.
8629
8630    The error response returned for some packets includes a two character
8631 error number.  That number is not well defined.
8632
8633    For any COMMAND not supported by the stub, an empty response ('$#00')
8634 should be returned.  That way it is possible to extend the protocol.  A
8635 newer GDB can tell if a packet is supported based on that response.
8636
8637    At a minimum, a stub is required to support the 'g' and 'G' commands
8638 for register access, and the 'm' and 'M' commands for memory access.
8639 Stubs that only control single-threaded targets can implement run
8640 control with the 'c' (continue), and 's' (step) commands.  Stubs that
8641 support multi-threading targets should support the 'vCont' command.  All
8642 other commands are optional.
8643
8644 \1f
8645 File: gdb.info,  Node: Packets,  Next: Stop Reply Packets,  Prev: Overview,  Up: Remote Protocol
8646
8647 E.2 Packets
8648 ===========
8649
8650 The following table provides a complete list of all currently defined
8651 COMMANDs and their corresponding response DATA.  *Note File-I/O Remote
8652 Protocol Extension::, for details about the File I/O extension of the
8653 remote protocol.
8654
8655    Each packet's description has a template showing the packet's overall
8656 syntax, followed by an explanation of the packet's meaning.  We include
8657 spaces in some of the templates for clarity; these are not part of the
8658 packet's syntax.  No GDB packet uses spaces to separate its components.
8659 For example, a template like 'foo BAR BAZ' describes a packet beginning
8660 with the three ASCII bytes 'foo', followed by a BAR, followed directly
8661 by a BAZ.  GDB does not transmit a space character between the 'foo' and
8662 the BAR, or between the BAR and the BAZ.
8663
8664    Several packets and replies include a THREAD-ID field to identify a
8665 thread.  Normally these are positive numbers with a target-specific
8666 interpretation, formatted as big-endian hex strings.  A THREAD-ID can
8667 also be a literal '-1' to indicate all threads, or '0' to pick any
8668 thread.
8669
8670    In addition, the remote protocol supports a multiprocess feature in
8671 which the THREAD-ID syntax is extended to optionally include both
8672 process and thread ID fields, as 'pPID.TID'.  The PID (process) and TID
8673 (thread) components each have the format described above: a positive
8674 number with target-specific interpretation formatted as a big-endian hex
8675 string, literal '-1' to indicate all processes or threads
8676 (respectively), or '0' to indicate an arbitrary process or thread.
8677 Specifying just a process, as 'pPID', is equivalent to 'pPID.-1'.  It is
8678 an error to specify all processes but a specific thread, such as
8679 'p-1.TID'.  Note that the 'p' prefix is _not_ used for those packets and
8680 replies explicitly documented to include a process ID, rather than a
8681 THREAD-ID.
8682
8683    The multiprocess THREAD-ID syntax extensions are only used if both
8684 GDB and the stub report support for the 'multiprocess' feature using
8685 'qSupported'.  *Note multiprocess extensions::, for more information.
8686
8687    Note that all packet forms beginning with an upper- or lower-case
8688 letter, other than those described here, are reserved for future use.
8689
8690    Here are the packet descriptions.
8691
8692 '!'
8693      Enable extended mode.  In extended mode, the remote server is made
8694      persistent.  The 'R' packet is used to restart the program being
8695      debugged.
8696
8697      Reply:
8698      'OK'
8699           The remote target both supports and has enabled extended mode.
8700
8701 '?'
8702      Indicate the reason the target halted.  The reply is the same as
8703      for step and continue.  This packet has a special interpretation
8704      when the target is in non-stop mode; see *note Remote Non-Stop::.
8705
8706      Reply: *Note Stop Reply Packets::, for the reply specifications.
8707
8708 'A ARGLEN,ARGNUM,ARG,...'
8709      Initialized 'argv[]' array passed into program.  ARGLEN specifies
8710      the number of bytes in the hex encoded byte stream ARG.  See
8711      'gdbserver' for more details.
8712
8713      Reply:
8714      'OK'
8715           The arguments were set.
8716      'E NN'
8717           An error occurred.
8718
8719 'b BAUD'
8720      (Don't use this packet; its behavior is not well-defined.)  Change
8721      the serial line speed to BAUD.
8722
8723      JTC: _When does the transport layer state change?  When it's
8724      received, or after the ACK is transmitted.  In either case, there
8725      are problems if the command or the acknowledgment packet is
8726      dropped._
8727
8728      Stan: _If people really wanted to add something like this, and get
8729      it working for the first time, they ought to modify ser-unix.c to
8730      send some kind of out-of-band message to a specially-setup stub and
8731      have the switch happen "in between" packets, so that from remote
8732      protocol's point of view, nothing actually happened._
8733
8734 'B ADDR,MODE'
8735      Set (MODE is 'S') or clear (MODE is 'C') a breakpoint at ADDR.
8736
8737      Don't use this packet.  Use the 'Z' and 'z' packets instead (*note
8738      insert breakpoint or watchpoint packet::).
8739
8740 'bc'
8741      Backward continue.  Execute the target system in reverse.  No
8742      parameter.  *Note Reverse Execution::, for more information.
8743
8744      Reply: *Note Stop Reply Packets::, for the reply specifications.
8745
8746 'bs'
8747      Backward single step.  Execute one instruction in reverse.  No
8748      parameter.  *Note Reverse Execution::, for more information.
8749
8750      Reply: *Note Stop Reply Packets::, for the reply specifications.
8751
8752 'c [ADDR]'
8753      Continue at ADDR, which is the address to resume.  If ADDR is
8754      omitted, resume at current address.
8755
8756      This packet is deprecated for multi-threading support.  *Note vCont
8757      packet::.
8758
8759      Reply: *Note Stop Reply Packets::, for the reply specifications.
8760
8761 'C SIG[;ADDR]'
8762      Continue with signal SIG (hex signal number).  If ';ADDR' is
8763      omitted, resume at same address.
8764
8765      This packet is deprecated for multi-threading support.  *Note vCont
8766      packet::.
8767
8768      Reply: *Note Stop Reply Packets::, for the reply specifications.
8769
8770 'd'
8771      Toggle debug flag.
8772
8773      Don't use this packet; instead, define a general set packet (*note
8774      General Query Packets::).
8775
8776 'D'
8777 'D;PID'
8778      The first form of the packet is used to detach GDB from the remote
8779      system.  It is sent to the remote target before GDB disconnects via
8780      the 'detach' command.
8781
8782      The second form, including a process ID, is used when multiprocess
8783      protocol extensions are enabled (*note multiprocess extensions::),
8784      to detach only a specific process.  The PID is specified as a
8785      big-endian hex string.
8786
8787      Reply:
8788      'OK'
8789           for success
8790      'E NN'
8791           for an error
8792
8793 'F RC,EE,CF;XX'
8794      A reply from GDB to an 'F' packet sent by the target.  This is part
8795      of the File-I/O protocol extension.  *Note File-I/O Remote Protocol
8796      Extension::, for the specification.
8797
8798 'g'
8799      Read general registers.
8800
8801      Reply:
8802      'XX...'
8803           Each byte of register data is described by two hex digits.
8804           The bytes with the register are transmitted in target byte
8805           order.  The size of each register and their position within
8806           the 'g' packet are determined by the GDB internal gdbarch
8807           functions 'DEPRECATED_REGISTER_RAW_SIZE' and
8808           'gdbarch_register_name'.  The specification of several
8809           standard 'g' packets is specified below.
8810
8811           When reading registers from a trace frame (*note Using the
8812           Collected Data: Analyze Collected Data.), the stub may also
8813           return a string of literal 'x''s in place of the register data
8814           digits, to indicate that the corresponding register has not
8815           been collected, thus its value is unavailable.  For example,
8816           for an architecture with 4 registers of 4 bytes each, the
8817           following reply indicates to GDB that registers 0 and 2 have
8818           not been collected, while registers 1 and 3 have been
8819           collected, and both have zero value:
8820
8821                -> g
8822                <- xxxxxxxx00000000xxxxxxxx00000000
8823
8824      'E NN'
8825           for an error.
8826
8827 'G XX...'
8828      Write general registers.  *Note read registers packet::, for a
8829      description of the XX... data.
8830
8831      Reply:
8832      'OK'
8833           for success
8834      'E NN'
8835           for an error
8836
8837 'H OP THREAD-ID'
8838      Set thread for subsequent operations ('m', 'M', 'g', 'G', et.al.).
8839      Depending on the operation to be performed, OP should be 'c' for
8840      step and continue operations (note that this is deprecated,
8841      supporting the 'vCont' command is a better option), and 'g' for
8842      other operations.  The thread designator THREAD-ID has the format
8843      and interpretation described in *note thread-id syntax::.
8844
8845      Reply:
8846      'OK'
8847           for success
8848      'E NN'
8849           for an error
8850
8851 'i [ADDR[,NNN]]'
8852      Step the remote target by a single clock cycle.  If ',NNN' is
8853      present, cycle step NNN cycles.  If ADDR is present, cycle step
8854      starting at that address.
8855
8856 'I'
8857      Signal, then cycle step.  *Note step with signal packet::.  *Note
8858      cycle step packet::.
8859
8860 'k'
8861      Kill request.
8862
8863      The exact effect of this packet is not specified.
8864
8865      For a bare-metal target, it may power cycle or reset the target
8866      system.  For that reason, the 'k' packet has no reply.
8867
8868      For a single-process target, it may kill that process if possible.
8869
8870      A multiple-process target may choose to kill just one process, or
8871      all that are under GDB's control.  For more precise control, use
8872      the vKill packet (*note vKill packet::).
8873
8874      If the target system immediately closes the connection in response
8875      to 'k', GDB does not consider the lack of packet acknowledgment to
8876      be an error, and assumes the kill was successful.
8877
8878      If connected using 'target extended-remote', and the target does
8879      not close the connection in response to a kill request, GDB probes
8880      the target state as if a new connection was opened (*note ?
8881      packet::).
8882
8883 'm ADDR,LENGTH'
8884      Read LENGTH bytes of memory starting at address ADDR.  Note that
8885      ADDR may not be aligned to any particular boundary.
8886
8887      The stub need not use any particular size or alignment when
8888      gathering data from memory for the response; even if ADDR is
8889      word-aligned and LENGTH is a multiple of the word size, the stub is
8890      free to use byte accesses, or not.  For this reason, this packet
8891      may not be suitable for accessing memory-mapped I/O devices.
8892
8893      Reply:
8894      'XX...'
8895           Memory contents; each byte is transmitted as a two-digit
8896           hexadecimal number.  The reply may contain fewer bytes than
8897           requested if the server was able to read only part of the
8898           region of memory.
8899      'E NN'
8900           NN is errno
8901
8902 'M ADDR,LENGTH:XX...'
8903      Write LENGTH bytes of memory starting at address ADDR.  The data is
8904      given by XX...; each byte is transmitted as a two-digit hexadecimal
8905      number.
8906
8907      Reply:
8908      'OK'
8909           for success
8910      'E NN'
8911           for an error (this includes the case where only part of the
8912           data was written).
8913
8914 'p N'
8915      Read the value of register N; N is in hex.  *Note read registers
8916      packet::, for a description of how the returned register value is
8917      encoded.
8918
8919      Reply:
8920      'XX...'
8921           the register's value
8922      'E NN'
8923           for an error
8924      ''
8925           Indicating an unrecognized QUERY.
8926
8927 'P N...=R...'
8928      Write register N... with value R....  The register number N is in
8929      hexadecimal, and R... contains two hex digits for each byte in the
8930      register (target byte order).
8931
8932      Reply:
8933      'OK'
8934           for success
8935      'E NN'
8936           for an error
8937
8938 'q NAME PARAMS...'
8939 'Q NAME PARAMS...'
8940      General query ('q') and set ('Q').  These packets are described
8941      fully in *note General Query Packets::.
8942
8943 'r'
8944      Reset the entire system.
8945
8946      Don't use this packet; use the 'R' packet instead.
8947
8948 'R XX'
8949      Restart the program being debugged.  The XX, while needed, is
8950      ignored.  This packet is only available in extended mode (*note
8951      extended mode::).
8952
8953      The 'R' packet has no reply.
8954
8955 's [ADDR]'
8956      Single step, resuming at ADDR.  If ADDR is omitted, resume at same
8957      address.
8958
8959      This packet is deprecated for multi-threading support.  *Note vCont
8960      packet::.
8961
8962      Reply: *Note Stop Reply Packets::, for the reply specifications.
8963
8964 'S SIG[;ADDR]'
8965      Step with signal.  This is analogous to the 'C' packet, but
8966      requests a single-step, rather than a normal resumption of
8967      execution.
8968
8969      This packet is deprecated for multi-threading support.  *Note vCont
8970      packet::.
8971
8972      Reply: *Note Stop Reply Packets::, for the reply specifications.
8973
8974 't ADDR:PP,MM'
8975      Search backwards starting at address ADDR for a match with pattern
8976      PP and mask MM, both of which are are 4 byte long.  There must be
8977      at least 3 digits in ADDR.
8978
8979 'T THREAD-ID'
8980      Find out if the thread THREAD-ID is alive.  *Note thread-id
8981      syntax::.
8982
8983      Reply:
8984      'OK'
8985           thread is still alive
8986      'E NN'
8987           thread is dead
8988
8989 'v'
8990      Packets starting with 'v' are identified by a multi-letter name, up
8991      to the first ';' or '?' (or the end of the packet).
8992
8993 'vAttach;PID'
8994      Attach to a new process with the specified process ID PID.  The
8995      process ID is a hexadecimal integer identifying the process.  In
8996      all-stop mode, all threads in the attached process are stopped; in
8997      non-stop mode, it may be attached without being stopped if that is
8998      supported by the target.
8999
9000      This packet is only available in extended mode (*note extended
9001      mode::).
9002
9003      Reply:
9004      'E NN'
9005           for an error
9006      'Any stop packet'
9007           for success in all-stop mode (*note Stop Reply Packets::)
9008      'OK'
9009           for success in non-stop mode (*note Remote Non-Stop::)
9010
9011 'vCont[;ACTION[:THREAD-ID]]...'
9012      Resume the inferior, specifying different actions for each thread.
9013      If an action is specified with no THREAD-ID, then it is applied to
9014      any threads that don't have a specific action specified; if no
9015      default action is specified then other threads should remain
9016      stopped in all-stop mode and in their current state in non-stop
9017      mode.  Specifying multiple default actions is an error; specifying
9018      no actions is also an error.  Thread IDs are specified using the
9019      syntax described in *note thread-id syntax::.
9020
9021      Currently supported actions are:
9022
9023      'c'
9024           Continue.
9025      'C SIG'
9026           Continue with signal SIG.  The signal SIG should be two hex
9027           digits.
9028      's'
9029           Step.
9030      'S SIG'
9031           Step with signal SIG.  The signal SIG should be two hex
9032           digits.
9033      't'
9034           Stop.
9035      'r START,END'
9036           Step once, and then keep stepping as long as the thread stops
9037           at addresses between START (inclusive) and END (exclusive).
9038           The remote stub reports a stop reply when either the thread
9039           goes out of the range or is stopped due to an unrelated
9040           reason, such as hitting a breakpoint.  *Note range stepping::.
9041
9042           If the range is empty (START == END), then the action becomes
9043           equivalent to the 's' action.  In other words, single-step
9044           once, and report the stop (even if the stepped instruction
9045           jumps to START).
9046
9047           (A stop reply may be sent at any point even if the PC is still
9048           within the stepping range; for example, it is valid to
9049           implement this packet in a degenerate way as a single
9050           instruction step operation.)
9051
9052      The optional argument ADDR normally associated with the 'c', 'C',
9053      's', and 'S' packets is not supported in 'vCont'.
9054
9055      The 't' action is only relevant in non-stop mode (*note Remote
9056      Non-Stop::) and may be ignored by the stub otherwise.  A stop reply
9057      should be generated for any affected thread not already stopped.
9058      When a thread is stopped by means of a 't' action, the
9059      corresponding stop reply should indicate that the thread has
9060      stopped with signal '0', regardless of whether the target uses some
9061      other signal as an implementation detail.
9062
9063      The stub must support 'vCont' if it reports support for
9064      multiprocess extensions (*note multiprocess extensions::).  Note
9065      that in this case 'vCont' actions can be specified to apply to all
9066      threads in a process by using the 'pPID.-1' form of the THREAD-ID.
9067
9068      Reply: *Note Stop Reply Packets::, for the reply specifications.
9069
9070 'vCont?'
9071      Request a list of actions supported by the 'vCont' packet.
9072
9073      Reply:
9074      'vCont[;ACTION...]'
9075           The 'vCont' packet is supported.  Each ACTION is a supported
9076           command in the 'vCont' packet.
9077      ''
9078           The 'vCont' packet is not supported.
9079
9080 'vFile:OPERATION:PARAMETER...'
9081      Perform a file operation on the target system.  For details, see
9082      *note Host I/O Packets::.
9083
9084 'vFlashErase:ADDR,LENGTH'
9085      Direct the stub to erase LENGTH bytes of flash starting at ADDR.
9086      The region may enclose any number of flash blocks, but its start
9087      and end must fall on block boundaries, as indicated by the flash
9088      block size appearing in the memory map (*note Memory Map Format::).
9089      GDB groups flash memory programming operations together, and sends
9090      a 'vFlashDone' request after each group; the stub is allowed to
9091      delay erase operation until the 'vFlashDone' packet is received.
9092
9093      Reply:
9094      'OK'
9095           for success
9096      'E NN'
9097           for an error
9098
9099 'vFlashWrite:ADDR:XX...'
9100      Direct the stub to write data to flash address ADDR.  The data is
9101      passed in binary form using the same encoding as for the 'X' packet
9102      (*note Binary Data::).  The memory ranges specified by
9103      'vFlashWrite' packets preceding a 'vFlashDone' packet must not
9104      overlap, and must appear in order of increasing addresses (although
9105      'vFlashErase' packets for higher addresses may already have been
9106      received; the ordering is guaranteed only between 'vFlashWrite'
9107      packets).  If a packet writes to an address that was neither erased
9108      by a preceding 'vFlashErase' packet nor by some other
9109      target-specific method, the results are unpredictable.
9110
9111      Reply:
9112      'OK'
9113           for success
9114      'E.memtype'
9115           for vFlashWrite addressing non-flash memory
9116      'E NN'
9117           for an error
9118
9119 'vFlashDone'
9120      Indicate to the stub that flash programming operation is finished.
9121      The stub is permitted to delay or batch the effects of a group of
9122      'vFlashErase' and 'vFlashWrite' packets until a 'vFlashDone' packet
9123      is received.  The contents of the affected regions of flash memory
9124      are unpredictable until the 'vFlashDone' request is completed.
9125
9126 'vKill;PID'
9127      Kill the process with the specified process ID PID, which is a
9128      hexadecimal integer identifying the process.  This packet is used
9129      in preference to 'k' when multiprocess protocol extensions are
9130      supported; see *note multiprocess extensions::.
9131
9132      Reply:
9133      'E NN'
9134           for an error
9135      'OK'
9136           for success
9137
9138 'vRun;FILENAME[;ARGUMENT]...'
9139      Run the program FILENAME, passing it each ARGUMENT on its command
9140      line.  The file and arguments are hex-encoded strings.  If FILENAME
9141      is an empty string, the stub may use a default program (e.g. the
9142      last program run).  The program is created in the stopped state.
9143
9144      This packet is only available in extended mode (*note extended
9145      mode::).
9146
9147      Reply:
9148      'E NN'
9149           for an error
9150      'Any stop packet'
9151           for success (*note Stop Reply Packets::)
9152
9153 'vStopped'
9154      *Note Notification Packets::.
9155
9156 'X ADDR,LENGTH:XX...'
9157      Write data to memory, where the data is transmitted in binary.
9158      Memory is specified by its address ADDR and number of bytes LENGTH;
9159      'XX...' is binary data (*note Binary Data::).
9160
9161      Reply:
9162      'OK'
9163           for success
9164      'E NN'
9165           for an error
9166
9167 'z TYPE,ADDR,KIND'
9168 'Z TYPE,ADDR,KIND'
9169      Insert ('Z') or remove ('z') a TYPE breakpoint or watchpoint
9170      starting at address ADDRESS of kind KIND.
9171
9172      Each breakpoint and watchpoint packet TYPE is documented
9173      separately.
9174
9175      _Implementation notes: A remote target shall return an empty string
9176      for an unrecognized breakpoint or watchpoint packet TYPE.  A remote
9177      target shall support either both or neither of a given 'ZTYPE...'
9178      and 'zTYPE...' packet pair.  To avoid potential problems with
9179      duplicate packets, the operations should be implemented in an
9180      idempotent way._
9181
9182 'z0,ADDR,KIND'
9183 'Z0,ADDR,KIND[;COND_LIST...][;cmds:PERSIST,CMD_LIST...]'
9184      Insert ('Z0') or remove ('z0') a memory breakpoint at address ADDR
9185      of type KIND.
9186
9187      A memory breakpoint is implemented by replacing the instruction at
9188      ADDR with a software breakpoint or trap instruction.  The KIND is
9189      target-specific and typically indicates the size of the breakpoint
9190      in bytes that should be inserted.  E.g., the ARM and MIPS can
9191      insert either a 2 or 4 byte breakpoint.  Some architectures have
9192      additional meanings for KIND; COND_LIST is an optional list of
9193      conditional expressions in bytecode form that should be evaluated
9194      on the target's side.  These are the conditions that should be
9195      taken into consideration when deciding if the breakpoint trigger
9196      should be reported back to GDBN.
9197
9198      The COND_LIST parameter is comprised of a series of expressions,
9199      concatenated without separators.  Each expression has the following
9200      form:
9201
9202      'X LEN,EXPR'
9203           LEN is the length of the bytecode expression and EXPR is the
9204           actual conditional expression in bytecode form.
9205
9206      The optional CMD_LIST parameter introduces commands that may be run
9207      on the target, rather than being reported back to GDB.  The
9208      parameter starts with a numeric flag PERSIST; if the flag is
9209      nonzero, then the breakpoint may remain active and the commands
9210      continue to be run even when GDB disconnects from the target.
9211      Following this flag is a series of expressions concatenated with no
9212      separators.  Each expression has the following form:
9213
9214      'X LEN,EXPR'
9215           LEN is the length of the bytecode expression and EXPR is the
9216           actual conditional expression in bytecode form.
9217
9218      see *note Architecture-Specific Protocol Details::.
9219
9220      _Implementation note: It is possible for a target to copy or move
9221      code that contains memory breakpoints (e.g., when implementing
9222      overlays).  The behavior of this packet, in the presence of such a
9223      target, is not defined._
9224
9225      Reply:
9226      'OK'
9227           success
9228      ''
9229           not supported
9230      'E NN'
9231           for an error
9232
9233 'z1,ADDR,KIND'
9234 'Z1,ADDR,KIND[;COND_LIST...]'
9235      Insert ('Z1') or remove ('z1') a hardware breakpoint at address
9236      ADDR.
9237
9238      A hardware breakpoint is implemented using a mechanism that is not
9239      dependant on being able to modify the target's memory.  The KIND
9240      and COND_LIST have the same meaning as in 'Z0' packets.
9241
9242      _Implementation note: A hardware breakpoint is not affected by code
9243      movement._
9244
9245      Reply:
9246      'OK'
9247           success
9248      ''
9249           not supported
9250      'E NN'
9251           for an error
9252
9253 'z2,ADDR,KIND'
9254 'Z2,ADDR,KIND'
9255      Insert ('Z2') or remove ('z2') a write watchpoint at ADDR.  The
9256      number of bytes to watch is specified by KIND.
9257
9258      Reply:
9259      'OK'
9260           success
9261      ''
9262           not supported
9263      'E NN'
9264           for an error
9265
9266 'z3,ADDR,KIND'
9267 'Z3,ADDR,KIND'
9268      Insert ('Z3') or remove ('z3') a read watchpoint at ADDR.  The
9269      number of bytes to watch is specified by KIND.
9270
9271      Reply:
9272      'OK'
9273           success
9274      ''
9275           not supported
9276      'E NN'
9277           for an error
9278
9279 'z4,ADDR,KIND'
9280 'Z4,ADDR,KIND'
9281      Insert ('Z4') or remove ('z4') an access watchpoint at ADDR.  The
9282      number of bytes to watch is specified by KIND.
9283
9284      Reply:
9285      'OK'
9286           success
9287      ''
9288           not supported
9289      'E NN'
9290           for an error
9291