1 This is gdb.info, produced by makeinfo version 4.8 from
2 ../.././gdb/doc/gdb.texinfo.
4 INFO-DIR-SECTION Software development
6 * Gdb: (gdb). The GNU debugger.
9 This file documents the GNU debugger GDB.
11 This is the Ninth Edition, of `Debugging with GDB: the GNU
12 Source-Level Debugger' for GDB Version 6.8.
14 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
16 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
17 Free Software Foundation, Inc.
19 Permission is granted to copy, distribute and/or modify this document
20 under the terms of the GNU Free Documentation License, Version 1.1 or
21 any later version published by the Free Software Foundation; with the
22 Invariant Sections being "Free Software" and "Free Software Needs Free
23 Documentation", with the Front-Cover Texts being "A GNU Manual," and
24 with the Back-Cover Texts as in (a) below.
26 (a) The FSF's Back-Cover Text is: "You are free to copy and modify
27 this GNU Manual. Buying copies from GNU Press supports the FSF in
28 developing GNU and promoting software freedom."
31 File: gdb.info, Node: GDB/MI Command Description Format, Next: GDB/MI Breakpoint Commands, Prev: GDB/MI Simple Examples, Up: GDB/MI
33 24.6 GDB/MI Command Description Format
34 ======================================
36 The remaining sections describe blocks of commands. Each block of
37 commands is laid out in a fashion similar to this section.
42 The motivation for this collection of commands.
47 A brief introduction to this collection of commands as a whole.
52 For each command in the block, the following is described:
65 The corresponding GDB CLI command(s), if any.
70 Example(s) formatted for readability. Some of the described commands
71 have not been implemented yet and these are labeled N.A. (not
75 File: gdb.info, Node: GDB/MI Breakpoint Commands, Next: GDB/MI Program Context, Prev: GDB/MI Command Description Format, Up: GDB/MI
77 24.7 GDB/MI Breakpoint Commands
78 ===============================
80 This section documents GDB/MI commands for manipulating breakpoints.
82 The `-break-after' Command
83 --------------------------
88 -break-after NUMBER COUNT
90 The breakpoint number NUMBER is not in effect until it has been hit
91 COUNT times. To see how this is reflected in the output of the
92 `-break-list' command, see the description of the `-break-list' command
98 The corresponding GDB command is `ignore'.
105 ^done,bkpt={number="1",addr="0x000100d0",file="hello.c",
106 fullname="/home/foo/hello.c",line="5",times="0"}
113 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
114 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
115 {width="14",alignment="-1",col_name="type",colhdr="Type"},
116 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
117 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
118 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
119 {width="40",alignment="2",col_name="what",colhdr="What"}],
120 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
121 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
122 line="5",times="0",ignore="3"}]}
125 The `-break-condition' Command
126 ------------------------------
131 -break-condition NUMBER EXPR
133 Breakpoint NUMBER will stop the program only if the condition in
134 EXPR is true. The condition becomes part of the `-break-list' output
135 (see the description of the `-break-list' command below).
140 The corresponding GDB command is `condition'.
150 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
151 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
152 {width="14",alignment="-1",col_name="type",colhdr="Type"},
153 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
154 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
155 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
156 {width="40",alignment="2",col_name="what",colhdr="What"}],
157 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
158 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
159 line="5",cond="1",times="0",ignore="3"}]}
162 The `-break-delete' Command
163 ---------------------------
168 -break-delete ( BREAKPOINT )+
170 Delete the breakpoint(s) whose number(s) are specified in the
171 argument list. This is obviously reflected in the breakpoint list.
176 The corresponding GDB command is `delete'.
186 ^done,BreakpointTable={nr_rows="0",nr_cols="6",
187 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
188 {width="14",alignment="-1",col_name="type",colhdr="Type"},
189 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
190 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
191 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
192 {width="40",alignment="2",col_name="what",colhdr="What"}],
196 The `-break-disable' Command
197 ----------------------------
202 -break-disable ( BREAKPOINT )+
204 Disable the named BREAKPOINT(s). The field `enabled' in the break
205 list is now set to `n' for the named BREAKPOINT(s).
210 The corresponding GDB command is `disable'.
220 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
221 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
222 {width="14",alignment="-1",col_name="type",colhdr="Type"},
223 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
224 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
225 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
226 {width="40",alignment="2",col_name="what",colhdr="What"}],
227 body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
228 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
229 line="5",times="0"}]}
232 The `-break-enable' Command
233 ---------------------------
238 -break-enable ( BREAKPOINT )+
240 Enable (previously disabled) BREAKPOINT(s).
245 The corresponding GDB command is `enable'.
255 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
256 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
257 {width="14",alignment="-1",col_name="type",colhdr="Type"},
258 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
259 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
260 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
261 {width="40",alignment="2",col_name="what",colhdr="What"}],
262 body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
263 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
264 line="5",times="0"}]}
267 The `-break-info' Command
268 -------------------------
273 -break-info BREAKPOINT
275 Get information about a single breakpoint.
280 The corresponding GDB command is `info break BREAKPOINT'.
287 The `-break-insert' Command
288 ---------------------------
293 -break-insert [ -t ] [ -h ] [ -f ]
294 [ -c CONDITION ] [ -i IGNORE-COUNT ]
295 [ -p THREAD ] [ LOCATION ]
297 If specified, LOCATION, can be one of:
307 The possible optional parameters of this command are:
310 Insert a temporary breakpoint.
313 Insert a hardware breakpoint.
316 Make the breakpoint conditional on CONDITION.
319 Initialize the IGNORE-COUNT.
322 If LOCATION cannot be parsed (for example if it refers to unknown
323 files or functions), create a pending breakpoint. Without this
324 flag, GDB will report an error, and won't create a breakpoint, if
325 LOCATION cannot be parsed.
330 The result is in the form:
332 ^done,bkpt={number="NUMBER",type="TYPE",disp="del"|"keep",
333 enabled="y"|"n",addr="HEX",func="FUNCNAME",file="FILENAME",
334 fullname="FULL_FILENAME",line="LINENO",[thread="THREADNO,]
337 where NUMBER is the GDB number for this breakpoint, FUNCNAME is the
338 name of the function where the breakpoint was inserted, FILENAME is the
339 name of the source file which contains this function, LINENO is the
340 source line number within that file and TIMES the number of times that
341 the breakpoint has been hit (always 0 for -break-insert but may be
342 greater for -break-info or -break-list which use the same output).
344 Note: this format is open to change.
349 The corresponding GDB commands are `break', `tbreak', `hbreak',
350 `thbreak', and `rbreak'.
357 ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",
358 fullname="/home/foo/recursive2.c,line="4",times="0"}
361 ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",
362 fullname="/home/foo/recursive2.c,line="11",times="0"}
365 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
366 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
367 {width="14",alignment="-1",col_name="type",colhdr="Type"},
368 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
369 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
370 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
371 {width="40",alignment="2",col_name="what",colhdr="What"}],
372 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
373 addr="0x0001072c", func="main",file="recursive2.c",
374 fullname="/home/foo/recursive2.c,"line="4",times="0"},
375 bkpt={number="2",type="breakpoint",disp="del",enabled="y",
376 addr="0x00010774",func="foo",file="recursive2.c",
377 fullname="/home/foo/recursive2.c",line="11",times="0"}]}
379 -break-insert -r foo.*
381 ^done,bkpt={number="3",addr="0x00010774",file="recursive2.c,
382 "fullname="/home/foo/recursive2.c",line="11",times="0"}
385 The `-break-list' Command
386 -------------------------
393 Displays the list of inserted breakpoints, showing the following
397 number of the breakpoint
400 type of the breakpoint: `breakpoint' or `watchpoint'
403 should the breakpoint be deleted or disabled when it is hit: `keep'
407 is the breakpoint enabled or no: `y' or `n'
410 memory location at which the breakpoint is set
413 logical location of the breakpoint, expressed by function name,
414 file name, line number
417 number of times the breakpoint has been hit
419 If there are no breakpoints or watchpoints, the `BreakpointTable'
420 `body' field is an empty list.
425 The corresponding GDB command is `info break'.
432 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
433 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
434 {width="14",alignment="-1",col_name="type",colhdr="Type"},
435 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
436 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
437 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
438 {width="40",alignment="2",col_name="what",colhdr="What"}],
439 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
440 addr="0x000100d0",func="main",file="hello.c",line="5",times="0"},
441 bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
442 addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",
443 line="13",times="0"}]}
446 Here's an example of the result when there are no breakpoints:
450 ^done,BreakpointTable={nr_rows="0",nr_cols="6",
451 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
452 {width="14",alignment="-1",col_name="type",colhdr="Type"},
453 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
454 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
455 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
456 {width="40",alignment="2",col_name="what",colhdr="What"}],
460 The `-break-watch' Command
461 --------------------------
466 -break-watch [ -a | -r ]
468 Create a watchpoint. With the `-a' option it will create an
469 "access" watchpoint, i.e., a watchpoint that triggers either on a read
470 from or on a write to the memory location. With the `-r' option, the
471 watchpoint created is a "read" watchpoint, i.e., it will trigger only
472 when the memory location is accessed for reading. Without either of
473 the options, the watchpoint created is a regular watchpoint, i.e., it
474 will trigger when the memory location is accessed for writing. *Note
475 Setting Watchpoints: Set Watchpoints.
477 Note that `-break-list' will report a single list of watchpoints and
478 breakpoints inserted.
483 The corresponding GDB commands are `watch', `awatch', and `rwatch'.
488 Setting a watchpoint on a variable in the `main' function:
492 ^done,wpt={number="2",exp="x"}
497 *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"},
498 value={old="-268439212",new="55"},
499 frame={func="main",args=[],file="recursive2.c",
500 fullname="/home/foo/bar/recursive2.c",line="5"}
503 Setting a watchpoint on a variable local to a function. GDB will
504 stop the program execution twice: first for the variable changing
505 value, then for the watchpoint going out of scope.
509 ^done,wpt={number="5",exp="C"}
514 *stopped,reason="watchpoint-trigger",
515 wpt={number="5",exp="C"},value={old="-276895068",new="3"},
516 frame={func="callee4",args=[],
517 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
518 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
523 *stopped,reason="watchpoint-scope",wpnum="5",
524 frame={func="callee3",args=[{name="strarg",
525 value="0x11940 \"A string argument.\""}],
526 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
527 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
530 Listing breakpoints and watchpoints, at different points in the
531 program execution. Note that once the watchpoint goes out of scope, it
536 ^done,wpt={number="2",exp="C"}
539 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
540 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
541 {width="14",alignment="-1",col_name="type",colhdr="Type"},
542 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
543 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
544 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
545 {width="40",alignment="2",col_name="what",colhdr="What"}],
546 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
547 addr="0x00010734",func="callee4",
548 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
549 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",times="1"},
550 bkpt={number="2",type="watchpoint",disp="keep",
551 enabled="y",addr="",what="C",times="0"}]}
556 *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"},
557 value={old="-276895068",new="3"},
558 frame={func="callee4",args=[],
559 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
560 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
563 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
564 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
565 {width="14",alignment="-1",col_name="type",colhdr="Type"},
566 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
567 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
568 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
569 {width="40",alignment="2",col_name="what",colhdr="What"}],
570 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
571 addr="0x00010734",func="callee4",
572 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
573 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"},
574 bkpt={number="2",type="watchpoint",disp="keep",
575 enabled="y",addr="",what="C",times="-5"}]}
579 ^done,reason="watchpoint-scope",wpnum="2",
580 frame={func="callee3",args=[{name="strarg",
581 value="0x11940 \"A string argument.\""}],
582 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
583 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
586 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
587 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
588 {width="14",alignment="-1",col_name="type",colhdr="Type"},
589 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
590 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
591 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
592 {width="40",alignment="2",col_name="what",colhdr="What"}],
593 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
594 addr="0x00010734",func="callee4",
595 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
596 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
601 File: gdb.info, Node: GDB/MI Program Context, Next: GDB/MI Thread Commands, Prev: GDB/MI Breakpoint Commands, Up: GDB/MI
603 24.8 GDB/MI Program Context
604 ============================
606 The `-exec-arguments' Command
607 -----------------------------
614 Set the inferior program arguments, to be used in the next
620 The corresponding GDB command is `set args'.
625 Don't have one around.
627 The `-exec-show-arguments' Command
628 ----------------------------------
635 Print the arguments of the program.
640 The corresponding GDB command is `show args'.
647 The `-environment-cd' Command
648 -----------------------------
653 -environment-cd PATHDIR
655 Set GDB's working directory.
660 The corresponding GDB command is `cd'.
666 -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
670 The `-environment-directory' Command
671 ------------------------------------
676 -environment-directory [ -r ] [ PATHDIR ]+
678 Add directories PATHDIR to beginning of search path for source files.
679 If the `-r' option is used, the search path is reset to the default
680 search path. If directories PATHDIR are supplied in addition to the
681 `-r' option, the search path is first reset and then addition occurs as
682 normal. Multiple directories may be specified, separated by blanks.
683 Specifying multiple directories in a single command results in the
684 directories added to the beginning of the search path in the same order
685 they were presented in the command. If blanks are needed as part of a
686 directory name, double-quotes should be used around the name. In the
687 command output, the path will show up separated by the system
688 directory-separator character. The directory-separator character must
689 not be used in any directory name. If no directories are specified,
690 the current search path is displayed.
695 The corresponding GDB command is `dir'.
701 -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
702 ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
704 -environment-directory ""
705 ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
707 -environment-directory -r /home/jjohnstn/src/gdb /usr/src
708 ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
710 -environment-directory -r
711 ^done,source-path="$cdir:$cwd"
714 The `-environment-path' Command
715 -------------------------------
720 -environment-path [ -r ] [ PATHDIR ]+
722 Add directories PATHDIR to beginning of search path for object files.
723 If the `-r' option is used, the search path is reset to the original
724 search path that existed at gdb start-up. If directories PATHDIR are
725 supplied in addition to the `-r' option, the search path is first reset
726 and then addition occurs as normal. Multiple directories may be
727 specified, separated by blanks. Specifying multiple directories in a
728 single command results in the directories added to the beginning of the
729 search path in the same order they were presented in the command. If
730 blanks are needed as part of a directory name, double-quotes should be
731 used around the name. In the command output, the path will show up
732 separated by the system directory-separator character. The
733 directory-separator character must not be used in any directory name.
734 If no directories are specified, the current path is displayed.
739 The corresponding GDB command is `path'.
746 ^done,path="/usr/bin"
748 -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
749 ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
751 -environment-path -r /usr/local/bin
752 ^done,path="/usr/local/bin:/usr/bin"
755 The `-environment-pwd' Command
756 ------------------------------
763 Show the current working directory.
768 The corresponding GDB command is `pwd'.
775 ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
779 File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Program Execution, Prev: GDB/MI Program Context, Up: GDB/MI
781 24.9 GDB/MI Thread Commands
782 ===========================
784 The `-thread-info' Command
785 --------------------------
802 The `-thread-list-all-threads' Command
803 --------------------------------------
808 -thread-list-all-threads
813 The equivalent GDB command is `info threads'.
820 The `-thread-list-ids' Command
821 ------------------------------
828 Produces a list of the currently known GDB thread ids. At the end
829 of the list it also prints the total number of such threads.
834 Part of `info threads' supplies the same information.
839 No threads present, besides the main process:
843 ^done,thread-ids={},number-of-threads="0"
850 ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
851 number-of-threads="3"
854 The `-thread-select' Command
855 ----------------------------
860 -thread-select THREADNUM
862 Make THREADNUM the current thread. It prints the number of the new
863 current thread, and the topmost frame for that thread.
868 The corresponding GDB command is `thread'.
877 *stopped,reason="end-stepping-range",thread-id="2",line="187",
878 file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
882 thread-ids={thread-id="3",thread-id="2",thread-id="1"},
883 number-of-threads="3"
886 ^done,new-thread-id="3",
887 frame={level="0",func="vprintf",
888 args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
889 {name="arg",value="0x2"}],file="vprintf.c",line="31"}
893 File: gdb.info, Node: GDB/MI Program Execution, Next: GDB/MI Stack Manipulation, Prev: GDB/MI Thread Commands, Up: GDB/MI
895 24.10 GDB/MI Program Execution
896 ==============================
898 These are the asynchronous commands which generate the out-of-band
899 record `*stopped'. Currently GDB only really executes asynchronously
900 with remote targets and this interaction is mimicked in other cases.
902 The `-exec-continue' Command
903 ----------------------------
910 Resumes the execution of the inferior program until a breakpoint is
911 encountered, or until the inferior exits.
916 The corresponding GDB corresponding is `continue'.
925 *stopped,reason="breakpoint-hit",bkptno="2",frame={func="foo",args=[],
926 file="hello.c",fullname="/home/foo/bar/hello.c",line="13"}
929 The `-exec-finish' Command
930 --------------------------
937 Resumes the execution of the inferior program until the current
938 function is exited. Displays the results returned by the function.
943 The corresponding GDB command is `finish'.
948 Function returning `void'.
954 *stopped,reason="function-finished",frame={func="main",args=[],
955 file="hello.c",fullname="/home/foo/bar/hello.c",line="7"}
958 Function returning other than `void'. The name of the internal GDB
959 variable storing the result is printed, together with the value itself.
964 *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
965 args=[{name="a",value="1"],{name="b",value="9"}},
966 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
967 gdb-result-var="$1",return-value="0"
970 The `-exec-interrupt' Command
971 -----------------------------
978 Interrupts the background execution of the target. Note how the
979 token associated with the stop message is the one for the execution
980 command that has been interrupted. The token for the interrupt itself
981 only appears in the `^done' output. If the user is trying to interrupt
982 a non-running program, an error message will be printed.
987 The corresponding GDB command is `interrupt'.
1000 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
1001 frame={addr="0x00010140",func="foo",args=[],file="try.c",
1002 fullname="/home/foo/bar/try.c",line="13"}
1007 ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
1010 The `-exec-next' Command
1011 ------------------------
1018 Resumes execution of the inferior program, stopping when the
1019 beginning of the next source line is reached.
1024 The corresponding GDB command is `next'.
1032 *stopped,reason="end-stepping-range",line="8",file="hello.c"
1035 The `-exec-next-instruction' Command
1036 ------------------------------------
1041 -exec-next-instruction
1043 Executes one machine instruction. If the instruction is a function
1044 call, continues until the function returns. If the program stops at an
1045 instruction in the middle of a source line, the address will be printed
1051 The corresponding GDB command is `nexti'.
1057 -exec-next-instruction
1061 *stopped,reason="end-stepping-range",
1062 addr="0x000100d4",line="5",file="hello.c"
1065 The `-exec-return' Command
1066 --------------------------
1073 Makes current function return immediately. Doesn't execute the
1074 inferior. Displays the new current frame.
1079 The corresponding GDB command is `return'.
1085 200-break-insert callee4
1086 200^done,bkpt={number="1",addr="0x00010734",
1087 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
1092 000*stopped,reason="breakpoint-hit",bkptno="1",
1093 frame={func="callee4",args=[],
1094 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1095 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
1101 111^done,frame={level="0",func="callee3",
1102 args=[{name="strarg",
1103 value="0x11940 \"A string argument.\""}],
1104 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1105 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
1108 The `-exec-run' Command
1109 -----------------------
1116 Starts execution of the inferior from the beginning. The inferior
1117 executes until either a breakpoint is encountered or the program exits.
1118 In the latter case the output will include an exit code, if the
1119 program has exited exceptionally.
1124 The corresponding GDB command is `run'.
1131 ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
1136 *stopped,reason="breakpoint-hit",bkptno="1",
1137 frame={func="main",args=[],file="recursive2.c",
1138 fullname="/home/foo/bar/recursive2.c",line="4"}
1141 Program exited normally:
1148 *stopped,reason="exited-normally"
1151 Program exited exceptionally:
1158 *stopped,reason="exited",exit-code="01"
1161 Another way the program can terminate is if it receives a signal
1162 such as `SIGINT'. In this case, GDB/MI displays this:
1165 *stopped,reason="exited-signalled",signal-name="SIGINT",
1166 signal-meaning="Interrupt"
1168 The `-exec-step' Command
1169 ------------------------
1176 Resumes execution of the inferior program, stopping when the
1177 beginning of the next source line is reached, if the next source line
1178 is not a function call. If it is, stop at the first instruction of the
1184 The corresponding GDB command is `step'.
1189 Stepping into a function:
1194 *stopped,reason="end-stepping-range",
1195 frame={func="foo",args=[{name="a",value="10"},
1196 {name="b",value="0"}],file="recursive2.c",
1197 fullname="/home/foo/bar/recursive2.c",line="11"}
1205 *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
1208 The `-exec-step-instruction' Command
1209 ------------------------------------
1214 -exec-step-instruction
1216 Resumes the inferior which executes one machine instruction. The
1217 output, once GDB has stopped, will vary depending on whether we have
1218 stopped in the middle of a source line or not. In the former case, the
1219 address at which the program stopped will be printed as well.
1224 The corresponding GDB command is `stepi'.
1230 -exec-step-instruction
1234 *stopped,reason="end-stepping-range",
1235 frame={func="foo",args=[],file="try.c",
1236 fullname="/home/foo/bar/try.c",line="10"}
1238 -exec-step-instruction
1242 *stopped,reason="end-stepping-range",
1243 frame={addr="0x000100f4",func="foo",args=[],file="try.c",
1244 fullname="/home/foo/bar/try.c",line="10"}
1247 The `-exec-until' Command
1248 -------------------------
1253 -exec-until [ LOCATION ]
1255 Executes the inferior until the LOCATION specified in the argument
1256 is reached. If there is no argument, the inferior executes until a
1257 source line greater than the current one is reached. The reason for
1258 stopping in this case will be `location-reached'.
1263 The corresponding GDB command is `until'.
1269 -exec-until recursive2.c:6
1273 *stopped,reason="location-reached",frame={func="main",args=[],
1274 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"}
1278 File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Variable Objects, Prev: GDB/MI Program Execution, Up: GDB/MI
1280 24.11 GDB/MI Stack Manipulation Commands
1281 ========================================
1283 The `-stack-info-frame' Command
1284 -------------------------------
1291 Get info on the selected frame.
1296 The corresponding GDB command is `info frame' or `frame' (without
1304 ^done,frame={level="1",addr="0x0001076c",func="callee3",
1305 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1306 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"}
1309 The `-stack-info-depth' Command
1310 -------------------------------
1315 -stack-info-depth [ MAX-DEPTH ]
1317 Return the depth of the stack. If the integer argument MAX-DEPTH is
1318 specified, do not count beyond MAX-DEPTH frames.
1323 There's no equivalent GDB command.
1328 For a stack with frame levels 0 through 11:
1337 -stack-info-depth 12
1340 -stack-info-depth 11
1343 -stack-info-depth 13
1347 The `-stack-list-arguments' Command
1348 -----------------------------------
1353 -stack-list-arguments SHOW-VALUES
1354 [ LOW-FRAME HIGH-FRAME ]
1356 Display a list of the arguments for the frames between LOW-FRAME and
1357 HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
1358 list the arguments for the whole call stack. If the two arguments are
1359 equal, show the single frame at the corresponding level. It is an
1360 error if LOW-FRAME is larger than the actual number of frames. On the
1361 other hand, HIGH-FRAME may be larger than the actual number of frames,
1362 in which case only existing frames will be returned.
1364 The SHOW-VALUES argument must have a value of 0 or 1. A value of 0
1365 means that only the names of the arguments are listed, a value of 1
1366 means that both names and values of the arguments are printed.
1371 GDB does not have an equivalent command. `gdbtk' has a `gdb_get_args'
1372 command which partially overlaps with the functionality of
1373 `-stack-list-arguments'.
1382 frame={level="0",addr="0x00010734",func="callee4",
1383 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1384 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"},
1385 frame={level="1",addr="0x0001076c",func="callee3",
1386 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1387 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"},
1388 frame={level="2",addr="0x0001078c",func="callee2",
1389 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1390 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"},
1391 frame={level="3",addr="0x000107b4",func="callee1",
1392 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1393 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"},
1394 frame={level="4",addr="0x000107e0",func="main",
1395 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
1396 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"}]
1398 -stack-list-arguments 0
1401 frame={level="0",args=[]},
1402 frame={level="1",args=[name="strarg"]},
1403 frame={level="2",args=[name="intarg",name="strarg"]},
1404 frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
1405 frame={level="4",args=[]}]
1407 -stack-list-arguments 1
1410 frame={level="0",args=[]},
1412 args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
1413 frame={level="2",args=[
1414 {name="intarg",value="2"},
1415 {name="strarg",value="0x11940 \"A string argument.\""}]},
1416 {frame={level="3",args=[
1417 {name="intarg",value="2"},
1418 {name="strarg",value="0x11940 \"A string argument.\""},
1419 {name="fltarg",value="3.5"}]},
1420 frame={level="4",args=[]}]
1422 -stack-list-arguments 0 2 2
1423 ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
1425 -stack-list-arguments 1 2 2
1426 ^done,stack-args=[frame={level="2",
1427 args=[{name="intarg",value="2"},
1428 {name="strarg",value="0x11940 \"A string argument.\""}]}]
1431 The `-stack-list-frames' Command
1432 --------------------------------
1437 -stack-list-frames [ LOW-FRAME HIGH-FRAME ]
1439 List the frames currently on the stack. For each frame it displays
1443 The frame number, 0 being the topmost frame, i.e., the innermost
1447 The `$pc' value for that frame.
1453 File name of the source file where the function lives.
1456 Line number corresponding to the `$pc'.
1458 If invoked without arguments, this command prints a backtrace for the
1459 whole stack. If given two integer arguments, it shows the frames whose
1460 levels are between the two arguments (inclusive). If the two arguments
1461 are equal, it shows the single frame at the corresponding level. It is
1462 an error if LOW-FRAME is larger than the actual number of frames. On
1463 the other hand, HIGH-FRAME may be larger than the actual number of
1464 frames, in which case only existing frames will be returned.
1469 The corresponding GDB commands are `backtrace' and `where'.
1474 Full stack backtrace:
1479 [frame={level="0",addr="0x0001076c",func="foo",
1480 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"},
1481 frame={level="1",addr="0x000107a4",func="foo",
1482 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1483 frame={level="2",addr="0x000107a4",func="foo",
1484 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1485 frame={level="3",addr="0x000107a4",func="foo",
1486 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1487 frame={level="4",addr="0x000107a4",func="foo",
1488 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1489 frame={level="5",addr="0x000107a4",func="foo",
1490 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1491 frame={level="6",addr="0x000107a4",func="foo",
1492 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1493 frame={level="7",addr="0x000107a4",func="foo",
1494 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1495 frame={level="8",addr="0x000107a4",func="foo",
1496 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1497 frame={level="9",addr="0x000107a4",func="foo",
1498 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1499 frame={level="10",addr="0x000107a4",func="foo",
1500 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1501 frame={level="11",addr="0x00010738",func="main",
1502 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"}]
1505 Show frames between LOW_FRAME and HIGH_FRAME:
1508 -stack-list-frames 3 5
1510 [frame={level="3",addr="0x000107a4",func="foo",
1511 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1512 frame={level="4",addr="0x000107a4",func="foo",
1513 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
1514 frame={level="5",addr="0x000107a4",func="foo",
1515 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}]
1518 Show a single frame:
1521 -stack-list-frames 3 3
1523 [frame={level="3",addr="0x000107a4",func="foo",
1524 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}]
1527 The `-stack-list-locals' Command
1528 --------------------------------
1533 -stack-list-locals PRINT-VALUES
1535 Display the local variable names for the selected frame. If
1536 PRINT-VALUES is 0 or `--no-values', print only the names of the
1537 variables; if it is 1 or `--all-values', print also their values; and
1538 if it is 2 or `--simple-values', print the name, type and value for
1539 simple data types and the name and type for arrays, structures and
1540 unions. In this last case, a frontend can immediately display the
1541 value of simple data types and create variable objects for other data
1542 types when the user wishes to explore their values in more detail.
1547 `info locals' in GDB, `gdb_get_locals' in `gdbtk'.
1553 -stack-list-locals 0
1554 ^done,locals=[name="A",name="B",name="C"]
1556 -stack-list-locals --all-values
1557 ^done,locals=[{name="A",value="1"},{name="B",value="2"},
1558 {name="C",value="{1, 2, 3}"}]
1559 -stack-list-locals --simple-values
1560 ^done,locals=[{name="A",type="int",value="1"},
1561 {name="B",type="int",value="2"},{name="C",type="int [3]"}]
1564 The `-stack-select-frame' Command
1565 ---------------------------------
1570 -stack-select-frame FRAMENUM
1572 Change the selected frame. Select a different frame FRAMENUM on the
1578 The corresponding GDB commands are `frame', `up', `down',
1579 `select-frame', `up-silent', and `down-silent'.
1585 -stack-select-frame 2
1590 File: gdb.info, Node: GDB/MI Variable Objects, Next: GDB/MI Data Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI
1592 24.12 GDB/MI Variable Objects
1593 =============================
1595 Introduction to Variable Objects
1596 --------------------------------
1598 Variable objects are "object-oriented" MI interface for examining and
1599 changing values of expressions. Unlike some other MI interfaces that
1600 work with expressions, variable objects are specifically designed for
1601 simple and efficient presentation in the frontend. A variable object
1602 is identified by string name. When a variable object is created, the
1603 frontend specifies the expression for that variable object. The
1604 expression can be a simple variable, or it can be an arbitrary complex
1605 expression, and can even involve CPU registers. After creating a
1606 variable object, the frontend can invoke other variable object
1607 operations--for example to obtain or change the value of a variable
1608 object, or to change display format.
1610 Variable objects have hierarchical tree structure. Any variable
1611 object that corresponds to a composite type, such as structure in C, has
1612 a number of child variable objects, for example corresponding to each
1613 element of a structure. A child variable object can itself have
1614 children, recursively. Recursion ends when we reach leaf variable
1615 objects, which always have built-in types. Child variable objects are
1616 created only by explicit request, so if a frontend is not interested in
1617 the children of a particular variable object, no child will be created.
1619 For a leaf variable object it is possible to obtain its value as a
1620 string, or set the value from a string. String value can be also
1621 obtained for a non-leaf variable object, but it's generally a string
1622 that only indicates the type of the object, and does not list its
1623 contents. Assignment to a non-leaf variable object is not allowed.
1625 A frontend does not need to read the values of all variable objects
1626 each time the program stops. Instead, MI provides an update command
1627 that lists all variable objects whose values has changed since the last
1628 update operation. This considerably reduces the amount of data that
1629 must be transferred to the frontend. As noted above, children variable
1630 objects are created on demand, and only leaf variable objects have a
1631 real value. As result, gdb will read target memory only for leaf
1632 variables that frontend has created.
1634 The automatic update is not always desirable. For example, a
1635 frontend might want to keep a value of some expression for future
1636 reference, and never update it. For another example, fetching memory
1637 is relatively slow for embedded targets, so a frontend might want to
1638 disable automatic update for the variables that are either not visible
1639 on the screen, or "closed". This is possible using so called "frozen
1640 variable objects". Such variable objects are never implicitly updated.
1642 The following is the complete set of GDB/MI operations defined to
1643 access this functionality:
1645 *Operation* *Description*
1646 `-var-create' create a variable object
1647 `-var-delete' delete the variable object and/or its
1649 `-var-set-format' set the display format of this variable
1650 `-var-show-format' show the display format of this variable
1651 `-var-info-num-children' tells how many children this object has
1652 `-var-list-children' return a list of the object's children
1653 `-var-info-type' show the type of this variable object
1654 `-var-info-expression' print parent-relative expression that this
1655 variable object represents
1656 `-var-info-path-expression' print full expression that this variable
1658 `-var-show-attributes' is this variable editable? does it exist
1660 `-var-evaluate-expression' get the value of this variable
1661 `-var-assign' set the value of this variable
1662 `-var-update' update the variable and its children
1663 `-var-set-frozen' set frozeness attribute
1665 In the next subsection we describe each operation in detail and
1666 suggest how it can be used.
1668 Description And Use of Operations on Variable Objects
1669 -----------------------------------------------------
1671 The `-var-create' Command
1672 -------------------------
1677 -var-create {NAME | "-"}
1678 {FRAME-ADDR | "*"} EXPRESSION
1680 This operation creates a variable object, which allows the
1681 monitoring of a variable, the result of an expression, a memory cell or
1684 The NAME parameter is the string by which the object can be
1685 referenced. It must be unique. If `-' is specified, the varobj system
1686 will generate a string "varNNNNNN" automatically. It will be unique
1687 provided that one does not specify NAME on that format. The command
1688 fails if a duplicate name is found.
1690 The frame under which the expression should be evaluated can be
1691 specified by FRAME-ADDR. A `*' indicates that the current frame should
1694 EXPRESSION is any expression valid on the current language set (must
1695 not begin with a `*'), or one of the following:
1697 * `*ADDR', where ADDR is the address of a memory cell
1699 * `*ADDR-ADDR' -- a memory address range (TBD)
1701 * `$REGNAME' -- a CPU register name
1706 This operation returns the name, number of children and the type of the
1707 object created. Type is returned as a string as the ones generated by
1710 name="NAME",numchild="N",type="TYPE"
1712 The `-var-delete' Command
1713 -------------------------
1718 -var-delete [ -c ] NAME
1720 Deletes a previously created variable object and all of its children.
1721 With the `-c' option, just deletes the children.
1723 Returns an error if the object NAME is not found.
1725 The `-var-set-format' Command
1726 -----------------------------
1731 -var-set-format NAME FORMAT-SPEC
1733 Sets the output format for the value of the object NAME to be
1736 The syntax for the FORMAT-SPEC is as follows:
1739 {binary | decimal | hexadecimal | octal | natural}
1741 The natural format is the default format choosen automatically based
1742 on the variable type (like decimal for an `int', hex for pointers,
1745 For a variable with children, the format is set only on the variable
1746 itself, and the children are not affected.
1748 The `-var-show-format' Command
1749 ------------------------------
1754 -var-show-format NAME
1756 Returns the format used to display the value of the object NAME.
1761 The `-var-info-num-children' Command
1762 ------------------------------------
1767 -var-info-num-children NAME
1769 Returns the number of children of a variable object NAME:
1773 The `-var-list-children' Command
1774 --------------------------------
1779 -var-list-children [PRINT-VALUES] NAME
1781 Return a list of the children of the specified variable object and
1782 create variable objects for them, if they do not already exist. With a
1783 single argument or if PRINT-VALUES has a value for of 0 or
1784 `--no-values', print only the names of the variables; if PRINT-VALUES
1785 is 1 or `--all-values', also print their values; and if it is 2 or
1786 `--simple-values' print the name and value for simple data types and
1787 just the name for arrays, structures and unions.
1793 -var-list-children n
1794 ^done,numchild=N,children=[{name=NAME,
1795 numchild=N,type=TYPE},(repeats N times)]
1797 -var-list-children --all-values n
1798 ^done,numchild=N,children=[{name=NAME,
1799 numchild=N,value=VALUE,type=TYPE},(repeats N times)]
1801 The `-var-info-type' Command
1802 ----------------------------
1809 Returns the type of the specified variable NAME. The type is
1810 returned as a string in the same format as it is output by the GDB CLI:
1814 The `-var-info-expression' Command
1815 ----------------------------------
1820 -var-info-expression NAME
1822 Returns a string that is suitable for presenting this variable
1823 object in user interface. The string is generally not valid expression
1824 in the current language, and cannot be evaluated.
1826 For example, if `a' is an array, and variable object `A' was created
1827 for `a', then we'll get this output:
1829 (gdb) -var-info-expression A.1
1830 ^done,lang="C",exp="1"
1832 Here, the values of `lang' can be `{"C" | "C++" | "Java"}'.
1834 Note that the output of the `-var-list-children' command also
1835 includes those expressions, so the `-var-info-expression' command is of
1838 The `-var-info-path-expression' Command
1839 ---------------------------------------
1844 -var-info-path-expression NAME
1846 Returns an expression that can be evaluated in the current context
1847 and will yield the same value that a variable object has. Compare this
1848 with the `-var-info-expression' command, which result can be used only
1849 for UI presentation. Typical use of the `-var-info-path-expression'
1850 command is creating a watchpoint from a variable object.
1852 For example, suppose `C' is a C++ class, derived from class `Base',
1853 and that the `Base' class has a member called `m_size'. Assume a
1854 variable `c' is has the type of `C' and a variable object `C' was
1855 created for variable `c'. Then, we'll get this output:
1856 (gdb) -var-info-path-expression C.Base.public.m_size
1857 ^done,path_expr=((Base)c).m_size)
1859 The `-var-show-attributes' Command
1860 ----------------------------------
1865 -var-show-attributes NAME
1867 List attributes of the specified variable object NAME:
1869 status=ATTR [ ( ,ATTR )* ]
1871 where ATTR is `{ { editable | noneditable } | TBD }'.
1873 The `-var-evaluate-expression' Command
1874 --------------------------------------
1879 -var-evaluate-expression NAME
1881 Evaluates the expression that is represented by the specified
1882 variable object and returns its value as a string. The format of the
1883 string can be changed using the `-var-set-format' command.
1887 Note that one must invoke `-var-list-children' for a variable before
1888 the value of a child variable can be evaluated.
1890 The `-var-assign' Command
1891 -------------------------
1896 -var-assign NAME EXPRESSION
1898 Assigns the value of EXPRESSION to the variable object specified by
1899 NAME. The object must be `editable'. If the variable's value is
1900 altered by the assign, the variable will show up in any subsequent
1911 ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
1914 The `-var-update' Command
1915 -------------------------
1920 -var-update [PRINT-VALUES] {NAME | "*"}
1922 Reevaluate the expressions corresponding to the variable object NAME
1923 and all its direct and indirect children, and return the list of
1924 variable objects whose values have changed; NAME must be a root
1925 variable object. Here, "changed" means that the result of
1926 `-var-evaluate-expression' before and after the `-var-update' is
1927 different. If `*' is used as the variable object names, all existing
1928 variable objects are updated, except for frozen ones (*note
1929 -var-set-frozen::). The option PRINT-VALUES determines whether both
1930 names and values, or just names are printed. The possible values of
1931 this options are the same as for `-var-list-children' (*note
1932 -var-list-children::). It is recommended to use the `--all-values'
1933 option, to reduce the number of MI commands needed on each program stop.
1942 -var-update --all-values var1
1943 ^done,changelist=[{name="var1",value="3",in_scope="true",
1944 type_changed="false"}]
1947 The field in_scope may take three values:
1950 The variable object's current value is valid.
1953 The variable object does not currently hold a valid value but it
1954 may hold one in the future if its associated expression comes back
1958 The variable object no longer holds a valid value. This can occur
1959 when the executable file being debugged has changed, either
1960 through recompilation or by using the GDB `file' command. The
1961 front end should normally choose to delete these variable objects.
1963 In the future new values may be added to this list so the front
1964 should be prepared for this possibility. *Note GDB/MI Development and
1965 Front Ends: GDB/MI Development and Front Ends.
1967 The `-var-set-frozen' Command
1968 -----------------------------
1973 -var-set-frozen NAME FLAG
1975 Set the frozenness flag on the variable object NAME. The FLAG
1976 parameter should be either `1' to make the variable frozen or `0' to
1977 make it unfrozen. If a variable object is frozen, then neither itself,
1978 nor any of its children, are implicitly updated by `-var-update' of a
1979 parent variable or by `-var-update *'. Only `-var-update' of the
1980 variable itself will update its value and values of its children.
1981 After a variable object is unfrozen, it is implicitly updated by all
1982 subsequent `-var-update' operations. Unfreezing a variable does not
1983 update it, only subsequent `-var-update' does.
1994 File: gdb.info, Node: GDB/MI Data Manipulation, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Variable Objects, Up: GDB/MI
1996 24.13 GDB/MI Data Manipulation
1997 ==============================
1999 This section describes the GDB/MI commands that manipulate data:
2000 examine memory and registers, evaluate expressions, etc.
2002 The `-data-disassemble' Command
2003 -------------------------------
2009 [ -s START-ADDR -e END-ADDR ]
2010 | [ -f FILENAME -l LINENUM [ -n LINES ] ]
2016 is the beginning address (or `$pc')
2022 is the name of the file to disassemble
2025 is the line number to disassemble around
2028 is the number of disassembly lines to be produced. If it is -1,
2029 the whole function will be disassembled, in case no END-ADDR is
2030 specified. If END-ADDR is specified as a non-zero value, and
2031 LINES is lower than the number of disassembly lines between
2032 START-ADDR and END-ADDR, only LINES lines are displayed; if LINES
2033 is higher than the number of lines between START-ADDR and
2034 END-ADDR, only the lines up to END-ADDR are displayed.
2037 is either 0 (meaning only disassembly) or 1 (meaning mixed source
2043 The output for each instruction is composed of four fields:
2053 Note that whatever included in the instruction field, is not
2054 manipulated directly by GDB/MI, i.e., it is not possible to adjust its
2060 There's no direct mapping from this command to the CLI.
2065 Disassemble from the current value of `$pc' to `$pc + 20':
2068 -data-disassemble -s $pc -e "$pc + 20" -- 0
2071 {address="0x000107c0",func-name="main",offset="4",
2073 {address="0x000107c4",func-name="main",offset="8",
2074 inst="sethi %hi(0x11800), %o2"},
2075 {address="0x000107c8",func-name="main",offset="12",
2076 inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
2077 {address="0x000107cc",func-name="main",offset="16",
2078 inst="sethi %hi(0x11800), %o2"},
2079 {address="0x000107d0",func-name="main",offset="20",
2080 inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
2083 Disassemble the whole `main' function. Line 32 is part of `main'.
2085 -data-disassemble -f basics.c -l 32 -- 0
2087 {address="0x000107bc",func-name="main",offset="0",
2088 inst="save %sp, -112, %sp"},
2089 {address="0x000107c0",func-name="main",offset="4",
2091 {address="0x000107c4",func-name="main",offset="8",
2092 inst="sethi %hi(0x11800), %o2"},
2094 {address="0x0001081c",func-name="main",offset="96",inst="ret "},
2095 {address="0x00010820",func-name="main",offset="100",inst="restore "}]
2098 Disassemble 3 instructions from the start of `main':
2101 -data-disassemble -f basics.c -l 32 -n 3 -- 0
2103 {address="0x000107bc",func-name="main",offset="0",
2104 inst="save %sp, -112, %sp"},
2105 {address="0x000107c0",func-name="main",offset="4",
2107 {address="0x000107c4",func-name="main",offset="8",
2108 inst="sethi %hi(0x11800), %o2"}]
2111 Disassemble 3 instructions from the start of `main' in mixed mode:
2114 -data-disassemble -f basics.c -l 32 -n 3 -- 1
2116 src_and_asm_line={line="31",
2117 file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
2118 testsuite/gdb.mi/basics.c",line_asm_insn=[
2119 {address="0x000107bc",func-name="main",offset="0",
2120 inst="save %sp, -112, %sp"}]},
2121 src_and_asm_line={line="32",
2122 file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
2123 testsuite/gdb.mi/basics.c",line_asm_insn=[
2124 {address="0x000107c0",func-name="main",offset="4",
2126 {address="0x000107c4",func-name="main",offset="8",
2127 inst="sethi %hi(0x11800), %o2"}]}]
2130 The `-data-evaluate-expression' Command
2131 ---------------------------------------
2136 -data-evaluate-expression EXPR
2138 Evaluate EXPR as an expression. The expression could contain an
2139 inferior function call. The function call will execute synchronously.
2140 If the expression contains spaces, it must be enclosed in double quotes.
2145 The corresponding GDB commands are `print', `output', and `call'. In
2146 `gdbtk' only, there's a corresponding `gdb_eval' command.
2151 In the following example, the numbers that precede the commands are the
2152 "tokens" described in *Note GDB/MI Command Syntax: GDB/MI Command
2153 Syntax. Notice how GDB/MI returns the same tokens in its output.
2155 211-data-evaluate-expression A
2158 311-data-evaluate-expression &A
2159 311^done,value="0xefffeb7c"
2161 411-data-evaluate-expression A+3
2164 511-data-evaluate-expression "A + 3"
2168 The `-data-list-changed-registers' Command
2169 ------------------------------------------
2174 -data-list-changed-registers
2176 Display a list of the registers that have changed.
2181 GDB doesn't have a direct analog for this command; `gdbtk' has the
2182 corresponding command `gdb_changed_register_list'.
2194 *stopped,reason="breakpoint-hit",bkptno="1",frame={func="main",
2195 args=[],file="try.c",fullname="/home/foo/bar/try.c",line="5"}
2197 -data-list-changed-registers
2198 ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
2199 "10","11","13","14","15","16","17","18","19","20","21","22","23",
2200 "24","25","26","27","28","30","31","64","65","66","67","69"]
2203 The `-data-list-register-names' Command
2204 ---------------------------------------
2209 -data-list-register-names [ ( REGNO )+ ]
2211 Show a list of register names for the current target. If no
2212 arguments are given, it shows a list of the names of all the registers.
2213 If integer numbers are given as arguments, it will print a list of the
2214 names of the registers corresponding to the arguments. To ensure
2215 consistency between a register name and its number, the output list may
2216 include empty register names.
2221 GDB does not have a command which corresponds to
2222 `-data-list-register-names'. In `gdbtk' there is a corresponding
2223 command `gdb_regnames'.
2228 For the PPC MBX board:
2230 -data-list-register-names
2231 ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
2232 "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
2233 "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
2234 "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
2235 "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
2236 "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
2237 "", "pc","ps","cr","lr","ctr","xer"]
2239 -data-list-register-names 1 2 3
2240 ^done,register-names=["r1","r2","r3"]
2243 The `-data-list-register-values' Command
2244 ----------------------------------------
2249 -data-list-register-values FMT [ ( REGNO )*]
2251 Display the registers' contents. FMT is the format according to
2252 which the registers' contents are to be returned, followed by an
2253 optional list of numbers specifying the registers to display. A
2254 missing list of numbers indicates that the contents of all the
2255 registers must be returned.
2257 Allowed formats for FMT are:
2280 The corresponding GDB commands are `info reg', `info all-reg', and (in
2281 `gdbtk') `gdb_fetch_registers'.
2286 For a PPC MBX board (note: line breaks are for readability only, they
2287 don't appear in the actual output):
2290 -data-list-register-values r 64 65
2291 ^done,register-values=[{number="64",value="0xfe00a300"},
2292 {number="65",value="0x00029002"}]
2294 -data-list-register-values x
2295 ^done,register-values=[{number="0",value="0xfe0043c8"},
2296 {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
2297 {number="3",value="0x0"},{number="4",value="0xa"},
2298 {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
2299 {number="7",value="0xfe011e98"},{number="8",value="0x2"},
2300 {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
2301 {number="11",value="0x1"},{number="12",value="0x0"},
2302 {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
2303 {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
2304 {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
2305 {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
2306 {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
2307 {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
2308 {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
2309 {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
2310 {number="29",value="0x0"},{number="30",value="0xfe010000"},
2311 {number="31",value="0x0"},{number="32",value="0x0"},
2312 {number="33",value="0x0"},{number="34",value="0x0"},
2313 {number="35",value="0x0"},{number="36",value="0x0"},
2314 {number="37",value="0x0"},{number="38",value="0x0"},
2315 {number="39",value="0x0"},{number="40",value="0x0"},
2316 {number="41",value="0x0"},{number="42",value="0x0"},
2317 {number="43",value="0x0"},{number="44",value="0x0"},
2318 {number="45",value="0x0"},{number="46",value="0x0"},
2319 {number="47",value="0x0"},{number="48",value="0x0"},
2320 {number="49",value="0x0"},{number="50",value="0x0"},
2321 {number="51",value="0x0"},{number="52",value="0x0"},
2322 {number="53",value="0x0"},{number="54",value="0x0"},
2323 {number="55",value="0x0"},{number="56",value="0x0"},
2324 {number="57",value="0x0"},{number="58",value="0x0"},
2325 {number="59",value="0x0"},{number="60",value="0x0"},
2326 {number="61",value="0x0"},{number="62",value="0x0"},
2327 {number="63",value="0x0"},{number="64",value="0xfe00a300"},
2328 {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
2329 {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
2330 {number="69",value="0x20002b03"}]
2333 The `-data-read-memory' Command
2334 -------------------------------
2339 -data-read-memory [ -o BYTE-OFFSET ]
2340 ADDRESS WORD-FORMAT WORD-SIZE
2341 NR-ROWS NR-COLS [ ASCHAR ]
2346 An expression specifying the address of the first memory word to be
2347 read. Complex expressions containing embedded white space should
2348 be quoted using the C convention.
2351 The format to be used to print the memory words. The notation is
2352 the same as for GDB's `print' command (*note Output Formats:
2356 The size of each memory word in bytes.
2359 The number of rows in the output table.
2362 The number of columns in the output table.
2365 If present, indicates that each row should include an ASCII dump.
2366 The value of ASCHAR is used as a padding character when a byte is
2367 not a member of the printable ASCII character set (printable ASCII
2368 characters are those whose code is between 32 and 126,
2372 An offset to add to the ADDRESS before fetching memory.
2374 This command displays memory contents as a table of NR-ROWS by
2375 NR-COLS words, each word being WORD-SIZE bytes. In total, `NR-ROWS *
2376 NR-COLS * WORD-SIZE' bytes are read (returned as `total-bytes').
2377 Should less than the requested number of bytes be returned by the
2378 target, the missing words are identified using `N/A'. The number of
2379 bytes read from the target is returned in `nr-bytes' and the starting
2380 address used to read memory in `addr'.
2382 The address of the next/previous row or page is available in
2383 `next-row' and `prev-row', `next-page' and `prev-page'.
2388 The corresponding GDB command is `x'. `gdbtk' has `gdb_get_mem' memory
2394 Read six bytes of memory starting at `bytes+6' but then offset by `-6'
2395 bytes. Format as three rows of two columns. One byte per word.
2396 Display each word in hex.
2399 9-data-read-memory -o -6 -- bytes+6 x 1 3 2
2400 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
2401 next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
2402 prev-page="0x0000138a",memory=[
2403 {addr="0x00001390",data=["0x00","0x01"]},
2404 {addr="0x00001392",data=["0x02","0x03"]},
2405 {addr="0x00001394",data=["0x04","0x05"]}]
2408 Read two bytes of memory starting at address `shorts + 64' and
2409 display as a single word formatted in decimal.
2412 5-data-read-memory shorts+64 d 2 1 1
2413 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
2414 next-row="0x00001512",prev-row="0x0000150e",
2415 next-page="0x00001512",prev-page="0x0000150e",memory=[
2416 {addr="0x00001510",data=["128"]}]
2419 Read thirty two bytes of memory starting at `bytes+16' and format as
2420 eight rows of four columns. Include a string encoding with `x' used as
2421 the non-printable character.
2424 4-data-read-memory bytes+16 x 1 8 4 x
2425 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
2426 next-row="0x000013c0",prev-row="0x0000139c",
2427 next-page="0x000013c0",prev-page="0x00001380",memory=[
2428 {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
2429 {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
2430 {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
2431 {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
2432 {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
2433 {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
2434 {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
2435 {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
2439 File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Symbol Query, Prev: GDB/MI Data Manipulation, Up: GDB/MI
2441 24.14 GDB/MI Tracepoint Commands
2442 ================================
2444 The tracepoint commands are not yet implemented.
2447 File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI File Commands, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI
2449 24.15 GDB/MI Symbol Query Commands
2450 ==================================
2452 The `-symbol-info-address' Command
2453 ----------------------------------
2458 -symbol-info-address SYMBOL
2460 Describe where SYMBOL is stored.
2465 The corresponding GDB command is `info address'.
2472 The `-symbol-info-file' Command
2473 -------------------------------
2480 Show the file for the symbol.
2485 There's no equivalent GDB command. `gdbtk' has `gdb_find_file'.
2492 The `-symbol-info-function' Command
2493 -----------------------------------
2498 -symbol-info-function
2500 Show which function the symbol lives in.
2505 `gdb_get_function' in `gdbtk'.
2512 The `-symbol-info-line' Command
2513 -------------------------------
2520 Show the core addresses of the code for a source line.
2525 The corresponding GDB command is `info line'. `gdbtk' has the
2526 `gdb_get_line' and `gdb_get_file' commands.
2533 The `-symbol-info-symbol' Command
2534 ---------------------------------
2539 -symbol-info-symbol ADDR
2541 Describe what symbol is at location ADDR.
2546 The corresponding GDB command is `info symbol'.
2553 The `-symbol-list-functions' Command
2554 ------------------------------------
2559 -symbol-list-functions
2561 List the functions in the executable.
2566 `info functions' in GDB, `gdb_listfunc' and `gdb_search' in `gdbtk'.
2573 The `-symbol-list-lines' Command
2574 --------------------------------
2579 -symbol-list-lines FILENAME
2581 Print the list of lines that contain code and their associated
2582 program addresses for the given source filename. The entries are
2583 sorted in ascending PC order.
2588 There is no corresponding GDB command.
2594 -symbol-list-lines basics.c
2595 ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
2598 The `-symbol-list-types' Command
2599 --------------------------------
2606 List all the type names.
2611 The corresponding commands are `info types' in GDB, `gdb_search' in
2619 The `-symbol-list-variables' Command
2620 ------------------------------------
2625 -symbol-list-variables
2627 List all the global and static variable names.
2632 `info variables' in GDB, `gdb_search' in `gdbtk'.
2639 The `-symbol-locate' Command
2640 ----------------------------
2650 `gdb_loc' in `gdbtk'.
2657 The `-symbol-type' Command
2658 --------------------------
2663 -symbol-type VARIABLE
2665 Show type of VARIABLE.
2670 The corresponding GDB command is `ptype', `gdbtk' has
2679 File: gdb.info, Node: GDB/MI File Commands, Next: GDB/MI Target Manipulation, Prev: GDB/MI Symbol Query, Up: GDB/MI
2681 24.16 GDB/MI File Commands
2682 ==========================
2684 This section describes the GDB/MI commands to specify executable file
2685 names and to read in and obtain symbol table information.
2687 The `-file-exec-and-symbols' Command
2688 ------------------------------------
2693 -file-exec-and-symbols FILE
2695 Specify the executable file to be debugged. This file is the one
2696 from which the symbol table is also read. If no file is specified, the
2697 command clears the executable and symbol information. If breakpoints
2698 are set when using this command with no arguments, GDB will produce
2699 error messages. Otherwise, no output is produced, except a completion
2705 The corresponding GDB command is `file'.
2711 -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2715 The `-file-exec-file' Command
2716 -----------------------------
2721 -file-exec-file FILE
2723 Specify the executable file to be debugged. Unlike
2724 `-file-exec-and-symbols', the symbol table is _not_ read from this
2725 file. If used without argument, GDB clears the information about the
2726 executable file. No output is produced, except a completion
2732 The corresponding GDB command is `exec-file'.
2738 -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2742 The `-file-list-exec-sections' Command
2743 --------------------------------------
2748 -file-list-exec-sections
2750 List the sections of the current executable file.
2755 The GDB command `info file' shows, among the rest, the same information
2756 as this command. `gdbtk' has a corresponding command `gdb_load_info'.
2763 The `-file-list-exec-source-file' Command
2764 -----------------------------------------
2769 -file-list-exec-source-file
2771 List the line number, the current source file, and the absolute path
2772 to the current source file for the current executable. The macro
2773 information field has a value of `1' or `0' depending on whether or not
2774 the file includes preprocessor macro information.
2779 The GDB equivalent is `info source'
2785 123-file-list-exec-source-file
2786 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1"
2789 The `-file-list-exec-source-files' Command
2790 ------------------------------------------
2795 -file-list-exec-source-files
2797 List the source files for the current executable.
2799 It will always output the filename, but only when GDB can find the
2800 absolute file name of a source file, will it output the fullname.
2805 The GDB equivalent is `info sources'. `gdbtk' has an analogous command
2812 -file-list-exec-source-files
2814 {file=foo.c,fullname=/home/foo.c},
2815 {file=/home/bar.c,fullname=/home/bar.c},
2816 {file=gdb_could_not_find_fullpath.c}]
2819 The `-file-list-shared-libraries' Command
2820 -----------------------------------------
2825 -file-list-shared-libraries
2827 List the shared libraries in the program.
2832 The corresponding GDB command is `info shared'.
2839 The `-file-list-symbol-files' Command
2840 -------------------------------------
2845 -file-list-symbol-files
2852 The corresponding GDB command is `info file' (part of it).
2859 The `-file-symbol-file' Command
2860 -------------------------------
2865 -file-symbol-file FILE
2867 Read symbol table info from the specified FILE argument. When used
2868 without arguments, clears GDB's symbol table info. No output is
2869 produced, except for a completion notification.
2874 The corresponding GDB command is `symbol-file'.
2880 -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2885 File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI File Transfer Commands, Prev: GDB/MI File Commands, Up: GDB/MI
2887 24.17 GDB/MI Target Manipulation Commands
2888 =========================================
2890 The `-target-attach' Command
2891 ----------------------------
2896 -target-attach PID | FILE
2898 Attach to a process PID or a file FILE outside of GDB.
2903 The corresponding GDB command is `attach'.
2910 The `-target-compare-sections' Command
2911 --------------------------------------
2916 -target-compare-sections [ SECTION ]
2918 Compare data of section SECTION on target to the exec file. Without
2919 the argument, all sections are compared.
2924 The GDB equivalent is `compare-sections'.
2931 The `-target-detach' Command
2932 ----------------------------
2939 Detach from the remote target which normally resumes its execution.
2945 The corresponding GDB command is `detach'.
2955 The `-target-disconnect' Command
2956 --------------------------------
2963 Disconnect from the remote target. There's no output and the target
2964 is generally not resumed.
2969 The corresponding GDB command is `disconnect'.
2979 The `-target-download' Command
2980 ------------------------------
2987 Loads the executable onto the remote target. It prints out an
2988 update message every half second, which includes the fields:
2991 The name of the section.
2994 The size of what has been sent so far for that section.
2997 The size of the section.
3000 The total size of what was sent so far (the current and the
3004 The size of the overall executable to download.
3006 Each message is sent as status record (*note GDB/MI Output Syntax:
3007 GDB/MI Output Syntax.).
3009 In addition, it prints the name and size of the sections, as they are
3010 downloaded. These messages include the following fields:
3013 The name of the section.
3016 The size of the section.
3019 The size of the overall executable to download.
3021 At the end, a summary is printed.
3026 The corresponding GDB command is `load'.
3031 Note: each status message appears on a single line. Here the messages
3032 have been broken down so that they can fit onto a page.
3036 +download,{section=".text",section-size="6668",total-size="9880"}
3037 +download,{section=".text",section-sent="512",section-size="6668",
3038 total-sent="512",total-size="9880"}
3039 +download,{section=".text",section-sent="1024",section-size="6668",
3040 total-sent="1024",total-size="9880"}
3041 +download,{section=".text",section-sent="1536",section-size="6668",
3042 total-sent="1536",total-size="9880"}
3043 +download,{section=".text",section-sent="2048",section-size="6668",
3044 total-sent="2048",total-size="9880"}
3045 +download,{section=".text",section-sent="2560",section-size="6668",
3046 total-sent="2560",total-size="9880"}
3047 +download,{section=".text",section-sent="3072",section-size="6668",
3048 total-sent="3072",total-size="9880"}
3049 +download,{section=".text",section-sent="3584",section-size="6668",
3050 total-sent="3584",total-size="9880"}
3051 +download,{section=".text",section-sent="4096",section-size="6668",
3052 total-sent="4096",total-size="9880"}
3053 +download,{section=".text",section-sent="4608",section-size="6668",
3054 total-sent="4608",total-size="9880"}
3055 +download,{section=".text",section-sent="5120",section-size="6668",
3056 total-sent="5120",total-size="9880"}
3057 +download,{section=".text",section-sent="5632",section-size="6668",
3058 total-sent="5632",total-size="9880"}
3059 +download,{section=".text",section-sent="6144",section-size="6668",
3060 total-sent="6144",total-size="9880"}
3061 +download,{section=".text",section-sent="6656",section-size="6668",
3062 total-sent="6656",total-size="9880"}
3063 +download,{section=".init",section-size="28",total-size="9880"}
3064 +download,{section=".fini",section-size="28",total-size="9880"}
3065 +download,{section=".data",section-size="3156",total-size="9880"}
3066 +download,{section=".data",section-sent="512",section-size="3156",
3067 total-sent="7236",total-size="9880"}
3068 +download,{section=".data",section-sent="1024",section-size="3156",
3069 total-sent="7748",total-size="9880"}
3070 +download,{section=".data",section-sent="1536",section-size="3156",
3071 total-sent="8260",total-size="9880"}
3072 +download,{section=".data",section-sent="2048",section-size="3156",
3073 total-sent="8772",total-size="9880"}
3074 +download,{section=".data",section-sent="2560",section-size="3156",
3075 total-sent="9284",total-size="9880"}
3076 +download,{section=".data",section-sent="3072",section-size="3156",
3077 total-sent="9796",total-size="9880"}
3078 ^done,address="0x10004",load-size="9880",transfer-rate="6586",
3082 The `-target-exec-status' Command
3083 ---------------------------------
3090 Provide information on the state of the target (whether it is
3091 running or not, for instance).
3096 There's no equivalent GDB command.
3103 The `-target-list-available-targets' Command
3104 --------------------------------------------
3109 -target-list-available-targets
3111 List the possible targets to connect to.
3116 The corresponding GDB command is `help target'.
3123 The `-target-list-current-targets' Command
3124 ------------------------------------------
3129 -target-list-current-targets
3131 Describe the current target.
3136 The corresponding information is printed by `info file' (among other
3144 The `-target-list-parameters' Command
3145 -------------------------------------
3150 -target-list-parameters
3162 The `-target-select' Command
3163 ----------------------------
3168 -target-select TYPE PARAMETERS ...
3170 Connect GDB to the remote target. This command takes two args:
3173 The type of target, for instance `async', `remote', etc.
3176 Device names, host names and the like. *Note Commands for
3177 Managing Targets: Target Commands, for more details.
3179 The output is a connection notification, followed by the address at
3180 which the target program is, in the following form:
3182 ^connected,addr="ADDRESS",func="FUNCTION NAME",
3188 The corresponding GDB command is `target'.
3194 -target-select async /dev/ttya
3195 ^connected,addr="0xfe00a300",func="??",args=[]
3199 File: gdb.info, Node: GDB/MI File Transfer Commands, Next: GDB/MI Miscellaneous Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI
3201 24.18 GDB/MI File Transfer Commands
3202 ===================================
3204 The `-target-file-put' Command
3205 ------------------------------
3210 -target-file-put HOSTFILE TARGETFILE
3212 Copy file HOSTFILE from the host system (the machine running GDB) to
3213 TARGETFILE on the target system.
3218 The corresponding GDB command is `remote put'.
3224 -target-file-put localfile remotefile
3228 The `-target-file-put' Command
3229 ------------------------------
3234 -target-file-get TARGETFILE HOSTFILE
3236 Copy file TARGETFILE from the target system to HOSTFILE on the host
3242 The corresponding GDB command is `remote get'.
3248 -target-file-get remotefile localfile
3252 The `-target-file-delete' Command
3253 ---------------------------------
3258 -target-file-delete TARGETFILE
3260 Delete TARGETFILE from the target system.
3265 The corresponding GDB command is `remote delete'.
3271 -target-file-delete remotefile
3276 File: gdb.info, Node: GDB/MI Miscellaneous Commands, Prev: GDB/MI File Transfer Commands, Up: GDB/MI
3278 24.19 Miscellaneous GDB/MI Commands
3279 ===================================
3281 The `-gdb-exit' Command
3282 -----------------------
3289 Exit GDB immediately.
3294 Approximately corresponds to `quit'.
3303 The `-exec-abort' Command
3304 -------------------------
3311 Kill the inferior running program.
3316 The corresponding GDB command is `kill'.
3323 The `-gdb-set' Command
3324 ----------------------
3331 Set an internal GDB variable.
3336 The corresponding GDB command is `set'.
3346 The `-gdb-show' Command
3347 -----------------------
3354 Show the current value of a GDB variable.
3359 The corresponding GDB command is `show'.
3369 The `-gdb-version' Command
3370 --------------------------
3377 Show version information for GDB. Used mostly in testing.
3382 The GDB equivalent is `show version'. GDB by default shows this
3383 information when you start an interactive session.
3391 ~Copyright 2000 Free Software Foundation, Inc.
3392 ~GDB is free software, covered by the GNU General Public License, and
3393 ~you are welcome to change it and/or distribute copies of it under
3394 ~ certain conditions.
3395 ~Type "show copying" to see the conditions.
3396 ~There is absolutely no warranty for GDB. Type "show warranty" for
3398 ~This GDB was configured as
3399 "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
3403 The `-list-features' Command
3404 ----------------------------
3406 Returns a list of particular features of the MI protocol that this
3407 version of gdb implements. A feature can be a command, or a new field
3408 in an output of some command, or even an important bugfix. While a
3409 frontend can sometimes detect presence of a feature at runtime, it is
3410 easier to perform detection at debugger startup.
3412 The command returns a list of strings, with each string naming an
3413 available feature. Each returned string is just a name, it does not
3414 have any internal structure. The list of possible feature names is
3419 (gdb) -list-features
3420 ^done,result=["feature1","feature2"]
3422 The current list of features is:
3424 - `frozen-varobjs'--indicates presence of the `-var-set-frozen'
3425 command, as well as possible presense of the `frozen' field in the
3426 output of `-varobj-create'.
3428 - `pending-breakpoints'--indicates presence of the `-f' option to
3429 the `-break-insert' command.
3432 The `-interpreter-exec' Command
3433 -------------------------------
3438 -interpreter-exec INTERPRETER COMMAND
3440 Execute the specified COMMAND in the given INTERPRETER.
3445 The corresponding GDB command is `interpreter-exec'.
3451 -interpreter-exec console "break main"
3452 &"During symbol reading, couldn't parse type; debugger out of date?.\n"
3453 &"During symbol reading, bad structure-type format.\n"
3454 ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
3458 The `-inferior-tty-set' Command
3459 -------------------------------
3464 -inferior-tty-set /dev/pts/1
3466 Set terminal for future runs of the program being debugged.
3471 The corresponding GDB command is `set inferior-tty' /dev/pts/1.
3477 -inferior-tty-set /dev/pts/1
3481 The `-inferior-tty-show' Command
3482 --------------------------------
3489 Show terminal for future runs of program being debugged.
3494 The corresponding GDB command is `show inferior-tty'.
3500 -inferior-tty-set /dev/pts/1
3504 ^done,inferior_tty_terminal="/dev/pts/1"
3507 The `-enable-timings' Command
3508 -----------------------------
3513 -enable-timings [yes | no]
3515 Toggle the printing of the wallclock, user and system times for an MI
3516 command as a field in its output. This command is to help frontend
3517 developers optimize the performance of their code. No argument is
3518 equivalent to `yes'.
3533 ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
3534 addr="0x080484ed",func="main",file="myprog.c",
3535 fullname="/home/nickrob/myprog.c",line="73",times="0"},
3536 time={wallclock="0.05185",user="0.00800",system="0.00000"}
3544 *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",
3545 frame={addr="0x080484ed",func="main",args=[{name="argc",value="1"},
3546 {name="argv",value="0xbfb60364"}],file="myprog.c",
3547 fullname="/home/nickrob/myprog.c",line="73"}
3551 File: gdb.info, Node: Annotations, Next: GDB Bugs, Prev: GDB/MI, Up: Top
3556 This chapter describes annotations in GDB. Annotations were designed
3557 to interface GDB to graphical user interfaces or other similar programs
3558 which want to interact with GDB at a relatively high level.
3560 The annotation mechanism has largely been superseded by GDB/MI
3565 * Annotations Overview:: What annotations are; the general syntax.
3566 * Server Prefix:: Issuing a command without affecting user state.
3567 * Prompting:: Annotations marking GDB's need for input.
3568 * Errors:: Annotations for error messages.
3569 * Invalidation:: Some annotations describe things now invalid.
3570 * Annotations for Running::
3571 Whether the program is running, how it stopped, etc.
3572 * Source Annotations:: Annotations describing source code.
3575 File: gdb.info, Node: Annotations Overview, Next: Server Prefix, Up: Annotations
3577 25.1 What is an Annotation?
3578 ===========================
3580 Annotations start with a newline character, two `control-z' characters,
3581 and the name of the annotation. If there is no additional information
3582 associated with this annotation, the name of the annotation is followed
3583 immediately by a newline. If there is additional information, the name
3584 of the annotation is followed by a space, the additional information,
3585 and a newline. The additional information cannot contain newline
3588 Any output not beginning with a newline and two `control-z'
3589 characters denotes literal output from GDB. Currently there is no need
3590 for GDB to output a newline followed by two `control-z' characters, but
3591 if there was such a need, the annotations could be extended with an
3592 `escape' annotation which means those three characters as output.
3594 The annotation LEVEL, which is specified using the `--annotate'
3595 command line option (*note Mode Options::), controls how much
3596 information GDB prints together with its prompt, values of expressions,
3597 source lines, and other types of output. Level 0 is for no
3598 annotations, level 1 is for use when GDB is run as a subprocess of GNU
3599 Emacs, level 3 is the maximum annotation suitable for programs that
3600 control GDB, and level 2 annotations have been made obsolete (*note
3601 Limitations of the Annotation Interface: (annotate)Limitations.).
3603 `set annotate LEVEL'
3604 The GDB command `set annotate' sets the level of annotations to
3605 the specified LEVEL.
3608 Show the current annotation level.
3610 This chapter describes level 3 annotations.
3612 A simple example of starting up GDB with annotations is:
3616 Copyright 2003 Free Software Foundation, Inc.
3617 GDB is free software, covered by the GNU General Public License,
3618 and you are welcome to change it and/or distribute copies of it
3619 under certain conditions.
3620 Type "show copying" to see the conditions.
3621 There is absolutely no warranty for GDB. Type "show warranty"
3623 This GDB was configured as "i386-pc-linux-gnu"
3633 Here `quit' is input to GDB; the rest is output from GDB. The three
3634 lines beginning `^Z^Z' (where `^Z' denotes a `control-z' character) are
3635 annotations; the rest is output from GDB.
3638 File: gdb.info, Node: Server Prefix, Next: Prompting, Prev: Annotations Overview, Up: Annotations
3640 25.2 The Server Prefix
3641 ======================
3643 If you prefix a command with `server ' then it will not affect the
3644 command history, nor will it affect GDB's notion of which command to
3645 repeat if <RET> is pressed on a line by itself. This means that
3646 commands can be run behind a user's back by a front-end in a
3649 The server prefix does not affect the recording of values into the
3650 value history; to print a value without recording it into the value
3651 history, use the `output' command instead of the `print' command.
3654 File: gdb.info, Node: Prompting, Next: Errors, Prev: Server Prefix, Up: Annotations
3656 25.3 Annotation for GDB Input
3657 =============================
3659 When GDB prompts for input, it annotates this fact so it is possible to
3660 know when to send output, when the output from a given command is over,
3663 Different kinds of input each have a different "input type". Each
3664 input type has three annotations: a `pre-' annotation, which denotes
3665 the beginning of any prompt which is being output, a plain annotation,
3666 which denotes the end of the prompt, and then a `post-' annotation
3667 which denotes the end of any echo which may (or may not) be associated
3668 with the input. For example, the `prompt' input type features the
3669 following annotations:
3678 When GDB is prompting for a command (the main GDB prompt).
3681 When GDB prompts for a set of commands, like in the `commands'
3682 command. The annotations are repeated for each command which is
3686 When GDB wants the user to select between various overloaded
3690 When GDB wants the user to confirm a potentially dangerous
3693 `prompt-for-continue'
3694 When GDB is asking the user to press return to continue. Note:
3695 Don't expect this to work well; instead use `set height 0' to
3696 disable prompting. This is because the counting of lines is buggy
3697 in the presence of annotations.
3700 File: gdb.info, Node: Errors, Next: Invalidation, Prev: Prompting, Up: Annotations
3707 This annotation occurs right before GDB responds to an interrupt.
3711 This annotation occurs right before GDB responds to an error.
3713 Quit and error annotations indicate that any annotations which GDB
3714 was in the middle of may end abruptly. For example, if a
3715 `value-history-begin' annotation is followed by a `error', one cannot
3716 expect to receive the matching `value-history-end'. One cannot expect
3717 not to receive it either, however; an error annotation does not
3718 necessarily mean that GDB is immediately returning all the way to the
3721 A quit or error annotation may be preceded by
3725 Any output between that and the quit or error annotation is the error
3728 Warning messages are not yet annotated.
3731 File: gdb.info, Node: Invalidation, Next: Annotations for Running, Prev: Errors, Up: Annotations
3733 25.5 Invalidation Notices
3734 =========================
3736 The following annotations say that certain pieces of state may have
3739 `^Z^Zframes-invalid'
3740 The frames (for example, output from the `backtrace' command) may
3743 `^Z^Zbreakpoints-invalid'
3744 The breakpoints may have changed. For example, the user just
3745 added or deleted a breakpoint.
3748 File: gdb.info, Node: Annotations for Running, Next: Source Annotations, Prev: Invalidation, Up: Annotations
3750 25.6 Running the Program
3751 ========================
3753 When the program starts executing due to a GDB command such as `step'
3758 is output. When the program stops,
3762 is output. Before the `stopped' annotation, a variety of
3763 annotations describe how the program stopped.
3765 `^Z^Zexited EXIT-STATUS'
3766 The program exited, and EXIT-STATUS is the exit status (zero for
3767 successful exit, otherwise nonzero).
3770 The program exited with a signal. After the `^Z^Zsignalled', the
3771 annotation continues:
3780 ^Z^Zsignal-string-end
3783 where NAME is the name of the signal, such as `SIGILL' or
3784 `SIGSEGV', and STRING is the explanation of the signal, such as
3785 `Illegal Instruction' or `Segmentation fault'. INTRO-TEXT,
3786 MIDDLE-TEXT, and END-TEXT are for the user's benefit and have no
3790 The syntax of this annotation is just like `signalled', but GDB is
3791 just saying that the program received the signal, not that it was
3794 `^Z^Zbreakpoint NUMBER'
3795 The program hit breakpoint number NUMBER.
3797 `^Z^Zwatchpoint NUMBER'
3798 The program hit watchpoint number NUMBER.
3801 File: gdb.info, Node: Source Annotations, Prev: Annotations for Running, Up: Annotations
3803 25.7 Displaying Source
3804 ======================
3806 The following annotation is used instead of displaying source code:
3808 ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
3810 where FILENAME is an absolute file name indicating which source
3811 file, LINE is the line number within that file (where 1 is the first
3812 line in the file), CHARACTER is the character position within the file
3813 (where 0 is the first character in the file) (for most debug formats
3814 this will necessarily point to the beginning of a line), MIDDLE is
3815 `middle' if ADDR is in the middle of the line, or `beg' if ADDR is at
3816 the beginning of the line, and ADDR is the address in the target
3817 program associated with the source which is being displayed. ADDR is
3818 in the form `0x' followed by one or more lowercase hex digits (note
3819 that this does not depend on the language).
3822 File: gdb.info, Node: GDB Bugs, Next: Command Line Editing, Prev: Annotations, Up: Top
3824 26 Reporting Bugs in GDB
3825 ************************
3827 Your bug reports play an essential role in making GDB reliable.
3829 Reporting a bug may help you by bringing a solution to your problem,
3830 or it may not. But in any case the principal function of a bug report
3831 is to help the entire community by making the next version of GDB work
3832 better. Bug reports are your contribution to the maintenance of GDB.
3834 In order for a bug report to serve its purpose, you must include the
3835 information that enables us to fix the bug.
3839 * Bug Criteria:: Have you found a bug?
3840 * Bug Reporting:: How to report bugs
3843 File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
3845 26.1 Have You Found a Bug?
3846 ==========================
3848 If you are not sure whether you have found a bug, here are some
3851 * If the debugger gets a fatal signal, for any input whatever, that
3852 is a GDB bug. Reliable debuggers never crash.
3854 * If GDB produces an error message for valid input, that is a bug.
3855 (Note that if you're cross debugging, the problem may also be
3856 somewhere in the connection to the target.)
3858 * If GDB does not produce an error message for invalid input, that
3859 is a bug. However, you should note that your idea of "invalid
3860 input" might be our idea of "an extension" or "support for
3861 traditional practice".
3863 * If you are an experienced user of debugging tools, your suggestions
3864 for improvement of GDB are welcome in any case.
3867 File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
3869 26.2 How to Report Bugs
3870 =======================
3872 A number of companies and individuals offer support for GNU products.
3873 If you obtained GDB from a support organization, we recommend you
3874 contact that organization first.
3876 You can find contact information for many support companies and
3877 individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
3879 In any event, we also recommend that you submit bug reports for GDB.
3880 The preferred method is to submit them directly using GDB's Bugs web
3881 page (http://www.gnu.org/software/gdb/bugs/). Alternatively, the
3882 e-mail gateway <bug-gdb@gnu.org> can be used.
3884 *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
3885 newsgroups.* Most users of GDB do not want to receive bug reports.
3886 Those that do have arranged to receive `bug-gdb'.
3888 The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
3889 serves as a repeater. The mailing list and the newsgroup carry exactly
3890 the same messages. Often people think of posting bug reports to the
3891 newsgroup instead of mailing them. This appears to work, but it has one
3892 problem which can be crucial: a newsgroup posting often lacks a mail
3893 path back to the sender. Thus, if we need to ask for more information,
3894 we may be unable to reach you. For this reason, it is better to send
3895 bug reports to the mailing list.
3897 The fundamental principle of reporting bugs usefully is this:
3898 *report all the facts*. If you are not sure whether to state a fact or
3899 leave it out, state it!
3901 Often people omit facts because they think they know what causes the
3902 problem and assume that some details do not matter. Thus, you might
3903 assume that the name of the variable you use in an example does not
3904 matter. Well, probably it does not, but one cannot be sure. Perhaps
3905 the bug is a stray memory reference which happens to fetch from the
3906 location where that name is stored in memory; perhaps, if the name were
3907 different, the contents of that location would fool the debugger into
3908 doing the right thing despite the bug. Play it safe and give a
3909 specific, complete example. That is the easiest thing for you to do,
3910 and the most helpful.
3912 Keep in mind that the purpose of a bug report is to enable us to fix
3913 the bug. It may be that the bug has been reported previously, but
3914 neither you nor we can know that unless your bug report is complete and
3917 Sometimes people give a few sketchy facts and ask, "Does this ring a
3918 bell?" Those bug reports are useless, and we urge everyone to _refuse
3919 to respond to them_ except to chide the sender to report bugs properly.
3921 To enable us to fix the bug, you should include all these things:
3923 * The version of GDB. GDB announces it if you start with no
3924 arguments; you can also print it at any time using `show version'.
3926 Without this, we will not know whether there is any point in
3927 looking for the bug in the current version of GDB.
3929 * The type of machine you are using, and the operating system name
3932 * What compiler (and its version) was used to compile GDB--e.g.
3935 * What compiler (and its version) was used to compile the program
3936 you are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP
3937 C Compiler". For GCC, you can say `gcc --version' to get this
3938 information; for other compilers, see the documentation for those
3941 * The command arguments you gave the compiler to compile your
3942 example and observe the bug. For example, did you use `-O'? To
3943 guarantee you will not omit something important, list them all. A
3944 copy of the Makefile (or the output from make) is sufficient.
3946 If we were to try to guess the arguments, we would probably guess
3947 wrong and then we might not encounter the bug.
3949 * A complete input script, and all necessary source files, that will
3952 * A description of what behavior you observe that you believe is
3953 incorrect. For example, "It gets a fatal signal."
3955 Of course, if the bug is that GDB gets a fatal signal, then we
3956 will certainly notice it. But if the bug is incorrect output, we
3957 might not notice unless it is glaringly wrong. You might as well
3958 not give us a chance to make a mistake.
3960 Even if the problem you experience is a fatal signal, you should
3961 still say so explicitly. Suppose something strange is going on,
3962 such as, your copy of GDB is out of synch, or you have encountered
3963 a bug in the C library on your system. (This has happened!) Your
3964 copy might crash and ours would not. If you told us to expect a
3965 crash, then when ours fails to crash, we would know that the bug
3966 was not happening for us. If you had not told us to expect a
3967 crash, then we would not be able to draw any conclusion from our
3970 To collect all this information, you can use a session recording
3971 program such as `script', which is available on many Unix systems.
3972 Just run your GDB session inside `script' and then include the
3973 `typescript' file with your bug report.
3975 Another way to record a GDB session is to run GDB inside Emacs and
3976 then save the entire buffer to a file.
3978 * If you wish to suggest changes to the GDB source, send us context
3979 diffs. If you even discuss something in the GDB source, refer to
3980 it by context, not by line number.
3982 The line numbers in our development sources will not match those
3983 in your sources. Your line numbers would convey no useful
3987 Here are some things that are not necessary:
3989 * A description of the envelope of the bug.
3991 Often people who encounter a bug spend a lot of time investigating
3992 which changes to the input file will make the bug go away and which
3993 changes will not affect it.
3995 This is often time consuming and not very useful, because the way
3996 we will find the bug is by running a single example under the
3997 debugger with breakpoints, not by pure deduction from a series of
3998 examples. We recommend that you save your time for something else.
4000 Of course, if you can find a simpler example to report _instead_
4001 of the original one, that is a convenience for us. Errors in the
4002 output will be easier to spot, running under the debugger will take
4003 less time, and so on.
4005 However, simplification is not vital; if you do not want to do
4006 this, report the bug anyway and send us the entire test case you
4009 * A patch for the bug.
4011 A patch for the bug does help us if it is a good one. But do not
4012 omit the necessary information, such as the test case, on the
4013 assumption that a patch is all we need. We might see problems
4014 with your patch and decide to fix the problem another way, or we
4015 might not understand it at all.
4017 Sometimes with a program as complicated as GDB it is very hard to
4018 construct an example that will make the program follow a certain
4019 path through the code. If you do not send us the example, we will
4020 not be able to construct one, so we will not be able to verify
4021 that the bug is fixed.
4023 And if we cannot understand what bug you are trying to fix, or why
4024 your patch should be an improvement, we will not install it. A
4025 test case will help us to understand.
4027 * A guess about what the bug is or what it depends on.
4029 Such guesses are usually wrong. Even we cannot guess right about
4030 such things without first using the debugger to find the facts.
4033 File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: GDB Bugs, Up: Top
4035 27 Command Line Editing
4036 ***********************
4038 This chapter describes the basic features of the GNU command line
4043 * Introduction and Notation:: Notation used in this text.
4044 * Readline Interaction:: The minimum set of commands for editing a line.
4045 * Readline Init File:: Customizing Readline from a user's view.
4046 * Bindable Readline Commands:: A description of most of the Readline commands
4047 available for binding
4048 * Readline vi Mode:: A short description of how to make Readline
4049 behave like the vi editor.
4052 File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
4054 27.1 Introduction to Line Editing
4055 =================================
4057 The following paragraphs describe the notation used to represent
4060 The text `C-k' is read as `Control-K' and describes the character
4061 produced when the <k> key is pressed while the Control key is depressed.
4063 The text `M-k' is read as `Meta-K' and describes the character
4064 produced when the Meta key (if you have one) is depressed, and the <k>
4065 key is pressed. The Meta key is labeled <ALT> on many keyboards. On
4066 keyboards with two keys labeled <ALT> (usually to either side of the
4067 space bar), the <ALT> on the left side is generally set to work as a
4068 Meta key. The <ALT> key on the right may also be configured to work as
4069 a Meta key or may be configured as some other modifier, such as a
4070 Compose key for typing accented characters.
4072 If you do not have a Meta or <ALT> key, or another key working as a
4073 Meta key, the identical keystroke can be generated by typing <ESC>
4074 _first_, and then typing <k>. Either process is known as "metafying"
4077 The text `M-C-k' is read as `Meta-Control-k' and describes the
4078 character produced by "metafying" `C-k'.
4080 In addition, several keys have their own names. Specifically,
4081 <DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves
4082 when seen in this text, or in an init file (*note Readline Init File::).
4083 If your keyboard lacks a <LFD> key, typing <C-j> will produce the
4084 desired character. The <RET> key may be labeled <Return> or <Enter> on
4088 File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
4090 27.2 Readline Interaction
4091 =========================
4093 Often during an interactive session you type in a long line of text,
4094 only to notice that the first word on the line is misspelled. The
4095 Readline library gives you a set of commands for manipulating the text
4096 as you type it in, allowing you to just fix your typo, and not forcing
4097 you to retype the majority of the line. Using these editing commands,
4098 you move the cursor to the place that needs correction, and delete or
4099 insert the text of the corrections. Then, when you are satisfied with
4100 the line, you simply press <RET>. You do not have to be at the end of
4101 the line to press <RET>; the entire line is accepted regardless of the
4102 location of the cursor within the line.
4106 * Readline Bare Essentials:: The least you need to know about Readline.
4107 * Readline Movement Commands:: Moving about the input line.
4108 * Readline Killing Commands:: How to delete text, and how to get it back!
4109 * Readline Arguments:: Giving numeric arguments to commands.
4110 * Searching:: Searching through previous lines.
4113 File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
4115 27.2.1 Readline Bare Essentials
4116 -------------------------------
4118 In order to enter characters into the line, simply type them. The typed
4119 character appears where the cursor was, and then the cursor moves one
4120 space to the right. If you mistype a character, you can use your erase
4121 character to back up and delete the mistyped character.
4123 Sometimes you may mistype a character, and not notice the error
4124 until you have typed several other characters. In that case, you can
4125 type `C-b' to move the cursor to the left, and then correct your
4126 mistake. Afterwards, you can move the cursor to the right with `C-f'.
4128 When you add text in the middle of a line, you will notice that
4129 characters to the right of the cursor are `pushed over' to make room
4130 for the text that you have inserted. Likewise, when you delete text
4131 behind the cursor, characters to the right of the cursor are `pulled
4132 back' to fill in the blank space created by the removal of the text. A
4133 list of the bare essentials for editing the text of an input line
4137 Move back one character.
4140 Move forward one character.
4142 <DEL> or <Backspace>
4143 Delete the character to the left of the cursor.
4146 Delete the character underneath the cursor.
4149 Insert the character into the line at the cursor.
4152 Undo the last editing command. You can undo all the way back to an
4155 (Depending on your configuration, the <Backspace> key be set to delete
4156 the character to the left of the cursor and the <DEL> key set to delete
4157 the character underneath the cursor, like `C-d', rather than the
4158 character to the left of the cursor.)
4161 File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
4163 27.2.2 Readline Movement Commands
4164 ---------------------------------
4166 The above table describes the most basic keystrokes that you need in
4167 order to do editing of the input line. For your convenience, many
4168 other commands have been added in addition to `C-b', `C-f', `C-d', and
4169 <DEL>. Here are some commands for moving more rapidly about the line.
4172 Move to the start of the line.
4175 Move to the end of the line.
4178 Move forward a word, where a word is composed of letters and
4182 Move backward a word.
4185 Clear the screen, reprinting the current line at the top.
4187 Notice how `C-f' moves forward a character, while `M-f' moves
4188 forward a word. It is a loose convention that control keystrokes
4189 operate on characters while meta keystrokes operate on words.
4192 File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
4194 27.2.3 Readline Killing Commands
4195 --------------------------------
4197 "Killing" text means to delete the text from the line, but to save it
4198 away for later use, usually by "yanking" (re-inserting) it back into
4199 the line. (`Cut' and `paste' are more recent jargon for `kill' and
4202 If the description for a command says that it `kills' text, then you
4203 can be sure that you can get the text back in a different (or the same)
4206 When you use a kill command, the text is saved in a "kill-ring".
4207 Any number of consecutive kills save all of the killed text together, so
4208 that when you yank it back, you get it all. The kill ring is not line
4209 specific; the text that you killed on a previously typed line is
4210 available to be yanked back later, when you are typing another line.
4212 Here is the list of commands for killing text.
4215 Kill the text from the current cursor position to the end of the
4219 Kill from the cursor to the end of the current word, or, if between
4220 words, to the end of the next word. Word boundaries are the same
4221 as those used by `M-f'.
4224 Kill from the cursor the start of the current word, or, if between
4225 words, to the start of the previous word. Word boundaries are the
4226 same as those used by `M-b'.
4229 Kill from the cursor to the previous whitespace. This is
4230 different than `M-<DEL>' because the word boundaries differ.
4233 Here is how to "yank" the text back into the line. Yanking means to
4234 copy the most-recently-killed text from the kill buffer.
4237 Yank the most recently killed text back into the buffer at the
4241 Rotate the kill-ring, and yank the new top. You can only do this
4242 if the prior command is `C-y' or `M-y'.
4245 File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
4247 27.2.4 Readline Arguments
4248 -------------------------
4250 You can pass numeric arguments to Readline commands. Sometimes the
4251 argument acts as a repeat count, other times it is the sign of the
4252 argument that is significant. If you pass a negative argument to a
4253 command which normally acts in a forward direction, that command will
4254 act in a backward direction. For example, to kill text back to the
4255 start of the line, you might type `M-- C-k'.
4257 The general way to pass numeric arguments to a command is to type
4258 meta digits before the command. If the first `digit' typed is a minus
4259 sign (`-'), then the sign of the argument will be negative. Once you
4260 have typed one meta digit to get the argument started, you can type the
4261 remainder of the digits, and then the command. For example, to give
4262 the `C-d' command an argument of 10, you could type `M-1 0 C-d', which
4263 will delete the next ten characters on the input line.
4266 File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
4268 27.2.5 Searching for Commands in the History
4269 --------------------------------------------
4271 Readline provides commands for searching through the command history
4272 for lines containing a specified string. There are two search modes:
4273 "incremental" and "non-incremental".
4275 Incremental searches begin before the user has finished typing the
4276 search string. As each character of the search string is typed,
4277 Readline displays the next entry from the history matching the string
4278 typed so far. An incremental search requires only as many characters
4279 as needed to find the desired history entry. To search backward in the
4280 history for a particular string, type `C-r'. Typing `C-s' searches
4281 forward through the history. The characters present in the value of
4282 the `isearch-terminators' variable are used to terminate an incremental
4283 search. If that variable has not been assigned a value, the <ESC> and
4284 `C-J' characters will terminate an incremental search. `C-g' will
4285 abort an incremental search and restore the original line. When the
4286 search is terminated, the history entry containing the search string
4287 becomes the current line.
4289 To find other matching entries in the history list, type `C-r' or
4290 `C-s' as appropriate. This will search backward or forward in the
4291 history for the next entry matching the search string typed so far.
4292 Any other key sequence bound to a Readline command will terminate the
4293 search and execute that command. For instance, a <RET> will terminate
4294 the search and accept the line, thereby executing the command from the
4295 history list. A movement command will terminate the search, make the
4296 last line found the current line, and begin editing.
4298 Readline remembers the last incremental search string. If two
4299 `C-r's are typed without any intervening characters defining a new
4300 search string, any remembered search string is used.
4302 Non-incremental searches read the entire search string before
4303 starting to search for matching history lines. The search string may be
4304 typed by the user or be part of the contents of the current line.
4307 File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
4309 27.3 Readline Init File
4310 =======================
4312 Although the Readline library comes with a set of Emacs-like
4313 keybindings installed by default, it is possible to use a different set
4314 of keybindings. Any user can customize programs that use Readline by
4315 putting commands in an "inputrc" file, conventionally in his home
4316 directory. The name of this file is taken from the value of the
4317 environment variable `INPUTRC'. If that variable is unset, the default
4320 When a program which uses the Readline library starts up, the init
4321 file is read, and the key bindings are set.
4323 In addition, the `C-x C-r' command re-reads this init file, thus
4324 incorporating any changes that you might have made to it.
4328 * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
4330 * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
4332 * Sample Init File:: An example inputrc file.
4335 File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
4337 27.3.1 Readline Init File Syntax
4338 --------------------------------
4340 There are only a few basic constructs allowed in the Readline init
4341 file. Blank lines are ignored. Lines beginning with a `#' are
4342 comments. Lines beginning with a `$' indicate conditional constructs
4343 (*note Conditional Init Constructs::). Other lines denote variable
4344 settings and key bindings.
4347 You can modify the run-time behavior of Readline by altering the
4348 values of variables in Readline using the `set' command within the
4349 init file. The syntax is simple:
4353 Here, for example, is how to change from the default Emacs-like
4354 key binding to use `vi' line editing commands:
4358 Variable names and values, where appropriate, are recognized
4359 without regard to case. Unrecognized variable names are ignored.
4361 Boolean variables (those that can be set to on or off) are set to
4362 on if the value is null or empty, ON (case-insensitive), or 1.
4363 Any other value results in the variable being set to off.
4365 A great deal of run-time behavior is changeable with the following
4369 Controls what happens when Readline wants to ring the
4370 terminal bell. If set to `none', Readline never rings the
4371 bell. If set to `visible', Readline uses a visible bell if
4372 one is available. If set to `audible' (the default),
4373 Readline attempts to ring the terminal's bell.
4375 `bind-tty-special-chars'
4376 If set to `on', Readline attempts to bind the control
4377 characters treated specially by the kernel's terminal driver
4378 to their Readline equivalents.
4381 The string to insert at the beginning of the line when the
4382 `insert-comment' command is executed. The default value is
4385 `completion-ignore-case'
4386 If set to `on', Readline performs filename matching and
4387 completion in a case-insensitive fashion. The default value
4390 `completion-query-items'
4391 The number of possible completions that determines when the
4392 user is asked whether the list of possibilities should be
4393 displayed. If the number of possible completions is greater
4394 than this value, Readline will ask the user whether or not he
4395 wishes to view them; otherwise, they are simply listed. This
4396 variable must be set to an integer value greater than or
4397 equal to 0. A negative value means Readline should never ask.
4398 The default limit is `100'.
4401 If set to `on', Readline will convert characters with the
4402 eighth bit set to an ASCII key sequence by stripping the
4403 eighth bit and prefixing an <ESC> character, converting them
4404 to a meta-prefixed key sequence. The default value is `on'.
4406 `disable-completion'
4407 If set to `On', Readline will inhibit word completion.
4408 Completion characters will be inserted into the line as if
4409 they had been mapped to `self-insert'. The default is `off'.
4412 The `editing-mode' variable controls which default set of key
4413 bindings is used. By default, Readline starts up in Emacs
4414 editing mode, where the keystrokes are most similar to Emacs.
4415 This variable can be set to either `emacs' or `vi'.
4418 When set to `on', Readline will try to enable the application
4419 keypad when it is called. Some systems need this to enable
4420 the arrow keys. The default is `off'.
4423 If set to `on', tilde expansion is performed when Readline
4424 attempts word completion. The default is `off'.
4426 `history-preserve-point'
4427 If set to `on', the history code attempts to place point at
4428 the same location on each history line retrieved with
4429 `previous-history' or `next-history'. The default is `off'.
4431 `horizontal-scroll-mode'
4432 This variable can be set to either `on' or `off'. Setting it
4433 to `on' means that the text of the lines being edited will
4434 scroll horizontally on a single screen line when they are
4435 longer than the width of the screen, instead of wrapping onto
4436 a new screen line. By default, this variable is set to `off'.
4439 If set to `on', Readline will enable eight-bit input (it will
4440 not clear the eighth bit in the characters it reads),
4441 regardless of what the terminal claims it can support. The
4442 default value is `off'. The name `meta-flag' is a synonym
4445 `isearch-terminators'
4446 The string of characters that should terminate an incremental
4447 search without subsequently executing the character as a
4448 command (*note Searching::). If this variable has not been
4449 given a value, the characters <ESC> and `C-J' will terminate
4450 an incremental search.
4453 Sets Readline's idea of the current keymap for key binding
4454 commands. Acceptable `keymap' names are `emacs',
4455 `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move',
4456 `vi-command', and `vi-insert'. `vi' is equivalent to
4457 `vi-command'; `emacs' is equivalent to `emacs-standard'. The
4458 default value is `emacs'. The value of the `editing-mode'
4459 variable also affects the default keymap.
4462 If set to `on', completed directory names have a slash
4463 appended. The default is `on'.
4465 `mark-modified-lines'
4466 This variable, when set to `on', causes Readline to display an
4467 asterisk (`*') at the start of history lines which have been
4468 modified. This variable is `off' by default.
4470 `mark-symlinked-directories'
4471 If set to `on', completed names which are symbolic links to
4472 directories have a slash appended (subject to the value of
4473 `mark-directories'). The default is `off'.
4475 `match-hidden-files'
4476 This variable, when set to `on', causes Readline to match
4477 files whose names begin with a `.' (hidden files) when
4478 performing filename completion, unless the leading `.' is
4479 supplied by the user in the filename to be completed. This
4480 variable is `on' by default.
4483 If set to `on', Readline will display characters with the
4484 eighth bit set directly rather than as a meta-prefixed escape
4485 sequence. The default is `off'.
4488 If set to `on', Readline uses an internal `more'-like pager
4489 to display a screenful of possible completions at a time.
4490 This variable is `on' by default.
4492 `print-completions-horizontally'
4493 If set to `on', Readline will display completions with matches
4494 sorted horizontally in alphabetical order, rather than down
4495 the screen. The default is `off'.
4497 `show-all-if-ambiguous'
4498 This alters the default behavior of the completion functions.
4499 If set to `on', words which have more than one possible
4500 completion cause the matches to be listed immediately instead
4501 of ringing the bell. The default value is `off'.
4503 `show-all-if-unmodified'
4504 This alters the default behavior of the completion functions
4505 in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to
4506 `on', words which have more than one possible completion
4507 without any possible partial completion (the possible
4508 completions don't share a common prefix) cause the matches to
4509 be listed immediately instead of ringing the bell. The
4510 default value is `off'.
4513 If set to `on', a character denoting a file's type is
4514 appended to the filename when listing possible completions.
4515 The default is `off'.
4519 The syntax for controlling key bindings in the init file is
4520 simple. First you need to find the name of the command that you
4521 want to change. The following sections contain tables of the
4522 command name, the default keybinding, if any, and a short
4523 description of what the command does.
4525 Once you know the name of the command, simply place on a line in
4526 the init file the name of the key you wish to bind the command to,
4527 a colon, and then the name of the command. The name of the key
4528 can be expressed in different ways, depending on what you find most
4531 In addition to command names, readline allows keys to be bound to
4532 a string that is inserted when the key is pressed (a MACRO).
4534 KEYNAME: FUNCTION-NAME or MACRO
4535 KEYNAME is the name of a key spelled out in English. For
4537 Control-u: universal-argument
4538 Meta-Rubout: backward-kill-word
4539 Control-o: "> output"
4541 In the above example, `C-u' is bound to the function
4542 `universal-argument', `M-DEL' is bound to the function
4543 `backward-kill-word', and `C-o' is bound to run the macro
4544 expressed on the right hand side (that is, to insert the text
4545 `> output' into the line).
4547 A number of symbolic character names are recognized while
4548 processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
4549 NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
4551 "KEYSEQ": FUNCTION-NAME or MACRO
4552 KEYSEQ differs from KEYNAME above in that strings denoting an
4553 entire key sequence can be specified, by placing the key
4554 sequence in double quotes. Some GNU Emacs style key escapes
4555 can be used, as in the following example, but the special
4556 character names are not recognized.
4558 "\C-u": universal-argument
4559 "\C-x\C-r": re-read-init-file
4560 "\e[11~": "Function Key 1"
4562 In the above example, `C-u' is again bound to the function
4563 `universal-argument' (just as it was in the first example),
4564 `C-x C-r' is bound to the function `re-read-init-file', and
4565 `<ESC> <[> <1> <1> <~>' is bound to insert the text `Function
4569 The following GNU Emacs style escape sequences are available when
4570 specifying key sequences:
4585 <">, a double quotation mark
4588 <'>, a single quote or apostrophe
4590 In addition to the GNU Emacs style escape sequences, a second set
4591 of backslash escapes is available:
4618 the eight-bit character whose value is the octal value NNN
4619 (one to three digits)
4622 the eight-bit character whose value is the hexadecimal value
4623 HH (one or two hex digits)
4625 When entering the text of a macro, single or double quotes must be
4626 used to indicate a macro definition. Unquoted text is assumed to
4627 be a function name. In the macro body, the backslash escapes
4628 described above are expanded. Backslash will quote any other
4629 character in the macro text, including `"' and `''. For example,
4630 the following binding will make `C-x \' insert a single `\' into
4636 File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
4638 27.3.2 Conditional Init Constructs
4639 ----------------------------------
4641 Readline implements a facility similar in spirit to the conditional
4642 compilation features of the C preprocessor which allows key bindings
4643 and variable settings to be performed as the result of tests. There
4644 are four parser directives used.
4647 The `$if' construct allows bindings to be made based on the
4648 editing mode, the terminal being used, or the application using
4649 Readline. The text of the test extends to the end of the line; no
4650 characters are required to isolate it.
4653 The `mode=' form of the `$if' directive is used to test
4654 whether Readline is in `emacs' or `vi' mode. This may be
4655 used in conjunction with the `set keymap' command, for
4656 instance, to set bindings in the `emacs-standard' and
4657 `emacs-ctlx' keymaps only if Readline is starting out in
4661 The `term=' form may be used to include terminal-specific key
4662 bindings, perhaps to bind the key sequences output by the
4663 terminal's function keys. The word on the right side of the
4664 `=' is tested against both the full name of the terminal and
4665 the portion of the terminal name before the first `-'. This
4666 allows `sun' to match both `sun' and `sun-cmd', for instance.
4669 The APPLICATION construct is used to include
4670 application-specific settings. Each program using the
4671 Readline library sets the APPLICATION NAME, and you can test
4672 for a particular value. This could be used to bind key
4673 sequences to functions useful for a specific program. For
4674 instance, the following command adds a key sequence that
4675 quotes the current or previous word in Bash:
4677 # Quote the current or previous word
4678 "\C-xq": "\eb\"\ef\""
4682 This command, as seen in the previous example, terminates an `$if'
4686 Commands in this branch of the `$if' directive are executed if the
4690 This directive takes a single filename as an argument and reads
4691 commands and bindings from that file. For example, the following
4692 directive reads from `/etc/inputrc':
4693 $include /etc/inputrc
4696 File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
4698 27.3.3 Sample Init File
4699 -----------------------
4701 Here is an example of an INPUTRC file. This illustrates key binding,
4702 variable assignment, and conditional syntax.
4705 # This file controls the behaviour of line input editing for
4706 # programs that use the GNU Readline library. Existing
4707 # programs include FTP, Bash, and GDB.
4709 # You can re-read the inputrc file with C-x C-r.
4710 # Lines beginning with '#' are comments.
4712 # First, include any systemwide bindings and variable
4713 # assignments from /etc/Inputrc
4714 $include /etc/Inputrc
4717 # Set various bindings for emacs mode.
4719 set editing-mode emacs
4723 Meta-Control-h: backward-kill-word Text after the function name is ignored
4726 # Arrow keys in keypad mode
4728 #"\M-OD": backward-char
4729 #"\M-OC": forward-char
4730 #"\M-OA": previous-history
4731 #"\M-OB": next-history
4733 # Arrow keys in ANSI mode
4735 "\M-[D": backward-char
4736 "\M-[C": forward-char
4737 "\M-[A": previous-history
4738 "\M-[B": next-history
4740 # Arrow keys in 8 bit keypad mode
4742 #"\M-\C-OD": backward-char
4743 #"\M-\C-OC": forward-char
4744 #"\M-\C-OA": previous-history
4745 #"\M-\C-OB": next-history
4747 # Arrow keys in 8 bit ANSI mode
4749 #"\M-\C-[D": backward-char
4750 #"\M-\C-[C": forward-char
4751 #"\M-\C-[A": previous-history
4752 #"\M-\C-[B": next-history
4758 # An old-style binding. This happens to be the default.
4761 # Macros that are convenient for shell interaction
4764 "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
4765 # prepare to type a quoted word --
4766 # insert open and close double quotes
4767 # and move to just after the open quote
4768 "\C-x\"": "\"\"\C-b"
4769 # insert a backslash (testing backslash escapes
4770 # in sequences and macros)
4772 # Quote the current or previous word
4773 "\C-xq": "\eb\"\ef\""
4774 # Add a binding to refresh the line, which is unbound
4775 "\C-xr": redraw-current-line
4776 # Edit variable on current line.
4777 "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
4780 # use a visible bell if one is available
4781 set bell-style visible
4783 # don't strip characters to 7 bits when reading
4786 # allow iso-latin1 characters to be inserted rather
4787 # than converted to prefix-meta sequences
4788 set convert-meta off
4790 # display characters with the eighth bit set directly
4791 # rather than as meta-prefixed characters
4794 # if there are more than 150 possible completions for
4795 # a word, ask the user if he wants to see all of them
4796 set completion-query-items 150
4802 "\M-.": yank-last-arg
4806 File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
4808 27.4 Bindable Readline Commands
4809 ===============================
4813 * Commands For Moving:: Moving about the line.
4814 * Commands For History:: Getting at previous lines.
4815 * Commands For Text:: Commands for changing text.
4816 * Commands For Killing:: Commands for killing and yanking.
4817 * Numeric Arguments:: Specifying numeric arguments, repeat counts.
4818 * Commands For Completion:: Getting Readline to do the typing for you.
4819 * Keyboard Macros:: Saving and re-executing typed characters
4820 * Miscellaneous Commands:: Other miscellaneous commands.
4822 This section describes Readline commands that may be bound to key
4823 sequences. Command names without an accompanying key sequence are
4826 In the following descriptions, "point" refers to the current cursor
4827 position, and "mark" refers to a cursor position saved by the
4828 `set-mark' command. The text between the point and mark is referred to
4832 File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
4834 27.4.1 Commands For Moving
4835 --------------------------
4837 `beginning-of-line (C-a)'
4838 Move to the start of the current line.
4841 Move to the end of the line.
4843 `forward-char (C-f)'
4844 Move forward a character.
4846 `backward-char (C-b)'
4847 Move back a character.
4849 `forward-word (M-f)'
4850 Move forward to the end of the next word. Words are composed of
4853 `backward-word (M-b)'
4854 Move back to the start of the current or previous word. Words are
4855 composed of letters and digits.
4857 `clear-screen (C-l)'
4858 Clear the screen and redraw the current line, leaving the current
4859 line at the top of the screen.
4861 `redraw-current-line ()'
4862 Refresh the current line. By default, this is unbound.
4866 File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
4868 27.4.2 Commands For Manipulating The History
4869 --------------------------------------------
4871 `accept-line (Newline or Return)'
4872 Accept the line regardless of where the cursor is. If this line is
4873 non-empty, it may be added to the history list for future recall
4874 with `add_history()'. If this line is a modified history line,
4875 the history line is restored to its original state.
4877 `previous-history (C-p)'
4878 Move `back' through the history list, fetching the previous
4881 `next-history (C-n)'
4882 Move `forward' through the history list, fetching the next command.
4884 `beginning-of-history (M-<)'
4885 Move to the first line in the history.
4887 `end-of-history (M->)'
4888 Move to the end of the input history, i.e., the line currently
4891 `reverse-search-history (C-r)'
4892 Search backward starting at the current line and moving `up'
4893 through the history as necessary. This is an incremental search.
4895 `forward-search-history (C-s)'
4896 Search forward starting at the current line and moving `down'
4897 through the the history as necessary. This is an incremental
4900 `non-incremental-reverse-search-history (M-p)'
4901 Search backward starting at the current line and moving `up'
4902 through the history as necessary using a non-incremental search
4903 for a string supplied by the user.
4905 `non-incremental-forward-search-history (M-n)'
4906 Search forward starting at the current line and moving `down'
4907 through the the history as necessary using a non-incremental search
4908 for a string supplied by the user.
4910 `history-search-forward ()'
4911 Search forward through the history for the string of characters
4912 between the start of the current line and the point. This is a
4913 non-incremental search. By default, this command is unbound.
4915 `history-search-backward ()'
4916 Search backward through the history for the string of characters
4917 between the start of the current line and the point. This is a
4918 non-incremental search. By default, this command is unbound.
4920 `yank-nth-arg (M-C-y)'
4921 Insert the first argument to the previous command (usually the
4922 second word on the previous line) at point. With an argument N,
4923 insert the Nth word from the previous command (the words in the
4924 previous command begin with word 0). A negative argument inserts
4925 the Nth word from the end of the previous command. Once the
4926 argument N is computed, the argument is extracted as if the `!N'
4927 history expansion had been specified.
4929 `yank-last-arg (M-. or M-_)'
4930 Insert last argument to the previous command (the last word of the
4931 previous history entry). With an argument, behave exactly like
4932 `yank-nth-arg'. Successive calls to `yank-last-arg' move back
4933 through the history list, inserting the last argument of each line
4934 in turn. The history expansion facilities are used to extract the
4935 last argument, as if the `!$' history expansion had been specified.
4939 File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
4941 27.4.3 Commands For Changing Text
4942 ---------------------------------
4945 Delete the character at point. If point is at the beginning of
4946 the line, there are no characters in the line, and the last
4947 character typed was not bound to `delete-char', then return EOF.
4949 `backward-delete-char (Rubout)'
4950 Delete the character behind the cursor. A numeric argument means
4951 to kill the characters instead of deleting them.
4953 `forward-backward-delete-char ()'
4954 Delete the character under the cursor, unless the cursor is at the
4955 end of the line, in which case the character behind the cursor is
4956 deleted. By default, this is not bound to a key.
4958 `quoted-insert (C-q or C-v)'
4959 Add the next character typed to the line verbatim. This is how to
4960 insert key sequences like `C-q', for example.
4962 `tab-insert (M-<TAB>)'
4963 Insert a tab character.
4965 `self-insert (a, b, A, 1, !, ...)'
4968 `transpose-chars (C-t)'
4969 Drag the character before the cursor forward over the character at
4970 the cursor, moving the cursor forward as well. If the insertion
4971 point is at the end of the line, then this transposes the last two
4972 characters of the line. Negative arguments have no effect.
4974 `transpose-words (M-t)'
4975 Drag the word before point past the word after point, moving point
4976 past that word as well. If the insertion point is at the end of
4977 the line, this transposes the last two words on the line.
4980 Uppercase the current (or following) word. With a negative
4981 argument, uppercase the previous word, but do not move the cursor.
4983 `downcase-word (M-l)'
4984 Lowercase the current (or following) word. With a negative
4985 argument, lowercase the previous word, but do not move the cursor.
4987 `capitalize-word (M-c)'
4988 Capitalize the current (or following) word. With a negative
4989 argument, capitalize the previous word, but do not move the cursor.
4992 Toggle overwrite mode. With an explicit positive numeric argument,
4993 switches to overwrite mode. With an explicit non-positive numeric
4994 argument, switches to insert mode. This command affects only
4995 `emacs' mode; `vi' mode does overwrite differently. Each call to
4996 `readline()' starts in insert mode.
4998 In overwrite mode, characters bound to `self-insert' replace the
4999 text at point rather than pushing the text to the right.
5000 Characters bound to `backward-delete-char' replace the character
5001 before point with a space.
5003 By default, this command is unbound.
5007 File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
5009 27.4.4 Killing And Yanking
5010 --------------------------
5013 Kill the text from point to the end of the line.
5015 `backward-kill-line (C-x Rubout)'
5016 Kill backward to the beginning of the line.
5018 `unix-line-discard (C-u)'
5019 Kill backward from the cursor to the beginning of the current line.
5021 `kill-whole-line ()'
5022 Kill all characters on the current line, no matter where point is.
5023 By default, this is unbound.
5026 Kill from point to the end of the current word, or if between
5027 words, to the end of the next word. Word boundaries are the same
5030 `backward-kill-word (M-<DEL>)'
5031 Kill the word behind point. Word boundaries are the same as
5034 `unix-word-rubout (C-w)'
5035 Kill the word behind point, using white space as a word boundary.
5036 The killed text is saved on the kill-ring.
5038 `unix-filename-rubout ()'
5039 Kill the word behind point, using white space and the slash
5040 character as the word boundaries. The killed text is saved on the
5043 `delete-horizontal-space ()'
5044 Delete all spaces and tabs around point. By default, this is
5048 Kill the text in the current region. By default, this command is
5051 `copy-region-as-kill ()'
5052 Copy the text in the region to the kill buffer, so it can be yanked
5053 right away. By default, this command is unbound.
5055 `copy-backward-word ()'
5056 Copy the word before point to the kill buffer. The word
5057 boundaries are the same as `backward-word'. By default, this
5060 `copy-forward-word ()'
5061 Copy the word following point to the kill buffer. The word
5062 boundaries are the same as `forward-word'. By default, this
5066 Yank the top of the kill ring into the buffer at point.
5069 Rotate the kill-ring, and yank the new top. You can only do this
5070 if the prior command is `yank' or `yank-pop'.
5073 File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
5075 27.4.5 Specifying Numeric Arguments
5076 -----------------------------------
5078 `digit-argument (M-0, M-1, ... M--)'
5079 Add this digit to the argument already accumulating, or start a new
5080 argument. `M--' starts a negative argument.
5082 `universal-argument ()'
5083 This is another way to specify an argument. If this command is
5084 followed by one or more digits, optionally with a leading minus
5085 sign, those digits define the argument. If the command is
5086 followed by digits, executing `universal-argument' again ends the
5087 numeric argument, but is otherwise ignored. As a special case, if
5088 this command is immediately followed by a character that is
5089 neither a digit or minus sign, the argument count for the next
5090 command is multiplied by four. The argument count is initially
5091 one, so executing this function the first time makes the argument
5092 count four, a second time makes the argument count sixteen, and so
5093 on. By default, this is not bound to a key.
5096 File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
5098 27.4.6 Letting Readline Type For You
5099 ------------------------------------
5102 Attempt to perform completion on the text before point. The
5103 actual completion performed is application-specific. The default
5104 is filename completion.
5106 `possible-completions (M-?)'
5107 List the possible completions of the text before point.
5109 `insert-completions (M-*)'
5110 Insert all completions of the text before point that would have
5111 been generated by `possible-completions'.
5114 Similar to `complete', but replaces the word to be completed with
5115 a single match from the list of possible completions. Repeated
5116 execution of `menu-complete' steps through the list of possible
5117 completions, inserting each match in turn. At the end of the list
5118 of completions, the bell is rung (subject to the setting of
5119 `bell-style') and the original text is restored. An argument of N
5120 moves N positions forward in the list of matches; a negative
5121 argument may be used to move backward through the list. This
5122 command is intended to be bound to <TAB>, but is unbound by
5125 `delete-char-or-list ()'
5126 Deletes the character under the cursor if not at the beginning or
5127 end of the line (like `delete-char'). If at the end of the line,
5128 behaves identically to `possible-completions'. This command is
5133 File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
5135 27.4.7 Keyboard Macros
5136 ----------------------
5138 `start-kbd-macro (C-x ()'
5139 Begin saving the characters typed into the current keyboard macro.
5141 `end-kbd-macro (C-x ))'
5142 Stop saving the characters typed into the current keyboard macro
5143 and save the definition.
5145 `call-last-kbd-macro (C-x e)'
5146 Re-execute the last keyboard macro defined, by making the
5147 characters in the macro appear as if typed at the keyboard.
5151 File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
5153 27.4.8 Some Miscellaneous Commands
5154 ----------------------------------
5156 `re-read-init-file (C-x C-r)'
5157 Read in the contents of the INPUTRC file, and incorporate any
5158 bindings or variable assignments found there.
5161 Abort the current editing command and ring the terminal's bell
5162 (subject to the setting of `bell-style').
5164 `do-uppercase-version (M-a, M-b, M-X, ...)'
5165 If the metafied character X is lowercase, run the command that is
5166 bound to the corresponding uppercase character.
5168 `prefix-meta (<ESC>)'
5169 Metafy the next character typed. This is for keyboards without a
5170 meta key. Typing `<ESC> f' is equivalent to typing `M-f'.
5172 `undo (C-_ or C-x C-u)'
5173 Incremental undo, separately remembered for each line.
5176 Undo all changes made to this line. This is like executing the
5177 `undo' command enough times to get back to the beginning.
5179 `tilde-expand (M-~)'
5180 Perform tilde expansion on the current word.
5183 Set the mark to the point. If a numeric argument is supplied, the
5184 mark is set to that position.
5186 `exchange-point-and-mark (C-x C-x)'
5187 Swap the point with the mark. The current cursor position is set
5188 to the saved position, and the old cursor position is saved as the
5191 `character-search (C-])'
5192 A character is read and point is moved to the next occurrence of
5193 that character. A negative count searches for previous
5196 `character-search-backward (M-C-])'
5197 A character is read and point is moved to the previous occurrence
5198 of that character. A negative count searches for subsequent
5201 `insert-comment (M-#)'
5202 Without a numeric argument, the value of the `comment-begin'
5203 variable is inserted at the beginning of the current line. If a
5204 numeric argument is supplied, this command acts as a toggle: if
5205 the characters at the beginning of the line do not match the value
5206 of `comment-begin', the value is inserted, otherwise the
5207 characters in `comment-begin' are deleted from the beginning of
5208 the line. In either case, the line is accepted as if a newline
5212 Print all of the functions and their key bindings to the Readline
5213 output stream. If a numeric argument is supplied, the output is
5214 formatted in such a way that it can be made part of an INPUTRC
5215 file. This command is unbound by default.
5218 Print all of the settable variables and their values to the
5219 Readline output stream. If a numeric argument is supplied, the
5220 output is formatted in such a way that it can be made part of an
5221 INPUTRC file. This command is unbound by default.
5224 Print all of the Readline key sequences bound to macros and the
5225 strings they output. If a numeric argument is supplied, the
5226 output is formatted in such a way that it can be made part of an
5227 INPUTRC file. This command is unbound by default.
5229 `emacs-editing-mode (C-e)'
5230 When in `vi' command mode, this causes a switch to `emacs' editing
5233 `vi-editing-mode (M-C-j)'
5234 When in `emacs' editing mode, this causes a switch to `vi' editing
5239 File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
5241 27.5 Readline vi Mode
5242 =====================
5244 While the Readline library does not have a full set of `vi' editing
5245 functions, it does contain enough to allow simple editing of the line.
5246 The Readline `vi' mode behaves as specified in the POSIX 1003.2
5249 In order to switch interactively between `emacs' and `vi' editing
5250 modes, use the command `M-C-j' (bound to emacs-editing-mode when in
5251 `vi' mode and to vi-editing-mode in `emacs' mode). The Readline
5252 default is `emacs' mode.
5254 When you enter a line in `vi' mode, you are already placed in
5255 `insertion' mode, as if you had typed an `i'. Pressing <ESC> switches
5256 you into `command' mode, where you can edit the text of the line with
5257 the standard `vi' movement keys, move to previous history lines with
5258 `k' and subsequent lines with `j', and so forth.
5261 File: gdb.info, Node: Using History Interactively, Next: Formatting Documentation, Prev: Command Line Editing, Up: Top
5263 28 Using History Interactively
5264 ******************************
5266 This chapter describes how to use the GNU History Library interactively,
5267 from a user's standpoint. It should be considered a user's guide. For
5268 information on using the GNU History Library in other programs, see the
5269 GNU Readline Library Manual.
5273 * History Interaction:: What it feels like using History as a user.
5276 File: gdb.info, Node: History Interaction, Up: Using History Interactively
5278 28.1 History Expansion
5279 ======================
5281 The History library provides a history expansion feature that is similar
5282 to the history expansion provided by `csh'. This section describes the
5283 syntax used to manipulate the history information.
5285 History expansions introduce words from the history list into the
5286 input stream, making it easy to repeat commands, insert the arguments
5287 to a previous command into the current input line, or fix errors in
5288 previous commands quickly.
5290 History expansion takes place in two parts. The first is to
5291 determine which line from the history list should be used during
5292 substitution. The second is to select portions of that line for
5293 inclusion into the current one. The line selected from the history is
5294 called the "event", and the portions of that line that are acted upon
5295 are called "words". Various "modifiers" are available to manipulate
5296 the selected words. The line is broken into words in the same fashion
5297 that Bash does, so that several words surrounded by quotes are
5298 considered one word. History expansions are introduced by the
5299 appearance of the history expansion character, which is `!' by default.
5303 * Event Designators:: How to specify which history line to use.
5304 * Word Designators:: Specifying which words are of interest.
5305 * Modifiers:: Modifying the results of substitution.
5308 File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
5310 28.1.1 Event Designators
5311 ------------------------
5313 An event designator is a reference to a command line entry in the
5317 Start a history substitution, except when followed by a space, tab,
5318 the end of the line, or `='.
5321 Refer to command line N.
5324 Refer to the command N lines back.
5327 Refer to the previous command. This is a synonym for `!-1'.
5330 Refer to the most recent command starting with STRING.
5333 Refer to the most recent command containing STRING. The trailing
5334 `?' may be omitted if the STRING is followed immediately by a
5338 Quick Substitution. Repeat the last command, replacing STRING1
5339 with STRING2. Equivalent to `!!:s/STRING1/STRING2/'.
5342 The entire command line typed so far.
5346 File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
5348 28.1.2 Word Designators
5349 -----------------------
5351 Word designators are used to select desired words from the event. A
5352 `:' separates the event specification from the word designator. It may
5353 be omitted if the word designator begins with a `^', `$', `*', `-', or
5354 `%'. Words are numbered from the beginning of the line, with the first
5355 word being denoted by 0 (zero). Words are inserted into the current
5356 line separated by single spaces.
5361 designates the preceding command. When you type this, the
5362 preceding command is repeated in toto.
5365 designates the last argument of the preceding command. This may be
5369 designates the second argument of the most recent command starting
5370 with the letters `fi'.
5372 Here are the word designators:
5375 The `0'th word. For many applications, this is the command word.
5381 The first argument; that is, word 1.
5387 The word matched by the most recent `?STRING?' search.
5390 A range of words; `-Y' abbreviates `0-Y'.
5393 All of the words, except the `0'th. This is a synonym for `1-$'.
5394 It is not an error to use `*' if there is just one word in the
5395 event; the empty string is returned in that case.
5401 Abbreviates `X-$' like `X*', but omits the last word.
5404 If a word designator is supplied without an event specification, the
5405 previous command is used as the event.
5408 File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
5413 After the optional word designator, you can add a sequence of one or
5414 more of the following modifiers, each preceded by a `:'.
5417 Remove a trailing pathname component, leaving only the head.
5420 Remove all leading pathname components, leaving the tail.
5423 Remove a trailing suffix of the form `.SUFFIX', leaving the
5427 Remove all but the trailing suffix.
5430 Print the new command but do not execute it.
5433 Substitute NEW for the first occurrence of OLD in the event line.
5434 Any delimiter may be used in place of `/'. The delimiter may be
5435 quoted in OLD and NEW with a single backslash. If `&' appears in
5436 NEW, it is replaced by OLD. A single backslash will quote the
5437 `&'. The final delimiter is optional if it is the last character
5441 Repeat the previous substitution.
5445 Cause changes to be applied over the entire event line. Used in
5446 conjunction with `s', as in `gs/OLD/NEW/', or with `&'.
5449 Apply the following `s' modifier once to each word in the event.
5453 File: gdb.info, Node: Formatting Documentation, Next: Installing GDB, Prev: Using History Interactively, Up: Top
5455 Appendix A Formatting Documentation
5456 ***********************************
5458 The GDB 4 release includes an already-formatted reference card, ready
5459 for printing with PostScript or Ghostscript, in the `gdb' subdirectory
5460 of the main source directory(1). If you can use PostScript or
5461 Ghostscript with your printer, you can print the reference card
5462 immediately with `refcard.ps'.
5464 The release also includes the source for the reference card. You
5465 can format it, using TeX, by typing:
5469 The GDB reference card is designed to print in "landscape" mode on
5470 US "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
5471 high. You will need to specify this form of printing as an option to
5472 your DVI output program.
5474 All the documentation for GDB comes as part of the machine-readable
5475 distribution. The documentation is written in Texinfo format, which is
5476 a documentation system that uses a single source file to produce both
5477 on-line information and a printed manual. You can use one of the Info
5478 formatting commands to create the on-line version of the documentation
5479 and TeX (or `texi2roff') to typeset the printed version.
5481 GDB includes an already formatted copy of the on-line Info version
5482 of this manual in the `gdb' subdirectory. The main Info file is
5483 `gdb-6.8/gdb/gdb.info', and it refers to subordinate files matching
5484 `gdb.info*' in the same directory. If necessary, you can print out
5485 these files, or read them with any editor; but they are easier to read
5486 using the `info' subsystem in GNU Emacs or the standalone `info'
5487 program, available as part of the GNU Texinfo distribution.
5489 If you want to format these Info files yourself, you need one of the
5490 Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
5492 If you have `makeinfo' installed, and are in the top level GDB
5493 source directory (`gdb-6.8', in the case of version 6.8), you can make
5494 the Info file by typing:
5499 If you want to typeset and print copies of this manual, you need TeX,
5500 a program to print its DVI output files, and `texinfo.tex', the Texinfo
5503 TeX is a typesetting program; it does not print files directly, but
5504 produces output files called DVI files. To print a typeset document,
5505 you need a program to print DVI files. If your system has TeX
5506 installed, chances are it has such a program. The precise command to
5507 use depends on your system; `lpr -d' is common; another (for PostScript
5508 devices) is `dvips'. The DVI print command may require a file name
5509 without any extension or a `.dvi' extension.
5511 TeX also requires a macro definitions file called `texinfo.tex'.
5512 This file tells TeX how to typeset a document written in Texinfo
5513 format. On its own, TeX cannot either read or typeset a Texinfo file.
5514 `texinfo.tex' is distributed with GDB and is located in the
5515 `gdb-VERSION-NUMBER/texinfo' directory.
5517 If you have TeX and a DVI printer program installed, you can typeset
5518 and print this manual. First switch to the `gdb' subdirectory of the
5519 main source directory (for example, to `gdb-6.8/gdb') and type:
5523 Then give `gdb.dvi' to your DVI printing program.
5525 ---------- Footnotes ----------
5527 (1) In `gdb-6.8/gdb/refcard.ps' of the version 6.8 release.
5530 File: gdb.info, Node: Installing GDB, Next: Maintenance Commands, Prev: Formatting Documentation, Up: Top
5532 Appendix B Installing GDB
5533 *************************
5537 * Requirements:: Requirements for building GDB
5538 * Running Configure:: Invoking the GDB `configure' script
5539 * Separate Objdir:: Compiling GDB in another directory
5540 * Config Names:: Specifying names for hosts and targets
5541 * Configure Options:: Summary of options for configure
5544 File: gdb.info, Node: Requirements, Next: Running Configure, Up: Installing GDB
5546 B.1 Requirements for Building GDB
5547 =================================
5549 Building GDB requires various tools and packages to be available.
5550 Other packages will be used only if they are found.
5552 Tools/Packages Necessary for Building GDB
5553 =========================================
5556 GDB is written in ISO C90. It should be buildable with any
5557 working C90 compiler, e.g. GCC.
5560 Tools/Packages Optional for Building GDB
5561 ========================================
5564 GDB can use the Expat XML parsing library. This library may be
5565 included with your operating system distribution; if it is not, you
5566 can get the latest version from `http://expat.sourceforge.net'.
5567 The `configure' script will search for this library in several
5568 standard locations; if it is installed in an unusual path, you can
5569 use the `--with-libexpat-prefix' option to specify its location.
5573 * Remote protocol memory maps (*note Memory Map Format::)
5575 * Target descriptions (*note Target Descriptions::)
5577 * Remote shared library lists (*note Library List Format::)
5579 * MS-Windows shared libraries (*note Shared Libraries::)
5583 File: gdb.info, Node: Running Configure, Next: Separate Objdir, Prev: Requirements, Up: Installing GDB
5585 B.2 Invoking the GDB `configure' Script
5586 =======================================
5588 GDB comes with a `configure' script that automates the process of
5589 preparing GDB for installation; you can then use `make' to build the
5592 The GDB distribution includes all the source code you need for GDB
5593 in a single directory, whose name is usually composed by appending the
5594 version number to `gdb'.
5596 For example, the GDB version 6.8 distribution is in the `gdb-6.8'
5597 directory. That directory contains:
5599 `gdb-6.8/configure (and supporting files)'
5600 script for configuring GDB and all its supporting libraries
5603 the source specific to GDB itself
5606 source for the Binary File Descriptor library
5612 source for the `-liberty' free software library
5615 source for the library of opcode tables and disassemblers
5618 source for the GNU command-line interface
5621 source for the GNU filename pattern-matching subroutine
5624 source for the GNU memory-mapped malloc package
5626 The simplest way to configure and build GDB is to run `configure'
5627 from the `gdb-VERSION-NUMBER' source directory, which in this example
5628 is the `gdb-6.8' directory.
5630 First switch to the `gdb-VERSION-NUMBER' source directory if you are
5631 not already in it; then run `configure'. Pass the identifier for the
5632 platform on which GDB will run as an argument.
5640 where HOST is an identifier such as `sun4' or `decstation', that
5641 identifies the platform where GDB will run. (You can often leave off
5642 HOST; `configure' tries to guess the correct value by examining your
5645 Running `configure HOST' and then running `make' builds the `bfd',
5646 `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
5647 The configured source files, and the binaries, are left in the
5648 corresponding source directories.
5650 `configure' is a Bourne-shell (`/bin/sh') script; if your system
5651 does not recognize this automatically when you run a different shell,
5652 you may need to run `sh' on it explicitly:
5656 If you run `configure' from a directory that contains source
5657 directories for multiple libraries or programs, such as the `gdb-6.8'
5658 source directory for version 6.8, `configure' creates configuration
5659 files for every directory level underneath (unless you tell it not to,
5660 with the `--norecursion' option).
5662 You should run the `configure' script from the top directory in the
5663 source tree, the `gdb-VERSION-NUMBER' directory. If you run
5664 `configure' from one of the subdirectories, you will configure only
5665 that subdirectory. That is usually not what you want. In particular,
5666 if you run the first `configure' from the `gdb' subdirectory of the
5667 `gdb-VERSION-NUMBER' directory, you will omit the configuration of
5668 `bfd', `readline', and other sibling directories of the `gdb'
5669 subdirectory. This leads to build errors about missing include files
5670 such as `bfd/bfd.h'.
5672 You can install `gdb' anywhere; it has no hardwired paths. However,
5673 you should make sure that the shell on your path (named by the `SHELL'
5674 environment variable) is publicly readable. Remember that GDB uses the
5675 shell to start your program--some systems refuse to let GDB debug child
5676 processes whose programs are not readable.
5679 File: gdb.info, Node: Separate Objdir, Next: Config Names, Prev: Running Configure, Up: Installing GDB
5681 B.3 Compiling GDB in Another Directory
5682 ======================================
5684 If you want to run GDB versions for several host or target machines,
5685 you need a different `gdb' compiled for each combination of host and
5686 target. `configure' is designed to make this easy by allowing you to
5687 generate each configuration in a separate subdirectory, rather than in
5688 the source directory. If your `make' program handles the `VPATH'
5689 feature (GNU `make' does), running `make' in each of these directories
5690 builds the `gdb' program specified there.
5692 To build `gdb' in a separate directory, run `configure' with the
5693 `--srcdir' option to specify where to find the source. (You also need
5694 to specify a path to find `configure' itself from your working
5695 directory. If the path to `configure' would be the same as the
5696 argument to `--srcdir', you can leave out the `--srcdir' option; it is
5699 For example, with version 6.8, you can build GDB in a separate
5700 directory for a Sun 4 like this:
5705 ../gdb-6.8/configure sun4
5708 When `configure' builds a configuration using a remote source
5709 directory, it creates a tree for the binaries with the same structure
5710 (and using the same names) as the tree under the source directory. In
5711 the example, you'd find the Sun 4 library `libiberty.a' in the
5712 directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
5714 Make sure that your path to the `configure' script has just one
5715 instance of `gdb' in it. If your path to `configure' looks like
5716 `../gdb-6.8/gdb/configure', you are configuring only one subdirectory
5717 of GDB, not the whole package. This leads to build errors about
5718 missing include files such as `bfd/bfd.h'.
5720 One popular reason to build several GDB configurations in separate
5721 directories is to configure GDB for cross-compiling (where GDB runs on
5722 one machine--the "host"--while debugging programs that run on another
5723 machine--the "target"). You specify a cross-debugging target by giving
5724 the `--target=TARGET' option to `configure'.
5726 When you run `make' to build a program or library, you must run it
5727 in a configured directory--whatever directory you were in when you
5728 called `configure' (or one of its subdirectories).
5730 The `Makefile' that `configure' generates in each source directory
5731 also runs recursively. If you type `make' in a source directory such
5732 as `gdb-6.8' (or in a separate configured directory configured with
5733 `--srcdir=DIRNAME/gdb-6.8'), you will build all the required libraries,
5736 When you have multiple hosts or targets configured in separate
5737 directories, you can run `make' on them in parallel (for example, if
5738 they are NFS-mounted on each of the hosts); they will not interfere
5742 File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB
5744 B.4 Specifying Names for Hosts and Targets
5745 ==========================================
5747 The specifications used for hosts and targets in the `configure' script
5748 are based on a three-part naming scheme, but some short predefined
5749 aliases are also supported. The full naming scheme encodes three pieces
5750 of information in the following pattern:
5752 ARCHITECTURE-VENDOR-OS
5754 For example, you can use the alias `sun4' as a HOST argument, or as
5755 the value for TARGET in a `--target=TARGET' option. The equivalent
5756 full name is `sparc-sun-sunos4'.
5758 The `configure' script accompanying GDB does not provide any query
5759 facility to list all supported host and target names or aliases.
5760 `configure' calls the Bourne shell script `config.sub' to map
5761 abbreviations to full names; you can read the script, if you wish, or
5762 you can use it to test your guesses on abbreviations--for example:
5764 % sh config.sub i386-linux
5766 % sh config.sub alpha-linux
5767 alpha-unknown-linux-gnu
5768 % sh config.sub hp9k700
5770 % sh config.sub sun4
5771 sparc-sun-sunos4.1.1
5772 % sh config.sub sun3
5774 % sh config.sub i986v
5775 Invalid configuration `i986v': machine `i986v' not recognized
5777 `config.sub' is also distributed in the GDB source directory
5778 (`gdb-6.8', for version 6.8).
5781 File: gdb.info, Node: Configure Options, Prev: Config Names, Up: Installing GDB
5783 B.5 `configure' Options
5784 =======================
5786 Here is a summary of the `configure' options and arguments that are
5787 most often useful for building GDB. `configure' also has several other
5788 options not listed here. *note (configure.info)What Configure Does::,
5789 for a full explanation of `configure'.
5795 [--norecursion] [--rm]
5799 You may introduce options with a single `-' rather than `--' if you
5800 prefer; but you may abbreviate option names if you use `--'.
5803 Display a quick summary of how to invoke `configure'.
5806 Configure the source to install programs and files under directory
5810 Configure the source to install programs under directory `DIR'.
5813 *Warning: using this option requires GNU `make', or another `make'
5814 that implements the `VPATH' feature.*
5815 Use this option to make configurations in directories separate
5816 from the GDB source directories. Among other things, you can use
5817 this to build (or maintain) several configurations simultaneously,
5818 in separate directories. `configure' writes
5819 configuration-specific files in the current directory, but
5820 arranges for them to use the source in the directory DIRNAME.
5821 `configure' creates directories under the working directory in
5822 parallel to the source directories below DIRNAME.
5825 Configure only the directory level where `configure' is executed;
5826 do not propagate configuration to subdirectories.
5829 Configure GDB for cross-debugging programs running on the specified
5830 TARGET. Without this option, GDB is configured to debug programs
5831 that run on the same machine (HOST) as GDB itself.
5833 There is no convenient way to generate a list of all available
5837 Configure GDB to run on the specified HOST.
5839 There is no convenient way to generate a list of all available
5842 There are many other options available as well, but they are
5843 generally needed for special purposes only.
5846 File: gdb.info, Node: Maintenance Commands, Next: Remote Protocol, Prev: Installing GDB, Up: Top
5848 Appendix C Maintenance Commands
5849 *******************************
5851 In addition to commands intended for GDB users, GDB includes a number
5852 of commands intended for GDB developers, that are not documented
5853 elsewhere in this manual. These commands are provided here for
5854 reference. (For commands that turn on debugging messages, see *Note
5855 Debugging Output::.)
5857 `maint agent EXPRESSION'
5858 Translate the given EXPRESSION into remote agent bytecodes. This
5859 command is useful for debugging the Agent Expression mechanism
5860 (*note Agent Expressions::).
5862 `maint info breakpoints'
5863 Using the same format as `info breakpoints', display both the
5864 breakpoints you've set explicitly, and those GDB is using for
5865 internal purposes. Internal breakpoints are shown with negative
5866 breakpoint numbers. The type column identifies what kind of
5867 breakpoint is shown:
5870 Normal, explicitly set breakpoint.
5873 Normal, explicitly set watchpoint.
5876 Internal breakpoint, used to handle correctly stepping through
5880 Internal breakpoint at the target of a `longjmp'.
5883 Temporary internal breakpoint used by the GDB `until' command.
5886 Temporary internal breakpoint used by the GDB `finish'
5890 Shared library events.
5893 `maint check-symtabs'
5894 Check the consistency of psymtabs and symtabs.
5896 `maint cplus first_component NAME'
5897 Print the first C++ class/namespace component of NAME.
5899 `maint cplus namespace'
5900 Print the list of possible C++ namespaces.
5902 `maint demangle NAME'
5903 Demangle a C++ or Objective-C mangled NAME.
5905 `maint deprecate COMMAND [REPLACEMENT]'
5906 `maint undeprecate COMMAND'
5907 Deprecate or undeprecate the named COMMAND. Deprecated commands
5908 cause GDB to issue a warning when you use them. The optional
5909 argument REPLACEMENT says which newer command should be used in
5910 favor of the deprecated one; if it is given, GDB will mention the
5911 replacement as part of the warning.
5914 Cause a fatal signal in the debugger and force it to dump its core.
5915 This is supported only on systems which support aborting a program
5916 with the `SIGQUIT' signal.
5918 `maint internal-error [MESSAGE-TEXT]'
5919 `maint internal-warning [MESSAGE-TEXT]'
5920 Cause GDB to call the internal function `internal_error' or
5921 `internal_warning' and hence behave as though an internal error or
5922 internal warning has been detected. In addition to reporting the
5923 internal problem, these functions give the user the opportunity to
5924 either quit GDB or create a core file of the current GDB session.
5926 These commands take an optional parameter MESSAGE-TEXT that is
5927 used as the text of the error or warning message.
5929 Here's an example of using `internal-error':
5931 (gdb) maint internal-error testing, 1, 2
5932 .../maint.c:121: internal-error: testing, 1, 2
5933 A problem internal to GDB has been detected. Further
5934 debugging may prove unreliable.
5935 Quit this debugging session? (y or n) n
5936 Create a core file? (y or n) n
5940 If GDB is talking to an inferior via the serial protocol, then
5941 this command sends the string TEXT to the inferior, and displays
5942 the response packet. GDB supplies the initial `$' character, the
5943 terminating `#' character, and the checksum.
5945 `maint print architecture [FILE]'
5946 Print the entire architecture configuration. The optional argument
5947 FILE names the file where the output goes.
5949 `maint print c-tdesc'
5950 Print the current target description (*note Target Descriptions::)
5951 as a C source file. The created source file can be used in GDB
5952 when an XML parser is not available to parse the description.
5954 `maint print dummy-frames'
5955 Prints the contents of GDB's internal dummy-frame stack.
5959 (gdb) print add(2,3)
5960 Breakpoint 2, add (a=2, b=3) at ...
5962 The program being debugged stopped while in a function called from GDB.
5964 (gdb) maint print dummy-frames
5965 0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6
5966 top=0x0200bdd4 id={stack=0x200bddc,code=0x101405c}
5967 call_lo=0x01014000 call_hi=0x01014001
5970 Takes an optional file parameter.
5972 `maint print registers [FILE]'
5973 `maint print raw-registers [FILE]'
5974 `maint print cooked-registers [FILE]'
5975 `maint print register-groups [FILE]'
5976 Print GDB's internal register data structures.
5978 The command `maint print raw-registers' includes the contents of
5979 the raw register cache; the command `maint print cooked-registers'
5980 includes the (cooked) value of all registers; and the command
5981 `maint print register-groups' includes the groups that each
5982 register is a member of. *Note Registers: (gdbint)Registers.
5984 These commands take an optional parameter, a file name to which to
5985 write the information.
5987 `maint print reggroups [FILE]'
5988 Print GDB's internal register group data structures. The optional
5989 argument FILE tells to what file to write the information.
5991 The register groups info looks like this:
5993 (gdb) maint print reggroups
6004 This command forces GDB to flush its internal register cache.
6006 `maint print objfiles'
6007 Print a dump of all known object files. For each object file, this
6008 command prints its name, address in memory, and all of its psymtabs
6011 `maint print statistics'
6012 This command prints, for each object file in the program, various
6013 data about that object file followed by the byte cache ("bcache")
6014 statistics for the object file. The objfile data includes the
6015 number of minimal, partial, full, and stabs symbols, the number of
6016 types defined by the objfile, the number of as yet unexpanded psym
6017 tables, the number of line tables and string tables, and the
6018 amount of memory used by the various tables. The bcache
6019 statistics include the counts, sizes, and counts of duplicates of
6020 all and unique objects, max, average, and median entry size, total
6021 memory used and its overhead and savings, and various measures of
6022 the hash table size and chain lengths.
6024 `maint print target-stack'
6025 A "target" is an interface between the debugger and a particular
6026 kind of file or process. Targets can be stacked in "strata", so
6027 that more than one target can potentially respond to a request.
6028 In particular, memory accesses will walk down the stack of targets
6029 until they find a target that is interested in handling that
6032 This command prints a short description of each layer that was
6033 pushed on the "target stack", starting from the top layer down to
6036 `maint print type EXPR'
6037 Print the type chain for a type specified by EXPR. The argument
6038 can be either a type name or a symbol. If it is a symbol, the
6039 type of that symbol is described. The type chain produced by this
6040 command is a recursive definition of the data type as stored in
6041 GDB's data structures, including its flags and contained types.
6043 `maint set dwarf2 max-cache-age'
6044 `maint show dwarf2 max-cache-age'
6045 Control the DWARF 2 compilation unit cache.
6047 In object files with inter-compilation-unit references, such as
6048 those produced by the GCC option `-feliminate-dwarf2-dups', the
6049 DWARF 2 reader needs to frequently refer to previously read
6050 compilation units. This setting controls how long a compilation
6051 unit will remain in the cache if it is not referenced. A higher
6052 limit means that cached compilation units will be stored in memory
6053 longer, and more total memory will be used. Setting it to zero
6054 disables caching, which will slow down GDB startup, but reduce
6058 `maint show profile'
6059 Control profiling of GDB.
6061 Profiling will be disabled until you use the `maint set profile'
6062 command to enable it. When you enable profiling, the system will
6063 begin collecting timing and execution count data; when you disable
6064 profiling or exit GDB, the results will be written to a log file.
6065 Remember that if you use profiling, GDB will overwrite the
6066 profiling log file (often called `gmon.out'). If you have a
6067 record of important profiling data in a `gmon.out' file, be sure
6068 to move it to a safe location.
6070 Configuring with `--enable-profiling' arranges for GDB to be
6071 compiled with the `-pg' compiler option.
6073 `maint show-debug-regs'
6074 Control whether to show variables that mirror the x86 hardware
6075 debug registers. Use `ON' to enable, `OFF' to disable. If
6076 enabled, the debug registers values are shown when GDB inserts or
6077 removes a hardware breakpoint or watchpoint, and when the inferior
6078 triggers a hardware-assisted breakpoint or watchpoint.
6081 Control whether to display memory usage for each command. If set
6082 to a nonzero value, GDB will display how much memory each command
6083 took, following the command's own output. This can also be
6084 requested by invoking GDB with the `--statistics' command-line
6085 switch (*note Mode Options::).
6088 Control whether to display the execution time for each command. If
6089 set to a nonzero value, GDB will display how much time it took to
6090 execute each command, following the command's own output. This
6091 can also be requested by invoking GDB with the `--statistics'
6092 command-line switch (*note Mode Options::).
6094 `maint translate-address [SECTION] ADDR'
6095 Find the symbol stored at the location specified by the address
6096 ADDR and an optional section name SECTION. If found, GDB prints
6097 the name of the closest symbol and an offset from the symbol's
6098 location to the specified address. This is similar to the `info
6099 address' command (*note Symbols::), except that this command also
6100 allows to find symbols in other sections.
6103 The following command is useful for non-interactive invocations of
6104 GDB, such as in the test suite.
6107 Set the maximum number of seconds GDB will wait for the target
6108 operation to finish. If this time expires, GDB reports and error
6109 and the command is aborted.
6112 Show the current setting of the target wait timeout.
6115 File: gdb.info, Node: Remote Protocol, Next: Agent Expressions, Prev: Maintenance Commands, Up: Top
6117 Appendix D GDB Remote Serial Protocol
6118 *************************************
6124 * Stop Reply Packets::
6125 * General Query Packets::
6126 * Register Packet Format::
6127 * Tracepoint Packets::
6128 * Host I/O Packets::
6131 * File-I/O Remote Protocol Extension::
6132 * Library List Format::
6133 * Memory Map Format::
6136 File: gdb.info, Node: Overview, Next: Packets, Up: Remote Protocol
6141 There may be occasions when you need to know something about the
6142 protocol--for example, if there is only one serial port to your target
6143 machine, you might want your program to do something special if it
6144 recognizes a packet meant for GDB.
6146 In the examples below, `->' and `<-' are used to indicate
6147 transmitted and received data, respectively.
6149 All GDB commands and responses (other than acknowledgments) are sent
6150 as a PACKET. A PACKET is introduced with the character `$', the actual
6151 PACKET-DATA, and the terminating character `#' followed by a two-digit
6154 `$'PACKET-DATA`#'CHECKSUM
6155 The two-digit CHECKSUM is computed as the modulo 256 sum of all
6156 characters between the leading `$' and the trailing `#' (an eight bit
6159 Implementors should note that prior to GDB 5.0 the protocol
6160 specification also included an optional two-digit SEQUENCE-ID:
6162 `$'SEQUENCE-ID`:'PACKET-DATA`#'CHECKSUM
6164 That SEQUENCE-ID was appended to the acknowledgment. GDB has never
6165 output SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0
6166 must not accept SEQUENCE-ID.
6168 When either the host or the target machine receives a packet, the
6169 first response expected is an acknowledgment: either `+' (to indicate
6170 the package was received correctly) or `-' (to request retransmission):
6172 -> `$'PACKET-DATA`#'CHECKSUM
6174 The host (GDB) sends COMMANDs, and the target (the debugging stub
6175 incorporated in your program) sends a RESPONSE. In the case of step
6176 and continue COMMANDs, the response is only sent when the operation has
6177 completed (the target has again stopped).
6179 PACKET-DATA consists of a sequence of characters with the exception
6180 of `#' and `$' (see `X' packet for additional exceptions).
6182 Fields within the packet should be separated using `,' `;' or `:'.
6183 Except where otherwise noted all numbers are represented in HEX with
6184 leading zeros suppressed.
6186 Implementors should note that prior to GDB 5.0, the character `:'
6187 could not appear as the third character in a packet (as it would
6188 potentially conflict with the SEQUENCE-ID).
6190 Binary data in most packets is encoded either as two hexadecimal
6191 digits per byte of binary data. This allowed the traditional remote
6192 protocol to work over connections which were only seven-bit clean.
6193 Some packets designed more recently assume an eight-bit clean
6194 connection, and use a more efficient encoding to send and receive
6197 The binary data representation uses `7d' (ASCII `}') as an escape
6198 character. Any escaped byte is transmitted as the escape character
6199 followed by the original character XORed with `0x20'. For example, the
6200 byte `0x7d' would be transmitted as the two bytes `0x7d 0x5d'. The
6201 bytes `0x23' (ASCII `#'), `0x24' (ASCII `$'), and `0x7d' (ASCII `}')
6202 must always be escaped. Responses sent by the stub must also escape
6203 `0x2a' (ASCII `*'), so that it is not interpreted as the start of a
6204 run-length encoded sequence (described next).
6206 Response DATA can be run-length encoded to save space. Run-length
6207 encoding replaces runs of identical characters with one instance of the
6208 repeated character, followed by a `*' and a repeat count. The repeat
6209 count is itself sent encoded, to avoid binary characters in DATA: a
6210 value of N is sent as `N+29'. For a repeat count greater or equal to
6211 3, this produces a printable ASCII character, e.g. a space (ASCII code
6212 32) for a repeat count of 3. (This is because run-length encoding
6213 starts to win for counts 3 or more.) Thus, for example, `0* ' is a
6214 run-length encoding of "0000": the space character after `*' means
6215 repeat the leading `0' `32 - 29 = 3' more times.
6217 The printable characters `#' and `$' or with a numeric value greater
6218 than 126 must not be used. Runs of six repeats (`#') or seven repeats
6219 (`$') can be expanded using a repeat count of only five (`"'). For
6220 example, `00000000' can be encoded as `0*"00'.
6222 The error response returned for some packets includes a two character
6223 error number. That number is not well defined.
6225 For any COMMAND not supported by the stub, an empty response
6226 (`$#00') should be returned. That way it is possible to extend the
6227 protocol. A newer GDB can tell if a packet is supported based on that
6230 A stub is required to support the `g', `G', `m', `M', `c', and `s'
6231 COMMANDs. All other COMMANDs are optional.
6234 File: gdb.info, Node: Packets, Next: Stop Reply Packets, Prev: Overview, Up: Remote Protocol
6239 The following table provides a complete list of all currently defined
6240 COMMANDs and their corresponding response DATA. *Note File-I/O Remote
6241 Protocol Extension::, for details about the File I/O extension of the
6244 Each packet's description has a template showing the packet's overall
6245 syntax, followed by an explanation of the packet's meaning. We include
6246 spaces in some of the templates for clarity; these are not part of the
6247 packet's syntax. No GDB packet uses spaces to separate its components.
6248 For example, a template like `foo BAR BAZ' describes a packet
6249 beginning with the three ASCII bytes `foo', followed by a BAR, followed
6250 directly by a BAZ. GDB does not transmit a space character between the
6251 `foo' and the BAR, or between the BAR and the BAZ.
6253 Note that all packet forms beginning with an upper- or lower-case
6254 letter, other than those described here, are reserved for future use.
6256 Here are the packet descriptions.
6259 Enable extended mode. In extended mode, the remote server is made
6260 persistent. The `R' packet is used to restart the program being
6265 The remote target both supports and has enabled extended mode.
6268 Indicate the reason the target halted. The reply is the same as
6269 for step and continue.
6271 Reply: *Note Stop Reply Packets::, for the reply specifications.
6273 `A ARGLEN,ARGNUM,ARG,...'
6274 Initialized `argv[]' array passed into program. ARGLEN specifies
6275 the number of bytes in the hex encoded byte stream ARG. See
6276 `gdbserver' for more details.
6280 The arguments were set.
6286 (Don't use this packet; its behavior is not well-defined.) Change
6287 the serial line speed to BAUD.
6289 JTC: _When does the transport layer state change? When it's
6290 received, or after the ACK is transmitted. In either case, there
6291 are problems if the command or the acknowledgment packet is
6294 Stan: _If people really wanted to add something like this, and get
6295 it working for the first time, they ought to modify ser-unix.c to
6296 send some kind of out-of-band message to a specially-setup stub
6297 and have the switch happen "in between" packets, so that from
6298 remote protocol's point of view, nothing actually happened._
6301 Set (MODE is `S') or clear (MODE is `C') a breakpoint at ADDR.
6303 Don't use this packet. Use the `Z' and `z' packets instead (*note
6304 insert breakpoint or watchpoint packet::).
6307 Continue. ADDR is address to resume. If ADDR is omitted, resume
6310 Reply: *Note Stop Reply Packets::, for the reply specifications.
6313 Continue with signal SIG (hex signal number). If `;ADDR' is
6314 omitted, resume at same address.
6316 Reply: *Note Stop Reply Packets::, for the reply specifications.
6321 Don't use this packet; instead, define a general set packet (*note
6322 General Query Packets::).
6325 Detach GDB from the remote system. Sent to the remote target
6326 before GDB disconnects via the `detach' command.
6336 A reply from GDB to an `F' packet sent by the target. This is
6337 part of the File-I/O protocol extension. *Note File-I/O Remote
6338 Protocol Extension::, for the specification.
6341 Read general registers.
6345 Each byte of register data is described by two hex digits.
6346 The bytes with the register are transmitted in target byte
6347 order. The size of each register and their position within
6348 the `g' packet are determined by the GDB internal gdbarch
6349 functions `DEPRECATED_REGISTER_RAW_SIZE' and
6350 `gdbarch_register_name'. The specification of several
6351 standard `g' packets is specified below.
6357 Write general registers. *Note read registers packet::, for a
6358 description of the XX... data.
6368 Set thread for subsequent operations (`m', `M', `g', `G', et.al.).
6369 C depends on the operation to be performed: it should be `c' for
6370 step and continue operations, `g' for other operations. The
6371 thread designator T may be `-1', meaning all the threads, a thread
6372 number, or `0' which means pick any thread.
6382 Step the remote target by a single clock cycle. If `,NNN' is
6383 present, cycle step NNN cycles. If ADDR is present, cycle step
6384 starting at that address.
6387 Signal, then cycle step. *Note step with signal packet::. *Note
6388 cycle step packet::.
6393 FIXME: _There is no description of how to operate when a specific
6394 thread context has been selected (i.e. does 'k' kill only that
6398 Read LENGTH bytes of memory starting at address ADDR. Note that
6399 ADDR may not be aligned to any particular boundary.
6401 The stub need not use any particular size or alignment when
6402 gathering data from memory for the response; even if ADDR is
6403 word-aligned and LENGTH is a multiple of the word size, the stub
6404 is free to use byte accesses, or not. For this reason, this
6405 packet may not be suitable for accessing memory-mapped I/O devices.
6409 Memory contents; each byte is transmitted as a two-digit
6410 hexadecimal number. The reply may contain fewer bytes than
6411 requested if the server was able to read only part of the
6417 `M ADDR,LENGTH:XX...'
6418 Write LENGTH bytes of memory starting at address ADDR. XX... is
6419 the data; each byte is transmitted as a two-digit hexadecimal
6427 for an error (this includes the case where only part of the
6431 Read the value of register N; N is in hex. *Note read registers
6432 packet::, for a description of how the returned register value is
6437 the register's value
6443 Indicating an unrecognized QUERY.
6446 Write register N... with value R.... The register number N is in
6447 hexadecimal, and R... contains two hex digits for each byte in the
6448 register (target byte order).
6459 General query (`q') and set (`Q'). These packets are described
6460 fully in *Note General Query Packets::.
6463 Reset the entire system.
6465 Don't use this packet; use the `R' packet instead.
6468 Restart the program being debugged. XX, while needed, is ignored.
6469 This packet is only available in extended mode (*note extended
6472 The `R' packet has no reply.
6475 Single step. ADDR is the address at which to resume. If ADDR is
6476 omitted, resume at same address.
6478 Reply: *Note Stop Reply Packets::, for the reply specifications.
6481 Step with signal. This is analogous to the `C' packet, but
6482 requests a single-step, rather than a normal resumption of
6485 Reply: *Note Stop Reply Packets::, for the reply specifications.
6488 Search backwards starting at address ADDR for a match with pattern
6489 PP and mask MM. PP and MM are 4 bytes. ADDR must be at least 3
6493 Find out if the thread XX is alive.
6497 thread is still alive
6503 Packets starting with `v' are identified by a multi-letter name,
6504 up to the first `;' or `?' (or the end of the packet).
6507 Attach to a new process with the specified process ID. PID is a
6508 hexadecimal integer identifying the process. The attached process
6511 This packet is only available in extended mode (*note extended
6519 for success (*note Stop Reply Packets::)
6521 `vCont[;ACTION[:TID]]...'
6522 Resume the inferior, specifying different actions for each thread.
6523 If an action is specified with no TID, then it is applied to any
6524 threads that don't have a specific action specified; if no default
6525 action is specified then other threads should remain stopped.
6526 Specifying multiple default actions is an error; specifying no
6527 actions is also an error. Thread IDs are specified in
6528 hexadecimal. Currently supported actions are:
6534 Continue with signal SIG. SIG should be two hex digits.
6540 Step with signal SIG. SIG should be two hex digits.
6542 The optional ADDR argument normally associated with these packets
6543 is not supported in `vCont'.
6545 Reply: *Note Stop Reply Packets::, for the reply specifications.
6548 Request a list of actions supported by the `vCont' packet.
6552 The `vCont' packet is supported. Each ACTION is a supported
6553 command in the `vCont' packet.
6556 The `vCont' packet is not supported.
6558 `vFile:OPERATION:PARAMETER...'
6559 Perform a file operation on the target system. For details, see
6560 *Note Host I/O Packets::.
6562 `vFlashErase:ADDR,LENGTH'
6563 Direct the stub to erase LENGTH bytes of flash starting at ADDR.
6564 The region may enclose any number of flash blocks, but its start
6565 and end must fall on block boundaries, as indicated by the flash
6566 block size appearing in the memory map (*note Memory Map
6567 Format::). GDB groups flash memory programming operations
6568 together, and sends a `vFlashDone' request after each group; the
6569 stub is allowed to delay erase operation until the `vFlashDone'
6579 `vFlashWrite:ADDR:XX...'
6580 Direct the stub to write data to flash address ADDR. The data is
6581 passed in binary form using the same encoding as for the `X'
6582 packet (*note Binary Data::). The memory ranges specified by
6583 `vFlashWrite' packets preceding a `vFlashDone' packet must not
6584 overlap, and must appear in order of increasing addresses
6585 (although `vFlashErase' packets for higher addresses may already
6586 have been received; the ordering is guaranteed only between
6587 `vFlashWrite' packets). If a packet writes to an address that was
6588 neither erased by a preceding `vFlashErase' packet nor by some
6589 other target-specific method, the results are unpredictable.
6596 for vFlashWrite addressing non-flash memory
6602 Indicate to the stub that flash programming operation is finished.
6603 The stub is permitted to delay or batch the effects of a group of
6604 `vFlashErase' and `vFlashWrite' packets until a `vFlashDone'
6605 packet is received. The contents of the affected regions of flash
6606 memory are unpredictable until the `vFlashDone' request is
6609 `vRun;FILENAME[;ARGUMENT]...'
6610 Run the program FILENAME, passing it each ARGUMENT on its command
6611 line. The file and arguments are hex-encoded strings. If
6612 FILENAME is an empty string, the stub may use a default program
6613 (e.g. the last program run). The program is created in the stopped
6616 This packet is only available in extended mode (*note extended
6624 for success (*note Stop Reply Packets::)
6626 `X ADDR,LENGTH:XX...'
6627 Write data to memory, where the data is transmitted in binary.
6628 ADDR is address, LENGTH is number of bytes, `XX...' is binary data
6629 (*note Binary Data::).
6638 `z TYPE,ADDR,LENGTH'
6639 `Z TYPE,ADDR,LENGTH'
6640 Insert (`Z') or remove (`z') a TYPE breakpoint or watchpoint
6641 starting at address ADDRESS and covering the next LENGTH bytes.
6643 Each breakpoint and watchpoint packet TYPE is documented
6646 _Implementation notes: A remote target shall return an empty string
6647 for an unrecognized breakpoint or watchpoint packet TYPE. A
6648 remote target shall support either both or neither of a given
6649 `ZTYPE...' and `zTYPE...' packet pair. To avoid potential
6650 problems with duplicate packets, the operations should be
6651 implemented in an idempotent way._
6655 Insert (`Z0') or remove (`z0') a memory breakpoint at address ADDR
6658 A memory breakpoint is implemented by replacing the instruction at
6659 ADDR with a software breakpoint or trap instruction. The LENGTH
6660 is used by targets that indicates the size of the breakpoint (in
6661 bytes) that should be inserted (e.g., the ARM and MIPS can insert
6662 either a 2 or 4 byte breakpoint).
6664 _Implementation note: It is possible for a target to copy or move
6665 code that contains memory breakpoints (e.g., when implementing
6666 overlays). The behavior of this packet, in the presence of such a
6667 target, is not defined._
6681 Insert (`Z1') or remove (`z1') a hardware breakpoint at address
6682 ADDR of size LENGTH.
6684 A hardware breakpoint is implemented using a mechanism that is not
6685 dependant on being able to modify the target's memory.
6687 _Implementation note: A hardware breakpoint is not affected by code
6702 Insert (`Z2') or remove (`z2') a write watchpoint.
6716 Insert (`Z3') or remove (`z3') a read watchpoint.
6730 Insert (`Z4') or remove (`z4') an access watchpoint.
6744 File: gdb.info, Node: Stop Reply Packets, Next: General Query Packets, Prev: Packets, Up: Remote Protocol
6746 D.3 Stop Reply Packets
6747 ======================
6749 The `C', `c', `S', `s' and `?' packets can receive any of the below as
6750 a reply. In the case of the `C', `c', `S' and `s' packets, that reply
6751 is only returned when the target halts. In the below the exact meaning
6752 of "signal number" is defined by the header `include/gdb/signals.h' in
6753 the GDB source code.
6755 As in the description of request packets, we include spaces in the
6756 reply templates for clarity; these are not part of the reply packet's
6757 syntax. No GDB stop reply packet uses spaces to separate its
6761 The program received signal number AA (a two-digit hexadecimal
6762 number). This is equivalent to a `T' response with no N:R pairs.
6764 `T AA N1:R1;N2:R2;...'
6765 The program received signal number AA (a two-digit hexadecimal
6766 number). This is equivalent to an `S' response, except that the
6767 `N:R' pairs can carry values of important registers and other
6768 information directly in the stop reply packet, reducing round-trip
6769 latency. Single-step and breakpoint traps are reported this way.
6770 Each `N:R' pair is interpreted as follows:
6772 * If N is a hexadecimal number, it is a register number, and the
6773 corresponding R gives that register's value. R is a series
6774 of bytes in target byte order, with each byte given by a
6775 two-digit hex number.
6777 * If N is `thread', then R is the thread process ID, in hex.
6779 * If N is a recognized "stop reason", it describes a more
6780 specific event that stopped the target. The currently
6781 defined stop reasons are listed below. AA should be `05',
6782 the trap signal. At most one stop reason should be present.
6784 * Otherwise, GDB should ignore this `N:R' pair and go on to the
6785 next; this allows us to extend the protocol in the future.
6787 The currently defined stop reasons are:
6792 The packet indicates a watchpoint hit, and R is the data
6796 The packet indicates that the loaded libraries have changed.
6797 GDB should use `qXfer:libraries:read' to fetch a new list of
6798 loaded libraries. R is ignored.
6801 The process exited, and AA is the exit status. This is only
6802 applicable to certain targets.
6805 The process terminated with signal AA.
6808 `XX...' is hex encoding of ASCII data, to be written as the
6809 program's console output. This can happen at any time while the
6810 program is running and the debugger should continue to wait for
6813 `F CALL-ID,PARAMETER...'
6814 CALL-ID is the identifier which says which host system call should
6815 be called. This is just the name of the function. Translation
6816 into the correct system call is only applicable as it's defined in
6817 GDB. *Note File-I/O Remote Protocol Extension::, for a list of
6818 implemented system calls.
6820 `PARAMETER...' is a list of parameters as defined for this very
6823 The target replies with this packet when it expects GDB to call a
6824 host system call on behalf of the target. GDB replies with an
6825 appropriate `F' packet and keeps up waiting for the next reply
6826 packet from the target. The latest `C', `c', `S' or `s' action is
6827 expected to be continued. *Note File-I/O Remote Protocol
6828 Extension::, for more details.
6832 File: gdb.info, Node: General Query Packets, Next: Register Packet Format, Prev: Stop Reply Packets, Up: Remote Protocol
6834 D.4 General Query Packets
6835 =========================
6837 Packets starting with `q' are "general query packets"; packets starting
6838 with `Q' are "general set packets". General query and set packets are
6839 a semi-unified form for retrieving and sending information to and from
6842 The initial letter of a query or set packet is followed by a name
6843 indicating what sort of thing the packet applies to. For example, GDB
6844 may use a `qSymbol' packet to exchange symbol definitions with the
6845 stub. These packet names follow some conventions:
6847 * The name must not contain commas, colons or semicolons.
6849 * Most GDB query and set packets have a leading upper case letter.
6851 * The names of custom vendor packets should use a company prefix, in
6852 lower case, followed by a period. For example, packets designed at
6853 the Acme Corporation might begin with `qacme.foo' (for querying
6854 foos) or `Qacme.bar' (for setting bars).
6856 The name of a query or set packet should be separated from any
6857 parameters by a `:'; the parameters themselves should be separated by
6858 `,' or `;'. Stubs must be careful to match the full packet name, and
6859 check for a separator or the end of the packet, in case two packet
6860 names share a common prefix. New packets should not begin with `qC',
6863 Like the descriptions of the other packets, each description here
6864 has a template showing the packet's overall syntax, followed by an
6865 explanation of the packet's meaning. We include spaces in some of the
6866 templates for clarity; these are not part of the packet's syntax. No
6867 GDB packet uses spaces to separate its components.
6869 Here are the currently defined query and set packets:
6872 Return the current thread id.
6876 Where PID is an unsigned hexadecimal process id.
6879 Any other reply implies the old pid.
6882 Compute the CRC checksum of a block of memory. Reply:
6884 An error (such as memory fault)
6887 The specified memory region's checksum is CRC32.
6891 Obtain a list of all active thread ids from the target (OS).
6892 Since there may be too many active threads to fit into one reply
6893 packet, this query works iteratively: it may require more than one
6894 query/reply sequence to obtain the entire list of threads. The
6895 first query of the sequence will be the `qfThreadInfo' query;
6896 subsequent queries in the sequence will be the `qsThreadInfo'
6899 NOTE: This packet replaces the `qL' query (see below).
6906 a comma-separated list of thread ids
6909 (lower case letter `L') denotes end of list.
6911 In response to each query, the target will reply with a list of
6912 one or more thread ids, in big-endian unsigned hex, separated by
6913 commas. GDB will respond to each reply with a request for more
6914 thread ids (using the `qs' form of the query), until the target
6915 responds with `l' (lower-case el, for "last").
6917 `qGetTLSAddr:THREAD-ID,OFFSET,LM'
6918 Fetch the address associated with thread local storage specified
6919 by THREAD-ID, OFFSET, and LM.
6921 THREAD-ID is the (big endian, hex encoded) thread id associated
6922 with the thread for which to fetch the TLS address.
6924 OFFSET is the (big endian, hex encoded) offset associated with the
6925 thread local variable. (This offset is obtained from the debug
6926 information associated with the variable.)
6928 LM is the (big endian, hex encoded) OS/ABI-specific encoding of the
6929 the load module associated with the thread local storage. For
6930 example, a GNU/Linux system will pass the link map address of the
6931 shared object associated with the thread local storage under
6932 consideration. Other operating environments may choose to
6933 represent the load module differently, so the precise meaning of
6934 this parameter will vary.
6938 Hex encoded (big endian) bytes representing the address of
6939 the thread local storage requested.
6942 An error occurred. NN are hex digits.
6945 An empty reply indicates that `qGetTLSAddr' is not supported
6948 `qL STARTFLAG THREADCOUNT NEXTTHREAD'
6949 Obtain thread information from RTOS. Where: STARTFLAG (one hex
6950 digit) is one to indicate the first query and zero to indicate a
6951 subsequent query; THREADCOUNT (two hex digits) is the maximum
6952 number of threads the response packet can contain; and NEXTTHREAD
6953 (eight hex digits), for subsequent queries (STARTFLAG is zero), is
6954 returned in the response as ARGTHREAD.
6956 Don't use this packet; use the `qfThreadInfo' query instead (see
6960 `qM COUNT DONE ARGTHREAD THREAD...'
6961 Where: COUNT (two hex digits) is the number of threads being
6962 returned; DONE (one hex digit) is zero to indicate more
6963 threads and one indicates no further threads; ARGTHREADID
6964 (eight hex digits) is NEXTTHREAD from the request packet;
6965 THREAD... is a sequence of thread IDs from the target.
6966 THREADID (eight hex digits). See
6967 `remote.c:parse_threadlist_response()'.
6970 Get section offsets that the target used when relocating the
6974 `Text=XXX;Data=YYY[;Bss=ZZZ]'
6975 Relocate the `Text' section by XXX from its original address.
6976 Relocate the `Data' section by YYY from its original address.
6977 If the object file format provides segment information (e.g.
6978 ELF `PT_LOAD' program headers), GDB will relocate entire
6979 segments by the supplied offsets.
6981 _Note: while a `Bss' offset may be included in the response,
6982 GDB ignores this and instead applies the `Data' offset to the
6985 `TextSeg=XXX[;DataSeg=YYY]'
6986 Relocate the first segment of the object file, which
6987 conventionally contains program code, to a starting address
6988 of XXX. If `DataSeg' is specified, relocate the second
6989 segment, which conventionally contains modifiable data, to a
6990 starting address of YYY. GDB will report an error if the
6991 object file does not contain segment information, or does not
6992 contain at least as many segments as mentioned in the reply.
6993 Extra segments are kept at fixed offsets relative to the last
6997 Returns information on THREADID. Where: MODE is a hex encoded 32
6998 bit mode; THREADID is a hex encoded 64 bit thread ID.
7000 Don't use this packet; use the `qThreadExtraInfo' query instead
7003 Reply: see `remote.c:remote_unpack_thread_info_response()'.
7005 `QPassSignals: SIGNAL [;SIGNAL]...'
7006 Each listed SIGNAL should be passed directly to the inferior
7007 process. Signals are numbered identically to continue packets and
7008 stop replies (*note Stop Reply Packets::). Each SIGNAL list item
7009 should be strictly greater than the previous item. These signals
7010 do not need to stop the inferior, or be reported to GDB. All
7011 other signals should be reported to GDB. Multiple `QPassSignals'
7012 packets do not combine; any earlier `QPassSignals' list is
7013 completely replaced by the new list. This packet improves
7014 performance when using `handle SIGNAL nostop noprint pass'.
7018 The request succeeded.
7021 An error occurred. NN are hex digits.
7024 An empty reply indicates that `QPassSignals' is not supported
7027 Use of this packet is controlled by the `set remote pass-signals'
7028 command (*note set remote pass-signals: Remote Configuration.).
7029 This packet is not probed by default; the remote stub must request
7030 it, by supplying an appropriate `qSupported' response (*note
7034 COMMAND (hex encoded) is passed to the local interpreter for
7035 execution. Invalid commands should be reported using the output
7036 string. Before the final result packet, the target may also
7037 respond with a number of intermediate `OOUTPUT' console output
7038 packets. _Implementors should note that providing access to a
7039 stubs's interpreter may have security implications_.
7043 A command response with no output.
7046 A command response with the hex encoded output string OUTPUT.
7049 Indicate a badly formed request.
7052 An empty reply indicates that `qRcmd' is not recognized.
7054 (Note that the `qRcmd' packet's name is separated from the command
7055 by a `,', not a `:', contrary to the naming conventions above.
7056 Please don't use this packet as a model for new packets.)
7058 `qSupported [:GDBFEATURE [;GDBFEATURE]... ]'
7059 Tell the remote stub about features supported by GDB, and query
7060 the stub for features it supports. This packet allows GDB and the
7061 remote stub to take advantage of each others' features.
7062 `qSupported' also consolidates multiple feature probes at startup,
7063 to improve GDB performance--a single larger packet performs better
7064 than multiple smaller probe packets on high-latency links. Some
7065 features may enable behavior which must not be on by default, e.g.
7066 because it would confuse older clients or stubs. Other features
7067 may describe packets which could be automatically probed for, but
7068 are not. These features must be reported before GDB will use
7069 them. This "default unsupported" behavior is not appropriate for
7070 all packets, but it helps to keep the initial connection time
7071 under control with new versions of GDB which support increasing
7075 `STUBFEATURE [;STUBFEATURE]...'
7076 The stub supports or does not support each returned
7077 STUBFEATURE, depending on the form of each STUBFEATURE (see
7078 below for the possible forms).
7081 An empty reply indicates that `qSupported' is not recognized,
7082 or that no features needed to be reported to GDB.
7084 The allowed forms for each feature (either a GDBFEATURE in the
7085 `qSupported' packet, or a STUBFEATURE in the response) are:
7088 The remote protocol feature NAME is supported, and associated
7089 with the specified VALUE. The format of VALUE depends on the
7090 feature, but it must not include a semicolon.
7093 The remote protocol feature NAME is supported, and does not
7094 need an associated value.
7097 The remote protocol feature NAME is not supported.
7100 The remote protocol feature NAME may be supported, and GDB
7101 should auto-detect support in some other way when it is
7102 needed. This form will not be used for GDBFEATURE
7103 notifications, but may be used for STUBFEATURE responses.
7105 Whenever the stub receives a `qSupported' request, the supplied
7106 set of GDB features should override any previous request. This
7107 allows GDB to put the stub in a known state, even if the stub had
7108 previously been communicating with a different version of GDB.
7110 No values of GDBFEATURE (for the packet sent by GDB) are defined
7111 yet. Stubs should ignore any unknown values for GDBFEATURE. Any
7112 GDB which sends a `qSupported' packet supports receiving packets
7113 of unlimited length (earlier versions of GDB may reject overly
7114 long responses). Values for GDBFEATURE may be defined in the
7115 future to let the stub take advantage of new features in GDB, e.g.
7116 incompatible improvements in the remote protocol--support for
7117 unlimited length responses would be a GDBFEATURE example, if it
7118 were not implied by the `qSupported' query. The stub's reply
7119 should be independent of the GDBFEATURE entries sent by GDB; first
7120 GDB describes all the features it supports, and then the stub
7121 replies with all the features it supports.
7123 Similarly, GDB will silently ignore unrecognized stub feature
7124 responses, as long as each response uses one of the standard forms.
7126 Some features are flags. A stub which supports a flag feature
7127 should respond with a `+' form response. Other features require
7128 values, and the stub should respond with an `=' form response.
7130 Each feature has a default value, which GDB will use if
7131 `qSupported' is not available or if the feature is not mentioned
7132 in the `qSupported' response. The default values are fixed; a
7133 stub is free to omit any feature responses that match the defaults.
7135 Not all features can be probed, but for those which can, the
7136 probing mechanism is useful: in some cases, a stub's internal
7137 architecture may not allow the protocol layer to know some
7138 information about the underlying target in advance. This is
7139 especially common in stubs which may be configured for multiple
7142 These are the currently defined stub features and their properties:
7144 Feature Name Value Default Probe Allowed
7146 `PacketSize' Yes `-' No
7147 `qXfer:auxv:read' No `-' Yes
7148 `qXfer:features:read' No `-' Yes
7149 `qXfer:libraries:read' No `-' Yes
7150 `qXfer:memory-map:read' No `-' Yes
7151 `qXfer:spu:read' No `-' Yes
7152 `qXfer:spu:write' No `-' Yes
7153 `QPassSignals' No `-' Yes
7155 These are the currently defined stub features, in more detail:
7158 The remote stub can accept packets up to at least BYTES in
7159 length. GDB will send packets up to this size for bulk
7160 transfers, and will never send larger packets. This is a
7161 limit on the data characters in the packet, including the
7162 frame and checksum. There is no trailing NUL byte in a
7163 remote protocol packet; if the stub stores packets in a
7164 NUL-terminated format, it should allow an extra byte in its
7165 buffer for the NUL. If this stub feature is not supported,
7166 GDB guesses based on the size of the `g' packet response.
7169 The remote stub understands the `qXfer:auxv:read' packet
7170 (*note qXfer auxiliary vector read::).
7172 `qXfer:features:read'
7173 The remote stub understands the `qXfer:features:read' packet
7174 (*note qXfer target description read::).
7176 `qXfer:libraries:read'
7177 The remote stub understands the `qXfer:libraries:read' packet
7178 (*note qXfer library list read::).
7180 `qXfer:memory-map:read'
7181 The remote stub understands the `qXfer:memory-map:read' packet
7182 (*note qXfer memory map read::).
7185 The remote stub understands the `qXfer:spu:read' packet
7186 (*note qXfer spu read::).
7189 The remote stub understands the `qXfer:spu:write' packet
7190 (*note qXfer spu write::).
7193 The remote stub understands the `QPassSignals' packet (*note
7198 Notify the target that GDB is prepared to serve symbol lookup
7199 requests. Accept requests from the target for the values of
7204 The target does not need to look up any (more) symbols.
7207 The target requests the value of symbol SYM_NAME (hex
7208 encoded). GDB may provide the value by using the
7209 `qSymbol:SYM_VALUE:SYM_NAME' message, described below.
7211 `qSymbol:SYM_VALUE:SYM_NAME'
7212 Set the value of SYM_NAME to SYM_VALUE.
7214 SYM_NAME (hex encoded) is the name of a symbol whose value the
7215 target has previously requested.
7217 SYM_VALUE (hex) is the value for symbol SYM_NAME. If GDB cannot
7218 supply a value for SYM_NAME, then this field will be empty.
7222 The target does not need to look up any (more) symbols.
7225 The target requests the value of a new symbol SYM_NAME (hex
7226 encoded). GDB will continue to supply the values of symbols
7227 (if available), until the target ceases to request them.
7231 *Note Tracepoint Packets::.
7233 `qThreadExtraInfo,ID'
7234 Obtain a printable string description of a thread's attributes from
7235 the target OS. ID is a thread-id in big-endian hex. This string
7236 may contain anything that the target OS thinks is interesting for
7237 GDB to tell the user about the thread. The string is displayed in
7238 GDB's `info threads' display. Some examples of possible thread
7239 extra info strings are `Runnable', or `Blocked on Mutex'.
7243 Where `XX...' is a hex encoding of ASCII data, comprising the
7244 printable string containing the extra information about the
7245 thread's attributes.
7247 (Note that the `qThreadExtraInfo' packet's name is separated from
7248 the command by a `,', not a `:', contrary to the naming
7249 conventions above. Please don't use this packet as a model for new
7257 *Note Tracepoint Packets::.
7259 `qXfer:OBJECT:read:ANNEX:OFFSET,LENGTH'
7260 Read uninterpreted bytes from the target's special data area
7261 identified by the keyword OBJECT. Request LENGTH bytes starting
7262 at OFFSET bytes into the data. The content and encoding of ANNEX
7263 is specific to OBJECT; it can supply additional details about what
7266 Here are the specific requests of this form defined so far. All
7267 `qXfer:OBJECT:read:...' requests use the same reply formats,
7270 `qXfer:auxv:read::OFFSET,LENGTH'
7271 Access the target's "auxiliary vector". *Note auxiliary
7272 vector: OS Information. Note ANNEX must be empty.
7274 This packet is not probed by default; the remote stub must
7275 request it, by supplying an appropriate `qSupported' response
7276 (*note qSupported::).
7278 `qXfer:features:read:ANNEX:OFFSET,LENGTH'
7279 Access the "target description". *Note Target
7280 Descriptions::. The annex specifies which XML document to
7281 access. The main description is always loaded from the
7284 This packet is not probed by default; the remote stub must
7285 request it, by supplying an appropriate `qSupported' response
7286 (*note qSupported::).
7288 `qXfer:libraries:read:ANNEX:OFFSET,LENGTH'
7289 Access the target's list of loaded libraries. *Note Library
7290 List Format::. The annex part of the generic `qXfer' packet
7291 must be empty (*note qXfer read::).
7293 Targets which maintain a list of libraries in the program's
7294 memory do not need to implement this packet; it is designed
7295 for platforms where the operating system manages the list of
7298 This packet is not probed by default; the remote stub must
7299 request it, by supplying an appropriate `qSupported' response
7300 (*note qSupported::).
7302 `qXfer:memory-map:read::OFFSET,LENGTH'
7303 Access the target's "memory-map". *Note Memory Map Format::.
7304 The annex part of the generic `qXfer' packet must be empty
7305 (*note qXfer read::).
7307 This packet is not probed by default; the remote stub must
7308 request it, by supplying an appropriate `qSupported' response
7309 (*note qSupported::).
7311 `qXfer:spu:read:ANNEX:OFFSET,LENGTH'
7312 Read contents of an `spufs' file on the target system. The
7313 annex specifies which file to read; it must be of the form
7314 `ID/NAME', where ID specifies an SPU context ID in the target
7315 process, and NAME identifes the `spufs' file in that context
7318 This packet is not probed by default; the remote stub must
7319 request it, by supplying an appropriate `qSupported' response
7320 (*note qSupported::).
7324 Data DATA (*note Binary Data::) has been read from the
7325 target. There may be more data at a higher address (although
7326 it is permitted to return `m' even for the last valid block
7327 of data, as long as at least one byte of data was read).
7328 DATA may have fewer bytes than the LENGTH in the request.
7331 Data DATA (*note Binary Data::) has been read from the target.
7332 There is no more data to be read. DATA may have fewer bytes
7333 than the LENGTH in the request.
7336 The OFFSET in the request is at the end of the data. There
7337 is no more data to be read.
7340 The request was malformed, or ANNEX was invalid.
7343 The offset was invalid, or there was an error encountered
7344 reading the data. NN is a hex-encoded `errno' value.
7347 An empty reply indicates the OBJECT string was not recognized
7348 by the stub, or that the object does not support reading.
7350 `qXfer:OBJECT:write:ANNEX:OFFSET:DATA...'
7351 Write uninterpreted bytes into the target's special data area
7352 identified by the keyword OBJECT, starting at OFFSET bytes into
7353 the data. DATA... is the binary-encoded data (*note Binary
7354 Data::) to be written. The content and encoding of ANNEX is
7355 specific to OBJECT; it can supply additional details about what
7358 Here are the specific requests of this form defined so far. All
7359 `qXfer:OBJECT:write:...' requests use the same reply formats,
7362 `qXfer:SPU:write:ANNEX:OFFSET:DATA...'
7363 Write DATA to an `spufs' file on the target system. The
7364 annex specifies which file to write; it must be of the form
7365 `ID/NAME', where ID specifies an SPU context ID in the target
7366 process, and NAME identifes the `spufs' file in that context
7369 This packet is not probed by default; the remote stub must
7370 request it, by supplying an appropriate `qSupported' response
7371 (*note qSupported::).
7375 NN (hex encoded) is the number of bytes written. This may be
7376 fewer bytes than supplied in the request.
7379 The request was malformed, or ANNEX was invalid.
7382 The offset was invalid, or there was an error encountered
7383 writing the data. NN is a hex-encoded `errno' value.
7386 An empty reply indicates the OBJECT string was not recognized
7387 by the stub, or that the object does not support writing.
7389 `qXfer:OBJECT:OPERATION:...'
7390 Requests of this form may be added in the future. When a stub does
7391 not recognize the OBJECT keyword, or its support for OBJECT does
7392 not recognize the OPERATION keyword, the stub must respond with an
7396 ---------- Footnotes ----------
7398 (1) The `qP' and `qL' packets predate these conventions, and have
7399 arguments without any terminator for the packet name; we suspect they
7400 are in widespread use in places that are difficult to upgrade. The
7401 `qC' packet has no arguments, but some existing stubs (e.g. RedBoot)
7402 are known to not check for the end of the packet.
7405 File: gdb.info, Node: Register Packet Format, Next: Tracepoint Packets, Prev: General Query Packets, Up: Remote Protocol
7407 D.5 Register Packet Format
7408 ==========================
7410 The following `g'/`G' packets have previously been defined. In the
7411 below, some thirty-two bit registers are transferred as sixty-four
7412 bits. Those registers should be zero/sign extended (which?) to fill
7413 the space allocated. Register bytes are transferred in target byte
7414 order. The two nibbles within a register byte are transferred
7415 most-significant - least-significant.
7418 All registers are transferred as thirty-two bit quantities in the
7419 order: 32 general-purpose; sr; lo; hi; bad; cause; pc; 32
7420 floating-point registers; fsr; fir; fp.
7423 All registers are transferred as sixty-four bit quantities
7424 (including thirty-two bit registers such as `sr'). The ordering
7425 is the same as `MIPS32'.
7429 File: gdb.info, Node: Tracepoint Packets, Next: Host I/O Packets, Prev: Register Packet Format, Up: Remote Protocol
7431 D.6 Tracepoint Packets
7432 ======================
7434 Here we describe the packets GDB uses to implement tracepoints (*note
7437 `QTDP:N:ADDR:ENA:STEP:PASS[-]'
7438 Create a new tracepoint, number N, at ADDR. If ENA is `E', then
7439 the tracepoint is enabled; if it is `D', then the tracepoint is
7440 disabled. STEP is the tracepoint's step count, and PASS is its
7441 pass count. If the trailing `-' is present, further `QTDP'
7442 packets will follow to specify this tracepoint's actions.
7446 The packet was understood and carried out.
7449 The packet was not recognized.
7451 `QTDP:-N:ADDR:[S]ACTION...[-]'
7452 Define actions to be taken when a tracepoint is hit. N and ADDR
7453 must be the same as in the initial `QTDP' packet for this
7454 tracepoint. This packet may only be sent immediately after
7455 another `QTDP' packet that ended with a `-'. If the trailing `-'
7456 is present, further `QTDP' packets will follow, specifying more
7457 actions for this tracepoint.
7459 In the series of action packets for a given tracepoint, at most one
7460 can have an `S' before its first ACTION. If such a packet is
7461 sent, it and the following packets define "while-stepping"
7462 actions. Any prior packets define ordinary actions -- that is,
7463 those taken when the tracepoint is first hit. If no action packet
7464 has an `S', then all the packets in the series specify ordinary
7467 The `ACTION...' portion of the packet is a series of actions,
7468 concatenated without separators. Each action has one of the
7472 Collect the registers whose bits are set in MASK. MASK is a
7473 hexadecimal number whose I'th bit is set if register number I
7474 should be collected. (The least significant bit is numbered
7475 zero.) Note that MASK may be any number of digits long; it
7476 may not fit in a 32-bit word.
7478 `M BASEREG,OFFSET,LEN'
7479 Collect LEN bytes of memory starting at the address in
7480 register number BASEREG, plus OFFSET. If BASEREG is `-1',
7481 then the range has a fixed address: OFFSET is the address of
7482 the lowest byte to collect. The BASEREG, OFFSET, and LEN
7483 parameters are all unsigned hexadecimal values (the `-1'
7484 value for BASEREG is a special case).
7487 Evaluate EXPR, whose length is LEN, and collect memory as it
7488 directs. EXPR is an agent expression, as described in *Note
7489 Agent Expressions::. Each byte of the expression is encoded
7490 as a two-digit hex number in the packet; LEN is the number of
7491 bytes in the expression (and thus one-half the number of hex
7492 digits in the packet).
7495 Any number of actions may be packed together in a single `QTDP'
7496 packet, as long as the packet does not exceed the maximum packet
7497 length (400 bytes, for many stubs). There may be only one `R'
7498 action per tracepoint, and it must precede any `M' or `X' actions.
7499 Any registers referred to by `M' and `X' actions must be
7500 collected by a preceding `R' action. (The "while-stepping"
7501 actions are treated as if they were attached to a separate
7502 tracepoint, as far as these restrictions are concerned.)
7506 The packet was understood and carried out.
7509 The packet was not recognized.
7512 Select the N'th tracepoint frame from the buffer, and use the
7513 register and memory contents recorded there to answer subsequent
7514 request packets from GDB.
7516 A successful reply from the stub indicates that the stub has found
7517 the requested frame. The response is a series of parts,
7518 concatenated without separators, describing the frame we selected.
7519 Each part has one of the following forms:
7522 The selected frame is number N in the trace frame buffer; F
7523 is a hexadecimal number. If F is `-1', then there was no
7524 frame matching the criteria in the request packet.
7527 The selected trace frame records a hit of tracepoint number T;
7528 T is a hexadecimal number.
7532 Like `QTFrame:N', but select the first tracepoint frame after the
7533 currently selected frame whose PC is ADDR; ADDR is a hexadecimal
7537 Like `QTFrame:N', but select the first tracepoint frame after the
7538 currently selected frame that is a hit of tracepoint T; T is a
7541 `QTFrame:range:START:END'
7542 Like `QTFrame:N', but select the first tracepoint frame after the
7543 currently selected frame whose PC is between START (inclusive) and
7544 END (exclusive); START and END are hexadecimal numbers.
7546 `QTFrame:outside:START:END'
7547 Like `QTFrame:range:START:END', but select the first frame
7548 _outside_ the given range of addresses.
7551 Begin the tracepoint experiment. Begin collecting data from
7552 tracepoint hits in the trace frame buffer.
7555 End the tracepoint experiment. Stop collecting trace frames.
7558 Clear the table of tracepoints, and empty the trace frame buffer.
7560 `QTro:START1,END1:START2,END2:...'
7561 Establish the given ranges of memory as "transparent". The stub
7562 will answer requests for these ranges from memory's current
7563 contents, if they were not collected as part of the tracepoint hit.
7565 GDB uses this to mark read-only regions of memory, like those
7566 containing program code. Since these areas never change, they
7567 should still have the same contents they did when the tracepoint
7568 was hit, so there's no reason for the stub to refuse to provide
7572 Ask the stub if there is a trace experiment running right now.
7576 There is no trace experiment running.
7579 There is a trace experiment running.
7583 File: gdb.info, Node: Host I/O Packets, Next: Interrupts, Prev: Tracepoint Packets, Up: Remote Protocol
7585 D.7 Host I/O Packets
7586 ====================
7588 The "Host I/O" packets allow GDB to perform I/O operations on the far
7589 side of a remote link. For example, Host I/O is used to upload and
7590 download files to a remote target with its own filesystem. Host I/O
7591 uses the same constant values and data structure layout as the
7592 target-initiated File-I/O protocol. However, the Host I/O packets are
7593 structured differently. The target-initiated protocol relies on target
7594 memory to store parameters and buffers. Host I/O requests are
7595 initiated by GDB, and the target's memory is not involved. *Note
7596 File-I/O Remote Protocol Extension::, for more details on the
7597 target-initiated protocol.
7599 The Host I/O request packets all encode a single operation along with
7600 its arguments. They have this format:
7602 `vFile:OPERATION: PARAMETER...'
7603 OPERATION is the name of the particular request; the target should
7604 compare the entire packet name up to the second colon when checking
7605 for a supported operation. The format of PARAMETER depends on the
7606 operation. Numbers are always passed in hexadecimal. Negative
7607 numbers have an explicit minus sign (i.e. two's complement is not
7608 used). Strings (e.g. filenames) are encoded as a series of
7609 hexadecimal bytes. The last argument to a system call may be a
7610 buffer of escaped binary data (*note Binary Data::).
7613 The valid responses to Host I/O packets are:
7615 `F RESULT [, ERRNO] [; ATTACHMENT]'
7616 RESULT is the integer value returned by this operation, usually
7617 non-negative for success and -1 for errors. If an error has
7618 occured, ERRNO will be included in the result. ERRNO will have a
7619 value defined by the File-I/O protocol (*note Errno Values::). For
7620 operations which return data, ATTACHMENT supplies the data as a
7621 binary buffer. Binary buffers in response packets are escaped in
7622 the normal way (*note Binary Data::). See the individual packet
7623 documentation for the interpretation of RESULT and ATTACHMENT.
7626 An empty response indicates that this operation is not recognized.
7629 These are the supported Host I/O operations:
7631 `vFile:open: PATHNAME, FLAGS, MODE'
7632 Open a file at PATHNAME and return a file descriptor for it, or
7633 return -1 if an error occurs. PATHNAME is a string, FLAGS is an
7634 integer indicating a mask of open flags (*note Open Flags::), and
7635 MODE is an integer indicating a mask of mode bits to use if the
7636 file is created (*note mode_t Values::). *Note open::, for
7637 details of the open flags and mode values.
7640 Close the open file corresponding to FD and return 0, or -1 if an
7643 `vFile:pread: FD, COUNT, OFFSET'
7644 Read data from the open file corresponding to FD. Up to COUNT
7645 bytes will be read from the file, starting at OFFSET relative to
7646 the start of the file. The target may read fewer bytes; common
7647 reasons include packet size limits and an end-of-file condition.
7648 The number of bytes read is returned. Zero should only be
7649 returned for a successful read at the end of the file, or if COUNT
7652 The data read should be returned as a binary attachment on success.
7653 If zero bytes were read, the response should include an empty
7654 binary attachment (i.e. a trailing semicolon). The return value
7655 is the number of target bytes read; the binary attachment may be
7656 longer if some characters were escaped.
7658 `vFile:pwrite: FD, OFFSET, DATA'
7659 Write DATA (a binary buffer) to the open file corresponding to FD.
7660 Start the write at OFFSET from the start of the file. Unlike
7661 many `write' system calls, there is no separate COUNT argument;
7662 the length of DATA in the packet is used. `vFile:write' returns
7663 the number of bytes written, which may be shorter than the length
7664 of DATA, or -1 if an error occurred.
7666 `vFile:unlink: PATHNAME'
7667 Delete the file at PATHNAME on the target. Return 0, or -1 if an
7668 error occurs. PATHNAME is a string.
7672 File: gdb.info, Node: Interrupts, Next: Examples, Prev: Host I/O Packets, Up: Remote Protocol
7677 When a program on the remote target is running, GDB may attempt to
7678 interrupt it by sending a `Ctrl-C' or a `BREAK', control of which is
7679 specified via GDB's `remotebreak' setting (*note set remotebreak::).
7681 The precise meaning of `BREAK' is defined by the transport mechanism
7682 and may, in fact, be undefined. GDB does not currently define a
7683 `BREAK' mechanism for any of the network interfaces.
7685 `Ctrl-C', on the other hand, is defined and implemented for all
7686 transport mechanisms. It is represented by sending the single byte
7687 `0x03' without any of the usual packet overhead described in the
7688 Overview section (*note Overview::). When a `0x03' byte is transmitted
7689 as part of a packet, it is considered to be packet data and does _not_
7690 represent an interrupt. E.g., an `X' packet (*note X packet::), used
7691 for binary downloads, may include an unescaped `0x03' as part of its
7694 Stubs are not required to recognize these interrupt mechanisms and
7695 the precise meaning associated with receipt of the interrupt is
7696 implementation defined. If the stub is successful at interrupting the
7697 running program, it is expected that it will send one of the Stop Reply
7698 Packets (*note Stop Reply Packets::) to GDB as a result of successfully
7699 stopping the program. Interrupts received while the program is stopped
7703 File: gdb.info, Node: Examples, Next: File-I/O Remote Protocol Extension, Prev: Interrupts, Up: Remote Protocol
7708 Example sequence of a target being re-started. Notice how the restart
7709 does not get any direct output:
7716 <- `T001:1234123412341234'
7719 Example sequence of a target being stepped by a single instruction:
7726 <- `T001:1234123412341234'
7734 File: gdb.info, Node: File-I/O Remote Protocol Extension, Next: Library List Format, Prev: Examples, Up: Remote Protocol
7736 D.10 File-I/O Remote Protocol Extension
7737 =======================================
7741 * File-I/O Overview::
7743 * The F Request Packet::
7744 * The F Reply Packet::
7745 * The Ctrl-C Message::
7747 * List of Supported Calls::
7748 * Protocol-specific Representation of Datatypes::
7750 * File-I/O Examples::
7753 File: gdb.info, Node: File-I/O Overview, Next: Protocol Basics, Up: File-I/O Remote Protocol Extension
7755 D.10.1 File-I/O Overview
7756 ------------------------
7758 The "File I/O remote protocol extension" (short: File-I/O) allows the
7759 target to use the host's file system and console I/O to perform various
7760 system calls. System calls on the target system are translated into a
7761 remote protocol packet to the host system, which then performs the
7762 needed actions and returns a response packet to the target system.
7763 This simulates file system operations even on targets that lack file
7766 The protocol is defined to be independent of both the host and
7767 target systems. It uses its own internal representation of datatypes
7768 and values. Both GDB and the target's GDB stub are responsible for
7769 translating the system-dependent value representations into the internal
7770 protocol representations when data is transmitted.
7772 The communication is synchronous. A system call is possible only
7773 when GDB is waiting for a response from the `C', `c', `S' or `s'
7774 packets. While GDB handles the request for a system call, the target
7775 is stopped to allow deterministic access to the target's memory.
7776 Therefore File-I/O is not interruptible by target signals. On the
7777 other hand, it is possible to interrupt File-I/O by a user interrupt
7778 (`Ctrl-C') within GDB.
7780 The target's request to perform a host system call does not finish
7781 the latest `C', `c', `S' or `s' action. That means, after finishing
7782 the system call, the target returns to continuing the previous activity
7783 (continue, step). No additional continue or step request from GDB is
7787 <- target requests 'system call X'
7788 target is stopped, GDB executes system call
7789 -> GDB returns result
7790 ... target continues, GDB returns to wait for the target
7791 <- target hits breakpoint and sends a Txx packet
7793 The protocol only supports I/O on the console and to regular files on
7794 the host file system. Character or block special devices, pipes, named
7795 pipes, sockets or any other communication method on the host system are
7796 not supported by this protocol.
7799 File: gdb.info, Node: Protocol Basics, Next: The F Request Packet, Prev: File-I/O Overview, Up: File-I/O Remote Protocol Extension
7801 D.10.2 Protocol Basics
7802 ----------------------
7804 The File-I/O protocol uses the `F' packet as the request as well as
7805 reply packet. Since a File-I/O system call can only occur when GDB is
7806 waiting for a response from the continuing or stepping target, the
7807 File-I/O request is a reply that GDB has to expect as a result of a
7808 previous `C', `c', `S' or `s' packet. This `F' packet contains all
7809 information needed to allow GDB to call the appropriate host system
7812 * A unique identifier for the requested system call.
7814 * All parameters to the system call. Pointers are given as addresses
7815 in the target memory address space. Pointers to strings are given
7816 as pointer/length pair. Numerical values are given as they are.
7817 Numerical control flags are given in a protocol-specific
7821 At this point, GDB has to perform the following actions.
7823 * If the parameters include pointer values to data needed as input
7824 to a system call, GDB requests this data from the target with a
7825 standard `m' packet request. This additional communication has to
7826 be expected by the target implementation and is handled as any
7829 * GDB translates all value from protocol representation to host
7830 representation as needed. Datatypes are coerced into the host
7833 * GDB calls the system call.
7835 * It then coerces datatypes back to protocol representation.
7837 * If the system call is expected to return data in buffer space
7838 specified by pointer parameters to the call, the data is
7839 transmitted to the target using a `M' or `X' packet. This packet
7840 has to be expected by the target implementation and is handled as
7841 any other `M' or `X' packet.
7844 Eventually GDB replies with another `F' packet which contains all
7845 necessary information for the target to continue. This at least
7850 * `errno', if has been changed by the system call.
7855 After having done the needed type and value coercion, the target
7856 continues the latest continue or step action.
7859 File: gdb.info, Node: The F Request Packet, Next: The F Reply Packet, Prev: Protocol Basics, Up: File-I/O Remote Protocol Extension
7861 D.10.3 The `F' Request Packet
7862 -----------------------------
7864 The `F' request packet has the following format:
7866 `FCALL-ID,PARAMETER...'
7867 CALL-ID is the identifier to indicate the host system call to be
7868 called. This is just the name of the function.
7870 PARAMETER... are the parameters to the system call. Parameters
7871 are hexadecimal integer values, either the actual values in case
7872 of scalar datatypes, pointers to target buffer space in case of
7873 compound datatypes and unspecified memory areas, or pointer/length
7874 pairs in case of string parameters. These are appended to the
7875 CALL-ID as a comma-delimited list. All values are transmitted in
7876 ASCII string representation, pointer/length pairs separated by a
7881 File: gdb.info, Node: The F Reply Packet, Next: The Ctrl-C Message, Prev: The F Request Packet, Up: File-I/O Remote Protocol Extension
7883 D.10.4 The `F' Reply Packet
7884 ---------------------------
7886 The `F' reply packet has the following format:
7888 `FRETCODE,ERRNO,CTRL-C FLAG;CALL-SPECIFIC ATTACHMENT'
7889 RETCODE is the return code of the system call as hexadecimal value.
7891 ERRNO is the `errno' set by the call, in protocol-specific
7892 representation. This parameter can be omitted if the call was
7895 CTRL-C FLAG is only sent if the user requested a break. In this
7896 case, ERRNO must be sent as well, even if the call was successful.
7897 The CTRL-C FLAG itself consists of the character `C':
7901 or, if the call was interrupted before the host call has been
7906 assuming 4 is the protocol-specific representation of `EINTR'.
7910 File: gdb.info, Node: The Ctrl-C Message, Next: Console I/O, Prev: The F Reply Packet, Up: File-I/O Remote Protocol Extension
7912 D.10.5 The `Ctrl-C' Message
7913 ---------------------------
7915 If the `Ctrl-C' flag is set in the GDB reply packet (*note The F Reply
7916 Packet::), the target should behave as if it had gotten a break
7917 message. The meaning for the target is "system call interrupted by
7918 `SIGINT'". Consequentially, the target should actually stop (as with a
7919 break message) and return to GDB with a `T02' packet.
7921 It's important for the target to know in which state the system call
7922 was interrupted. There are two possible cases:
7924 * The system call hasn't been performed on the host yet.
7926 * The system call on the host has been finished.
7929 These two states can be distinguished by the target by the value of
7930 the returned `errno'. If it's the protocol representation of `EINTR',
7931 the system call hasn't been performed. This is equivalent to the
7932 `EINTR' handling on POSIX systems. In any other case, the target may
7933 presume that the system call has been finished -- successfully or not
7934 -- and should behave as if the break message arrived right after the
7937 GDB must behave reliably. If the system call has not been called
7938 yet, GDB may send the `F' reply immediately, setting `EINTR' as `errno'
7939 in the packet. If the system call on the host has been finished before
7940 the user requests a break, the full action must be finished by GDB.
7941 This requires sending `M' or `X' packets as necessary. The `F' packet
7942 may only be sent when either nothing has happened or the full action
7946 File: gdb.info, Node: Console I/O, Next: List of Supported Calls, Prev: The Ctrl-C Message, Up: File-I/O Remote Protocol Extension
7951 By default and if not explicitly closed by the target system, the file
7952 descriptors 0, 1 and 2 are connected to the GDB console. Output on the
7953 GDB console is handled as any other file output operation (`write(1,
7954 ...)' or `write(2, ...)'). Console input is handled by GDB so that
7955 after the target read request from file descriptor 0 all following
7956 typing is buffered until either one of the following conditions is met:
7958 * The user types `Ctrl-c'. The behaviour is as explained above, and
7959 the `read' system call is treated as finished.
7961 * The user presses <RET>. This is treated as end of input with a
7964 * The user types `Ctrl-d'. This is treated as end of input. No
7965 trailing character (neither newline nor `Ctrl-D') is appended to
7969 If the user has typed more characters than fit in the buffer given to
7970 the `read' call, the trailing characters are buffered in GDB until
7971 either another `read(0, ...)' is requested by the target, or debugging
7972 is stopped at the user's request.
7975 File: gdb.info, Node: List of Supported Calls, Next: Protocol-specific Representation of Datatypes, Prev: Console I/O, Up: File-I/O Remote Protocol Extension
7977 D.10.7 List of Supported Calls
7978 ------------------------------
7995 File: gdb.info, Node: open, Next: close, Up: List of Supported Calls
8001 int open(const char *pathname, int flags);
8002 int open(const char *pathname, int flags, mode_t mode);
8005 `Fopen,PATHPTR/LEN,FLAGS,MODE'
8007 FLAGS is the bitwise `OR' of the following values:
8010 If the file does not exist it will be created. The host
8011 rules apply as far as file ownership and time stamps are
8015 When used with `O_CREAT', if the file already exists it is an
8016 error and open() fails.
8019 If the file already exists and the open mode allows writing
8020 (`O_RDWR' or `O_WRONLY' is given) it will be truncated to
8024 The file is opened in append mode.
8027 The file is opened for reading only.
8030 The file is opened for writing only.
8033 The file is opened for reading and writing.
8035 Other bits are silently ignored.
8037 MODE is the bitwise `OR' of the following values:
8040 User has read permission.
8043 User has write permission.
8046 Group has read permission.
8049 Group has write permission.
8052 Others have read permission.
8055 Others have write permission.
8057 Other bits are silently ignored.
8060 `open' returns the new file descriptor or -1 if an error occurred.
8065 PATHNAME already exists and `O_CREAT' and `O_EXCL' were used.
8068 PATHNAME refers to a directory.
8071 The requested access is not allowed.
8074 PATHNAME was too long.
8077 A directory component in PATHNAME does not exist.
8080 PATHNAME refers to a device, pipe, named pipe or socket.
8083 PATHNAME refers to a file on a read-only filesystem and write
8084 access was requested.
8087 PATHNAME is an invalid pointer value.
8090 No space on device to create the file.
8093 The process already has the maximum number of files open.
8096 The limit on the total number of files open on the system has
8100 The call was interrupted by the user.
8104 File: gdb.info, Node: close, Next: read, Prev: open, Up: List of Supported Calls
8116 `close' returns zero on success, or -1 if an error occurred.
8121 FD isn't a valid open file descriptor.
8124 The call was interrupted by the user.
8128 File: gdb.info, Node: read, Next: write, Prev: close, Up: List of Supported Calls
8134 int read(int fd, void *buf, unsigned int count);
8137 `Fread,FD,BUFPTR,COUNT'
8140 On success, the number of bytes read is returned. Zero indicates
8141 end of file. If count is zero, read returns zero as well. On
8142 error, -1 is returned.
8147 FD is not a valid file descriptor or is not open for reading.
8150 BUFPTR is an invalid pointer value.
8153 The call was interrupted by the user.
8157 File: gdb.info, Node: write, Next: lseek, Prev: read, Up: List of Supported Calls
8163 int write(int fd, const void *buf, unsigned int count);
8166 `Fwrite,FD,BUFPTR,COUNT'
8169 On success, the number of bytes written are returned. Zero
8170 indicates nothing was written. On error, -1 is returned.
8175 FD is not a valid file descriptor or is not open for writing.
8178 BUFPTR is an invalid pointer value.
8181 An attempt was made to write a file that exceeds the
8182 host-specific maximum file size allowed.
8185 No space on device to write the data.
8188 The call was interrupted by the user.
8192 File: gdb.info, Node: lseek, Next: rename, Prev: write, Up: List of Supported Calls
8198 long lseek (int fd, long offset, int flag);
8201 `Flseek,FD,OFFSET,FLAG'
8206 The offset is set to OFFSET bytes.
8209 The offset is set to its current location plus OFFSET bytes.
8212 The offset is set to the size of the file plus OFFSET bytes.
8215 On success, the resulting unsigned offset in bytes from the
8216 beginning of the file is returned. Otherwise, a value of -1 is
8222 FD is not a valid open file descriptor.
8225 FD is associated with the GDB console.
8228 FLAG is not a proper value.
8231 The call was interrupted by the user.
8235 File: gdb.info, Node: rename, Next: unlink, Prev: lseek, Up: List of Supported Calls
8241 int rename(const char *oldpath, const char *newpath);
8244 `Frename,OLDPATHPTR/LEN,NEWPATHPTR/LEN'
8247 On success, zero is returned. On error, -1 is returned.
8252 NEWPATH is an existing directory, but OLDPATH is not a
8256 NEWPATH is a non-empty directory.
8259 OLDPATH or NEWPATH is a directory that is in use by some
8263 An attempt was made to make a directory a subdirectory of
8267 A component used as a directory in OLDPATH or new path is
8268 not a directory. Or OLDPATH is a directory and NEWPATH
8269 exists but is not a directory.
8272 OLDPATHPTR or NEWPATHPTR are invalid pointer values.
8275 No access to the file or the path of the file.
8278 OLDPATH or NEWPATH was too long.
8281 A directory component in OLDPATH or NEWPATH does not exist.
8284 The file is on a read-only filesystem.
8287 The device containing the file has no room for the new
8291 The call was interrupted by the user.
8295 File: gdb.info, Node: unlink, Next: stat/fstat, Prev: rename, Up: List of Supported Calls
8301 int unlink(const char *pathname);
8304 `Funlink,PATHNAMEPTR/LEN'
8307 On success, zero is returned. On error, -1 is returned.
8312 No access to the file or the path of the file.
8315 The system does not allow unlinking of directories.
8318 The file PATHNAME cannot be unlinked because it's being used
8322 PATHNAMEPTR is an invalid pointer value.
8325 PATHNAME was too long.
8328 A directory component in PATHNAME does not exist.
8331 A component of the path is not a directory.
8334 The file is on a read-only filesystem.
8337 The call was interrupted by the user.
8341 File: gdb.info, Node: stat/fstat, Next: gettimeofday, Prev: unlink, Up: List of Supported Calls
8347 int stat(const char *pathname, struct stat *buf);
8348 int fstat(int fd, struct stat *buf);
8351 `Fstat,PATHNAMEPTR/LEN,BUFPTR'
8355 On success, zero is returned. On error, -1 is returned.
8360 FD is not a valid open file.
8363 A directory component in PATHNAME does not exist or the path
8367 A component of the path is not a directory.
8370 PATHNAMEPTR is an invalid pointer value.
8373 No access to the file or the path of the file.
8376 PATHNAME was too long.
8379 The call was interrupted by the user.
8383 File: gdb.info, Node: gettimeofday, Next: isatty, Prev: stat/fstat, Up: List of Supported Calls
8389 int gettimeofday(struct timeval *tv, void *tz);
8392 `Fgettimeofday,TVPTR,TZPTR'
8395 On success, 0 is returned, -1 otherwise.
8400 TZ is a non-NULL pointer.
8403 TVPTR and/or TZPTR is an invalid pointer value.
8407 File: gdb.info, Node: isatty, Next: system, Prev: gettimeofday, Up: List of Supported Calls
8419 Returns 1 if FD refers to the GDB console, 0 otherwise.
8424 The call was interrupted by the user.
8427 Note that the `isatty' call is treated as a special case: it returns
8428 1 to the target if the file descriptor is attached to the GDB console,
8429 0 otherwise. Implementing through system calls would require
8430 implementing `ioctl' and would be more complex than needed.
8433 File: gdb.info, Node: system, Prev: isatty, Up: List of Supported Calls
8439 int system(const char *command);
8442 `Fsystem,COMMANDPTR/LEN'
8445 If LEN is zero, the return value indicates whether a shell is
8446 available. A zero return value indicates a shell is not available.
8447 For non-zero LEN, the value returned is -1 on error and the return
8448 status of the command otherwise. Only the exit status of the
8449 command is returned, which is extracted from the host's `system'
8450 return value by calling `WEXITSTATUS(retval)'. In case `/bin/sh'
8451 could not be executed, 127 is returned.
8456 The call was interrupted by the user.
8459 GDB takes over the full task of calling the necessary host calls to
8460 perform the `system' call. The return value of `system' on the host is
8461 simplified before it's returned to the target. Any termination signal
8462 information from the child process is discarded, and the return value
8463 consists entirely of the exit status of the called command.
8465 Due to security concerns, the `system' call is by default refused by
8466 GDB. The user has to allow this call explicitly with the `set remote
8467 system-call-allowed 1' command.
8469 `set remote system-call-allowed'
8470 Control whether to allow the `system' calls in the File I/O
8471 protocol for the remote target. The default is zero (disabled).
8473 `show remote system-call-allowed'
8474 Show whether the `system' calls are allowed in the File I/O
8478 File: gdb.info, Node: Protocol-specific Representation of Datatypes, Next: Constants, Prev: List of Supported Calls, Up: File-I/O Remote Protocol Extension
8480 D.10.8 Protocol-specific Representation of Datatypes
8481 ----------------------------------------------------
8485 * Integral Datatypes::
8492 File: gdb.info, Node: Integral Datatypes, Next: Pointer Values, Up: Protocol-specific Representation of Datatypes
8497 The integral datatypes used in the system calls are `int', `unsigned
8498 int', `long', `unsigned long', `mode_t', and `time_t'.
8500 `int', `unsigned int', `mode_t' and `time_t' are implemented as 32
8501 bit values in this protocol.
8503 `long' and `unsigned long' are implemented as 64 bit types.
8505 *Note Limits::, for corresponding MIN and MAX values (similar to
8506 those in `limits.h') to allow range checking on host and target.
8508 `time_t' datatypes are defined as seconds since the Epoch.
8510 All integral datatypes transferred as part of a memory read or write
8511 of a structured datatype e.g. a `struct stat' have to be given in big
8515 File: gdb.info, Node: Pointer Values, Next: Memory Transfer, Prev: Integral Datatypes, Up: Protocol-specific Representation of Datatypes
8520 Pointers to target data are transmitted as they are. An exception is
8521 made for pointers to buffers for which the length isn't transmitted as
8522 part of the function call, namely strings. Strings are transmitted as
8523 a pointer/length pair, both as hex values, e.g.
8527 which is a pointer to data of length 18 bytes at position 0x1aaf. The
8528 length is defined as the full string length in bytes, including the
8529 trailing null byte. For example, the string `"hello world"' at address
8530 0x123456 is transmitted as
8535 File: gdb.info, Node: Memory Transfer, Next: struct stat, Prev: Pointer Values, Up: Protocol-specific Representation of Datatypes
8540 Structured data which is transferred using a memory read or write (for
8541 example, a `struct stat') is expected to be in a protocol-specific
8542 format with all scalar multibyte datatypes being big endian.
8543 Translation to this representation needs to be done both by the target
8544 before the `F' packet is sent, and by GDB before it transfers memory to
8545 the target. Transferred pointers to structured data should point to
8546 the already-coerced data at any time.
8549 File: gdb.info, Node: struct stat, Next: struct timeval, Prev: Memory Transfer, Up: Protocol-specific Representation of Datatypes
8554 The buffer of type `struct stat' used by the target and GDB is defined
8558 unsigned int st_dev; /* device */
8559 unsigned int st_ino; /* inode */
8560 mode_t st_mode; /* protection */
8561 unsigned int st_nlink; /* number of hard links */
8562 unsigned int st_uid; /* user ID of owner */
8563 unsigned int st_gid; /* group ID of owner */
8564 unsigned int st_rdev; /* device type (if inode device) */
8565 unsigned long st_size; /* total size, in bytes */
8566 unsigned long st_blksize; /* blocksize for filesystem I/O */
8567 unsigned long st_blocks; /* number of blocks allocated */
8568 time_t st_atime; /* time of last access */
8569 time_t st_mtime; /* time of last modification */
8570 time_t st_ctime; /* time of last change */
8573 The integral datatypes conform to the definitions given in the
8574 appropriate section (see *Note Integral Datatypes::, for details) so
8575 this structure is of size 64 bytes.
8577 The values of several fields have a restricted meaning and/or range
8581 A value of 0 represents a file, 1 the console.
8584 No valid meaning for the target. Transmitted unchanged.
8587 Valid mode bits are described in *Note Constants::. Any other
8588 bits have currently no meaning for the target.
8593 No valid meaning for the target. Transmitted unchanged.
8598 These values have a host and file system dependent accuracy.
8599 Especially on Windows hosts, the file system may not support exact
8602 The target gets a `struct stat' of the above representation and is
8603 responsible for coercing it to the target representation before
8606 Note that due to size differences between the host, target, and
8607 protocol representations of `struct stat' members, these members could
8608 eventually get truncated on the target.
8611 File: gdb.info, Node: struct timeval, Prev: struct stat, Up: Protocol-specific Representation of Datatypes
8616 The buffer of type `struct timeval' used by the File-I/O protocol is
8620 time_t tv_sec; /* second */
8621 long tv_usec; /* microsecond */
8624 The integral datatypes conform to the definitions given in the
8625 appropriate section (see *Note Integral Datatypes::, for details) so
8626 this structure is of size 8 bytes.
8629 File: gdb.info, Node: Constants, Next: File-I/O Examples, Prev: Protocol-specific Representation of Datatypes, Up: File-I/O Remote Protocol Extension
8634 The following values are used for the constants inside of the protocol.
8635 GDB and target are responsible for translating these values before and
8636 after the call as needed.
8647 File: gdb.info, Node: Open Flags, Next: mode_t Values, Up: Constants
8652 All values are given in hexadecimal representation.
8663 File: gdb.info, Node: mode_t Values, Next: Errno Values, Prev: Open Flags, Up: Constants
8668 All values are given in octal representation.
8683 File: gdb.info, Node: Errno Values, Next: Lseek Flags, Prev: mode_t Values, Up: Constants
8688 All values are given in decimal representation.
8711 `EUNKNOWN' is used as a fallback error value if a host system returns
8712 any error value not in the list of supported error numbers.
8715 File: gdb.info, Node: Lseek Flags, Next: Limits, Prev: Errno Values, Up: Constants
8725 File: gdb.info, Node: Limits, Prev: Lseek Flags, Up: Constants
8730 All values are given in decimal representation.
8735 LONG_MIN -9223372036854775808
8736 LONG_MAX 9223372036854775807
8737 ULONG_MAX 18446744073709551615
8740 File: gdb.info, Node: File-I/O Examples, Prev: Constants, Up: File-I/O Remote Protocol Extension
8742 D.10.10 File-I/O Examples
8743 -------------------------
8745 Example sequence of a write call, file descriptor 3, buffer is at target
8746 address 0x1234, 6 bytes should be written:
8748 <- `Fwrite,3,1234,6'
8749 _request memory read from target_
8752 _return "6 bytes written"_
8755 Example sequence of a read call, file descriptor 3, buffer is at
8756 target address 0x1234, 6 bytes should be read:
8759 _request memory write to target_
8761 _return "6 bytes read"_
8764 Example sequence of a read call, call fails on the host due to
8765 invalid file descriptor (`EBADF'):
8770 Example sequence of a read call, user presses `Ctrl-c' before
8771 syscall on host is called:
8777 Example sequence of a read call, user presses `Ctrl-c' after syscall
8785 File: gdb.info, Node: Library List Format, Next: Memory Map Format, Prev: File-I/O Remote Protocol Extension, Up: Remote Protocol
8787 D.11 Library List Format
8788 ========================
8790 On some platforms, a dynamic loader (e.g. `ld.so') runs in the same
8791 process as your application to manage libraries. In this case, GDB can
8792 use the loader's symbol table and normal memory operations to maintain
8793 a list of shared libraries. On other platforms, the operating system
8794 manages loaded libraries. GDB can not retrieve the list of currently
8795 loaded libraries through memory operations, so it uses the
8796 `qXfer:libraries:read' packet (*note qXfer library list read::)
8797 instead. The remote stub queries the target's operating system and
8798 reports which libraries are loaded.
8800 The `qXfer:libraries:read' packet returns an XML document which
8801 lists loaded libraries and their offsets. Each library has an
8802 associated name and one or more segment base addresses, which report
8803 where the library was loaded in memory. The segment bases are start
8804 addresses, not relocation offsets; they do not depend on the library's
8805 link-time base addresses.
8807 GDB must be linked with the Expat library to support XML library
8808 lists. *Note Expat::.
8810 A simple memory map, with one loaded library relocated by a single
8811 offset, looks like this:
8814 <library name="/lib/libc.so.6">
8815 <segment address="0x10000000"/>
8819 The format of a library list is described by this DTD:
8821 <!-- library-list: Root element with versioning -->
8822 <!ELEMENT library-list (library)*>
8823 <!ATTLIST library-list version CDATA #FIXED "1.0">
8824 <!ELEMENT library (segment)*>
8825 <!ATTLIST library name CDATA #REQUIRED>
8826 <!ELEMENT segment EMPTY>
8827 <!ATTLIST segment address CDATA #REQUIRED>
8830 File: gdb.info, Node: Memory Map Format, Prev: Library List Format, Up: Remote Protocol
8832 D.12 Memory Map Format
8833 ======================
8835 To be able to write into flash memory, GDB needs to obtain a memory map
8836 from the target. This section describes the format of the memory map.
8838 The memory map is obtained using the `qXfer:memory-map:read' (*note
8839 qXfer memory map read::) packet and is an XML document that lists
8842 GDB must be linked with the Expat library to support XML memory
8843 maps. *Note Expat::.
8845 The top-level structure of the document is shown below:
8847 <?xml version="1.0"?>
8848 <!DOCTYPE memory-map
8849 PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
8850 "http://sourceware.org/gdb/gdb-memory-map.dtd">
8855 Each region can be either:
8857 * A region of RAM starting at ADDR and extending for LENGTH bytes
8860 <memory type="ram" start="ADDR" length="LENGTH"/>
8862 * A region of read-only memory:
8864 <memory type="rom" start="ADDR" length="LENGTH"/>
8866 * A region of flash memory, with erasure blocks BLOCKSIZE bytes in
8869 <memory type="flash" start="ADDR" length="LENGTH">
8870 <property name="blocksize">BLOCKSIZE</property>
8874 Regions must not overlap. GDB assumes that areas of memory not
8875 covered by the memory map are RAM, and uses the ordinary `M' and `X'
8876 packets to write to addresses in such ranges.
8878 The formal DTD for memory map format is given below:
8880 <!-- ................................................... -->
8881 <!-- Memory Map XML DTD ................................ -->
8882 <!-- File: memory-map.dtd .............................. -->
8883 <!-- .................................... .............. -->
8884 <!-- memory-map.dtd -->
8885 <!-- memory-map: Root element with versioning -->
8886 <!ELEMENT memory-map (memory | property)>
8887 <!ATTLIST memory-map version CDATA #FIXED "1.0.0">
8888 <!ELEMENT memory (property)>
8889 <!-- memory: Specifies a memory region,
8890 and its type, or device. -->
8891 <!ATTLIST memory type CDATA #REQUIRED
8892 start CDATA #REQUIRED
8893 length CDATA #REQUIRED
8894 device CDATA #IMPLIED>
8895 <!-- property: Generic attribute tag -->
8896 <!ELEMENT property (#PCDATA | property)*>
8897 <!ATTLIST property name CDATA #REQUIRED>
8900 File: gdb.info, Node: Agent Expressions, Next: Target Descriptions, Prev: Remote Protocol, Up: Top
8902 Appendix E The GDB Agent Expression Mechanism
8903 *********************************************
8905 In some applications, it is not feasible for the debugger to interrupt
8906 the program's execution long enough for the developer to learn anything
8907 helpful about its behavior. If the program's correctness depends on its
8908 real-time behavior, delays introduced by a debugger might cause the
8909 program to fail, even when the code itself is correct. It is useful to
8910 be able to observe the program's behavior without interrupting it.
8912 Using GDB's `trace' and `collect' commands, the user can specify
8913 locations in the program, and arbitrary expressions to evaluate when
8914 those locations are reached. Later, using the `tfind' command, she can
8915 examine the values those expressions had when the program hit the trace
8916 points. The expressions may also denote objects in memory --
8917 structures or arrays, for example -- whose values GDB should record;
8918 while visiting a particular tracepoint, the user may inspect those
8919 objects as if they were in memory at that moment. However, because GDB
8920 records these values without interacting with the user, it can do so
8921 quickly and unobtrusively, hopefully not disturbing the program's
8924 When GDB is debugging a remote target, the GDB "agent" code running
8925 on the target computes the values of the expressions itself. To avoid
8926 having a full symbolic expression evaluator on the agent, GDB translates
8927 expressions in the source language into a simpler bytecode language, and
8928 then sends the bytecode to the agent; the agent then executes the
8929 bytecode, and records the values for GDB to retrieve later.
8931 The bytecode language is simple; there are forty-odd opcodes, the
8932 bulk of which are the usual vocabulary of C operands (addition,
8933 subtraction, shifts, and so on) and various sizes of literals and
8934 memory reference operations. The bytecode interpreter operates
8935 strictly on machine-level values -- various sizes of integers and
8936 floating point numbers -- and requires no information about types or
8937 symbols; thus, the interpreter's internal data structures are simple,
8938 and each bytecode requires only a few native machine instructions to
8939 implement it. The interpreter is small, and strict limits on the
8940 memory and time required to evaluate an expression are easy to
8941 determine, making it suitable for use by the debugging agent in
8942 real-time applications.
8946 * General Bytecode Design:: Overview of the interpreter.
8947 * Bytecode Descriptions:: What each one does.
8948 * Using Agent Expressions:: How agent expressions fit into the big picture.
8949 * Varying Target Capabilities:: How to discover what the target can do.
8950 * Tracing on Symmetrix:: Special info for implementation on EMC's
8952 * Rationale:: Why we did it this way.
8955 File: gdb.info, Node: General Bytecode Design, Next: Bytecode Descriptions, Up: Agent Expressions
8957 E.1 General Bytecode Design
8958 ===========================
8960 The agent represents bytecode expressions as an array of bytes. Each
8961 instruction is one byte long (thus the term "bytecode"). Some
8962 instructions are followed by operand bytes; for example, the `goto'
8963 instruction is followed by a destination for the jump.
8965 The bytecode interpreter is a stack-based machine; most instructions
8966 pop their operands off the stack, perform some operation, and push the
8967 result back on the stack for the next instruction to consume. Each
8968 element of the stack may contain either a integer or a floating point
8969 value; these values are as many bits wide as the largest integer that
8970 can be directly manipulated in the source language. Stack elements
8971 carry no record of their type; bytecode could push a value as an
8972 integer, then pop it as a floating point value. However, GDB will not
8973 generate code which does this. In C, one might define the type of a
8974 stack element as follows:
8979 where `LONGEST' and `DOUBLEST' are `typedef' names for the largest
8980 integer and floating point types on the machine.
8982 By the time the bytecode interpreter reaches the end of the
8983 expression, the value of the expression should be the only value left
8984 on the stack. For tracing applications, `trace' bytecodes in the
8985 expression will have recorded the necessary data, and the value on the
8986 stack may be discarded. For other applications, like conditional
8987 breakpoints, the value may be useful.
8989 Separate from the stack, the interpreter has two registers:
8991 The address of the next bytecode to execute.
8994 The address of the start of the bytecode expression, necessary for
8995 interpreting the `goto' and `if_goto' instructions.
8997 Neither of these registers is directly visible to the bytecode
8998 language itself, but they are useful for defining the meanings of the
8999 bytecode operations.
9001 There are no instructions to perform side effects on the running
9002 program, or call the program's functions; we assume that these
9003 expressions are only used for unobtrusive debugging, not for patching
9006 Most bytecode instructions do not distinguish between the various
9007 sizes of values, and operate on full-width values; the upper bits of the
9008 values are simply ignored, since they do not usually make a difference
9009 to the value computed. The exceptions to this rule are:
9010 memory reference instructions (`ref'N)
9011 There are distinct instructions to fetch different word sizes from
9012 memory. Once on the stack, however, the values are treated as
9013 full-size integers. They may need to be sign-extended; the `ext'
9014 instruction exists for this purpose.
9016 the sign-extension instruction (`ext' N)
9017 These clearly need to know which portion of their operand is to be
9018 extended to occupy the full length of the word.
9021 If the interpreter is unable to evaluate an expression completely for
9022 some reason (a memory location is inaccessible, or a divisor is zero,
9023 for example), we say that interpretation "terminates with an error".
9024 This means that the problem is reported back to the interpreter's caller
9025 in some helpful way. In general, code using agent expressions should
9026 assume that they may attempt to divide by zero, fetch arbitrary memory
9027 locations, and misbehave in other ways.
9029 Even complicated C expressions compile to a few bytecode
9030 instructions; for example, the expression `x + y * z' would typically
9031 produce code like the following, assuming that `x' and `y' live in
9032 registers, and `z' is a global variable holding a 32-bit `int':
9035 const32 address of z
9042 In detail, these mean:
9044 Push the value of register 1 (presumably holding `x') onto the
9048 Push the value of register 2 (holding `y').
9050 `const32 address of z'
9051 Push the address of `z' onto the stack.
9054 Fetch a 32-bit word from the address at the top of the stack;
9055 replace the address on the stack with the value. Thus, we replace
9056 the address of `z' with `z''s value.
9059 Sign-extend the value on the top of the stack from 32 bits to full
9060 length. This is necessary because `z' is a signed integer.
9063 Pop the top two numbers on the stack, multiply them, and push their
9064 product. Now the top of the stack contains the value of the
9068 Pop the top two numbers, add them, and push the sum. Now the top
9069 of the stack contains the value of `x + y * z'.
9072 Stop executing; the value left on the stack top is the value to be