1 This is gdb.info, produced by makeinfo version 4.8 from 2 /home/jingyu/projects/gcc/android-toolchainsrc/build/../gdb/gdb-6.6/gdb/doc/gdb.texinfo. 3 4 INFO-DIR-SECTION Software development 5 START-INFO-DIR-ENTRY 6 * Gdb: (gdb). The GNU debugger. 7 END-INFO-DIR-ENTRY 8 9 This file documents the GNU debugger GDB. 10 11 This is the Ninth Edition, of `Debugging with GDB: the GNU 12 Source-Level Debugger' for GDB Version 6.6. 13 14 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 15 1998, 16 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 17 Free Software Foundation, Inc. 18 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. 25 26 (a) The Free Software Foundation's Back-Cover Text is: "You have 27 freedom to copy and modify this GNU Manual, like GNU software. Copies 28 published by the Free Software Foundation raise funds for GNU 29 development." 30 31 32 File: gdb.info, Node: Top, Next: Summary, Prev: (dir), Up: (dir) 33 34 Debugging with GDB 35 ****************** 36 37 This file describes GDB, the GNU symbolic debugger. 38 39 This is the Ninth Edition, for GDB Version 6.6. 40 41 Copyright (C) 1988-2006 Free Software Foundation, Inc. 42 43 * Menu: 44 45 * Summary:: Summary of GDB 46 * Sample Session:: A sample GDB session 47 48 * Invocation:: Getting in and out of GDB 49 * Commands:: GDB commands 50 * Running:: Running programs under GDB 51 * Stopping:: Stopping and continuing 52 * Stack:: Examining the stack 53 * Source:: Examining source files 54 * Data:: Examining data 55 * Macros:: Preprocessor Macros 56 * Tracepoints:: Debugging remote targets non-intrusively 57 * Overlays:: Debugging programs that use overlays 58 59 * Languages:: Using GDB with different languages 60 61 * Symbols:: Examining the symbol table 62 * Altering:: Altering execution 63 * GDB Files:: GDB files 64 * Targets:: Specifying a debugging target 65 * Remote Debugging:: Debugging remote programs 66 * Configurations:: Configuration-specific information 67 * Controlling GDB:: Controlling GDB 68 * Sequences:: Canned sequences of commands 69 * TUI:: GDB Text User Interface 70 * Interpreters:: Command Interpreters 71 * Emacs:: Using GDB under GNU Emacs 72 * Annotations:: GDB's annotation interface. 73 * GDB/MI:: GDB's Machine Interface. 74 75 * GDB Bugs:: Reporting bugs in GDB 76 * Formatting Documentation:: How to format and print GDB documentation 77 78 * Command Line Editing:: Command Line Editing 79 * Using History Interactively:: Using History Interactively 80 * Installing GDB:: Installing GDB 81 * Maintenance Commands:: Maintenance Commands 82 * Remote Protocol:: GDB Remote Serial Protocol 83 * Agent Expressions:: The GDB Agent Expression Mechanism 84 * Copying:: GNU General Public License says 85 how you can copy and share GDB 86 * GNU Free Documentation License:: The license for this documentation 87 * Index:: Index 88 89 90 File: gdb.info, Node: Summary, Next: Sample Session, Prev: Top, Up: Top 91 92 Summary of GDB 93 ************** 94 95 The purpose of a debugger such as GDB is to allow you to see what is 96 going on "inside" another program while it executes--or what another 97 program was doing at the moment it crashed. 98 99 GDB can do four main kinds of things (plus other things in support of 100 these) to help you catch bugs in the act: 101 102 * Start your program, specifying anything that might affect its 103 behavior. 104 105 * Make your program stop on specified conditions. 106 107 * Examine what has happened, when your program has stopped. 108 109 * Change things in your program, so you can experiment with 110 correcting the effects of one bug and go on to learn about another. 111 112 You can use GDB to debug programs written in C and C++. For more 113 information, see *Note Supported languages: Supported languages. For 114 more information, see *Note C and C++: C. 115 116 Support for Modula-2 is partial. For information on Modula-2, see 117 *Note Modula-2: Modula-2. 118 119 Debugging Pascal programs which use sets, subranges, file variables, 120 or nested functions does not currently work. GDB does not support 121 entering expressions, printing values, or similar features using Pascal 122 syntax. 123 124 GDB can be used to debug programs written in Fortran, although it 125 may be necessary to refer to some variables with a trailing underscore. 126 127 GDB can be used to debug programs written in Objective-C, using 128 either the Apple/NeXT or the GNU Objective-C runtime. 129 130 * Menu: 131 132 * Free Software:: Freely redistributable software 133 * Contributors:: Contributors to GDB 134 135 136 File: gdb.info, Node: Free Software, Next: Contributors, Up: Summary 137 138 Free software 139 ============= 140 141 GDB is "free software", protected by the GNU General Public License 142 (GPL). The GPL gives you the freedom to copy or adapt a licensed 143 program--but every person getting a copy also gets with it the freedom 144 to modify that copy (which means that they must get access to the 145 source code), and the freedom to distribute further copies. Typical 146 software companies use copyrights to limit your freedoms; the Free 147 Software Foundation uses the GPL to preserve these freedoms. 148 149 Fundamentally, the General Public License is a license which says 150 that you have these freedoms and that you cannot take these freedoms 151 away from anyone else. 152 153 Free Software Needs Free Documentation 154 ====================================== 155 156 The biggest deficiency in the free software community today is not in 157 the software--it is the lack of good free documentation that we can 158 include with the free software. Many of our most important programs do 159 not come with free reference manuals and free introductory texts. 160 Documentation is an essential part of any software package; when an 161 important free software package does not come with a free manual and a 162 free tutorial, that is a major gap. We have many such gaps today. 163 164 Consider Perl, for instance. The tutorial manuals that people 165 normally use are non-free. How did this come about? Because the 166 authors of those manuals published them with restrictive terms--no 167 copying, no modification, source files not available--which exclude 168 them from the free software world. 169 170 That wasn't the first time this sort of thing happened, and it was 171 far from the last. Many times we have heard a GNU user eagerly 172 describe a manual that he is writing, his intended contribution to the 173 community, only to learn that he had ruined everything by signing a 174 publication contract to make it non-free. 175 176 Free documentation, like free software, is a matter of freedom, not 177 price. The problem with the non-free manual is not that publishers 178 charge a price for printed copies--that in itself is fine. (The Free 179 Software Foundation sells printed copies of manuals, too.) The problem 180 is the restrictions on the use of the manual. Free manuals are 181 available in source code form, and give you permission to copy and 182 modify. Non-free manuals do not allow this. 183 184 The criteria of freedom for a free manual are roughly the same as for 185 free software. Redistribution (including the normal kinds of 186 commercial redistribution) must be permitted, so that the manual can 187 accompany every copy of the program, both on-line and on paper. 188 189 Permission for modification of the technical content is crucial too. 190 When people modify the software, adding or changing features, if they 191 are conscientious they will change the manual too--so they can provide 192 accurate and clear documentation for the modified program. A manual 193 that leaves you no choice but to write a new manual to document a 194 changed version of the program is not really available to our community. 195 196 Some kinds of limits on the way modification is handled are 197 acceptable. For example, requirements to preserve the original 198 author's copyright notice, the distribution terms, or the list of 199 authors, are ok. It is also no problem to require modified versions to 200 include notice that they were modified. Even entire sections that may 201 not be deleted or changed are acceptable, as long as they deal with 202 nontechnical topics (like this one). These kinds of restrictions are 203 acceptable because they don't obstruct the community's normal use of 204 the manual. 205 206 However, it must be possible to modify all the _technical_ content 207 of the manual, and then distribute the result in all the usual media, 208 through all the usual channels. Otherwise, the restrictions obstruct 209 the use of the manual, it is not free, and we need another manual to 210 replace it. 211 212 Please spread the word about this issue. Our community continues to 213 lose manuals to proprietary publishing. If we spread the word that 214 free software needs free reference manuals and free tutorials, perhaps 215 the next person who wants to contribute by writing documentation will 216 realize, before it is too late, that only free manuals contribute to 217 the free software community. 218 219 If you are writing documentation, please insist on publishing it 220 under the GNU Free Documentation License or another free documentation 221 license. Remember that this decision requires your approval--you don't 222 have to let the publisher decide. Some commercial publishers will use 223 a free license if you insist, but they will not propose the option; it 224 is up to you to raise the issue and say firmly that this is what you 225 want. If the publisher you are dealing with refuses, please try other 226 publishers. If you're not sure whether a proposed license is free, 227 write to <licensing (a] gnu.org>. 228 229 You can encourage commercial publishers to sell more free, copylefted 230 manuals and tutorials by buying them, and particularly by buying copies 231 from the publishers that paid for their writing or for major 232 improvements. Meanwhile, try to avoid buying non-free documentation at 233 all. Check the distribution terms of a manual before you buy it, and 234 insist that whoever seeks your business must respect your freedom. 235 Check the history of the book, and try to reward the publishers that 236 have paid or pay the authors to work on it. 237 238 The Free Software Foundation maintains a list of free documentation 239 published by other publishers, at 240 `http://www.fsf.org/doc/other-free-books.html'. 241 242 243 File: gdb.info, Node: Contributors, Prev: Free Software, Up: Summary 244 245 Contributors to GDB 246 =================== 247 248 Richard Stallman was the original author of GDB, and of many other GNU 249 programs. Many others have contributed to its development. This 250 section attempts to credit major contributors. One of the virtues of 251 free software is that everyone is free to contribute to it; with 252 regret, we cannot actually acknowledge everyone here. The file 253 `ChangeLog' in the GDB distribution approximates a blow-by-blow account. 254 255 Changes much prior to version 2.0 are lost in the mists of time. 256 257 _Plea:_ Additions to this section are particularly welcome. If you 258 or your friends (or enemies, to be evenhanded) have been unfairly 259 omitted from this list, we would like to add your names! 260 261 So that they may not regard their many labors as thankless, we 262 particularly thank those who shepherded GDB through major releases: 263 Andrew Cagney (releases 6.3, 6.2, 6.1, 6.0, 5.3, 5.2, 5.1 and 5.0); Jim 264 Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs 265 (release 4.14); Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10, 266 and 4.9); Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, 267 and 4.4); John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim 268 Kingdon (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2, 269 3.1, and 3.0). 270 271 Richard Stallman, assisted at various times by Peter TerMaat, Chris 272 Hanson, and Richard Mlynarik, handled releases through 2.8. 273 274 Michael Tiemann is the author of most of the GNU C++ support in GDB, 275 with significant additional contributions from Per Bothner and Daniel 276 Berlin. James Clark wrote the GNU C++ demangler. Early work on C++ 277 was by Peter TerMaat (who also did much general update work leading to 278 release 3.0). 279 280 GDB uses the BFD subroutine library to examine multiple object-file 281 formats; BFD was a joint project of David V. Henkel-Wallace, Rich 282 Pixley, Steve Chamberlain, and John Gilmore. 283 284 David Johnson wrote the original COFF support; Pace Willison did the 285 original support for encapsulated COFF. 286 287 Brent Benson of Harris Computer Systems contributed DWARF 2 support. 288 289 Adam de Boor and Bradley Davis contributed the ISI Optimum V support. 290 Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS 291 support. Jean-Daniel Fekete contributed Sun 386i support. Chris 292 Hanson improved the HP9000 support. Noboyuki Hikichi and Tomoyuki 293 Hasei contributed Sony/News OS 3 support. David Johnson contributed 294 Encore Umax support. Jyrki Kuoppala contributed Altos 3068 support. 295 Jeff Law contributed HP PA and SOM support. Keith Packard contributed 296 NS32K support. Doug Rabson contributed Acorn Risc Machine support. 297 Bob Rusk contributed Harris Nighthawk CX-UX support. Chris Smith 298 contributed Convex support (and Fortran debugging). Jonathan Stone 299 contributed Pyramid support. Michael Tiemann contributed SPARC support. 300 Tim Tucker contributed support for the Gould NP1 and Gould Powernode. 301 Pace Willison contributed Intel 386 support. Jay Vosburgh contributed 302 Symmetry support. Marko Mlinar contributed OpenRISC 1000 support. 303 304 Andreas Schwab contributed M68K GNU/Linux support. 305 306 Rich Schaefer and Peter Schauer helped with support of SunOS shared 307 libraries. 308 309 Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about 310 several machine instruction sets. 311 312 Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped 313 develop remote debugging. Intel Corporation, Wind River Systems, AMD, 314 and ARM contributed remote debugging modules for the i960, VxWorks, 315 A29K UDI, and RDI targets, respectively. 316 317 Brian Fox is the author of the readline libraries providing 318 command-line editing and command history. 319 320 Andrew Beers of SUNY Buffalo wrote the language-switching code, the 321 Modula-2 support, and contributed the Languages chapter of this manual. 322 323 Fred Fish wrote most of the support for Unix System Vr4. He also 324 enhanced the command-completion support to cover C++ overloaded symbols. 325 326 Hitachi America (now Renesas America), Ltd. sponsored the support for 327 H8/300, H8/500, and Super-H processors. 328 329 NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx 330 processors. 331 332 Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and 333 M32R/D processors. 334 335 Toshiba sponsored the support for the TX39 Mips processor. 336 337 Matsushita sponsored the support for the MN10200 and MN10300 338 processors. 339 340 Fujitsu sponsored the support for SPARClite and FR30 processors. 341 342 Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware 343 watchpoints. 344 345 Michael Snyder added support for tracepoints. 346 347 Stu Grossman wrote gdbserver. 348 349 Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly 350 innumerable bug fixes and cleanups throughout GDB. 351 352 The following people at the Hewlett-Packard Company contributed 353 support for the PA-RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0 354 (narrow mode), HP's implementation of kernel threads, HP's aC++ 355 compiler, and the Text User Interface (nee Terminal User Interface): 356 Ben Krepp, Richard Title, John Bishop, Susan Macchia, Kathy Mann, 357 Satish Pai, India Paul, Steve Rehrauer, and Elena Zannoni. Kim Haase 358 provided HP-specific information in this manual. 359 360 DJ Delorie ported GDB to MS-DOS, for the DJGPP project. Robert 361 Hoehne made significant contributions to the DJGPP port. 362 363 Cygnus Solutions has sponsored GDB maintenance and much of its 364 development since 1991. Cygnus engineers who have worked on GDB 365 fulltime include Mark Alexander, Jim Blandy, Per Bothner, Kevin 366 Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin Hunt, Jim 367 Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler, 368 Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek 369 Radouch, Keith Seitz, Stan Shebs, David Taylor, and Elena Zannoni. In 370 addition, Dave Brolley, Ian Carmichael, Steve Chamberlain, Nick Clifton, 371 JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank Eigler, Doug 372 Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff 373 Holcomb, Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner, 374 Jason Merrill, Catherine Moore, Drew Moseley, Ken Raeburn, Gavin 375 Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela 376 Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David 377 Zuhn have made contributions both large and small. 378 379 Andrew Cagney, Fernando Nasser, and Elena Zannoni, while working for 380 Cygnus Solutions, implemented the original GDB/MI interface. 381 382 Jim Blandy added support for preprocessor macros, while working for 383 Red Hat. 384 385 Andrew Cagney designed GDB's architecture vector. Many people 386 including Andrew Cagney, Stephane Carrez, Randolph Chung, Nick Duffek, 387 Richard Henderson, Mark Kettenis, Grace Sainsbury, Kei Sakamoto, 388 Yoshinori Sato, Michael Snyder, Andreas Schwab, Jason Thorpe, Corinna 389 Vinschen, Ulrich Weigand, and Elena Zannoni, helped with the migration 390 of old architectures to this new framework. 391 392 Andrew Cagney completely re-designed and re-implemented GDB's 393 unwinder framework, this consisting of a fresh new design featuring 394 frame IDs, independent frame sniffers, and the sentinel frame. Mark 395 Kettenis implemented the DWARF 2 unwinder, Jeff Johnston the libunwind 396 unwinder, and Andrew Cagney the dummy, sentinel, tramp, and trad 397 unwinders. The architecture specific changes, each involving a 398 complete rewrite of the architecture's frame code, were carried out by 399 Jim Blandy, Joel Brobecker, Kevin Buettner, Andrew Cagney, Stephane 400 Carrez, Randolph Chung, Orjan Friberg, Richard Henderson, Daniel 401 Jacobowitz, Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei 402 Sakamoto, Yoshinori Sato, Michael Snyder, Corinna Vinschen, and Ulrich 403 Weigand. 404 405 Christian Zankel, Ross Morley, Bob Wilson, and Maxim Grigoriev from 406 Tensilica, Inc. contributed support for Xtensa processors. Others who 407 have worked on the Xtensa port of GDB in the past include Steve Tjiang, 408 John Newlin, and Scott Foehner. 409 410 411 File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top 412 413 1 A Sample GDB Session 414 ********************** 415 416 You can use this manual at your leisure to read all about GDB. 417 However, a handful of commands are enough to get started using the 418 debugger. This chapter illustrates those commands. 419 420 One of the preliminary versions of GNU `m4' (a generic macro 421 processor) exhibits the following bug: sometimes, when we change its 422 quote strings from the default, the commands used to capture one macro 423 definition within another stop working. In the following short `m4' 424 session, we define a macro `foo' which expands to `0000'; we then use 425 the `m4' built-in `defn' to define `bar' as the same thing. However, 426 when we change the open quote string to `<QUOTE>' and the close quote 427 string to `<UNQUOTE>', the same procedure fails to define a new synonym 428 `baz': 429 430 $ cd gnu/m4 431 $ ./m4 432 define(foo,0000) 433 434 foo 435 0000 436 define(bar,defn(`foo')) 437 438 bar 439 0000 440 changequote(<QUOTE>,<UNQUOTE>) 441 442 define(baz,defn(<QUOTE>foo<UNQUOTE>)) 443 baz 444 Ctrl-d 445 m4: End of input: 0: fatal error: EOF in string 446 447 Let us use GDB to try to see what is going on. 448 449 $ gdb m4 450 GDB is free software and you are welcome to distribute copies 451 of it under certain conditions; type "show copying" to see 452 the conditions. 453 There is absolutely no warranty for GDB; type "show warranty" 454 for details. 455 456 GDB 6.6, Copyright 1999 Free Software Foundation, Inc... 457 (gdb) 458 459 GDB reads only enough symbol data to know where to find the rest when 460 needed; as a result, the first prompt comes up very quickly. We now 461 tell GDB to use a narrower display width than usual, so that examples 462 fit in this manual. 463 464 (gdb) set width 70 465 466 We need to see how the `m4' built-in `changequote' works. Having 467 looked at the source, we know the relevant subroutine is 468 `m4_changequote', so we set a breakpoint there with the GDB `break' 469 command. 470 471 (gdb) break m4_changequote 472 Breakpoint 1 at 0x62f4: file builtin.c, line 879. 473 474 Using the `run' command, we start `m4' running under GDB control; as 475 long as control does not reach the `m4_changequote' subroutine, the 476 program runs as usual: 477 478 (gdb) run 479 Starting program: /work/Editorial/gdb/gnu/m4/m4 480 define(foo,0000) 481 482 foo 483 0000 484 485 To trigger the breakpoint, we call `changequote'. GDB suspends 486 execution of `m4', displaying information about the context where it 487 stops. 488 489 changequote(<QUOTE>,<UNQUOTE>) 490 491 Breakpoint 1, m4_changequote (argc=3, argv=0x33c70) 492 at builtin.c:879 493 879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3)) 494 495 Now we use the command `n' (`next') to advance execution to the next 496 line of the current function. 497 498 (gdb) n 499 882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\ 500 : nil, 501 502 `set_quotes' looks like a promising subroutine. We can go into it by 503 using the command `s' (`step') instead of `next'. `step' goes to the 504 next line to be executed in _any_ subroutine, so it steps into 505 `set_quotes'. 506 507 (gdb) s 508 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>") 509 at input.c:530 510 530 if (lquote != def_lquote) 511 512 The display that shows the subroutine where `m4' is now suspended (and 513 its arguments) is called a stack frame display. It shows a summary of 514 the stack. We can use the `backtrace' command (which can also be 515 spelled `bt'), to see where we are in the stack as a whole: the 516 `backtrace' command displays a stack frame for each active subroutine. 517 518 (gdb) bt 519 #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>") 520 at input.c:530 521 #1 0x6344 in m4_changequote (argc=3, argv=0x33c70) 522 at builtin.c:882 523 #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242 524 #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30) 525 at macro.c:71 526 #4 0x79dc in expand_input () at macro.c:40 527 #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195 528 529 We step through a few more lines to see what happens. The first two 530 times, we can use `s'; the next two times we use `n' to avoid falling 531 into the `xstrdup' subroutine. 532 533 (gdb) s 534 0x3b5c 532 if (rquote != def_rquote) 535 (gdb) s 536 0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \ 537 def_lquote : xstrdup(lq); 538 (gdb) n 539 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\ 540 : xstrdup(rq); 541 (gdb) n 542 538 len_lquote = strlen(rquote); 543 544 The last line displayed looks a little odd; we can examine the variables 545 `lquote' and `rquote' to see if they are in fact the new left and right 546 quotes we specified. We use the command `p' (`print') to see their 547 values. 548 549 (gdb) p lquote 550 $1 = 0x35d40 "<QUOTE>" 551 (gdb) p rquote 552 $2 = 0x35d50 "<UNQUOTE>" 553 554 `lquote' and `rquote' are indeed the new left and right quotes. To 555 look at some context, we can display ten lines of source surrounding 556 the current line with the `l' (`list') command. 557 558 (gdb) l 559 533 xfree(rquote); 560 534 561 535 lquote = (lq == nil || *lq == '\0') ? def_lquote\ 562 : xstrdup (lq); 563 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\ 564 : xstrdup (rq); 565 537 566 538 len_lquote = strlen(rquote); 567 539 len_rquote = strlen(lquote); 568 540 } 569 541 570 542 void 571 572 Let us step past the two lines that set `len_lquote' and `len_rquote', 573 and then examine the values of those variables. 574 575 (gdb) n 576 539 len_rquote = strlen(lquote); 577 (gdb) n 578 540 } 579 (gdb) p len_lquote 580 $3 = 9 581 (gdb) p len_rquote 582 $4 = 7 583 584 That certainly looks wrong, assuming `len_lquote' and `len_rquote' are 585 meant to be the lengths of `lquote' and `rquote' respectively. We can 586 set them to better values using the `p' command, since it can print the 587 value of any expression--and that expression can include subroutine 588 calls and assignments. 589 590 (gdb) p len_lquote=strlen(lquote) 591 $5 = 7 592 (gdb) p len_rquote=strlen(rquote) 593 $6 = 9 594 595 Is that enough to fix the problem of using the new quotes with the `m4' 596 built-in `defn'? We can allow `m4' to continue executing with the `c' 597 (`continue') command, and then try the example that caused trouble 598 initially: 599 600 (gdb) c 601 Continuing. 602 603 define(baz,defn(<QUOTE>foo<UNQUOTE>)) 604 605 baz 606 0000 607 608 Success! The new quotes now work just as well as the default ones. The 609 problem seems to have been just the two typos defining the wrong 610 lengths. We allow `m4' exit by giving it an EOF as input: 611 612 Ctrl-d 613 Program exited normally. 614 615 The message `Program exited normally.' is from GDB; it indicates `m4' 616 has finished executing. We can end our GDB session with the GDB `quit' 617 command. 618 619 (gdb) quit 620 621 622 File: gdb.info, Node: Invocation, Next: Commands, Prev: Sample Session, Up: Top 623 624 2 Getting In and Out of GDB 625 *************************** 626 627 This chapter discusses how to start GDB, and how to get out of it. The 628 essentials are: 629 * type `gdb' to start GDB. 630 631 * type `quit' or `Ctrl-d' to exit. 632 633 * Menu: 634 635 * Invoking GDB:: How to start GDB 636 * Quitting GDB:: How to quit GDB 637 * Shell Commands:: How to use shell commands inside GDB 638 * Logging output:: How to log GDB's output to a file 639 640 641 File: gdb.info, Node: Invoking GDB, Next: Quitting GDB, Up: Invocation 642 643 2.1 Invoking GDB 644 ================ 645 646 Invoke GDB by running the program `gdb'. Once started, GDB reads 647 commands from the terminal until you tell it to exit. 648 649 You can also run `gdb' with a variety of arguments and options, to 650 specify more of your debugging environment at the outset. 651 652 The command-line options described here are designed to cover a 653 variety of situations; in some environments, some of these options may 654 effectively be unavailable. 655 656 The most usual way to start GDB is with one argument, specifying an 657 executable program: 658 659 gdb PROGRAM 660 661 You can also start with both an executable program and a core file 662 specified: 663 664 gdb PROGRAM CORE 665 666 You can, instead, specify a process ID as a second argument, if you 667 want to debug a running process: 668 669 gdb PROGRAM 1234 670 671 would attach GDB to process `1234' (unless you also have a file named 672 `1234'; GDB does check for a core file first). 673 674 Taking advantage of the second command-line argument requires a 675 fairly complete operating system; when you use GDB as a remote debugger 676 attached to a bare board, there may not be any notion of "process", and 677 there is often no way to get a core dump. GDB will warn you if it is 678 unable to attach or to read core dumps. 679 680 You can optionally have `gdb' pass any arguments after the 681 executable file to the inferior using `--args'. This option stops 682 option processing. 683 gdb --args gcc -O2 -c foo.c 684 This will cause `gdb' to debug `gcc', and to set `gcc''s 685 command-line arguments (*note Arguments::) to `-O2 -c foo.c'. 686 687 You can run `gdb' without printing the front material, which 688 describes GDB's non-warranty, by specifying `-silent': 689 690 gdb -silent 691 692 You can further control how GDB starts up by using command-line 693 options. GDB itself can remind you of the options available. 694 695 Type 696 697 gdb -help 698 699 to display all available options and briefly describe their use (`gdb 700 -h' is a shorter equivalent). 701 702 All options and command line arguments you give are processed in 703 sequential order. The order makes a difference when the `-x' option is 704 used. 705 706 * Menu: 707 708 * File Options:: Choosing files 709 * Mode Options:: Choosing modes 710 * Startup:: What GDB does during startup 711 712 713 File: gdb.info, Node: File Options, Next: Mode Options, Up: Invoking GDB 714 715 2.1.1 Choosing files 716 -------------------- 717 718 When GDB starts, it reads any arguments other than options as 719 specifying an executable file and core file (or process ID). This is 720 the same as if the arguments were specified by the `-se' and `-c' (or 721 `-p' options respectively. (GDB reads the first argument that does not 722 have an associated option flag as equivalent to the `-se' option 723 followed by that argument; and the second argument that does not have 724 an associated option flag, if any, as equivalent to the `-c'/`-p' 725 option followed by that argument.) If the second argument begins with 726 a decimal digit, GDB will first attempt to attach to it as a process, 727 and if that fails, attempt to open it as a corefile. If you have a 728 corefile whose name begins with a digit, you can prevent GDB from 729 treating it as a pid by prefixing it with `./', e.g. `./12345'. 730 731 If GDB has not been configured to included core file support, such 732 as for most embedded targets, then it will complain about a second 733 argument and ignore it. 734 735 Many options have both long and short forms; both are shown in the 736 following list. GDB also recognizes the long forms if you truncate 737 them, so long as enough of the option is present to be unambiguous. 738 (If you prefer, you can flag option arguments with `--' rather than 739 `-', though we illustrate the more usual convention.) 740 741 `-symbols FILE' 742 `-s FILE' 743 Read symbol table from file FILE. 744 745 `-exec FILE' 746 `-e FILE' 747 Use file FILE as the executable file to execute when appropriate, 748 and for examining pure data in conjunction with a core dump. 749 750 `-se FILE' 751 Read symbol table from file FILE and use it as the executable file. 752 753 `-core FILE' 754 `-c FILE' 755 Use file FILE as a core dump to examine. 756 757 `-c NUMBER' 758 759 `-pid NUMBER' 760 `-p NUMBER' 761 Connect to process ID NUMBER, as with the `attach' command. If 762 there is no such process, GDB will attempt to open a core file 763 named NUMBER. 764 765 `-command FILE' 766 `-x FILE' 767 Execute GDB commands from file FILE. *Note Command files: Command 768 Files. 769 770 `-eval-command COMMAND' 771 `-ex COMMAND' 772 Execute a single GDB command. 773 774 This option may be used multiple times to call multiple commands. 775 It may also be interleaved with `-command' as required. 776 777 gdb -ex 'target sim' -ex 'load' \ 778 -x setbreakpoints -ex 'run' a.out 779 780 `-directory DIRECTORY' 781 `-d DIRECTORY' 782 Add DIRECTORY to the path to search for source and script files. 783 784 `-r' 785 `-readnow' 786 Read each symbol file's entire symbol table immediately, rather 787 than the default, which is to read it incrementally as it is 788 needed. This makes startup slower, but makes future operations 789 faster. 790 791 792 793 File: gdb.info, Node: Mode Options, Next: Startup, Prev: File Options, Up: Invoking GDB 794 795 2.1.2 Choosing modes 796 -------------------- 797 798 You can run GDB in various alternative modes--for example, in batch 799 mode or quiet mode. 800 801 `-nx' 802 `-n' 803 Do not execute commands found in any initialization files. 804 Normally, GDB executes the commands in these files after all the 805 command options and arguments have been processed. *Note Command 806 files: Command Files. 807 808 `-quiet' 809 `-silent' 810 `-q' 811 "Quiet". Do not print the introductory and copyright messages. 812 These messages are also suppressed in batch mode. 813 814 `-batch' 815 Run in batch mode. Exit with status `0' after processing all the 816 command files specified with `-x' (and all commands from 817 initialization files, if not inhibited with `-n'). Exit with 818 nonzero status if an error occurs in executing the GDB commands in 819 the command files. 820 821 Batch mode may be useful for running GDB as a filter, for example 822 to download and run a program on another computer; in order to 823 make this more useful, the message 824 825 Program exited normally. 826 827 (which is ordinarily issued whenever a program running under GDB 828 control terminates) is not issued when running in batch mode. 829 830 `-batch-silent' 831 Run in batch mode exactly like `-batch', but totally silently. All 832 GDB output to `stdout' is prevented (`stderr' is unaffected). 833 This is much quieter than `-silent' and would be useless for an 834 interactive session. 835 836 This is particularly useful when using targets that give `Loading 837 section' messages, for example. 838 839 Note that targets that give their output via GDB, as opposed to 840 writing directly to `stdout', will also be made silent. 841 842 `-return-child-result' 843 The return code from GDB will be the return code from the child 844 process (the process being debugged), with the following 845 exceptions: 846 847 * GDB exits abnormally. E.g., due to an incorrect argument or 848 an internal error. In this case the exit code is the same as 849 it would have been without `-return-child-result'. 850 851 * The user quits with an explicit value. E.g., `quit 1'. 852 853 * The child process never runs, or is not allowed to terminate, 854 in which case the exit code will be -1. 855 856 This option is useful in conjunction with `-batch' or 857 `-batch-silent', when GDB is being used as a remote program loader 858 or simulator interface. 859 860 `-nowindows' 861 `-nw' 862 "No windows". If GDB comes with a graphical user interface (GUI) 863 built in, then this option tells GDB to only use the command-line 864 interface. If no GUI is available, this option has no effect. 865 866 `-windows' 867 `-w' 868 If GDB includes a GUI, then this option requires it to be used if 869 possible. 870 871 `-cd DIRECTORY' 872 Run GDB using DIRECTORY as its working directory, instead of the 873 current directory. 874 875 `-fullname' 876 `-f' 877 GNU Emacs sets this option when it runs GDB as a subprocess. It 878 tells GDB to output the full file name and line number in a 879 standard, recognizable fashion each time a stack frame is 880 displayed (which includes each time your program stops). This 881 recognizable format looks like two `\032' characters, followed by 882 the file name, line number and character position separated by 883 colons, and a newline. The Emacs-to-GDB interface program uses 884 the two `\032' characters as a signal to display the source code 885 for the frame. 886 887 `-epoch' 888 The Epoch Emacs-GDB interface sets this option when it runs GDB as 889 a subprocess. It tells GDB to modify its print routines so as to 890 allow Epoch to display values of expressions in a separate window. 891 892 `-annotate LEVEL' 893 This option sets the "annotation level" inside GDB. Its effect is 894 identical to using `set annotate LEVEL' (*note Annotations::). 895 The annotation LEVEL controls how much information GDB prints 896 together with its prompt, values of expressions, source lines, and 897 other types of output. Level 0 is the normal, level 1 is for use 898 when GDB is run as a subprocess of GNU Emacs, level 3 is the 899 maximum annotation suitable for programs that control GDB, and 900 level 2 has been deprecated. 901 902 The annotation mechanism has largely been superseded by GDB/MI 903 (*note GDB/MI::). 904 905 `--args' 906 Change interpretation of command line so that arguments following 907 the executable file are passed as command line arguments to the 908 inferior. This option stops option processing. 909 910 `-baud BPS' 911 `-b BPS' 912 Set the line speed (baud rate or bits per second) of any serial 913 interface used by GDB for remote debugging. 914 915 `-l TIMEOUT' 916 Set the timeout (in seconds) of any communication used by GDB for 917 remote debugging. 918 919 `-tty DEVICE' 920 `-t DEVICE' 921 Run using DEVICE for your program's standard input and output. 922 923 `-tui' 924 Activate the "Text User Interface" when starting. The Text User 925 Interface manages several text windows on the terminal, showing 926 source, assembly, registers and GDB command outputs (*note GDB 927 Text User Interface: TUI.). Alternatively, the Text User 928 Interface can be enabled by invoking the program `gdbtui'. Do not 929 use this option if you run GDB from Emacs (*note Using GDB under 930 GNU Emacs: Emacs.). 931 932 `-interpreter INTERP' 933 Use the interpreter INTERP for interface with the controlling 934 program or device. This option is meant to be set by programs 935 which communicate with GDB using it as a back end. *Note Command 936 Interpreters: Interpreters. 937 938 `--interpreter=mi' (or `--interpreter=mi2') causes GDB to use the 939 "GDB/MI interface" (*note The GDB/MI Interface: GDB/MI.) included 940 since GDB version 6.0. The previous GDB/MI interface, included in 941 GDB version 5.3 and selected with `--interpreter=mi1', is 942 deprecated. Earlier GDB/MI interfaces are no longer supported. 943 944 `-write' 945 Open the executable and core files for both reading and writing. 946 This is equivalent to the `set write on' command inside GDB (*note 947 Patching::). 948 949 `-statistics' 950 This option causes GDB to print statistics about time and memory 951 usage after it completes each command and returns to the prompt. 952 953 `-version' 954 This option causes GDB to print its version number and no-warranty 955 blurb, and exit. 956 957 958 959 File: gdb.info, Node: Startup, Prev: Mode Options, Up: Invoking GDB 960 961 2.1.3 What GDB does during startup 962 ---------------------------------- 963 964 Here's the description of what GDB does during session startup: 965 966 1. Sets up the command interpreter as specified by the command line 967 (*note interpreter: Mode Options.). 968 969 2. Reads the "init file" (if any) in your home directory(1) and 970 executes all the commands in that file. 971 972 3. Processes command line options and operands. 973 974 4. Reads and executes the commands from init file (if any) in the 975 current working directory. This is only done if the current 976 directory is different from your home directory. Thus, you can 977 have more than one init file, one generic in your home directory, 978 and another, specific to the program you are debugging, in the 979 directory where you invoke GDB. 980 981 5. Reads command files specified by the `-x' option. *Note Command 982 Files::, for more details about GDB command files. 983 984 6. Reads the command history recorded in the "history file". *Note 985 Command History::, for more details about the command history and 986 the files where GDB records it. 987 988 Init files use the same syntax as "command files" (*note Command 989 Files::) and are processed by GDB in the same way. The init file in 990 your home directory can set options (such as `set complaints') that 991 affect subsequent processing of command line options and operands. 992 Init files are not executed if you use the `-nx' option (*note Choosing 993 modes: Mode Options.). 994 995 The GDB init files are normally called `.gdbinit'. On some 996 configurations of GDB, the init file is known by a different name 997 (these are typically environments where a specialized form of GDB may 998 need to coexist with other forms, hence a different name for the 999 specialized version's init file). These are the environments with 1000 special init file names: 1001 1002 * The DJGPP port of GDB uses the name `gdb.ini', due to the 1003 limitations of file names imposed by DOS filesystems. The Windows 1004 ports of GDB use the standard name, but if they find a `gdb.ini' 1005 file, they warn you about that and suggest to rename the file to 1006 the standard name. 1007 1008 * VxWorks (Wind River Systems real-time OS): `.vxgdbinit' 1009 1010 * OS68K (Enea Data Systems real-time OS): `.os68gdbinit' 1011 1012 * ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit' 1013 1014 * CISCO 68k: `.cisco-gdbinit' 1015 1016 ---------- Footnotes ---------- 1017 1018 (1) On DOS/Windows systems, the home directory is the one pointed to 1019 by the `HOME' environment variable. 1020 1021 1022 File: gdb.info, Node: Quitting GDB, Next: Shell Commands, Prev: Invoking GDB, Up: Invocation 1023 1024 2.2 Quitting GDB 1025 ================ 1026 1027 `quit [EXPRESSION]' 1028 `q' 1029 To exit GDB, use the `quit' command (abbreviated `q'), or type an 1030 end-of-file character (usually `Ctrl-d'). If you do not supply 1031 EXPRESSION, GDB will terminate normally; otherwise it will 1032 terminate using the result of EXPRESSION as the error code. 1033 1034 An interrupt (often `Ctrl-c') does not exit from GDB, but rather 1035 terminates the action of any GDB command that is in progress and 1036 returns to GDB command level. It is safe to type the interrupt 1037 character at any time because GDB does not allow it to take effect 1038 until a time when it is safe. 1039 1040 If you have been using GDB to control an attached process or device, 1041 you can release it with the `detach' command (*note Debugging an 1042 already-running process: Attach.). 1043 1044 1045 File: gdb.info, Node: Shell Commands, Next: Logging output, Prev: Quitting GDB, Up: Invocation 1046 1047 2.3 Shell commands 1048 ================== 1049 1050 If you need to execute occasional shell commands during your debugging 1051 session, there is no need to leave or suspend GDB; you can just use the 1052 `shell' command. 1053 1054 `shell COMMAND STRING' 1055 Invoke a standard shell to execute COMMAND STRING. If it exists, 1056 the environment variable `SHELL' determines which shell to run. 1057 Otherwise GDB uses the default shell (`/bin/sh' on Unix systems, 1058 `COMMAND.COM' on MS-DOS, etc.). 1059 1060 The utility `make' is often needed in development environments. You 1061 do not have to use the `shell' command for this purpose in GDB: 1062 1063 `make MAKE-ARGS' 1064 Execute the `make' program with the specified arguments. This is 1065 equivalent to `shell make MAKE-ARGS'. 1066 1067 1068 File: gdb.info, Node: Logging output, Prev: Shell Commands, Up: Invocation 1069 1070 2.4 Logging output 1071 ================== 1072 1073 You may want to save the output of GDB commands to a file. There are 1074 several commands to control GDB's logging. 1075 1076 `set logging on' 1077 Enable logging. 1078 1079 `set logging off' 1080 Disable logging. 1081 1082 `set logging file FILE' 1083 Change the name of the current logfile. The default logfile is 1084 `gdb.txt'. 1085 1086 `set logging overwrite [on|off]' 1087 By default, GDB will append to the logfile. Set `overwrite' if 1088 you want `set logging on' to overwrite the logfile instead. 1089 1090 `set logging redirect [on|off]' 1091 By default, GDB output will go to both the terminal and the 1092 logfile. Set `redirect' if you want output to go only to the log 1093 file. 1094 1095 `show logging' 1096 Show the current values of the logging settings. 1097 1098 1099 File: gdb.info, Node: Commands, Next: Running, Prev: Invocation, Up: Top 1100 1101 3 GDB Commands 1102 ************** 1103 1104 You can abbreviate a GDB command to the first few letters of the command 1105 name, if that abbreviation is unambiguous; and you can repeat certain 1106 GDB commands by typing just <RET>. You can also use the <TAB> key to 1107 get GDB to fill out the rest of a word in a command (or to show you the 1108 alternatives available, if there is more than one possibility). 1109 1110 * Menu: 1111 1112 * Command Syntax:: How to give commands to GDB 1113 * Completion:: Command completion 1114 * Help:: How to ask GDB for help 1115 1116 1117 File: gdb.info, Node: Command Syntax, Next: Completion, Up: Commands 1118 1119 3.1 Command syntax 1120 ================== 1121 1122 A GDB command is a single line of input. There is no limit on how long 1123 it can be. It starts with a command name, which is followed by 1124 arguments whose meaning depends on the command name. For example, the 1125 command `step' accepts an argument which is the number of times to 1126 step, as in `step 5'. You can also use the `step' command with no 1127 arguments. Some commands do not allow any arguments. 1128 1129 GDB command names may always be truncated if that abbreviation is 1130 unambiguous. Other possible command abbreviations are listed in the 1131 documentation for individual commands. In some cases, even ambiguous 1132 abbreviations are allowed; for example, `s' is specially defined as 1133 equivalent to `step' even though there are other commands whose names 1134 start with `s'. You can test abbreviations by using them as arguments 1135 to the `help' command. 1136 1137 A blank line as input to GDB (typing just <RET>) means to repeat the 1138 previous command. Certain commands (for example, `run') will not 1139 repeat this way; these are commands whose unintentional repetition 1140 might cause trouble and which you are unlikely to want to repeat. 1141 User-defined commands can disable this feature; see *Note dont-repeat: 1142 Define. 1143 1144 The `list' and `x' commands, when you repeat them with <RET>, 1145 construct new arguments rather than repeating exactly as typed. This 1146 permits easy scanning of source or memory. 1147 1148 GDB can also use <RET> in another way: to partition lengthy output, 1149 in a way similar to the common utility `more' (*note Screen size: 1150 Screen Size.). Since it is easy to press one <RET> too many in this 1151 situation, GDB disables command repetition after any command that 1152 generates this sort of display. 1153 1154 Any text from a `#' to the end of the line is a comment; it does 1155 nothing. This is useful mainly in command files (*note Command files: 1156 Command Files.). 1157 1158 The `Ctrl-o' binding is useful for repeating a complex sequence of 1159 commands. This command accepts the current line, like <RET>, and then 1160 fetches the next line relative to the current line from the history for 1161 editing. 1162 1163 1164 File: gdb.info, Node: Completion, Next: Help, Prev: Command Syntax, Up: Commands 1165 1166 3.2 Command completion 1167 ====================== 1168 1169 GDB can fill in the rest of a word in a command for you, if there is 1170 only one possibility; it can also show you what the valid possibilities 1171 are for the next word in a command, at any time. This works for GDB 1172 commands, GDB subcommands, and the names of symbols in your program. 1173 1174 Press the <TAB> key whenever you want GDB to fill out the rest of a 1175 word. If there is only one possibility, GDB fills in the word, and 1176 waits for you to finish the command (or press <RET> to enter it). For 1177 example, if you type 1178 1179 (gdb) info bre <TAB> 1180 1181 GDB fills in the rest of the word `breakpoints', since that is the only 1182 `info' subcommand beginning with `bre': 1183 1184 (gdb) info breakpoints 1185 1186 You can either press <RET> at this point, to run the `info breakpoints' 1187 command, or backspace and enter something else, if `breakpoints' does 1188 not look like the command you expected. (If you were sure you wanted 1189 `info breakpoints' in the first place, you might as well just type 1190 <RET> immediately after `info bre', to exploit command abbreviations 1191 rather than command completion). 1192 1193 If there is more than one possibility for the next word when you 1194 press <TAB>, GDB sounds a bell. You can either supply more characters 1195 and try again, or just press <TAB> a second time; GDB displays all the 1196 possible completions for that word. For example, you might want to set 1197 a breakpoint on a subroutine whose name begins with `make_', but when 1198 you type `b make_<TAB>' GDB just sounds the bell. Typing <TAB> again 1199 displays all the function names in your program that begin with those 1200 characters, for example: 1201 1202 (gdb) b make_ <TAB> 1203 GDB sounds bell; press <TAB> again, to see: 1204 make_a_section_from_file make_environ 1205 make_abs_section make_function_type 1206 make_blockvector make_pointer_type 1207 make_cleanup make_reference_type 1208 make_command make_symbol_completion_list 1209 (gdb) b make_ 1210 1211 After displaying the available possibilities, GDB copies your partial 1212 input (`b make_' in the example) so you can finish the command. 1213 1214 If you just want to see the list of alternatives in the first place, 1215 you can press `M-?' rather than pressing <TAB> twice. `M-?' means 1216 `<META> ?'. You can type this either by holding down a key designated 1217 as the <META> shift on your keyboard (if there is one) while typing 1218 `?', or as <ESC> followed by `?'. 1219 1220 Sometimes the string you need, while logically a "word", may contain 1221 parentheses or other characters that GDB normally excludes from its 1222 notion of a word. To permit word completion to work in this situation, 1223 you may enclose words in `'' (single quote marks) in GDB commands. 1224 1225 The most likely situation where you might need this is in typing the 1226 name of a C++ function. This is because C++ allows function 1227 overloading (multiple definitions of the same function, distinguished 1228 by argument type). For example, when you want to set a breakpoint you 1229 may need to distinguish whether you mean the version of `name' that 1230 takes an `int' parameter, `name(int)', or the version that takes a 1231 `float' parameter, `name(float)'. To use the word-completion 1232 facilities in this situation, type a single quote `'' at the beginning 1233 of the function name. This alerts GDB that it may need to consider 1234 more information than usual when you press <TAB> or `M-?' to request 1235 word completion: 1236 1237 (gdb) b 'bubble( M-? 1238 bubble(double,double) bubble(int,int) 1239 (gdb) b 'bubble( 1240 1241 In some cases, GDB can tell that completing a name requires using 1242 quotes. When this happens, GDB inserts the quote for you (while 1243 completing as much as it can) if you do not type the quote in the first 1244 place: 1245 1246 (gdb) b bub <TAB> 1247 GDB alters your input line to the following, and rings a bell: 1248 (gdb) b 'bubble( 1249 1250 In general, GDB can tell that a quote is needed (and inserts it) if you 1251 have not yet started typing the argument list when you ask for 1252 completion on an overloaded symbol. 1253 1254 For more information about overloaded functions, see *Note C++ 1255 expressions: C plus plus expressions. You can use the command `set 1256 overload-resolution off' to disable overload resolution; see *Note GDB 1257 features for C++: Debugging C plus plus. 1258 1259 1260 File: gdb.info, Node: Help, Prev: Completion, Up: Commands 1261 1262 3.3 Getting help 1263 ================ 1264 1265 You can always ask GDB itself for information on its commands, using 1266 the command `help'. 1267 1268 `help' 1269 `h' 1270 You can use `help' (abbreviated `h') with no arguments to display 1271 a short list of named classes of commands: 1272 1273 (gdb) help 1274 List of classes of commands: 1275 1276 aliases -- Aliases of other commands 1277 breakpoints -- Making program stop at certain points 1278 data -- Examining data 1279 files -- Specifying and examining files 1280 internals -- Maintenance commands 1281 obscure -- Obscure features 1282 running -- Running the program 1283 stack -- Examining the stack 1284 status -- Status inquiries 1285 support -- Support facilities 1286 tracepoints -- Tracing of program execution without 1287 1288 stopping the program 1289 user-defined -- User-defined commands 1290 1291 Type "help" followed by a class name for a list of 1292 commands in that class. 1293 Type "help" followed by command name for full 1294 documentation. 1295 Command name abbreviations are allowed if unambiguous. 1296 (gdb) 1297 1298 `help CLASS' 1299 Using one of the general help classes as an argument, you can get a 1300 list of the individual commands in that class. For example, here 1301 is the help display for the class `status': 1302 1303 (gdb) help status 1304 Status inquiries. 1305 1306 List of commands: 1307 1308 info -- Generic command for showing things 1309 about the program being debugged 1310 show -- Generic command for showing things 1311 about the debugger 1312 1313 Type "help" followed by command name for full 1314 documentation. 1315 Command name abbreviations are allowed if unambiguous. 1316 (gdb) 1317 1318 `help COMMAND' 1319 With a command name as `help' argument, GDB displays a short 1320 paragraph on how to use that command. 1321 1322 `apropos ARGS' 1323 The `apropos' command searches through all of the GDB commands, 1324 and their documentation, for the regular expression specified in 1325 ARGS. It prints out all matches found. For example: 1326 1327 apropos reload 1328 1329 results in: 1330 1331 set symbol-reloading -- Set dynamic symbol table reloading 1332 multiple times in one run 1333 show symbol-reloading -- Show dynamic symbol table reloading 1334 multiple times in one run 1335 1336 `complete ARGS' 1337 The `complete ARGS' command lists all the possible completions for 1338 the beginning of a command. Use ARGS to specify the beginning of 1339 the command you want completed. For example: 1340 1341 complete i 1342 1343 results in: 1344 1345 if 1346 ignore 1347 info 1348 inspect 1349 1350 This is intended for use by GNU Emacs. 1351 1352 In addition to `help', you can use the GDB commands `info' and 1353 `show' to inquire about the state of your program, or the state of GDB 1354 itself. Each command supports many topics of inquiry; this manual 1355 introduces each of them in the appropriate context. The listings under 1356 `info' and under `show' in the Index point to all the sub-commands. 1357 *Note Index::. 1358 1359 `info' 1360 This command (abbreviated `i') is for describing the state of your 1361 program. For example, you can list the arguments given to your 1362 program with `info args', list the registers currently in use with 1363 `info registers', or list the breakpoints you have set with `info 1364 breakpoints'. You can get a complete list of the `info' 1365 sub-commands with `help info'. 1366 1367 `set' 1368 You can assign the result of an expression to an environment 1369 variable with `set'. For example, you can set the GDB prompt to a 1370 $-sign with `set prompt $'. 1371 1372 `show' 1373 In contrast to `info', `show' is for describing the state of GDB 1374 itself. You can change most of the things you can `show', by 1375 using the related command `set'; for example, you can control what 1376 number system is used for displays with `set radix', or simply 1377 inquire which is currently in use with `show radix'. 1378 1379 To display all the settable parameters and their current values, 1380 you can use `show' with no arguments; you may also use `info set'. 1381 Both commands produce the same display. 1382 1383 Here are three miscellaneous `show' subcommands, all of which are 1384 exceptional in lacking corresponding `set' commands: 1385 1386 `show version' 1387 Show what version of GDB is running. You should include this 1388 information in GDB bug-reports. If multiple versions of GDB are 1389 in use at your site, you may need to determine which version of 1390 GDB you are running; as GDB evolves, new commands are introduced, 1391 and old ones may wither away. Also, many system vendors ship 1392 variant versions of GDB, and there are variant versions of GDB in 1393 GNU/Linux distributions as well. The version number is the same 1394 as the one announced when you start GDB. 1395 1396 `show copying' 1397 `info copying' 1398 Display information about permission for copying GDB. 1399 1400 `show warranty' 1401 `info warranty' 1402 Display the GNU "NO WARRANTY" statement, or a warranty, if your 1403 version of GDB comes with one. 1404 1405 1406 1407 File: gdb.info, Node: Running, Next: Stopping, Prev: Commands, Up: Top 1408 1409 4 Running Programs Under GDB 1410 **************************** 1411 1412 When you run a program under GDB, you must first generate debugging 1413 information when you compile it. 1414 1415 You may start GDB with its arguments, if any, in an environment of 1416 your choice. If you are doing native debugging, you may redirect your 1417 program's input and output, debug an already running process, or kill a 1418 child process. 1419 1420 * Menu: 1421 1422 * Compilation:: Compiling for debugging 1423 * Starting:: Starting your program 1424 * Arguments:: Your program's arguments 1425 * Environment:: Your program's environment 1426 1427 * Working Directory:: Your program's working directory 1428 * Input/Output:: Your program's input and output 1429 * Attach:: Debugging an already-running process 1430 * Kill Process:: Killing the child process 1431 1432 * Threads:: Debugging programs with multiple threads 1433 * Processes:: Debugging programs with multiple processes 1434 * Checkpoint/Restart:: Setting a _bookmark_ to return to later 1435 1436 1437 File: gdb.info, Node: Compilation, Next: Starting, Up: Running 1438 1439 4.1 Compiling for debugging 1440 =========================== 1441 1442 In order to debug a program effectively, you need to generate debugging 1443 information when you compile it. This debugging information is stored 1444 in the object file; it describes the data type of each variable or 1445 function and the correspondence between source line numbers and 1446 addresses in the executable code. 1447 1448 To request debugging information, specify the `-g' option when you 1449 run the compiler. 1450 1451 Programs that are to be shipped to your customers are compiled with 1452 optimizations, using the `-O' compiler option. However, many compilers 1453 are unable to handle the `-g' and `-O' options together. Using those 1454 compilers, you cannot generate optimized executables containing 1455 debugging information. 1456 1457 GCC, the GNU C/C++ compiler, supports `-g' with or without `-O', 1458 making it possible to debug optimized code. We recommend that you 1459 _always_ use `-g' whenever you compile a program. You may think your 1460 program is correct, but there is no sense in pushing your luck. 1461 1462 When you debug a program compiled with `-g -O', remember that the 1463 optimizer is rearranging your code; the debugger shows you what is 1464 really there. Do not be too surprised when the execution path does not 1465 exactly match your source file! An extreme example: if you define a 1466 variable, but never use it, GDB never sees that variable--because the 1467 compiler optimizes it out of existence. 1468 1469 Some things do not work as well with `-g -O' as with just `-g', 1470 particularly on machines with instruction scheduling. If in doubt, 1471 recompile with `-g' alone, and if this fixes the problem, please report 1472 it to us as a bug (including a test case!). *Note Variables::, for 1473 more information about debugging optimized code. 1474 1475 Older versions of the GNU C compiler permitted a variant option 1476 `-gg' for debugging information. GDB no longer supports this format; 1477 if your GNU C compiler has this option, do not use it. 1478 1479 GDB knows about preprocessor macros and can show you their expansion 1480 (*note Macros::). Most compilers do not include information about 1481 preprocessor macros in the debugging information if you specify the 1482 `-g' flag alone, because this information is rather large. Version 3.1 1483 and later of GCC, the GNU C compiler, provides macro information if you 1484 specify the options `-gdwarf-2' and `-g3'; the former option requests 1485 debugging information in the Dwarf 2 format, and the latter requests 1486 "extra information". In the future, we hope to find more compact ways 1487 to represent macro information, so that it can be included with `-g' 1488 alone. 1489 1490 1491 File: gdb.info, Node: Starting, Next: Arguments, Prev: Compilation, Up: Running 1492 1493 4.2 Starting your program 1494 ========================= 1495 1496 `run' 1497 `r' 1498 Use the `run' command to start your program under GDB. You must 1499 first specify the program name (except on VxWorks) with an 1500 argument to GDB (*note Getting In and Out of GDB: Invocation.), or 1501 by using the `file' or `exec-file' command (*note Commands to 1502 specify files: Files.). 1503 1504 1505 If you are running your program in an execution environment that 1506 supports processes, `run' creates an inferior process and makes that 1507 process run your program. (In environments without processes, `run' 1508 jumps to the start of your program.) 1509 1510 The execution of a program is affected by certain information it 1511 receives from its superior. GDB provides ways to specify this 1512 information, which you must do _before_ starting your program. (You 1513 can change it after starting your program, but such changes only affect 1514 your program the next time you start it.) This information may be 1515 divided into four categories: 1516 1517 The _arguments._ 1518 Specify the arguments to give your program as the arguments of the 1519 `run' command. If a shell is available on your target, the shell 1520 is used to pass the arguments, so that you may use normal 1521 conventions (such as wildcard expansion or variable substitution) 1522 in describing the arguments. In Unix systems, you can control 1523 which shell is used with the `SHELL' environment variable. *Note 1524 Your program's arguments: Arguments. 1525 1526 The _environment._ 1527 Your program normally inherits its environment from GDB, but you 1528 can use the GDB commands `set environment' and `unset environment' 1529 to change parts of the environment that affect your program. 1530 *Note Your program's environment: Environment. 1531 1532 The _working directory._ 1533 Your program inherits its working directory from GDB. You can set 1534 the GDB working directory with the `cd' command in GDB. *Note 1535 Your program's working directory: Working Directory. 1536 1537 The _standard input and output._ 1538 Your program normally uses the same device for standard input and 1539 standard output as GDB is using. You can redirect input and output 1540 in the `run' command line, or you can use the `tty' command to set 1541 a different device for your program. *Note Your program's input 1542 and output: Input/Output. 1543 1544 _Warning:_ While input and output redirection work, you cannot use 1545 pipes to pass the output of the program you are debugging to 1546 another program; if you attempt this, GDB is likely to wind up 1547 debugging the wrong program. 1548 1549 When you issue the `run' command, your program begins to execute 1550 immediately. *Note Stopping and continuing: Stopping, for discussion 1551 of how to arrange for your program to stop. Once your program has 1552 stopped, you may call functions in your program, using the `print' or 1553 `call' commands. *Note Examining Data: Data. 1554 1555 If the modification time of your symbol file has changed since the 1556 last time GDB read its symbols, GDB discards its symbol table, and 1557 reads it again. When it does this, GDB tries to retain your current 1558 breakpoints. 1559 1560 `start' 1561 The name of the main procedure can vary from language to language. 1562 With C or C++, the main procedure name is always `main', but other 1563 languages such as Ada do not require a specific name for their 1564 main procedure. The debugger provides a convenient way to start 1565 the execution of the program and to stop at the beginning of the 1566 main procedure, depending on the language used. 1567 1568 The `start' command does the equivalent of setting a temporary 1569 breakpoint at the beginning of the main procedure and then invoking 1570 the `run' command. 1571 1572 Some programs contain an "elaboration" phase where some startup 1573 code is executed before the main procedure is called. This 1574 depends on the languages used to write your program. In C++, for 1575 instance, constructors for static and global objects are executed 1576 before `main' is called. It is therefore possible that the 1577 debugger stops before reaching the main procedure. However, the 1578 temporary breakpoint will remain to halt execution. 1579 1580 Specify the arguments to give to your program as arguments to the 1581 `start' command. These arguments will be given verbatim to the 1582 underlying `run' command. Note that the same arguments will be 1583 reused if no argument is provided during subsequent calls to 1584 `start' or `run'. 1585 1586 It is sometimes necessary to debug the program during elaboration. 1587 In these cases, using the `start' command would stop the 1588 execution of your program too late, as the program would have 1589 already completed the elaboration phase. Under these 1590 circumstances, insert breakpoints in your elaboration code before 1591 running your program. 1592 1593 1594 File: gdb.info, Node: Arguments, Next: Environment, Prev: Starting, Up: Running 1595 1596 4.3 Your program's arguments 1597 ============================ 1598 1599 The arguments to your program can be specified by the arguments of the 1600 `run' command. They are passed to a shell, which expands wildcard 1601 characters and performs redirection of I/O, and thence to your program. 1602 Your `SHELL' environment variable (if it exists) specifies what shell 1603 GDB uses. If you do not define `SHELL', GDB uses the default shell 1604 (`/bin/sh' on Unix). 1605 1606 On non-Unix systems, the program is usually invoked directly by GDB, 1607 which emulates I/O redirection via the appropriate system calls, and 1608 the wildcard characters are expanded by the startup code of the 1609 program, not by the shell. 1610 1611 `run' with no arguments uses the same arguments used by the previous 1612 `run', or those set by the `set args' command. 1613 1614 `set args' 1615 Specify the arguments to be used the next time your program is 1616 run. If `set args' has no arguments, `run' executes your program 1617 with no arguments. Once you have run your program with arguments, 1618 using `set args' before the next `run' is the only way to run it 1619 again without arguments. 1620 1621 `show args' 1622 Show the arguments to give your program when it is started. 1623 1624 1625 File: gdb.info, Node: Environment, Next: Working Directory, Prev: Arguments, Up: Running 1626 1627 4.4 Your program's environment 1628 ============================== 1629 1630 The "environment" consists of a set of environment variables and their 1631 values. Environment variables conventionally record such things as 1632 your user name, your home directory, your terminal type, and your search 1633 path for programs to run. Usually you set up environment variables with 1634 the shell and they are inherited by all the other programs you run. 1635 When debugging, it can be useful to try running your program with a 1636 modified environment without having to start GDB over again. 1637 1638 `path DIRECTORY' 1639 Add DIRECTORY to the front of the `PATH' environment variable (the 1640 search path for executables) that will be passed to your program. 1641 The value of `PATH' used by GDB does not change. You may specify 1642 several directory names, separated by whitespace or by a 1643 system-dependent separator character (`:' on Unix, `;' on MS-DOS 1644 and MS-Windows). If DIRECTORY is already in the path, it is moved 1645 to the front, so it is searched sooner. 1646 1647 You can use the string `$cwd' to refer to whatever is the current 1648 working directory at the time GDB searches the path. If you use 1649 `.' instead, it refers to the directory where you executed the 1650 `path' command. GDB replaces `.' in the DIRECTORY argument (with 1651 the current path) before adding DIRECTORY to the search path. 1652 1653 `show paths' 1654 Display the list of search paths for executables (the `PATH' 1655 environment variable). 1656 1657 `show environment [VARNAME]' 1658 Print the value of environment variable VARNAME to be given to 1659 your program when it starts. If you do not supply VARNAME, print 1660 the names and values of all environment variables to be given to 1661 your program. You can abbreviate `environment' as `env'. 1662 1663 `set environment VARNAME [=VALUE]' 1664 Set environment variable VARNAME to VALUE. The value changes for 1665 your program only, not for GDB itself. VALUE may be any string; 1666 the values of environment variables are just strings, and any 1667 interpretation is supplied by your program itself. The VALUE 1668 parameter is optional; if it is eliminated, the variable is set to 1669 a null value. 1670 1671 For example, this command: 1672 1673 set env USER = foo 1674 1675 tells the debugged program, when subsequently run, that its user 1676 is named `foo'. (The spaces around `=' are used for clarity here; 1677 they are not actually required.) 1678 1679 `unset environment VARNAME' 1680 Remove variable VARNAME from the environment to be passed to your 1681 program. This is different from `set env VARNAME ='; `unset 1682 environment' removes the variable from the environment, rather 1683 than assigning it an empty value. 1684 1685 _Warning:_ On Unix systems, GDB runs your program using the shell 1686 indicated by your `SHELL' environment variable if it exists (or 1687 `/bin/sh' if not). If your `SHELL' variable names a shell that runs an 1688 initialization file--such as `.cshrc' for C-shell, or `.bashrc' for 1689 BASH--any variables you set in that file affect your program. You may 1690 wish to move setting of environment variables to files that are only 1691 run when you sign on, such as `.login' or `.profile'. 1692 1693 1694 File: gdb.info, Node: Working Directory, Next: Input/Output, Prev: Environment, Up: Running 1695 1696 4.5 Your program's working directory 1697 ==================================== 1698 1699 Each time you start your program with `run', it inherits its working 1700 directory from the current working directory of GDB. The GDB working 1701 directory is initially whatever it inherited from its parent process 1702 (typically the shell), but you can specify a new working directory in 1703 GDB with the `cd' command. 1704 1705 The GDB working directory also serves as a default for the commands 1706 that specify files for GDB to operate on. *Note Commands to specify 1707 files: Files. 1708 1709 `cd DIRECTORY' 1710 Set the GDB working directory to DIRECTORY. 1711 1712 `pwd' 1713 Print the GDB working directory. 1714 1715 It is generally impossible to find the current working directory of 1716 the process being debugged (since a program can change its directory 1717 during its run). If you work on a system where GDB is configured with 1718 the `/proc' support, you can use the `info proc' command (*note SVR4 1719 Process Information::) to find out the current working directory of the 1720 debuggee. 1721 1722 1723 File: gdb.info, Node: Input/Output, Next: Attach, Prev: Working Directory, Up: Running 1724 1725 4.6 Your program's input and output 1726 =================================== 1727 1728 By default, the program you run under GDB does input and output to the 1729 same terminal that GDB uses. GDB switches the terminal to its own 1730 terminal modes to interact with you, but it records the terminal modes 1731 your program was using and switches back to them when you continue 1732 running your program. 1733 1734 `info terminal' 1735 Displays information recorded by GDB about the terminal modes your 1736 program is using. 1737 1738 You can redirect your program's input and/or output using shell 1739 redirection with the `run' command. For example, 1740 1741 run > outfile 1742 1743 starts your program, diverting its output to the file `outfile'. 1744 1745 Another way to specify where your program should do input and output 1746 is with the `tty' command. This command accepts a file name as 1747 argument, and causes this file to be the default for future `run' 1748 commands. It also resets the controlling terminal for the child 1749 process, for future `run' commands. For example, 1750 1751 tty /dev/ttyb 1752 1753 directs that processes started with subsequent `run' commands default 1754 to do input and output on the terminal `/dev/ttyb' and have that as 1755 their controlling terminal. 1756 1757 An explicit redirection in `run' overrides the `tty' command's 1758 effect on the input/output device, but not its effect on the controlling 1759 terminal. 1760 1761 When you use the `tty' command or redirect input in the `run' 1762 command, only the input _for your program_ is affected. The input for 1763 GDB still comes from your terminal. `tty' is an alias for `set 1764 inferior-tty'. 1765 1766 You can use the `show inferior-tty' command to tell GDB to display 1767 the name of the terminal that will be used for future runs of your 1768 program. 1769 1770 `set inferior-tty /dev/ttyb' 1771 Set the tty for the program being debugged to /dev/ttyb. 1772 1773 `show inferior-tty' 1774 Show the current tty for the program being debugged. 1775 1776 1777 File: gdb.info, Node: Attach, Next: Kill Process, Prev: Input/Output, Up: Running 1778 1779 4.7 Debugging an already-running process 1780 ======================================== 1781 1782 `attach PROCESS-ID' 1783 This command attaches to a running process--one that was started 1784 outside GDB. (`info files' shows your active targets.) The 1785 command takes as argument a process ID. The usual way to find out 1786 the PROCESS-ID of a Unix process is with the `ps' utility, or with 1787 the `jobs -l' shell command. 1788 1789 `attach' does not repeat if you press <RET> a second time after 1790 executing the command. 1791 1792 To use `attach', your program must be running in an environment 1793 which supports processes; for example, `attach' does not work for 1794 programs on bare-board targets that lack an operating system. You must 1795 also have permission to send the process a signal. 1796 1797 When you use `attach', the debugger finds the program running in the 1798 process first by looking in the current working directory, then (if the 1799 program is not found) by using the source file search path (*note 1800 Specifying source directories: Source Path.). You can also use the 1801 `file' command to load the program. *Note Commands to Specify Files: 1802 Files. 1803 1804 The first thing GDB does after arranging to debug the specified 1805 process is to stop it. You can examine and modify an attached process 1806 with all the GDB commands that are ordinarily available when you start 1807 processes with `run'. You can insert breakpoints; you can step and 1808 continue; you can modify storage. If you would rather the process 1809 continue running, you may use the `continue' command after attaching 1810 GDB to the process. 1811 1812 `detach' 1813 When you have finished debugging the attached process, you can use 1814 the `detach' command to release it from GDB control. Detaching 1815 the process continues its execution. After the `detach' command, 1816 that process and GDB become completely independent once more, and 1817 you are ready to `attach' another process or start one with `run'. 1818 `detach' does not repeat if you press <RET> again after executing 1819 the command. 1820 1821 If you exit GDB or use the `run' command while you have an attached 1822 process, you kill that process. By default, GDB asks for confirmation 1823 if you try to do either of these things; you can control whether or not 1824 you need to confirm by using the `set confirm' command (*note Optional 1825 warnings and messages: Messages/Warnings.). 1826 1827 1828 File: gdb.info, Node: Kill Process, Next: Threads, Prev: Attach, Up: Running 1829 1830 4.8 Killing the child process 1831 ============================= 1832 1833 `kill' 1834 Kill the child process in which your program is running under GDB. 1835 1836 This command is useful if you wish to debug a core dump instead of a 1837 running process. GDB ignores any core dump file while your program is 1838 running. 1839 1840 On some operating systems, a program cannot be executed outside GDB 1841 while you have breakpoints set on it inside GDB. You can use the 1842 `kill' command in this situation to permit running your program outside 1843 the debugger. 1844 1845 The `kill' command is also useful if you wish to recompile and 1846 relink your program, since on many systems it is impossible to modify an 1847 executable file while it is running in a process. In this case, when 1848 you next type `run', GDB notices that the file has changed, and reads 1849 the symbol table again (while trying to preserve your current 1850 breakpoint settings). 1851 1852 1853 File: gdb.info, Node: Threads, Next: Processes, Prev: Kill Process, Up: Running 1854 1855 4.9 Debugging programs with multiple threads 1856 ============================================ 1857 1858 In some operating systems, such as HP-UX and Solaris, a single program 1859 may have more than one "thread" of execution. The precise semantics of 1860 threads differ from one operating system to another, but in general the 1861 threads of a single program are akin to multiple processes--except that 1862 they share one address space (that is, they can all examine and modify 1863 the same variables). On the other hand, each thread has its own 1864 registers and execution stack, and perhaps private memory. 1865 1866 GDB provides these facilities for debugging multi-thread programs: 1867 1868 * automatic notification of new threads 1869 1870 * `thread THREADNO', a command to switch among threads 1871 1872 * `info threads', a command to inquire about existing threads 1873 1874 * `thread apply [THREADNO] [ALL] ARGS', a command to apply a command 1875 to a list of threads 1876 1877 * thread-specific breakpoints 1878 1879 _Warning:_ These facilities are not yet available on every GDB 1880 configuration where the operating system supports threads. If 1881 your GDB does not support threads, these commands have no effect. 1882 For example, a system without thread support shows no output from 1883 `info threads', and always rejects the `thread' command, like this: 1884 1885 (gdb) info threads 1886 (gdb) thread 1 1887 Thread ID 1 not known. Use the "info threads" command to 1888 see the IDs of currently known threads. 1889 1890 The GDB thread debugging facility allows you to observe all threads 1891 while your program runs--but whenever GDB takes control, one thread in 1892 particular is always the focus of debugging. This thread is called the 1893 "current thread". Debugging commands show program information from the 1894 perspective of the current thread. 1895 1896 Whenever GDB detects a new thread in your program, it displays the 1897 target system's identification for the thread with a message in the 1898 form `[New SYSTAG]'. SYSTAG is a thread identifier whose form varies 1899 depending on the particular system. For example, on LynxOS, you might 1900 see 1901 1902 [New process 35 thread 27] 1903 1904 when GDB notices a new thread. In contrast, on an SGI system, the 1905 SYSTAG is simply something like `process 368', with no further 1906 qualifier. 1907 1908 For debugging purposes, GDB associates its own thread number--always 1909 a single integer--with each thread in your program. 1910 1911 `info threads' 1912 Display a summary of all threads currently in your program. GDB 1913 displays for each thread (in this order): 1914 1915 1. the thread number assigned by GDB 1916 1917 2. the target system's thread identifier (SYSTAG) 1918 1919 3. the current stack frame summary for that thread 1920 1921 An asterisk `*' to the left of the GDB thread number indicates the 1922 current thread. 1923 1924 For example, 1925 1926 (gdb) info threads 1927 3 process 35 thread 27 0x34e5 in sigpause () 1928 2 process 35 thread 23 0x34e5 in sigpause () 1929 * 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8) 1930 at threadtest.c:68 1931 1932 On HP-UX systems: 1933 1934 For debugging purposes, GDB associates its own thread number--a 1935 small integer assigned in thread-creation order--with each thread in 1936 your program. 1937 1938 Whenever GDB detects a new thread in your program, it displays both 1939 GDB's thread number and the target system's identification for the 1940 thread with a message in the form `[New SYSTAG]'. SYSTAG is a thread 1941 identifier whose form varies depending on the particular system. For 1942 example, on HP-UX, you see 1943 1944 [New thread 2 (system thread 26594)] 1945 1946 when GDB notices a new thread. 1947 1948 `info threads' 1949 Display a summary of all threads currently in your program. GDB 1950 displays for each thread (in this order): 1951 1952 1. the thread number assigned by GDB 1953 1954 2. the target system's thread identifier (SYSTAG) 1955 1956 3. the current stack frame summary for that thread 1957 1958 An asterisk `*' to the left of the GDB thread number indicates the 1959 current thread. 1960 1961 For example, 1962 1963 (gdb) info threads 1964 * 3 system thread 26607 worker (wptr=0x7b09c318 "@") \ 1965 1966 at quicksort.c:137 1967 2 system thread 26606 0x7b0030d8 in __ksleep () \ 1968 1969 from /usr/lib/libc.2 1970 1 system thread 27905 0x7b003498 in _brk () \ 1971 1972 from /usr/lib/libc.2 1973 1974 On Solaris, you can display more information about user threads with 1975 a Solaris-specific command: 1976 1977 `maint info sol-threads' 1978 Display info on Solaris user threads. 1979 1980 `thread THREADNO' 1981 Make thread number THREADNO the current thread. The command 1982 argument THREADNO is the internal GDB thread number, as shown in 1983 the first field of the `info threads' display. GDB responds by 1984 displaying the system identifier of the thread you selected, and 1985 its current stack frame summary: 1986 1987 (gdb) thread 2 1988 [Switching to process 35 thread 23] 1989 0x34e5 in sigpause () 1990 1991 As with the `[New ...]' message, the form of the text after 1992 `Switching to' depends on your system's conventions for identifying 1993 threads. 1994 1995 `thread apply [THREADNO] [ALL] COMMAND' 1996 The `thread apply' command allows you to apply the named COMMAND 1997 to one or more threads. Specify the numbers of the threads that 1998 you want affected with the command argument THREADNO. It can be a 1999 single thread number, one of the numbers shown in the first field 2000 of the `info threads' display; or it could be a range of thread 2001 numbers, as in `2-4'. To apply a command to all threads, type 2002 `thread apply all COMMAND'. 2003 2004 Whenever GDB stops your program, due to a breakpoint or a signal, it 2005 automatically selects the thread where that breakpoint or signal 2006 happened. GDB alerts you to the context switch with a message of the 2007 form `[Switching to SYSTAG]' to identify the thread. 2008 2009 *Note Stopping and starting multi-thread programs: Thread Stops, for 2010 more information about how GDB behaves when you stop and start programs 2011 with multiple threads. 2012 2013 *Note Setting watchpoints: Set Watchpoints, for information about 2014 watchpoints in programs with multiple threads. 2015 2016 2017 File: gdb.info, Node: Processes, Next: Checkpoint/Restart, Prev: Threads, Up: Running 2018 2019 4.10 Debugging programs with multiple processes 2020 =============================================== 2021 2022 On most systems, GDB has no special support for debugging programs 2023 which create additional processes using the `fork' function. When a 2024 program forks, GDB will continue to debug the parent process and the 2025 child process will run unimpeded. If you have set a breakpoint in any 2026 code which the child then executes, the child will get a `SIGTRAP' 2027 signal which (unless it catches the signal) will cause it to terminate. 2028 2029 However, if you want to debug the child process there is a workaround 2030 which isn't too painful. Put a call to `sleep' in the code which the 2031 child process executes after the fork. It may be useful to sleep only 2032 if a certain environment variable is set, or a certain file exists, so 2033 that the delay need not occur when you don't want to run GDB on the 2034 child. While the child is sleeping, use the `ps' program to get its 2035 process ID. Then tell GDB (a new invocation of GDB if you are also 2036 debugging the parent process) to attach to the child process (*note 2037 Attach::). From that point on you can debug the child process just 2038 like any other process which you attached to. 2039 2040 On some systems, GDB provides support for debugging programs that 2041 create additional processes using the `fork' or `vfork' functions. 2042 Currently, the only platforms with this feature are HP-UX (11.x and 2043 later only?) and GNU/Linux (kernel version 2.5.60 and later). 2044 2045 By default, when a program forks, GDB will continue to debug the 2046 parent process and the child process will run unimpeded. 2047 2048 If you want to follow the child process instead of the parent 2049 process, use the command `set follow-fork-mode'. 2050 2051 `set follow-fork-mode MODE' 2052 Set the debugger response to a program call of `fork' or `vfork'. 2053 A call to `fork' or `vfork' creates a new process. The MODE 2054 argument can be: 2055 2056 `parent' 2057 The original process is debugged after a fork. The child 2058 process runs unimpeded. This is the default. 2059 2060 `child' 2061 The new process is debugged after a fork. The parent process 2062 runs unimpeded. 2063 2064 2065 `show follow-fork-mode' 2066 Display the current debugger response to a `fork' or `vfork' call. 2067 2068 On Linux, if you want to debug both the parent and child processes, 2069 use the command `set detach-on-fork'. 2070 2071 `set detach-on-fork MODE' 2072 Tells gdb whether to detach one of the processes after a fork, or 2073 retain debugger control over them both. 2074 2075 `on' 2076 The child process (or parent process, depending on the value 2077 of `follow-fork-mode') will be detached and allowed to run 2078 independently. This is the default. 2079 2080 `off' 2081 Both processes will be held under the control of GDB. One 2082 process (child or parent, depending on the value of 2083 `follow-fork-mode') is debugged as usual, while the other is 2084 held suspended. 2085 2086 2087 `show detach-on-follow' 2088 Show whether detach-on-follow mode is on/off. 2089 2090 If you choose to set DETACH-ON-FOLLOW mode off, then GDB will retain 2091 control of all forked processes (including nested forks). You can list 2092 the forked processes under the control of GDB by using the `info forks' 2093 command, and switch from one fork to another by using the `fork' 2094 command. 2095 2096 `info forks' 2097 Print a list of all forked processes under the control of GDB. 2098 The listing will include a fork id, a process id, and the current 2099 position (program counter) of the process. 2100 2101 `fork FORK-ID' 2102 Make fork number FORK-ID the current process. The argument 2103 FORK-ID is the internal fork number assigned by GDB, as shown in 2104 the first field of the `info forks' display. 2105 2106 2107 To quit debugging one of the forked processes, you can either detach 2108 from it by using the `detach fork' command (allowing it to run 2109 independently), or delete (and kill) it using the `delete fork' command. 2110 2111 `detach fork FORK-ID' 2112 Detach from the process identified by GDB fork number FORK-ID, and 2113 remove it from the fork list. The process will be allowed to run 2114 independently. 2115 2116 `delete fork FORK-ID' 2117 Kill the process identified by GDB fork number FORK-ID, and remove 2118 it from the fork list. 2119 2120 2121 If you ask to debug a child process and a `vfork' is followed by an 2122 `exec', GDB executes the new target up to the first breakpoint in the 2123 new target. If you have a breakpoint set on `main' in your original 2124 program, the breakpoint will also be set on the child process's `main'. 2125 2126 When a child process is spawned by `vfork', you cannot debug the 2127 child or parent until an `exec' call completes. 2128 2129 If you issue a `run' command to GDB after an `exec' call executes, 2130 the new target restarts. To restart the parent process, use the `file' 2131 command with the parent executable name as its argument. 2132 2133 You can use the `catch' command to make GDB stop whenever a `fork', 2134 `vfork', or `exec' call is made. *Note Setting catchpoints: Set 2135 Catchpoints. 2136 2137 2138 File: gdb.info, Node: Checkpoint/Restart, Prev: Processes, Up: Running 2139 2140 4.11 Setting a _bookmark_ to return to later 2141 ============================================ 2142 2143 On certain operating systems(1), GDB is able to save a "snapshot" of a 2144 program's state, called a "checkpoint", and come back to it later. 2145 2146 Returning to a checkpoint effectively undoes everything that has 2147 happened in the program since the `checkpoint' was saved. This 2148 includes changes in memory, registers, and even (within some limits) 2149 system state. Effectively, it is like going back in time to the moment 2150 when the checkpoint was saved. 2151 2152 Thus, if you're stepping thru a program and you think you're getting 2153 close to the point where things go wrong, you can save a checkpoint. 2154 Then, if you accidentally go too far and miss the critical statement, 2155 instead of having to restart your program from the beginning, you can 2156 just go back to the checkpoint and start again from there. 2157 2158 This can be especially useful if it takes a lot of time or steps to 2159 reach the point where you think the bug occurs. 2160 2161 To use the `checkpoint'/`restart' method of debugging: 2162 2163 `checkpoint' 2164 Save a snapshot of the debugged program's current execution state. 2165 The `checkpoint' command takes no arguments, but each checkpoint 2166 is assigned a small integer id, similar to a breakpoint id. 2167 2168 `info checkpoints' 2169 List the checkpoints that have been saved in the current debugging 2170 session. For each checkpoint, the following information will be 2171 listed: 2172 2173 `Checkpoint ID' 2174 2175 `Process ID' 2176 2177 `Code Address' 2178 2179 `Source line, or label' 2180 2181 `restart CHECKPOINT-ID' 2182 Restore the program state that was saved as checkpoint number 2183 CHECKPOINT-ID. All program variables, registers, stack frames 2184 etc. will be returned to the values that they had when the 2185 checkpoint was saved. In essence, gdb will "wind back the clock" 2186 to the point in time when the checkpoint was saved. 2187 2188 Note that breakpoints, GDB variables, command history etc. are 2189 not affected by restoring a checkpoint. In general, a checkpoint 2190 only restores things that reside in the program being debugged, 2191 not in the debugger. 2192 2193 `delete checkpoint CHECKPOINT-ID' 2194 Delete the previously-saved checkpoint identified by CHECKPOINT-ID. 2195 2196 2197 Returning to a previously saved checkpoint will restore the user 2198 state of the program being debugged, plus a significant subset of the 2199 system (OS) state, including file pointers. It won't "un-write" data 2200 from a file, but it will rewind the file pointer to the previous 2201 location, so that the previously written data can be overwritten. For 2202 files opened in read mode, the pointer will also be restored so that the 2203 previously read data can be read again. 2204 2205 Of course, characters that have been sent to a printer (or other 2206 external device) cannot be "snatched back", and characters received 2207 from eg. a serial device can be removed from internal program buffers, 2208 but they cannot be "pushed back" into the serial pipeline, ready to be 2209 received again. Similarly, the actual contents of files that have been 2210 changed cannot be restored (at this time). 2211 2212 However, within those constraints, you actually can "rewind" your 2213 program to a previously saved point in time, and begin debugging it 2214 again -- and you can change the course of events so as to debug a 2215 different execution path this time. 2216 2217 Finally, there is one bit of internal program state that will be 2218 different when you return to a checkpoint -- the program's process id. 2219 Each checkpoint will have a unique process id (or PID), and each will 2220 be different from the program's original PID. If your program has 2221 saved a local copy of its process id, this could potentially pose a 2222 problem. 2223 2224 4.11.1 A non-obvious benefit of using checkpoints 2225 ------------------------------------------------- 2226 2227 On some systems such as GNU/Linux, address space randomization is 2228 performed on new processes for security reasons. This makes it 2229 difficult or impossible to set a breakpoint, or watchpoint, on an 2230 absolute address if you have to restart the program, since the absolute 2231 location of a symbol will change from one execution to the next. 2232 2233 A checkpoint, however, is an _identical_ copy of a process. 2234 Therefore if you create a checkpoint at (eg.) the start of main, and 2235 simply return to that checkpoint instead of restarting the process, you 2236 can avoid the effects of address randomization and your symbols will 2237 all stay in the same place. 2238 2239 ---------- Footnotes ---------- 2240 2241 (1) Currently, only GNU/Linux. 2242 2243 2244 File: gdb.info, Node: Stopping, Next: Stack, Prev: Running, Up: Top 2245 2246 5 Stopping and Continuing 2247 ************************* 2248 2249 The principal purposes of using a debugger are so that you can stop your 2250 program before it terminates; or so that, if your program runs into 2251 trouble, you can investigate and find out why. 2252 2253 Inside GDB, your program may stop for any of several reasons, such 2254 as a signal, a breakpoint, or reaching a new line after a GDB command 2255 such as `step'. You may then examine and change variables, set new 2256 breakpoints or remove old ones, and then continue execution. Usually, 2257 the messages shown by GDB provide ample explanation of the status of 2258 your program--but you can also explicitly request this information at 2259 any time. 2260 2261 `info program' 2262 Display information about the status of your program: whether it is 2263 running or not, what process it is, and why it stopped. 2264 2265 * Menu: 2266 2267 * Breakpoints:: Breakpoints, watchpoints, and catchpoints 2268 * Continuing and Stepping:: Resuming execution 2269 * Signals:: Signals 2270 * Thread Stops:: Stopping and starting multi-thread programs 2271 2272 2273 File: gdb.info, Node: Breakpoints, Next: Continuing and Stepping, Up: Stopping 2274 2275 5.1 Breakpoints, watchpoints, and catchpoints 2276 ============================================= 2277 2278 A "breakpoint" makes your program stop whenever a certain point in the 2279 program is reached. For each breakpoint, you can add conditions to 2280 control in finer detail whether your program stops. You can set 2281 breakpoints with the `break' command and its variants (*note Setting 2282 breakpoints: Set Breaks.), to specify the place where your program 2283 should stop by line number, function name or exact address in the 2284 program. 2285 2286 On some systems, you can set breakpoints in shared libraries before 2287 the executable is run. There is a minor limitation on HP-UX systems: 2288 you must wait until the executable is run in order to set breakpoints 2289 in shared library routines that are not called directly by the program 2290 (for example, routines that are arguments in a `pthread_create' call). 2291 2292 A "watchpoint" is a special breakpoint that stops your program when 2293 the value of an expression changes. The expression may be a value of a 2294 variable, or it could involve values of one or more variables combined 2295 by operators, such as `a + b'. This is sometimes called "data 2296 breakpoints". You must use a different command to set watchpoints 2297 (*note Setting watchpoints: Set Watchpoints.), but aside from that, you 2298 can manage a watchpoint like any other breakpoint: you enable, disable, 2299 and delete both breakpoints and watchpoints using the same commands. 2300 2301 You can arrange to have values from your program displayed 2302 automatically whenever GDB stops at a breakpoint. *Note Automatic 2303 display: Auto Display. 2304 2305 A "catchpoint" is another special breakpoint that stops your program 2306 when a certain kind of event occurs, such as the throwing of a C++ 2307 exception or the loading of a library. As with watchpoints, you use a 2308 different command to set a catchpoint (*note Setting catchpoints: Set 2309 Catchpoints.), but aside from that, you can manage a catchpoint like any 2310 other breakpoint. (To stop when your program receives a signal, use the 2311 `handle' command; see *Note Signals: Signals.) 2312 2313 GDB assigns a number to each breakpoint, watchpoint, or catchpoint 2314 when you create it; these numbers are successive integers starting with 2315 one. In many of the commands for controlling various features of 2316 breakpoints you use the breakpoint number to say which breakpoint you 2317 want to change. Each breakpoint may be "enabled" or "disabled"; if 2318 disabled, it has no effect on your program until you enable it again. 2319 2320 Some GDB commands accept a range of breakpoints on which to operate. 2321 A breakpoint range is either a single breakpoint number, like `5', or 2322 two such numbers, in increasing order, separated by a hyphen, like 2323 `5-7'. When a breakpoint range is given to a command, all breakpoint 2324 in that range are operated on. 2325 2326 * Menu: 2327 2328 * Set Breaks:: Setting breakpoints 2329 * Set Watchpoints:: Setting watchpoints 2330 * Set Catchpoints:: Setting catchpoints 2331 * Delete Breaks:: Deleting breakpoints 2332 * Disabling:: Disabling breakpoints 2333 * Conditions:: Break conditions 2334 * Break Commands:: Breakpoint command lists 2335 * Breakpoint Menus:: Breakpoint menus 2336 * Error in Breakpoints:: ``Cannot insert breakpoints'' 2337 * Breakpoint related warnings:: ``Breakpoint address adjusted...'' 2338 2339 2340 File: gdb.info, Node: Set Breaks, Next: Set Watchpoints, Up: Breakpoints 2341 2342 5.1.1 Setting breakpoints 2343 ------------------------- 2344 2345 Breakpoints are set with the `break' command (abbreviated `b'). The 2346 debugger convenience variable `$bpnum' records the number of the 2347 breakpoint you've set most recently; see *Note Convenience variables: 2348 Convenience Vars, for a discussion of what you can do with convenience 2349 variables. 2350 2351 You have several ways to say where the breakpoint should go. 2352 2353 `break FUNCTION' 2354 Set a breakpoint at entry to function FUNCTION. When using source 2355 languages that permit overloading of symbols, such as C++, 2356 FUNCTION may refer to more than one possible place to break. 2357 *Note Breakpoint menus: Breakpoint Menus, for a discussion of that 2358 situation. 2359 2360 `break +OFFSET' 2361 `break -OFFSET' 2362 Set a breakpoint some number of lines forward or back from the 2363 position at which execution stopped in the currently selected 2364 "stack frame". (*Note Frames: Frames, for a description of stack 2365 frames.) 2366 2367 `break LINENUM' 2368 Set a breakpoint at line LINENUM in the current source file. The 2369 current source file is the last file whose source text was printed. 2370 The breakpoint will stop your program just before it executes any 2371 of the code on that line. 2372 2373 `break FILENAME:LINENUM' 2374 Set a breakpoint at line LINENUM in source file FILENAME. 2375 2376 `break FILENAME:FUNCTION' 2377 Set a breakpoint at entry to function FUNCTION found in file 2378 FILENAME. Specifying a file name as well as a function name is 2379 superfluous except when multiple files contain similarly named 2380 functions. 2381 2382 `break *ADDRESS' 2383 Set a breakpoint at address ADDRESS. You can use this to set 2384 breakpoints in parts of your program which do not have debugging 2385 information or source files. 2386 2387 `break' 2388 When called without any arguments, `break' sets a breakpoint at 2389 the next instruction to be executed in the selected stack frame 2390 (*note Examining the Stack: Stack.). In any selected frame but the 2391 innermost, this makes your program stop as soon as control returns 2392 to that frame. This is similar to the effect of a `finish' 2393 command in the frame inside the selected frame--except that 2394 `finish' does not leave an active breakpoint. If you use `break' 2395 without an argument in the innermost frame, GDB stops the next 2396 time it reaches the current location; this may be useful inside 2397 loops. 2398 2399 GDB normally ignores breakpoints when it resumes execution, until 2400 at least one instruction has been executed. If it did not do 2401 this, you would be unable to proceed past a breakpoint without 2402 first disabling the breakpoint. This rule applies whether or not 2403 the breakpoint already existed when your program stopped. 2404 2405 `break ... if COND' 2406 Set a breakpoint with condition COND; evaluate the expression COND 2407 each time the breakpoint is reached, and stop only if the value is 2408 nonzero--that is, if COND evaluates as true. `...' stands for one 2409 of the possible arguments described above (or no argument) 2410 specifying where to break. *Note Break conditions: Conditions, 2411 for more information on breakpoint conditions. 2412 2413 `tbreak ARGS' 2414 Set a breakpoint enabled only for one stop. ARGS are the same as 2415 for the `break' command, and the breakpoint is set in the same 2416 way, but the breakpoint is automatically deleted after the first 2417 time your program stops there. *Note Disabling breakpoints: 2418 Disabling. 2419 2420 `hbreak ARGS' 2421 Set a hardware-assisted breakpoint. ARGS are the same as for the 2422 `break' command and the breakpoint is set in the same way, but the 2423 breakpoint requires hardware support and some target hardware may 2424 not have this support. The main purpose of this is EPROM/ROM code 2425 debugging, so you can set a breakpoint at an instruction without 2426 changing the instruction. This can be used with the new 2427 trap-generation provided by SPARClite DSU and most x86-based 2428 targets. These targets will generate traps when a program 2429 accesses some data or instruction address that is assigned to the 2430 debug registers. However the hardware breakpoint registers can 2431 take a limited number of breakpoints. For example, on the DSU, 2432 only two data breakpoints can be set at a time, and GDB will 2433 reject this command if more than two are used. Delete or disable 2434 unused hardware breakpoints before setting new ones (*note 2435 Disabling: Disabling.). *Note Break conditions: Conditions. For 2436 remote targets, you can restrict the number of hardware 2437 breakpoints GDB will use, see *Note set remote 2438 hardware-breakpoint-limit::. 2439 2440 `thbreak ARGS' 2441 Set a hardware-assisted breakpoint enabled only for one stop. ARGS 2442 are the same as for the `hbreak' command and the breakpoint is set 2443 in the same way. However, like the `tbreak' command, the 2444 breakpoint is automatically deleted after the first time your 2445 program stops there. Also, like the `hbreak' command, the 2446 breakpoint requires hardware support and some target hardware may 2447 not have this support. *Note Disabling breakpoints: Disabling. 2448 See also *Note Break conditions: Conditions. 2449 2450 `rbreak REGEX' 2451 Set breakpoints on all functions matching the regular expression 2452 REGEX. This command sets an unconditional breakpoint on all 2453 matches, printing a list of all breakpoints it set. Once these 2454 breakpoints are set, they are treated just like the breakpoints 2455 set with the `break' command. You can delete them, disable them, 2456 or make them conditional the same way as any other breakpoint. 2457 2458 The syntax of the regular expression is the standard one used with 2459 tools like `grep'. Note that this is different from the syntax 2460 used by shells, so for instance `foo*' matches all functions that 2461 include an `fo' followed by zero or more `o's. There is an 2462 implicit `.*' leading and trailing the regular expression you 2463 supply, so to match only functions that begin with `foo', use 2464 `^foo'. 2465 2466 When debugging C++ programs, `rbreak' is useful for setting 2467 breakpoints on overloaded functions that are not members of any 2468 special classes. 2469 2470 The `rbreak' command can be used to set breakpoints in *all* the 2471 functions in a program, like this: 2472 2473 (gdb) rbreak . 2474 2475 `info breakpoints [N]' 2476 `info break [N]' 2477 `info watchpoints [N]' 2478 Print a table of all breakpoints, watchpoints, and catchpoints set 2479 and not deleted. Optional argument N means print information only 2480 about the specified breakpoint (or watchpoint or catchpoint). For 2481 each breakpoint, following columns are printed: 2482 2483 _Breakpoint Numbers_ 2484 2485 _Type_ 2486 Breakpoint, watchpoint, or catchpoint. 2487 2488 _Disposition_ 2489 Whether the breakpoint is marked to be disabled or deleted 2490 when hit. 2491 2492 _Enabled or Disabled_ 2493 Enabled breakpoints are marked with `y'. `n' marks 2494 breakpoints that are not enabled. 2495 2496 _Address_ 2497 Where the breakpoint is in your program, as a memory address. 2498 If the breakpoint is pending (see below for details) on a 2499 future load of a shared library, the address will be listed 2500 as `<PENDING>'. 2501 2502 _What_ 2503 Where the breakpoint is in the source for your program, as a 2504 file and line number. For a pending breakpoint, the original 2505 string passed to the breakpoint command will be listed as it 2506 cannot be resolved until the appropriate shared library is 2507 loaded in the future. 2508 2509 If a breakpoint is conditional, `info break' shows the condition on 2510 the line following the affected breakpoint; breakpoint commands, 2511 if any, are listed after that. A pending breakpoint is allowed to 2512 have a condition specified for it. The condition is not parsed 2513 for validity until a shared library is loaded that allows the 2514 pending breakpoint to resolve to a valid location. 2515 2516 `info break' with a breakpoint number N as argument lists only 2517 that breakpoint. The convenience variable `$_' and the default 2518 examining-address for the `x' command are set to the address of 2519 the last breakpoint listed (*note Examining memory: Memory.). 2520 2521 `info break' displays a count of the number of times the breakpoint 2522 has been hit. This is especially useful in conjunction with the 2523 `ignore' command. You can ignore a large number of breakpoint 2524 hits, look at the breakpoint info to see how many times the 2525 breakpoint was hit, and then run again, ignoring one less than 2526 that number. This will get you quickly to the last hit of that 2527 breakpoint. 2528 2529 GDB allows you to set any number of breakpoints at the same place in 2530 your program. There is nothing silly or meaningless about this. When 2531 the breakpoints are conditional, this is even useful (*note Break 2532 conditions: Conditions.). 2533 2534 If a specified breakpoint location cannot be found, it may be due to 2535 the fact that the location is in a shared library that is yet to be 2536 loaded. In such a case, you may want GDB to create a special 2537 breakpoint (known as a "pending breakpoint") that attempts to resolve 2538 itself in the future when an appropriate shared library gets loaded. 2539 2540 Pending breakpoints are useful to set at the start of your GDB 2541 session for locations that you know will be dynamically loaded later by 2542 the program being debugged. When shared libraries are loaded, a check 2543 is made to see if the load resolves any pending breakpoint locations. 2544 If a pending breakpoint location gets resolved, a regular breakpoint is 2545 created and the original pending breakpoint is removed. 2546 2547 GDB provides some additional commands for controlling pending 2548 breakpoint support: 2549 2550 `set breakpoint pending auto' 2551 This is the default behavior. When GDB cannot find the breakpoint 2552 location, it queries you whether a pending breakpoint should be 2553 created. 2554 2555 `set breakpoint pending on' 2556 This indicates that an unrecognized breakpoint location should 2557 automatically result in a pending breakpoint being created. 2558 2559 `set breakpoint pending off' 2560 This indicates that pending breakpoints are not to be created. Any 2561 unrecognized breakpoint location results in an error. This 2562 setting does not affect any pending breakpoints previously created. 2563 2564 `show breakpoint pending' 2565 Show the current behavior setting for creating pending breakpoints. 2566 2567 Normal breakpoint operations apply to pending breakpoints as well. 2568 You may specify a condition for a pending breakpoint and/or commands to 2569 run when the breakpoint is reached. You can also enable or disable the 2570 pending breakpoint. When you specify a condition for a pending 2571 breakpoint, the parsing of the condition will be deferred until the 2572 point where the pending breakpoint location is resolved. Disabling a 2573 pending breakpoint tells GDB to not attempt to resolve the breakpoint 2574 on any subsequent shared library load. When a pending breakpoint is 2575 re-enabled, GDB checks to see if the location is already resolved. 2576 This is done because any number of shared library loads could have 2577 occurred since the time the breakpoint was disabled and one or more of 2578 these loads could resolve the location. 2579 2580 GDB itself sometimes sets breakpoints in your program for special 2581 purposes, such as proper handling of `longjmp' (in C programs). These 2582 internal breakpoints are assigned negative numbers, starting with `-1'; 2583 `info breakpoints' does not display them. You can see these 2584 breakpoints with the GDB maintenance command `maint info breakpoints' 2585 (*note maint info breakpoints::). 2586 2587 2588 File: gdb.info, Node: Set Watchpoints, Next: Set Catchpoints, Prev: Set Breaks, Up: Breakpoints 2589 2590 5.1.2 Setting watchpoints 2591 ------------------------- 2592 2593 You can use a watchpoint to stop execution whenever the value of an 2594 expression changes, without having to predict a particular place where 2595 this may happen. (This is sometimes called a "data breakpoint".) The 2596 expression may be as simple as the value of a single variable, or as 2597 complex as many variables combined by operators. Examples include: 2598 2599 * A reference to the value of a single variable. 2600 2601 * An address cast to an appropriate data type. For example, `*(int 2602 *)0x12345678' will watch a 4-byte region at the specified address 2603 (assuming an `int' occupies 4 bytes). 2604 2605 * An arbitrarily complex expression, such as `a*b + c/d'. The 2606 expression can use any operators valid in the program's native 2607 language (*note Languages::). 2608 2609 Depending on your system, watchpoints may be implemented in software 2610 or hardware. GDB does software watchpointing by single-stepping your 2611 program and testing the variable's value each time, which is hundreds of 2612 times slower than normal execution. (But this may still be worth it, to 2613 catch errors where you have no clue what part of your program is the 2614 culprit.) 2615 2616 On some systems, such as HP-UX, GNU/Linux and most other x86-based 2617 targets, GDB includes support for hardware watchpoints, which do not 2618 slow down the running of your program. 2619 2620 `watch EXPR' 2621 Set a watchpoint for an expression. GDB will break when the 2622 expression EXPR is written into by the program and its value 2623 changes. The simplest (and the most popular) use of this command 2624 is to watch the value of a single variable: 2625 2626 (gdb) watch foo 2627 2628 `rwatch EXPR' 2629 Set a watchpoint that will break when the value of EXPR is read by 2630 the program. 2631 2632 `awatch EXPR' 2633 Set a watchpoint that will break when EXPR is either read from or 2634 written into by the program. 2635 2636 `info watchpoints' 2637 This command prints a list of watchpoints, breakpoints, and 2638 catchpoints; it is the same as `info break' (*note Set Breaks::). 2639 2640 GDB sets a "hardware watchpoint" if possible. Hardware watchpoints 2641 execute very quickly, and the debugger reports a change in value at the 2642 exact instruction where the change occurs. If GDB cannot set a 2643 hardware watchpoint, it sets a software watchpoint, which executes more 2644 slowly and reports the change in value at the next _statement_, not the 2645 instruction, after the change occurs. 2646 2647 You can force GDB to use only software watchpoints with the `set 2648 can-use-hw-watchpoints 0' command. With this variable set to zero, GDB 2649 will never try to use hardware watchpoints, even if the underlying 2650 system supports them. (Note that hardware-assisted watchpoints that 2651 were set _before_ setting `can-use-hw-watchpoints' to zero will still 2652 use the hardware mechanism of watching expressiion values.) 2653 2654 `set can-use-hw-watchpoints' 2655 Set whether or not to use hardware watchpoints. 2656 2657 `show can-use-hw-watchpoints' 2658 Show the current mode of using hardware watchpoints. 2659 2660 For remote targets, you can restrict the number of hardware 2661 watchpoints GDB will use, see *Note set remote 2662 hardware-breakpoint-limit::. 2663 2664 When you issue the `watch' command, GDB reports 2665 2666 Hardware watchpoint NUM: EXPR 2667 2668 if it was able to set a hardware watchpoint. 2669 2670 Currently, the `awatch' and `rwatch' commands can only set hardware 2671 watchpoints, because accesses to data that don't change the value of 2672 the watched expression cannot be detected without examining every 2673 instruction as it is being executed, and GDB does not do that 2674 currently. If GDB finds that it is unable to set a hardware breakpoint 2675 with the `awatch' or `rwatch' command, it will print a message like 2676 this: 2677 2678 Expression cannot be implemented with read/access watchpoint. 2679 2680 Sometimes, GDB cannot set a hardware watchpoint because the data 2681 type of the watched expression is wider than what a hardware watchpoint 2682 on the target machine can handle. For example, some systems can only 2683 watch regions that are up to 4 bytes wide; on such systems you cannot 2684 set hardware watchpoints for an expression that yields a 2685 double-precision floating-point number (which is typically 8 bytes 2686 wide). As a work-around, it might be possible to break the large region 2687 into a series of smaller ones and watch them with separate watchpoints. 2688 2689 If you set too many hardware watchpoints, GDB might be unable to 2690 insert all of them when you resume the execution of your program. 2691 Since the precise number of active watchpoints is unknown until such 2692 time as the program is about to be resumed, GDB might not be able to 2693 warn you about this when you set the watchpoints, and the warning will 2694 be printed only when the program is resumed: 2695 2696 Hardware watchpoint NUM: Could not insert watchpoint 2697 2698 If this happens, delete or disable some of the watchpoints. 2699 2700 Watching complex expressions that reference many variables can also 2701 exhaust the resources available for hardware-assisted watchpoints. 2702 That's because GDB needs to watch every variable in the expression with 2703 separately allocated resources. 2704 2705 The SPARClite DSU will generate traps when a program accesses some 2706 data or instruction address that is assigned to the debug registers. 2707 For the data addresses, DSU facilitates the `watch' command. However 2708 the hardware breakpoint registers can only take two data watchpoints, 2709 and both watchpoints must be the same kind. For example, you can set 2710 two watchpoints with `watch' commands, two with `rwatch' commands, *or* 2711 two with `awatch' commands, but you cannot set one watchpoint with one 2712 command and the other with a different command. GDB will reject the 2713 command if you try to mix watchpoints. Delete or disable unused 2714 watchpoint commands before setting new ones. 2715 2716 If you call a function interactively using `print' or `call', any 2717 watchpoints you have set will be inactive until GDB reaches another 2718 kind of breakpoint or the call completes. 2719 2720 GDB automatically deletes watchpoints that watch local (automatic) 2721 variables, or expressions that involve such variables, when they go out 2722 of scope, that is, when the execution leaves the block in which these 2723 variables were defined. In particular, when the program being debugged 2724 terminates, _all_ local variables go out of scope, and so only 2725 watchpoints that watch global variables remain set. If you rerun the 2726 program, you will need to set all such watchpoints again. One way of 2727 doing that would be to set a code breakpoint at the entry to the `main' 2728 function and when it breaks, set all the watchpoints. 2729 2730 _Warning:_ In multi-thread programs, watchpoints have only limited 2731 usefulness. With the current watchpoint implementation, GDB can 2732 only watch the value of an expression _in a single thread_. If 2733 you are confident that the expression can only change due to the 2734 current thread's activity (and if you are also confident that no 2735 other thread can become current), then you can use watchpoints as 2736 usual. However, GDB may not notice when a non-current thread's 2737 activity changes the expression. 2738 2739 _HP-UX Warning:_ In multi-thread programs, software watchpoints 2740 have only limited usefulness. If GDB creates a software 2741 watchpoint, it can only watch the value of an expression _in a 2742 single thread_. If you are confident that the expression can only 2743 change due to the current thread's activity (and if you are also 2744 confident that no other thread can become current), then you can 2745 use software watchpoints as usual. However, GDB may not notice 2746 when a non-current thread's activity changes the expression. 2747 (Hardware watchpoints, in contrast, watch an expression in all 2748 threads.) 2749 2750 *Note set remote hardware-watchpoint-limit::. 2751 2752 2753 File: gdb.info, Node: Set Catchpoints, Next: Delete Breaks, Prev: Set Watchpoints, Up: Breakpoints 2754 2755 5.1.3 Setting catchpoints 2756 ------------------------- 2757 2758 You can use "catchpoints" to cause the debugger to stop for certain 2759 kinds of program events, such as C++ exceptions or the loading of a 2760 shared library. Use the `catch' command to set a catchpoint. 2761 2762 `catch EVENT' 2763 Stop when EVENT occurs. EVENT can be any of the following: 2764 `throw' 2765 The throwing of a C++ exception. 2766 2767 `catch' 2768 The catching of a C++ exception. 2769 2770 `exec' 2771 A call to `exec'. This is currently only available for HP-UX. 2772 2773 `fork' 2774 A call to `fork'. This is currently only available for HP-UX. 2775 2776 `vfork' 2777 A call to `vfork'. This is currently only available for 2778 HP-UX. 2779 2780 `load' 2781 `load LIBNAME' 2782 The dynamic loading of any shared library, or the loading of 2783 the library LIBNAME. This is currently only available for 2784 HP-UX. 2785 2786 `unload' 2787 `unload LIBNAME' 2788 The unloading of any dynamically loaded shared library, or 2789 the unloading of the library LIBNAME. This is currently only 2790 available for HP-UX. 2791 2792 `tcatch EVENT' 2793 Set a catchpoint that is enabled only for one stop. The 2794 catchpoint is automatically deleted after the first time the event 2795 is caught. 2796 2797 2798 Use the `info break' command to list the current catchpoints. 2799 2800 There are currently some limitations to C++ exception handling 2801 (`catch throw' and `catch catch') in GDB: 2802 2803 * If you call a function interactively, GDB normally returns control 2804 to you when the function has finished executing. If the call 2805 raises an exception, however, the call may bypass the mechanism 2806 that returns control to you and cause your program either to abort 2807 or to simply continue running until it hits a breakpoint, catches 2808 a signal that GDB is listening for, or exits. This is the case 2809 even if you set a catchpoint for the exception; catchpoints on 2810 exceptions are disabled within interactive calls. 2811 2812 * You cannot raise an exception interactively. 2813 2814 * You cannot install an exception handler interactively. 2815 2816 Sometimes `catch' is not the best way to debug exception handling: 2817 if you need to know exactly where an exception is raised, it is better 2818 to stop _before_ the exception handler is called, since that way you 2819 can see the stack before any unwinding takes place. If you set a 2820 breakpoint in an exception handler instead, it may not be easy to find 2821 out where the exception was raised. 2822 2823 To stop just before an exception handler is called, you need some 2824 knowledge of the implementation. In the case of GNU C++, exceptions are 2825 raised by calling a library function named `__raise_exception' which 2826 has the following ANSI C interface: 2827 2828 /* ADDR is where the exception identifier is stored. 2829 ID is the exception identifier. */ 2830 void __raise_exception (void **addr, void *id); 2831 2832 To make the debugger catch all exceptions before any stack unwinding 2833 takes place, set a breakpoint on `__raise_exception' (*note 2834 Breakpoints; watchpoints; and exceptions: Breakpoints.). 2835 2836 With a conditional breakpoint (*note Break conditions: Conditions.) 2837 that depends on the value of ID, you can stop your program when a 2838 specific exception is raised. You can use multiple conditional 2839 breakpoints to stop your program when any of a number of exceptions are 2840 raised. 2841 2842 2843 File: gdb.info, Node: Delete Breaks, Next: Disabling, Prev: Set Catchpoints, Up: Breakpoints 2844 2845 5.1.4 Deleting breakpoints 2846 -------------------------- 2847 2848 It is often necessary to eliminate a breakpoint, watchpoint, or 2849 catchpoint once it has done its job and you no longer want your program 2850 to stop there. This is called "deleting" the breakpoint. A breakpoint 2851 that has been deleted no longer exists; it is forgotten. 2852 2853 With the `clear' command you can delete breakpoints according to 2854 where they are in your program. With the `delete' command you can 2855 delete individual breakpoints, watchpoints, or catchpoints by specifying 2856 their breakpoint numbers. 2857 2858 It is not necessary to delete a breakpoint to proceed past it. GDB 2859 automatically ignores breakpoints on the first instruction to be 2860 executed when you continue execution without changing the execution 2861 address. 2862 2863 `clear' 2864 Delete any breakpoints at the next instruction to be executed in 2865 the selected stack frame (*note Selecting a frame: Selection.). 2866 When the innermost frame is selected, this is a good way to delete 2867 a breakpoint where your program just stopped. 2868 2869 `clear FUNCTION' 2870 `clear FILENAME:FUNCTION' 2871 Delete any breakpoints set at entry to the named FUNCTION. 2872 2873 `clear LINENUM' 2874 `clear FILENAME:LINENUM' 2875 Delete any breakpoints set at or within the code of the specified 2876 LINENUM of the specified FILENAME. 2877 2878 `delete [breakpoints] [RANGE...]' 2879 Delete the breakpoints, watchpoints, or catchpoints of the 2880 breakpoint ranges specified as arguments. If no argument is 2881 specified, delete all breakpoints (GDB asks confirmation, unless 2882 you have `set confirm off'). You can abbreviate this command as 2883 `d'. 2884 2885 2886 File: gdb.info, Node: Disabling, Next: Conditions, Prev: Delete Breaks, Up: Breakpoints 2887 2888 5.1.5 Disabling breakpoints 2889 --------------------------- 2890 2891 Rather than deleting a breakpoint, watchpoint, or catchpoint, you might 2892 prefer to "disable" it. This makes the breakpoint inoperative as if it 2893 had been deleted, but remembers the information on the breakpoint so 2894 that you can "enable" it again later. 2895 2896 You disable and enable breakpoints, watchpoints, and catchpoints with 2897 the `enable' and `disable' commands, optionally specifying one or more 2898 breakpoint numbers as arguments. Use `info break' or `info watch' to 2899 print a list of breakpoints, watchpoints, and catchpoints if you do not 2900 know which numbers to use. 2901 2902 A breakpoint, watchpoint, or catchpoint can have any of four 2903 different states of enablement: 2904 2905 * Enabled. The breakpoint stops your program. A breakpoint set 2906 with the `break' command starts out in this state. 2907 2908 * Disabled. The breakpoint has no effect on your program. 2909 2910 * Enabled once. The breakpoint stops your program, but then becomes 2911 disabled. 2912 2913 * Enabled for deletion. The breakpoint stops your program, but 2914 immediately after it does so it is deleted permanently. A 2915 breakpoint set with the `tbreak' command starts out in this state. 2916 2917 You can use the following commands to enable or disable breakpoints, 2918 watchpoints, and catchpoints: 2919 2920 `disable [breakpoints] [RANGE...]' 2921 Disable the specified breakpoints--or all breakpoints, if none are 2922 listed. A disabled breakpoint has no effect but is not forgotten. 2923 All options such as ignore-counts, conditions and commands are 2924 remembered in case the breakpoint is enabled again later. You may 2925 abbreviate `disable' as `dis'. 2926 2927 `enable [breakpoints] [RANGE...]' 2928 Enable the specified breakpoints (or all defined breakpoints). 2929 They become effective once again in stopping your program. 2930 2931 `enable [breakpoints] once RANGE...' 2932 Enable the specified breakpoints temporarily. GDB disables any of 2933 these breakpoints immediately after stopping your program. 2934 2935 `enable [breakpoints] delete RANGE...' 2936 Enable the specified breakpoints to work once, then die. GDB 2937 deletes any of these breakpoints as soon as your program stops 2938 there. Breakpoints set by the `tbreak' command start out in this 2939 state. 2940 2941 Except for a breakpoint set with `tbreak' (*note Setting 2942 breakpoints: Set Breaks.), breakpoints that you set are initially 2943 enabled; subsequently, they become disabled or enabled only when you 2944 use one of the commands above. (The command `until' can set and delete 2945 a breakpoint of its own, but it does not change the state of your other 2946 breakpoints; see *Note Continuing and stepping: Continuing and 2947 Stepping.) 2948 2949 2950 File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints 2951 2952 5.1.6 Break conditions 2953 ---------------------- 2954 2955 The simplest sort of breakpoint breaks every time your program reaches a 2956 specified place. You can also specify a "condition" for a breakpoint. 2957 A condition is just a Boolean expression in your programming language 2958 (*note Expressions: Expressions.). A breakpoint with a condition 2959 evaluates the expression each time your program reaches it, and your 2960 program stops only if the condition is _true_. 2961 2962 This is the converse of using assertions for program validation; in 2963 that situation, you want to stop when the assertion is violated--that 2964 is, when the condition is false. In C, if you want to test an 2965 assertion expressed by the condition ASSERT, you should set the 2966 condition `! ASSERT' on the appropriate breakpoint. 2967 2968 Conditions are also accepted for watchpoints; you may not need them, 2969 since a watchpoint is inspecting the value of an expression anyhow--but 2970 it might be simpler, say, to just set a watchpoint on a variable name, 2971 and specify a condition that tests whether the new value is an 2972 interesting one. 2973 2974 Break conditions can have side effects, and may even call functions 2975 in your program. This can be useful, for example, to activate functions 2976 that log program progress, or to use your own print functions to format 2977 special data structures. The effects are completely predictable unless 2978 there is another enabled breakpoint at the same address. (In that 2979 case, GDB might see the other breakpoint first and stop your program 2980 without checking the condition of this one.) Note that breakpoint 2981 commands are usually more convenient and flexible than break conditions 2982 for the purpose of performing side effects when a breakpoint is reached 2983 (*note Breakpoint command lists: Break Commands.). 2984 2985 Break conditions can be specified when a breakpoint is set, by using 2986 `if' in the arguments to the `break' command. *Note Setting 2987 breakpoints: Set Breaks. They can also be changed at any time with the 2988 `condition' command. 2989 2990 You can also use the `if' keyword with the `watch' command. The 2991 `catch' command does not recognize the `if' keyword; `condition' is the 2992 only way to impose a further condition on a catchpoint. 2993 2994 `condition BNUM EXPRESSION' 2995 Specify EXPRESSION as the break condition for breakpoint, 2996 watchpoint, or catchpoint number BNUM. After you set a condition, 2997 breakpoint BNUM stops your program only if the value of EXPRESSION 2998 is true (nonzero, in C). When you use `condition', GDB checks 2999 EXPRESSION immediately for syntactic correctness, and to determine 3000 whether symbols in it have referents in the context of your 3001 breakpoint. If EXPRESSION uses symbols not referenced in the 3002 context of the breakpoint, GDB prints an error message: 3003 3004 No symbol "foo" in current context. 3005 3006 GDB does not actually evaluate EXPRESSION at the time the 3007 `condition' command (or a command that sets a breakpoint with a 3008 condition, like `break if ...') is given, however. *Note 3009 Expressions: Expressions. 3010 3011 `condition BNUM' 3012 Remove the condition from breakpoint number BNUM. It becomes an 3013 ordinary unconditional breakpoint. 3014 3015 A special case of a breakpoint condition is to stop only when the 3016 breakpoint has been reached a certain number of times. This is so 3017 useful that there is a special way to do it, using the "ignore count" 3018 of the breakpoint. Every breakpoint has an ignore count, which is an 3019 integer. Most of the time, the ignore count is zero, and therefore has 3020 no effect. But if your program reaches a breakpoint whose ignore count 3021 is positive, then instead of stopping, it just decrements the ignore 3022 count by one and continues. As a result, if the ignore count value is 3023 N, the breakpoint does not stop the next N times your program reaches 3024 it. 3025 3026 `ignore BNUM COUNT' 3027 Set the ignore count of breakpoint number BNUM to COUNT. The next 3028 COUNT times the breakpoint is reached, your program's execution 3029 does not stop; other than to decrement the ignore count, GDB takes 3030 no action. 3031 3032 To make the breakpoint stop the next time it is reached, specify a 3033 count of zero. 3034 3035 When you use `continue' to resume execution of your program from a 3036 breakpoint, you can specify an ignore count directly as an 3037 argument to `continue', rather than using `ignore'. *Note 3038 Continuing and stepping: Continuing and Stepping. 3039 3040 If a breakpoint has a positive ignore count and a condition, the 3041 condition is not checked. Once the ignore count reaches zero, GDB 3042 resumes checking the condition. 3043 3044 You could achieve the effect of the ignore count with a condition 3045 such as `$foo-- <= 0' using a debugger convenience variable that 3046 is decremented each time. *Note Convenience variables: 3047 Convenience Vars. 3048 3049 Ignore counts apply to breakpoints, watchpoints, and catchpoints. 3050 3051 3052 File: gdb.info, Node: Break Commands, Next: Breakpoint Menus, Prev: Conditions, Up: Breakpoints 3053 3054 5.1.7 Breakpoint command lists 3055 ------------------------------ 3056 3057 You can give any breakpoint (or watchpoint or catchpoint) a series of 3058 commands to execute when your program stops due to that breakpoint. For 3059 example, you might want to print the values of certain expressions, or 3060 enable other breakpoints. 3061 3062 `commands [BNUM]' 3063 `... COMMAND-LIST ...' 3064 `end' 3065 Specify a list of commands for breakpoint number BNUM. The 3066 commands themselves appear on the following lines. Type a line 3067 containing just `end' to terminate the commands. 3068 3069 To remove all commands from a breakpoint, type `commands' and 3070 follow it immediately with `end'; that is, give no commands. 3071 3072 With no BNUM argument, `commands' refers to the last breakpoint, 3073 watchpoint, or catchpoint set (not to the breakpoint most recently 3074 encountered). 3075 3076 Pressing <RET> as a means of repeating the last GDB command is 3077 disabled within a COMMAND-LIST. 3078 3079 You can use breakpoint commands to start your program up again. 3080 Simply use the `continue' command, or `step', or any other command that 3081 resumes execution. 3082 3083 Any other commands in the command list, after a command that resumes 3084 execution, are ignored. This is because any time you resume execution 3085 (even with a simple `next' or `step'), you may encounter another 3086 breakpoint--which could have its own command list, leading to 3087 ambiguities about which list to execute. 3088 3089 If the first command you specify in a command list is `silent', the 3090 usual message about stopping at a breakpoint is not printed. This may 3091 be desirable for breakpoints that are to print a specific message and 3092 then continue. If none of the remaining commands print anything, you 3093 see no sign that the breakpoint was reached. `silent' is meaningful 3094 only at the beginning of a breakpoint command list. 3095 3096 The commands `echo', `output', and `printf' allow you to print 3097 precisely controlled output, and are often useful in silent 3098 breakpoints. *Note Commands for controlled output: Output. 3099 3100 For example, here is how you could use breakpoint commands to print 3101 the value of `x' at entry to `foo' whenever `x' is positive. 3102 3103 break foo if x>0 3104 commands 3105 silent 3106 printf "x is %d\n",x 3107 cont 3108 end 3109 3110 One application for breakpoint commands is to compensate for one bug 3111 so you can test for another. Put a breakpoint just after the erroneous 3112 line of code, give it a condition to detect the case in which something 3113 erroneous has been done, and give it commands to assign correct values 3114 to any variables that need them. End with the `continue' command so 3115 that your program does not stop, and start with the `silent' command so 3116 that no output is produced. Here is an example: 3117 3118 break 403 3119 commands 3120 silent 3121 set x = y + 4 3122 cont 3123 end 3124 3125 3126 File: gdb.info, Node: Breakpoint Menus, Next: Error in Breakpoints, Prev: Break Commands, Up: Breakpoints 3127 3128 5.1.8 Breakpoint menus 3129 ---------------------- 3130 3131 Some programming languages (notably C++ and Objective-C) permit a 3132 single function name to be defined several times, for application in 3133 different contexts. This is called "overloading". When a function 3134 name is overloaded, `break FUNCTION' is not enough to tell GDB where 3135 you want a breakpoint. If you realize this is a problem, you can use 3136 something like `break FUNCTION(TYPES)' to specify which particular 3137 version of the function you want. Otherwise, GDB offers you a menu of 3138 numbered choices for different possible breakpoints, and waits for your 3139 selection with the prompt `>'. The first two options are always `[0] 3140 cancel' and `[1] all'. Typing `1' sets a breakpoint at each definition 3141 of FUNCTION, and typing `0' aborts the `break' command without setting 3142 any new breakpoints. 3143 3144 For example, the following session excerpt shows an attempt to set a 3145 breakpoint at the overloaded symbol `String::after'. We choose three 3146 particular definitions of that function name: 3147 3148 (gdb) b String::after 3149 [0] cancel 3150 [1] all 3151 [2] file:String.cc; line number:867 3152 [3] file:String.cc; line number:860 3153 [4] file:String.cc; line number:875 3154 [5] file:String.cc; line number:853 3155 [6] file:String.cc; line number:846 3156 [7] file:String.cc; line number:735 3157 > 2 4 6 3158 Breakpoint 1 at 0xb26c: file String.cc, line 867. 3159 Breakpoint 2 at 0xb344: file String.cc, line 875. 3160 Breakpoint 3 at 0xafcc: file String.cc, line 846. 3161 Multiple breakpoints were set. 3162 Use the "delete" command to delete unwanted 3163 breakpoints. 3164 (gdb) 3165 3166 3167 File: gdb.info, Node: Error in Breakpoints, Next: Breakpoint related warnings, Prev: Breakpoint Menus, Up: Breakpoints 3168 3169 5.1.9 "Cannot insert breakpoints" 3170 --------------------------------- 3171 3172 Under some operating systems, breakpoints cannot be used in a program if 3173 any other process is running that program. In this situation, 3174 attempting to run or continue a program with a breakpoint causes GDB to 3175 print an error message: 3176 3177 Cannot insert breakpoints. 3178 The same program may be running in another process. 3179 3180 When this happens, you have three ways to proceed: 3181 3182 1. Remove or disable the breakpoints, then continue. 3183 3184 2. Suspend GDB, and copy the file containing your program to a new 3185 name. Resume GDB and use the `exec-file' command to specify that 3186 GDB should run your program under that name. Then start your 3187 program again. 3188 3189 3. Relink your program so that the text segment is nonsharable, using 3190 the linker option `-N'. The operating system limitation may not 3191 apply to nonsharable executables. 3192 3193 A similar message can be printed if you request too many active 3194 hardware-assisted breakpoints and watchpoints: 3195 3196 Stopped; cannot insert breakpoints. 3197 You may have requested too many hardware breakpoints and watchpoints. 3198 3199 This message is printed when you attempt to resume the program, since 3200 only then GDB knows exactly how many hardware breakpoints and 3201 watchpoints it needs to insert. 3202 3203 When this message is printed, you need to disable or remove some of 3204 the hardware-assisted breakpoints and watchpoints, and then continue. 3205 3206 3207 File: gdb.info, Node: Breakpoint related warnings, Prev: Error in Breakpoints, Up: Breakpoints 3208 3209 5.1.10 "Breakpoint address adjusted..." 3210 --------------------------------------- 3211 3212 Some processor architectures place constraints on the addresses at 3213 which breakpoints may be placed. For architectures thus constrained, 3214 GDB will attempt to adjust the breakpoint's address to comply with the 3215 constraints dictated by the architecture. 3216 3217 One example of such an architecture is the Fujitsu FR-V. The FR-V is 3218 a VLIW architecture in which a number of RISC-like instructions may be 3219 bundled together for parallel execution. The FR-V architecture 3220 constrains the location of a breakpoint instruction within such a 3221 bundle to the instruction with the lowest address. GDB honors this 3222 constraint by adjusting a breakpoint's address to the first in the 3223 bundle. 3224 3225 It is not uncommon for optimized code to have bundles which contain 3226 instructions from different source statements, thus it may happen that 3227 a breakpoint's address will be adjusted from one source statement to 3228 another. Since this adjustment may significantly alter GDB's 3229 breakpoint related behavior from what the user expects, a warning is 3230 printed when the breakpoint is first set and also when the breakpoint 3231 is hit. 3232 3233 A warning like the one below is printed when setting a breakpoint 3234 that's been subject to address adjustment: 3235 3236 warning: Breakpoint address adjusted from 0x00010414 to 0x00010410. 3237 3238 Such warnings are printed both for user settable and GDB's internal 3239 breakpoints. If you see one of these warnings, you should verify that 3240 a breakpoint set at the adjusted address will have the desired affect. 3241 If not, the breakpoint in question may be removed and other breakpoints 3242 may be set which will have the desired behavior. E.g., it may be 3243 sufficient to place the breakpoint at a later instruction. A 3244 conditional breakpoint may also be useful in some cases to prevent the 3245 breakpoint from triggering too often. 3246 3247 GDB will also issue a warning when stopping at one of these adjusted 3248 breakpoints: 3249 3250 warning: Breakpoint 1 address previously adjusted from 0x00010414 3251 to 0x00010410. 3252 3253 When this warning is encountered, it may be too late to take remedial 3254 action except in cases where the breakpoint is hit earlier or more 3255 frequently than expected. 3256 3257 3258 File: gdb.info, Node: Continuing and Stepping, Next: Signals, Prev: Breakpoints, Up: Stopping 3259 3260 5.2 Continuing and stepping 3261 =========================== 3262 3263 "Continuing" means resuming program execution until your program 3264 completes normally. In contrast, "stepping" means executing just one 3265 more "step" of your program, where "step" may mean either one line of 3266 source code, or one machine instruction (depending on what particular 3267 command you use). Either when continuing or when stepping, your 3268 program may stop even sooner, due to a breakpoint or a signal. (If it 3269 stops due to a signal, you may want to use `handle', or use `signal 0' 3270 to resume execution. *Note Signals: Signals.) 3271 3272 `continue [IGNORE-COUNT]' 3273 `c [IGNORE-COUNT]' 3274 `fg [IGNORE-COUNT]' 3275 Resume program execution, at the address where your program last 3276 stopped; any breakpoints set at that address are bypassed. The 3277 optional argument IGNORE-COUNT allows you to specify a further 3278 number of times to ignore a breakpoint at this location; its 3279 effect is like that of `ignore' (*note Break conditions: 3280 Conditions.). 3281 3282 The argument IGNORE-COUNT is meaningful only when your program 3283 stopped due to a breakpoint. At other times, the argument to 3284 `continue' is ignored. 3285 3286 The synonyms `c' and `fg' (for "foreground", as the debugged 3287 program is deemed to be the foreground program) are provided 3288 purely for convenience, and have exactly the same behavior as 3289 `continue'. 3290 3291 To resume execution at a different place, you can use `return' 3292 (*note Returning from a function: Returning.) to go back to the calling 3293 function; or `jump' (*note Continuing at a different address: Jumping.) 3294 to go to an arbitrary location in your program. 3295 3296 A typical technique for using stepping is to set a breakpoint (*note 3297 Breakpoints; watchpoints; and catchpoints: Breakpoints.) at the 3298 beginning of the function or the section of your program where a problem 3299 is believed to lie, run your program until it stops at that breakpoint, 3300 and then step through the suspect area, examining the variables that are 3301 interesting, until you see the problem happen. 3302 3303 `step' 3304 Continue running your program until control reaches a different 3305 source line, then stop it and return control to GDB. This command 3306 is abbreviated `s'. 3307 3308 _Warning:_ If you use the `step' command while control is 3309 within a function that was compiled without debugging 3310 information, execution proceeds until control reaches a 3311 function that does have debugging information. Likewise, it 3312 will not step into a function which is compiled without 3313 debugging information. To step through functions without 3314 debugging information, use the `stepi' command, described 3315 below. 3316 3317 The `step' command only stops at the first instruction of a source 3318 line. This prevents the multiple stops that could otherwise occur 3319 in `switch' statements, `for' loops, etc. `step' continues to 3320 stop if a function that has debugging information is called within 3321 the line. In other words, `step' _steps inside_ any functions 3322 called within the line. 3323 3324 Also, the `step' command only enters a function if there is line 3325 number information for the function. Otherwise it acts like the 3326 `next' command. This avoids problems when using `cc -gl' on MIPS 3327 machines. Previously, `step' entered subroutines if there was any 3328 debugging information about the routine. 3329 3330 `step COUNT' 3331 Continue running as in `step', but do so COUNT times. If a 3332 breakpoint is reached, or a signal not related to stepping occurs 3333 before COUNT steps, stepping stops right away. 3334 3335 `next [COUNT]' 3336 Continue to the next source line in the current (innermost) stack 3337 frame. This is similar to `step', but function calls that appear 3338 within the line of code are executed without stopping. Execution 3339 stops when control reaches a different line of code at the 3340 original stack level that was executing when you gave the `next' 3341 command. This command is abbreviated `n'. 3342 3343 An argument COUNT is a repeat count, as for `step'. 3344 3345 The `next' command only stops at the first instruction of a source 3346 line. This prevents multiple stops that could otherwise occur in 3347 `switch' statements, `for' loops, etc. 3348 3349 `set step-mode' 3350 `set step-mode on' 3351 The `set step-mode on' command causes the `step' command to stop 3352 at the first instruction of a function which contains no debug line 3353 information rather than stepping over it. 3354 3355 This is useful in cases where you may be interested in inspecting 3356 the machine instructions of a function which has no symbolic info 3357 and do not want GDB to automatically skip over this function. 3358 3359 `set step-mode off' 3360 Causes the `step' command to step over any functions which 3361 contains no debug information. This is the default. 3362 3363 `show step-mode' 3364 Show whether GDB will stop in or step over functions without 3365 source line debug information. 3366 3367 `finish' 3368 Continue running until just after function in the selected stack 3369 frame returns. Print the returned value (if any). 3370 3371 Contrast this with the `return' command (*note Returning from a 3372 function: Returning.). 3373 3374 `until' 3375 `u' 3376 Continue running until a source line past the current line, in the 3377 current stack frame, is reached. This command is used to avoid 3378 single stepping through a loop more than once. It is like the 3379 `next' command, except that when `until' encounters a jump, it 3380 automatically continues execution until the program counter is 3381 greater than the address of the jump. 3382 3383 This means that when you reach the end of a loop after single 3384 stepping though it, `until' makes your program continue execution 3385 until it exits the loop. In contrast, a `next' command at the end 3386 of a loop simply steps back to the beginning of the loop, which 3387 forces you to step through the next iteration. 3388 3389 `until' always stops your program if it attempts to exit the 3390 current stack frame. 3391 3392 `until' may produce somewhat counterintuitive results if the order 3393 of machine code does not match the order of the source lines. For 3394 example, in the following excerpt from a debugging session, the `f' 3395 (`frame') command shows that execution is stopped at line `206'; 3396 yet when we use `until', we get to line `195': 3397 3398 (gdb) f 3399 #0 main (argc=4, argv=0xf7fffae8) at m4.c:206 3400 206 expand_input(); 3401 (gdb) until 3402 195 for ( ; argc > 0; NEXTARG) { 3403 3404 This happened because, for execution efficiency, the compiler had 3405 generated code for the loop closure test at the end, rather than 3406 the start, of the loop--even though the test in a C `for'-loop is 3407 written before the body of the loop. The `until' command appeared 3408 to step back to the beginning of the loop when it advanced to this 3409 expression; however, it has not really gone to an earlier 3410 statement--not in terms of the actual machine code. 3411 3412 `until' with no argument works by means of single instruction 3413 stepping, and hence is slower than `until' with an argument. 3414 3415 `until LOCATION' 3416 `u LOCATION' 3417 Continue running your program until either the specified location 3418 is reached, or the current stack frame returns. LOCATION is any of 3419 the forms of argument acceptable to `break' (*note Setting 3420 breakpoints: Set Breaks.). This form of the command uses 3421 breakpoints, and hence is quicker than `until' without an 3422 argument. The specified location is actually reached only if it 3423 is in the current frame. This implies that `until' can be used to 3424 skip over recursive function invocations. For instance in the 3425 code below, if the current location is line `96', issuing `until 3426 99' will execute the program up to line `99' in the same 3427 invocation of factorial, i.e. after the inner invocations have 3428 returned. 3429 3430 94 int factorial (int value) 3431 95 { 3432 96 if (value > 1) { 3433 97 value *= factorial (value - 1); 3434 98 } 3435 99 return (value); 3436 100 } 3437 3438 `advance LOCATION' 3439 Continue running the program up to the given LOCATION. An 3440 argument is required, which should be of the same form as 3441 arguments for the `break' command. Execution will also stop upon 3442 exit from the current stack frame. This command is similar to 3443 `until', but `advance' will not skip over recursive function 3444 calls, and the target location doesn't have to be in the same 3445 frame as the current one. 3446 3447 `stepi' 3448 `stepi ARG' 3449 `si' 3450 Execute one machine instruction, then stop and return to the 3451 debugger. 3452 3453 It is often useful to do `display/i $pc' when stepping by machine 3454 instructions. This makes GDB automatically display the next 3455 instruction to be executed, each time your program stops. *Note 3456 Automatic display: Auto Display. 3457 3458 An argument is a repeat count, as in `step'. 3459 3460 `nexti' 3461 `nexti ARG' 3462 `ni' 3463 Execute one machine instruction, but if it is a function call, 3464 proceed until the function returns. 3465 3466 An argument is a repeat count, as in `next'. 3467 3468 3469 File: gdb.info, Node: Signals, Next: Thread Stops, Prev: Continuing and Stepping, Up: Stopping 3470 3471 5.3 Signals 3472 =========== 3473 3474 A signal is an asynchronous event that can happen in a program. The 3475 operating system defines the possible kinds of signals, and gives each 3476 kind a name and a number. For example, in Unix `SIGINT' is the signal 3477 a program gets when you type an interrupt character (often `Ctrl-c'); 3478 `SIGSEGV' is the signal a program gets from referencing a place in 3479 memory far away from all the areas in use; `SIGALRM' occurs when the 3480 alarm clock timer goes off (which happens only if your program has 3481 requested an alarm). 3482 3483 Some signals, including `SIGALRM', are a normal part of the 3484 functioning of your program. Others, such as `SIGSEGV', indicate 3485 errors; these signals are "fatal" (they kill your program immediately) 3486 if the program has not specified in advance some other way to handle 3487 the signal. `SIGINT' does not indicate an error in your program, but 3488 it is normally fatal so it can carry out the purpose of the interrupt: 3489 to kill the program. 3490 3491 GDB has the ability to detect any occurrence of a signal in your 3492 program. You can tell GDB in advance what to do for each kind of 3493 signal. 3494 3495 Normally, GDB is set up to let the non-erroneous signals like 3496 `SIGALRM' be silently passed to your program (so as not to interfere 3497 with their role in the program's functioning) but to stop your program 3498 immediately whenever an error signal happens. You can change these 3499 settings with the `handle' command. 3500 3501 `info signals' 3502 `info handle' 3503 Print a table of all the kinds of signals and how GDB has been 3504 told to handle each one. You can use this to see the signal 3505 numbers of all the defined types of signals. 3506 3507 `info signals SIG' 3508 Similar, but print information only about the specified signal 3509 number. 3510 3511 `info handle' is an alias for `info signals'. 3512 3513 `handle SIGNAL [KEYWORDS...]' 3514 Change the way GDB handles signal SIGNAL. SIGNAL can be the 3515 number of a signal or its name (with or without the `SIG' at the 3516 beginning); a list of signal numbers of the form `LOW-HIGH'; or 3517 the word `all', meaning all the known signals. Optional arguments 3518 KEYWORDS, described below, say what change to make. 3519 3520 The keywords allowed by the `handle' command can be abbreviated. 3521 Their full names are: 3522 3523 `nostop' 3524 GDB should not stop your program when this signal happens. It may 3525 still print a message telling you that the signal has come in. 3526 3527 `stop' 3528 GDB should stop your program when this signal happens. This 3529 implies the `print' keyword as well. 3530 3531 `print' 3532 GDB should print a message when this signal happens. 3533 3534 `noprint' 3535 GDB should not mention the occurrence of the signal at all. This 3536 implies the `nostop' keyword as well. 3537 3538 `pass' 3539 `noignore' 3540 GDB should allow your program to see this signal; your program can 3541 handle the signal, or else it may terminate if the signal is fatal 3542 and not handled. `pass' and `noignore' are synonyms. 3543 3544 `nopass' 3545 `ignore' 3546 GDB should not allow your program to see this signal. `nopass' 3547 and `ignore' are synonyms. 3548 3549 When a signal stops your program, the signal is not visible to the 3550 program until you continue. Your program sees the signal then, if 3551 `pass' is in effect for the signal in question _at that time_. In 3552 other words, after GDB reports a signal, you can use the `handle' 3553 command with `pass' or `nopass' to control whether your program sees 3554 that signal when you continue. 3555 3556 The default is set to `nostop', `noprint', `pass' for non-erroneous 3557 signals such as `SIGALRM', `SIGWINCH' and `SIGCHLD', and to `stop', 3558 `print', `pass' for the erroneous signals. 3559 3560 You can also use the `signal' command to prevent your program from 3561 seeing a signal, or cause it to see a signal it normally would not see, 3562 or to give it any signal at any time. For example, if your program 3563 stopped due to some sort of memory reference error, you might store 3564 correct values into the erroneous variables and continue, hoping to see 3565 more execution; but your program would probably terminate immediately as 3566 a result of the fatal signal once it saw the signal. To prevent this, 3567 you can continue with `signal 0'. *Note Giving your program a signal: 3568 Signaling. 3569 3570 3571 File: gdb.info, Node: Thread Stops, Prev: Signals, Up: Stopping 3572 3573 5.4 Stopping and starting multi-thread programs 3574 =============================================== 3575 3576 When your program has multiple threads (*note Debugging programs with 3577 multiple threads: Threads.), you can choose whether to set breakpoints 3578 on all threads, or on a particular thread. 3579 3580 `break LINESPEC thread THREADNO' 3581 `break LINESPEC thread THREADNO if ...' 3582 LINESPEC specifies source lines; there are several ways of writing 3583 them, but the effect is always to specify some source line. 3584 3585 Use the qualifier `thread THREADNO' with a breakpoint command to 3586 specify that you only want GDB to stop the program when a 3587 particular thread reaches this breakpoint. THREADNO is one of the 3588 numeric thread identifiers assigned by GDB, shown in the first 3589 column of the `info threads' display. 3590 3591 If you do not specify `thread THREADNO' when you set a breakpoint, 3592 the breakpoint applies to _all_ threads of your program. 3593 3594 You can use the `thread' qualifier on conditional breakpoints as 3595 well; in this case, place `thread THREADNO' before the breakpoint 3596 condition, like this: 3597 3598 (gdb) break frik.c:13 thread 28 if bartab > lim 3599 3600 3601 Whenever your program stops under GDB for any reason, _all_ threads 3602 of execution stop, not just the current thread. This allows you to 3603 examine the overall state of the program, including switching between 3604 threads, without worrying that things may change underfoot. 3605 3606 There is an unfortunate side effect. If one thread stops for a 3607 breakpoint, or for some other reason, and another thread is blocked in a 3608 system call, then the system call may return prematurely. This is a 3609 consequence of the interaction between multiple threads and the signals 3610 that GDB uses to implement breakpoints and other events that stop 3611 execution. 3612 3613 To handle this problem, your program should check the return value of 3614 each system call and react appropriately. This is good programming 3615 style anyways. 3616 3617 For example, do not write code like this: 3618 3619 sleep (10); 3620 3621 The call to `sleep' will return early if a different thread stops at 3622 a breakpoint or for some other reason. 3623 3624 Instead, write this: 3625 3626 int unslept = 10; 3627 while (unslept > 0) 3628 unslept = sleep (unslept); 3629 3630 A system call is allowed to return early, so the system is still 3631 conforming to its specification. But GDB does cause your 3632 multi-threaded program to behave differently than it would without GDB. 3633 3634 Also, GDB uses internal breakpoints in the thread library to monitor 3635 certain events such as thread creation and thread destruction. When 3636 such an event happens, a system call in another thread may return 3637 prematurely, even though your program does not appear to stop. 3638 3639 Conversely, whenever you restart the program, _all_ threads start 3640 executing. _This is true even when single-stepping_ with commands like 3641 `step' or `next'. 3642 3643 In particular, GDB cannot single-step all threads in lockstep. 3644 Since thread scheduling is up to your debugging target's operating 3645 system (not controlled by GDB), other threads may execute more than one 3646 statement while the current thread completes a single step. Moreover, 3647 in general other threads stop in the middle of a statement, rather than 3648 at a clean statement boundary, when the program stops. 3649 3650 You might even find your program stopped in another thread after 3651 continuing or even single-stepping. This happens whenever some other 3652 thread runs into a breakpoint, a signal, or an exception before the 3653 first thread completes whatever you requested. 3654 3655 On some OSes, you can lock the OS scheduler and thus allow only a 3656 single thread to run. 3657 3658 `set scheduler-locking MODE' 3659 Set the scheduler locking mode. If it is `off', then there is no 3660 locking and any thread may run at any time. If `on', then only the 3661 current thread may run when the inferior is resumed. The `step' 3662 mode optimizes for single-stepping. It stops other threads from 3663 "seizing the prompt" by preempting the current thread while you are 3664 stepping. Other threads will only rarely (or never) get a chance 3665 to run when you step. They are more likely to run when you `next' 3666 over a function call, and they are completely free to run when you 3667 use commands like `continue', `until', or `finish'. However, 3668 unless another thread hits a breakpoint during its timeslice, they 3669 will never steal the GDB prompt away from the thread that you are 3670 debugging. 3671 3672 `show scheduler-locking' 3673 Display the current scheduler locking mode. 3674 3675 3676 File: gdb.info, Node: Stack, Next: Source, Prev: Stopping, Up: Top 3677 3678 6 Examining the Stack 3679 ********************* 3680 3681 When your program has stopped, the first thing you need to know is 3682 where it stopped and how it got there. 3683 3684 Each time your program performs a function call, information about 3685 the call is generated. That information includes the location of the 3686 call in your program, the arguments of the call, and the local 3687 variables of the function being called. The information is saved in a 3688 block of data called a "stack frame". The stack frames are allocated 3689 in a region of memory called the "call stack". 3690 3691 When your program stops, the GDB commands for examining the stack 3692 allow you to see all of this information. 3693 3694 One of the stack frames is "selected" by GDB and many GDB commands 3695 refer implicitly to the selected frame. In particular, whenever you 3696 ask GDB for the value of a variable in your program, the value is found 3697 in the selected frame. There are special GDB commands to select 3698 whichever frame you are interested in. *Note Selecting a frame: 3699 Selection. 3700 3701 When your program stops, GDB automatically selects the currently 3702 executing frame and describes it briefly, similar to the `frame' 3703 command (*note Information about a frame: Frame Info.). 3704 3705 * Menu: 3706 3707 * Frames:: Stack frames 3708 * Backtrace:: Backtraces 3709 * Selection:: Selecting a frame 3710 * Frame Info:: Information on a frame 3711 3712 3713 File: gdb.info, Node: Frames, Next: Backtrace, Up: Stack 3714 3715 6.1 Stack frames 3716 ================ 3717 3718 The call stack is divided up into contiguous pieces called "stack 3719 frames", or "frames" for short; each frame is the data associated with 3720 one call to one function. The frame contains the arguments given to 3721 the function, the function's local variables, and the address at which 3722 the function is executing. 3723 3724 When your program is started, the stack has only one frame, that of 3725 the function `main'. This is called the "initial" frame or the 3726 "outermost" frame. Each time a function is called, a new frame is 3727 made. Each time a function returns, the frame for that function 3728 invocation is eliminated. If a function is recursive, there can be 3729 many frames for the same function. The frame for the function in which 3730 execution is actually occurring is called the "innermost" frame. This 3731 is the most recently created of all the stack frames that still exist. 3732 3733 Inside your program, stack frames are identified by their addresses. 3734 A stack frame consists of many bytes, each of which has its own 3735 address; each kind of computer has a convention for choosing one byte 3736 whose address serves as the address of the frame. Usually this address 3737 is kept in a register called the "frame pointer register" (*note $fp: 3738 Registers.) while execution is going on in that frame. 3739 3740 GDB assigns numbers to all existing stack frames, starting with zero 3741 for the innermost frame, one for the frame that called it, and so on 3742 upward. These numbers do not really exist in your program; they are 3743 assigned by GDB to give you a way of designating stack frames in GDB 3744 commands. 3745 3746 Some compilers provide a way to compile functions so that they 3747 operate without stack frames. (For example, the gcc option 3748 `-fomit-frame-pointer' 3749 generates functions without a frame.) This is occasionally done 3750 with heavily used library functions to save the frame setup time. GDB 3751 has limited facilities for dealing with these function invocations. If 3752 the innermost function invocation has no stack frame, GDB nevertheless 3753 regards it as though it had a separate frame, which is numbered zero as 3754 usual, allowing correct tracing of the function call chain. However, 3755 GDB has no provision for frameless functions elsewhere in the stack. 3756 3757 `frame ARGS' 3758 The `frame' command allows you to move from one stack frame to 3759 another, and to print the stack frame you select. ARGS may be 3760 either the address of the frame or the stack frame number. 3761 Without an argument, `frame' prints the current stack frame. 3762 3763 `select-frame' 3764 The `select-frame' command allows you to move from one stack frame 3765 to another without printing the frame. This is the silent version 3766 of `frame'. 3767 3768 3769 File: gdb.info, Node: Backtrace, Next: Selection, Prev: Frames, Up: Stack 3770 3771 6.2 Backtraces 3772 ============== 3773 3774 A backtrace is a summary of how your program got where it is. It shows 3775 one line per frame, for many frames, starting with the currently 3776 executing frame (frame zero), followed by its caller (frame one), and 3777 on up the stack. 3778 3779 `backtrace' 3780 `bt' 3781 Print a backtrace of the entire stack: one line per frame for all 3782 frames in the stack. 3783 3784 You can stop the backtrace at any time by typing the system 3785 interrupt character, normally `Ctrl-c'. 3786 3787 `backtrace N' 3788 `bt N' 3789 Similar, but print only the innermost N frames. 3790 3791 `backtrace -N' 3792 `bt -N' 3793 Similar, but print only the outermost N frames. 3794 3795 `backtrace full' 3796 `bt full' 3797 `bt full N' 3798 `bt full -N' 3799 Print the values of the local variables also. N specifies the 3800 number of frames to print, as described above. 3801 3802 The names `where' and `info stack' (abbreviated `info s') are 3803 additional aliases for `backtrace'. 3804 3805 In a multi-threaded program, GDB by default shows the backtrace only 3806 for the current thread. To display the backtrace for several or all of 3807 the threads, use the command `thread apply' (*note thread apply: 3808 Threads.). For example, if you type `thread apply all backtrace', GDB 3809 will display the backtrace for all the threads; this is handy when you 3810 debug a core dump of a multi-threaded program. 3811 3812 Each line in the backtrace shows the frame number and the function 3813 name. The program counter value is also shown--unless you use `set 3814 print address off'. The backtrace also shows the source file name and 3815 line number, as well as the arguments to the function. The program 3816 counter value is omitted if it is at the beginning of the code for that 3817 line number. 3818 3819 Here is an example of a backtrace. It was made with the command `bt 3820 3', so it shows the innermost three frames. 3821 3822 #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) 3823 at builtin.c:993 3824 #1 0x6e38 in expand_macro (sym=0x2b600) at macro.c:242 3825 #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08) 3826 at macro.c:71 3827 (More stack frames follow...) 3828 3829 The display for frame zero does not begin with a program counter value, 3830 indicating that your program has stopped at the beginning of the code 3831 for line `993' of `builtin.c'. 3832 3833 If your program was compiled with optimizations, some compilers will 3834 optimize away arguments passed to functions if those arguments are 3835 never used after the call. Such optimizations generate code that 3836 passes arguments through registers, but doesn't store those arguments 3837 in the stack frame. GDB has no way of displaying such arguments in 3838 stack frames other than the innermost one. Here's what such a 3839 backtrace might look like: 3840 3841 #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) 3842 at builtin.c:993 3843 #1 0x6e38 in expand_macro (sym=<value optimized out>) at macro.c:242 3844 #2 0x6840 in expand_token (obs=0x0, t=<value optimized out>, td=0xf7fffb08) 3845 at macro.c:71 3846 (More stack frames follow...) 3847 3848 The values of arguments that were not saved in their stack frames are 3849 shown as `<value optimized out>'. 3850 3851 If you need to display the values of such optimized-out arguments, 3852 either deduce that from other variables whose values depend on the one 3853 you are interested in, or recompile without optimizations. 3854 3855 Most programs have a standard user entry point--a place where system 3856 libraries and startup code transition into user code. For C this is 3857 `main'(1). When GDB finds the entry function in a backtrace it will 3858 terminate the backtrace, to avoid tracing into highly system-specific 3859 (and generally uninteresting) code. 3860 3861 If you need to examine the startup code, or limit the number of 3862 levels in a backtrace, you can change this behavior: 3863 3864 `set backtrace past-main' 3865 `set backtrace past-main on' 3866 Backtraces will continue past the user entry point. 3867 3868 `set backtrace past-main off' 3869 Backtraces will stop when they encounter the user entry point. 3870 This is the default. 3871 3872 `show backtrace past-main' 3873 Display the current user entry point backtrace policy. 3874 3875 `set backtrace past-entry' 3876 `set backtrace past-entry on' 3877 Backtraces will continue past the internal entry point of an 3878 application. This entry point is encoded by the linker when the 3879 application is built, and is likely before the user entry point 3880 `main' (or equivalent) is called. 3881 3882 `set backtrace past-entry off' 3883 Backtraces will stop when they encouter the internal entry point 3884 of an application. This is the default. 3885 3886 `show backtrace past-entry' 3887 Display the current internal entry point backtrace policy. 3888 3889 `set backtrace limit N' 3890 `set backtrace limit 0' 3891 Limit the backtrace to N levels. A value of zero means unlimited. 3892 3893 `show backtrace limit' 3894 Display the current limit on backtrace levels. 3895 3896 ---------- Footnotes ---------- 3897 3898 (1) Note that embedded programs (the so-called "free-standing" 3899 environment) are not required to have a `main' function as the entry 3900 point. They could even have multiple entry points. 3901 3902 3903 File: gdb.info, Node: Selection, Next: Frame Info, Prev: Backtrace, Up: Stack 3904 3905 6.3 Selecting a frame 3906 ===================== 3907 3908 Most commands for examining the stack and other data in your program 3909 work on whichever stack frame is selected at the moment. Here are the 3910 commands for selecting a stack frame; all of them finish by printing a 3911 brief description of the stack frame just selected. 3912 3913 `frame N' 3914 `f N' 3915 Select frame number N. Recall that frame zero is the innermost 3916 (currently executing) frame, frame one is the frame that called the 3917 innermost one, and so on. The highest-numbered frame is the one 3918 for `main'. 3919 3920 `frame ADDR' 3921 `f ADDR' 3922 Select the frame at address ADDR. This is useful mainly if the 3923 chaining of stack frames has been damaged by a bug, making it 3924 impossible for GDB to assign numbers properly to all frames. In 3925 addition, this can be useful when your program has multiple stacks 3926 and switches between them. 3927 3928 On the SPARC architecture, `frame' needs two addresses to select 3929 an arbitrary frame: a frame pointer and a stack pointer. 3930 3931 On the MIPS and Alpha architecture, it needs two addresses: a stack 3932 pointer and a program counter. 3933 3934 On the 29k architecture, it needs three addresses: a register stack 3935 pointer, a program counter, and a memory stack pointer. 3936 3937 `up N' 3938 Move N frames up the stack. For positive numbers N, this advances 3939 toward the outermost frame, to higher frame numbers, to frames 3940 that have existed longer. N defaults to one. 3941 3942 `down N' 3943 Move N frames down the stack. For positive numbers N, this 3944 advances toward the innermost frame, to lower frame numbers, to 3945 frames that were created more recently. N defaults to one. You 3946 may abbreviate `down' as `do'. 3947 3948 All of these commands end by printing two lines of output describing 3949 the frame. The first line shows the frame number, the function name, 3950 the arguments, and the source file and line number of execution in that 3951 frame. The second line shows the text of that source line. 3952 3953 For example: 3954 3955 (gdb) up 3956 #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc) 3957 at env.c:10 3958 10 read_input_file (argv[i]); 3959 3960 After such a printout, the `list' command with no arguments prints 3961 ten lines centered on the point of execution in the frame. You can 3962 also edit the program at the point of execution with your favorite 3963 editing program by typing `edit'. *Note Printing source lines: List, 3964 for details. 3965 3966 `up-silently N' 3967 `down-silently N' 3968 These two commands are variants of `up' and `down', respectively; 3969 they differ in that they do their work silently, without causing 3970 display of the new frame. They are intended primarily for use in 3971 GDB command scripts, where the output might be unnecessary and 3972 distracting. 3973 3974 3975 File: gdb.info, Node: Frame Info, Prev: Selection, Up: Stack 3976 3977 6.4 Information about a frame 3978 ============================= 3979 3980 There are several other commands to print information about the selected 3981 stack frame. 3982 3983 `frame' 3984 `f' 3985 When used without any argument, this command does not change which 3986 frame is selected, but prints a brief description of the currently 3987 selected stack frame. It can be abbreviated `f'. With an 3988 argument, this command is used to select a stack frame. *Note 3989 Selecting a frame: Selection. 3990 3991 `info frame' 3992 `info f' 3993 This command prints a verbose description of the selected stack 3994 frame, including: 3995 3996 * the address of the frame 3997 3998 * the address of the next frame down (called by this frame) 3999 4000 * the address of the next frame up (caller of this frame) 4001 4002 * the language in which the source code corresponding to this 4003 frame is written 4004 4005 * the address of the frame's arguments 4006 4007 * the address of the frame's local variables 4008 4009 * the program counter saved in it (the address of execution in 4010 the caller frame) 4011 4012 * which registers were saved in the frame 4013 4014 The verbose description is useful when something has gone wrong 4015 that has made the stack format fail to fit the usual conventions. 4016 4017 `info frame ADDR' 4018 `info f ADDR' 4019 Print a verbose description of the frame at address ADDR, without 4020 selecting that frame. The selected frame remains unchanged by this 4021 command. This requires the same kind of address (more than one 4022 for some architectures) that you specify in the `frame' command. 4023 *Note Selecting a frame: Selection. 4024 4025 `info args' 4026 Print the arguments of the selected frame, each on a separate line. 4027 4028 `info locals' 4029 Print the local variables of the selected frame, each on a separate 4030 line. These are all variables (declared either static or 4031 automatic) accessible at the point of execution of the selected 4032 frame. 4033 4034 `info catch' 4035 Print a list of all the exception handlers that are active in the 4036 current stack frame at the current point of execution. To see 4037 other exception handlers, visit the associated frame (using the 4038 `up', `down', or `frame' commands); then type `info catch'. *Note 4039 Setting catchpoints: Set Catchpoints. 4040 4041 4042 4043 File: gdb.info, Node: Source, Next: Data, Prev: Stack, Up: Top 4044 4045 7 Examining Source Files 4046 ************************ 4047 4048 GDB can print parts of your program's source, since the debugging 4049 information recorded in the program tells GDB what source files were 4050 used to build it. When your program stops, GDB spontaneously prints 4051 the line where it stopped. Likewise, when you select a stack frame 4052 (*note Selecting a frame: Selection.), GDB prints the line where 4053 execution in that frame has stopped. You can print other portions of 4054 source files by explicit command. 4055 4056 If you use GDB through its GNU Emacs interface, you may prefer to 4057 use Emacs facilities to view source; see *Note Using GDB under GNU 4058 Emacs: Emacs. 4059 4060 * Menu: 4061 4062 * List:: Printing source lines 4063 * Edit:: Editing source files 4064 * Search:: Searching source files 4065 * Source Path:: Specifying source directories 4066 * Machine Code:: Source and machine code 4067 4068 4069 File: gdb.info, Node: List, Next: Edit, Up: Source 4070 4071 7.1 Printing source lines 4072 ========================= 4073 4074 To print lines from a source file, use the `list' command (abbreviated 4075 `l'). By default, ten lines are printed. There are several ways to 4076 specify what part of the file you want to print. 4077 4078 Here are the forms of the `list' command most commonly used: 4079 4080 `list LINENUM' 4081 Print lines centered around line number LINENUM in the current 4082 source file. 4083 4084 `list FUNCTION' 4085 Print lines centered around the beginning of function FUNCTION. 4086 4087 `list' 4088 Print more lines. If the last lines printed were printed with a 4089 `list' command, this prints lines following the last lines 4090 printed; however, if the last line printed was a solitary line 4091 printed as part of displaying a stack frame (*note Examining the 4092 Stack: Stack.), this prints lines centered around that line. 4093 4094 `list -' 4095 Print lines just before the lines last printed. 4096 4097 By default, GDB prints ten source lines with any of these forms of 4098 the `list' command. You can change this using `set listsize': 4099 4100 `set listsize COUNT' 4101 Make the `list' command display COUNT source lines (unless the 4102 `list' argument explicitly specifies some other number). 4103 4104 `show listsize' 4105 Display the number of lines that `list' prints. 4106 4107 Repeating a `list' command with <RET> discards the argument, so it 4108 is equivalent to typing just `list'. This is more useful than listing 4109 the same lines again. An exception is made for an argument of `-'; 4110 that argument is preserved in repetition so that each repetition moves 4111 up in the source file. 4112 4113 In general, the `list' command expects you to supply zero, one or two 4114 "linespecs". Linespecs specify source lines; there are several ways of 4115 writing them, but the effect is always to specify some source line. 4116 Here is a complete description of the possible arguments for `list': 4117 4118 `list LINESPEC' 4119 Print lines centered around the line specified by LINESPEC. 4120 4121 `list FIRST,LAST' 4122 Print lines from FIRST to LAST. Both arguments are linespecs. 4123 4124 `list ,LAST' 4125 Print lines ending with LAST. 4126 4127 `list FIRST,' 4128 Print lines starting with FIRST. 4129 4130 `list +' 4131 Print lines just after the lines last printed. 4132 4133 `list -' 4134 Print lines just before the lines last printed. 4135 4136 `list' 4137 As described in the preceding table. 4138 4139 Here are the ways of specifying a single source line--all the kinds 4140 of linespec. 4141 4142 `NUMBER' 4143 Specifies line NUMBER of the current source file. When a `list' 4144 command has two linespecs, this refers to the same source file as 4145 the first linespec. 4146 4147 `+OFFSET' 4148 Specifies the line OFFSET lines after the last line printed. When 4149 used as the second linespec in a `list' command that has two, this 4150 specifies the line OFFSET lines down from the first linespec. 4151 4152 `-OFFSET' 4153 Specifies the line OFFSET lines before the last line printed. 4154 4155 `FILENAME:NUMBER' 4156 Specifies line NUMBER in the source file FILENAME. 4157 4158 `FUNCTION' 4159 Specifies the line that begins the body of the function FUNCTION. 4160 For example: in C, this is the line with the open brace. 4161 4162 `FILENAME:FUNCTION' 4163 Specifies the line of the open-brace that begins the body of the 4164 function FUNCTION in the file FILENAME. You only need the file 4165 name with a function name to avoid ambiguity when there are 4166 identically named functions in different source files. 4167 4168 `*ADDRESS' 4169 Specifies the line containing the program address ADDRESS. 4170 ADDRESS may be any expression. 4171 4172 4173 File: gdb.info, Node: Edit, Next: Search, Prev: List, Up: Source 4174 4175 7.2 Editing source files 4176 ======================== 4177 4178 To edit the lines in a source file, use the `edit' command. The 4179 editing program of your choice is invoked with the current line set to 4180 the active line in the program. Alternatively, there are several ways 4181 to specify what part of the file you want to print if you want to see 4182 other parts of the program. 4183 4184 Here are the forms of the `edit' command most commonly used: 4185 4186 `edit' 4187 Edit the current source file at the active line number in the 4188 program. 4189 4190 `edit NUMBER' 4191 Edit the current source file with NUMBER as the active line number. 4192 4193 `edit FUNCTION' 4194 Edit the file containing FUNCTION at the beginning of its 4195 definition. 4196 4197 `edit FILENAME:NUMBER' 4198 Specifies line NUMBER in the source file FILENAME. 4199 4200 `edit FILENAME:FUNCTION' 4201 Specifies the line that begins the body of the function FUNCTION 4202 in the file FILENAME. You only need the file name with a function 4203 name to avoid ambiguity when there are identically named functions 4204 in different source files. 4205 4206 `edit *ADDRESS' 4207 Specifies the line containing the program address ADDRESS. 4208 ADDRESS may be any expression. 4209 4210 7.2.1 Choosing your editor 4211 -------------------------- 4212 4213 You can customize GDB to use any editor you want (1). By default, it 4214 is `/bin/ex', but you can change this by setting the environment 4215 variable `EDITOR' before using GDB. For example, to configure GDB to 4216 use the `vi' editor, you could use these commands with the `sh' shell: 4217 EDITOR=/usr/bin/vi 4218 export EDITOR 4219 gdb ... 4220 or in the `csh' shell, 4221 setenv EDITOR /usr/bin/vi 4222 gdb ... 4223 4224 ---------- Footnotes ---------- 4225 4226 (1) The only restriction is that your editor (say `ex'), recognizes 4227 the following command-line syntax: 4228 ex +NUMBER file 4229 The optional numeric value +NUMBER specifies the number of the line 4230 in the file where to start editing. 4231 4232 4233 File: gdb.info, Node: Search, Next: Source Path, Prev: Edit, Up: Source 4234 4235 7.3 Searching source files 4236 ========================== 4237 4238 There are two commands for searching through the current source file 4239 for a regular expression. 4240 4241 `forward-search REGEXP' 4242 `search REGEXP' 4243 The command `forward-search REGEXP' checks each line, starting 4244 with the one following the last line listed, for a match for 4245 REGEXP. It lists the line that is found. You can use the synonym 4246 `search REGEXP' or abbreviate the command name as `fo'. 4247 4248 `reverse-search REGEXP' 4249 The command `reverse-search REGEXP' checks each line, starting 4250 with the one before the last line listed and going backward, for a 4251 match for REGEXP. It lists the line that is found. You can 4252 abbreviate this command as `rev'. 4253 4254 4255 File: gdb.info, Node: Source Path, Next: Machine Code, Prev: Search, Up: Source 4256 4257 7.4 Specifying source directories 4258 ================================= 4259 4260 Executable programs sometimes do not record the directories of the 4261 source files from which they were compiled, just the names. Even when 4262 they do, the directories could be moved between the compilation and 4263 your debugging session. GDB has a list of directories to search for 4264 source files; this is called the "source path". Each time GDB wants a 4265 source file, it tries all the directories in the list, in the order 4266 they are present in the list, until it finds a file with the desired 4267 name. 4268 4269 For example, suppose an executable references the file 4270 `/usr/src/foo-1.0/lib/foo.c', and our source path is `/mnt/cross'. The 4271 file is first looked up literally; if this fails, 4272 `/mnt/cross/usr/src/foo-1.0/lib/foo.c' is tried; if this fails, 4273 `/mnt/cross/foo.c' is opened; if this fails, an error message is 4274 printed. GDB does not look up the parts of the source file name, such 4275 as `/mnt/cross/src/foo-1.0/lib/foo.c'. Likewise, the subdirectories of 4276 the source path are not searched: if the source path is `/mnt/cross', 4277 and the binary refers to `foo.c', GDB would not find it under 4278 `/mnt/cross/usr/src/foo-1.0/lib'. 4279 4280 Plain file names, relative file names with leading directories, file 4281 names containing dots, etc. are all treated as described above; for 4282 instance, if the source path is `/mnt/cross', and the source file is 4283 recorded as `../lib/foo.c', GDB would first try `../lib/foo.c', then 4284 `/mnt/cross/../lib/foo.c', and after that--`/mnt/cross/foo.c'. 4285 4286 Note that the executable search path is _not_ used to locate the 4287 source files. 4288 4289 Whenever you reset or rearrange the source path, GDB clears out any 4290 information it has cached about where source files are found and where 4291 each line is in the file. 4292 4293 When you start GDB, its source path includes only `cdir' and `cwd', 4294 in that order. To add other directories, use the `directory' command. 4295 4296 The search path is used to find both program source files and GDB 4297 script files (read using the `-command' option and `source' command). 4298 4299 In addition to the source path, GDB provides a set of commands that 4300 manage a list of source path substitution rules. A "substitution rule" 4301 specifies how to rewrite source directories stored in the program's 4302 debug information in case the sources were moved to a different 4303 directory between compilation and debugging. A rule is made of two 4304 strings, the first specifying what needs to be rewritten in the path, 4305 and the second specifying how it should be rewritten. In *Note set 4306 substitute-path::, we name these two parts FROM and TO respectively. 4307 GDB does a simple string replacement of FROM with TO at the start of 4308 the directory part of the source file name, and uses that result 4309 instead of the original file name to look up the sources. 4310 4311 Using the previous example, suppose the `foo-1.0' tree has been 4312 moved from `/usr/src' to `/mnt/cross', then you can tell GDB to replace 4313 `/usr/src' in all source path names with `/mnt/cross'. The first 4314 lookup will then be `/mnt/cross/foo-1.0/lib/foo.c' in place of the 4315 original location of `/usr/src/foo-1.0/lib/foo.c'. To define a source 4316 path substitution rule, use the `set substitute-path' command (*note 4317 set substitute-path::). 4318 4319 To avoid unexpected substitution results, a rule is applied only if 4320 the FROM part of the directory name ends at a directory separator. For 4321 instance, a rule substituting `/usr/source' into `/mnt/cross' will be 4322 applied to `/usr/source/foo-1.0' but not to `/usr/sourceware/foo-2.0'. 4323 And because the substitution is applied only at the begining of the 4324 directory name, this rule will not be applied to 4325 `/root/usr/source/baz.c' either. 4326 4327 In many cases, you can achieve the same result using the `directory' 4328 command. However, `set substitute-path' can be more efficient in the 4329 case where the sources are organized in a complex tree with multiple 4330 subdirectories. With the `directory' command, you need to add each 4331 subdirectory of your project. If you moved the entire tree while 4332 preserving its internal organization, then `set substitute-path' allows 4333 you to direct the debugger to all the sources with one single command. 4334 4335 `set substitute-path' is also more than just a shortcut command. 4336 The source path is only used if the file at the original location no 4337 longer exists. On the other hand, `set substitute-path' modifies the 4338 debugger behavior to look at the rewritten location instead. So, if 4339 for any reason a source file that is not relevant to your executable is 4340 located at the original location, a substitution rule is the only 4341 method available to point GDB at the new location. 4342 4343 `directory DIRNAME ...' 4344 4345 `dir DIRNAME ...' 4346 Add directory DIRNAME to the front of the source path. Several 4347 directory names may be given to this command, separated by `:' 4348 (`;' on MS-DOS and MS-Windows, where `:' usually appears as part 4349 of absolute file names) or whitespace. You may specify a 4350 directory that is already in the source path; this moves it 4351 forward, so GDB searches it sooner. 4352 4353 You can use the string `$cdir' to refer to the compilation 4354 directory (if one is recorded), and `$cwd' to refer to the current 4355 working directory. `$cwd' is not the same as `.'--the former 4356 tracks the current working directory as it changes during your GDB 4357 session, while the latter is immediately expanded to the current 4358 directory at the time you add an entry to the source path. 4359 4360 `directory' 4361 Reset the source path to its default value (`$cdir:$cwd' on Unix 4362 systems). This requires confirmation. 4363 4364 `show directories' 4365 Print the source path: show which directories it contains. 4366 4367 `set substitute-path FROM TO' 4368 Define a source path substitution rule, and add it at the end of 4369 the current list of existing substitution rules. If a rule with 4370 the same FROM was already defined, then the old rule is also 4371 deleted. 4372 4373 For example, if the file `/foo/bar/baz.c' was moved to 4374 `/mnt/cross/baz.c', then the command 4375 4376 (gdb) set substitute-path /usr/src /mnt/cross 4377 4378 will tell GDB to replace `/usr/src' with `/mnt/cross', which will 4379 allow GDB to find the file `baz.c' even though it was moved. 4380 4381 In the case when more than one substitution rule have been defined, 4382 the rules are evaluated one by one in the order where they have 4383 been defined. The first one matching, if any, is selected to 4384 perform the substitution. 4385 4386 For instance, if we had entered the following commands: 4387 4388 (gdb) set substitute-path /usr/src/include /mnt/include 4389 (gdb) set substitute-path /usr/src /mnt/src 4390 4391 GDB would then rewrite `/usr/src/include/defs.h' into 4392 `/mnt/include/defs.h' by using the first rule. However, it would 4393 use the second rule to rewrite `/usr/src/lib/foo.c' into 4394 `/mnt/src/lib/foo.c'. 4395 4396 `unset substitute-path [path]' 4397 If a path is specified, search the current list of substitution 4398 rules for a rule that would rewrite that path. Delete that rule 4399 if found. A warning is emitted by the debugger if no rule could 4400 be found. 4401 4402 If no path is specified, then all substitution rules are deleted. 4403 4404 `show substitute-path [path]' 4405 If a path is specified, then print the source path substitution 4406 rule which would rewrite that path, if any. 4407 4408 If no path is specified, then print all existing source path 4409 substitution rules. 4410 4411 4412 If your source path is cluttered with directories that are no longer 4413 of interest, GDB may sometimes cause confusion by finding the wrong 4414 versions of source. You can correct the situation as follows: 4415 4416 1. Use `directory' with no argument to reset the source path to its 4417 default value. 4418 4419 2. Use `directory' with suitable arguments to reinstall the 4420 directories you want in the source path. You can add all the 4421 directories in one command. 4422 4423 4424 File: gdb.info, Node: Machine Code, Prev: Source Path, Up: Source 4425 4426 7.5 Source and machine code 4427 =========================== 4428 4429 You can use the command `info line' to map source lines to program 4430 addresses (and vice versa), and the command `disassemble' to display a 4431 range of addresses as machine instructions. When run under GNU Emacs 4432 mode, the `info line' command causes the arrow to point to the line 4433 specified. Also, `info line' prints addresses in symbolic form as well 4434 as hex. 4435 4436 `info line LINESPEC' 4437 Print the starting and ending addresses of the compiled code for 4438 source line LINESPEC. You can specify source lines in any of the 4439 ways understood by the `list' command (*note Printing source 4440 lines: List.). 4441 4442 For example, we can use `info line' to discover the location of the 4443 object code for the first line of function `m4_changequote': 4444 4445 (gdb) info line m4_changequote 4446 Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350. 4447 4448 We can also inquire (using `*ADDR' as the form for LINESPEC) what 4449 source line covers a particular address: 4450 (gdb) info line *0x63ff 4451 Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404. 4452 4453 After `info line', the default address for the `x' command is 4454 changed to the starting address of the line, so that `x/i' is 4455 sufficient to begin examining the machine code (*note Examining memory: 4456 Memory.). Also, this address is saved as the value of the convenience 4457 variable `$_' (*note Convenience variables: Convenience Vars.). 4458 4459 `disassemble' 4460 This specialized command dumps a range of memory as machine 4461 instructions. The default memory range is the function 4462 surrounding the program counter of the selected frame. A single 4463 argument to this command is a program counter value; GDB dumps the 4464 function surrounding this value. Two arguments specify a range of 4465 addresses (first inclusive, second exclusive) to dump. 4466 4467 The following example shows the disassembly of a range of addresses 4468 of HP PA-RISC 2.0 code: 4469 4470 (gdb) disas 0x32c4 0x32e4 4471 Dump of assembler code from 0x32c4 to 0x32e4: 4472 0x32c4 <main+204>: addil 0,dp 4473 0x32c8 <main+208>: ldw 0x22c(sr0,r1),r26 4474 0x32cc <main+212>: ldil 0x3000,r31 4475 0x32d0 <main+216>: ble 0x3f8(sr4,r31) 4476 0x32d4 <main+220>: ldo 0(r31),rp 4477 0x32d8 <main+224>: addil -0x800,dp 4478 0x32dc <main+228>: ldo 0x588(r1),r26 4479 0x32e0 <main+232>: ldil 0x3000,r31 4480 End of assembler dump. 4481 4482 Some architectures have more than one commonly-used set of 4483 instruction mnemonics or other syntax. 4484 4485 For programs that were dynamically linked and use shared libraries, 4486 instructions that call functions or branch to locations in the shared 4487 libraries might show a seemingly bogus location--it's actually a 4488 location of the relocation table. On some architectures, GDB might be 4489 able to resolve these to actual function names. 4490 4491 `set disassembly-flavor INSTRUCTION-SET' 4492 Select the instruction set to use when disassembling the program 4493 via the `disassemble' or `x/i' commands. 4494 4495 Currently this command is only defined for the Intel x86 family. 4496 You can set INSTRUCTION-SET to either `intel' or `att'. The 4497 default is `att', the AT&T flavor used by default by Unix 4498 assemblers for x86-based targets. 4499 4500 `show disassembly-flavor' 4501 Show the current setting of the disassembly flavor. 4502 4503 4504 File: gdb.info, Node: Data, Next: Macros, Prev: Source, Up: Top 4505 4506 8 Examining Data 4507 **************** 4508 4509 The usual way to examine data in your program is with the `print' 4510 command (abbreviated `p'), or its synonym `inspect'. It evaluates and 4511 prints the value of an expression of the language your program is 4512 written in (*note Using GDB with Different Languages: Languages.). 4513 4514 `print EXPR' 4515 `print /F EXPR' 4516 EXPR is an expression (in the source language). By default the 4517 value of EXPR is printed in a format appropriate to its data type; 4518 you can choose a different format by specifying `/F', where F is a 4519 letter specifying the format; see *Note Output formats: Output 4520 Formats. 4521 4522 `print' 4523 `print /F' 4524 If you omit EXPR, GDB displays the last value again (from the 4525 "value history"; *note Value history: Value History.). This 4526 allows you to conveniently inspect the same value in an 4527 alternative format. 4528 4529 A more low-level way of examining data is with the `x' command. It 4530 examines data in memory at a specified address and prints it in a 4531 specified format. *Note Examining memory: Memory. 4532 4533 If you are interested in information about types, or about how the 4534 fields of a struct or a class are declared, use the `ptype EXP' command 4535 rather than `print'. *Note Examining the Symbol Table: Symbols. 4536 4537 * Menu: 4538 4539 * Expressions:: Expressions 4540 * Variables:: Program variables 4541 * Arrays:: Artificial arrays 4542 * Output Formats:: Output formats 4543 * Memory:: Examining memory 4544 * Auto Display:: Automatic display 4545 * Print Settings:: Print settings 4546 * Value History:: Value history 4547 * Convenience Vars:: Convenience variables 4548 * Registers:: Registers 4549 * Floating Point Hardware:: Floating point hardware 4550 * Vector Unit:: Vector Unit 4551 * OS Information:: Auxiliary data provided by operating system 4552 * Memory Region Attributes:: Memory region attributes 4553 * Dump/Restore Files:: Copy between memory and a file 4554 * Core File Generation:: Cause a program dump its core 4555 * Character Sets:: Debugging programs that use a different 4556 character set than GDB does 4557 * Caching Remote Data:: Data caching for remote targets 4558 4559 4560 File: gdb.info, Node: Expressions, Next: Variables, Up: Data 4561 4562 8.1 Expressions 4563 =============== 4564 4565 `print' and many other GDB commands accept an expression and compute 4566 its value. Any kind of constant, variable or operator defined by the 4567 programming language you are using is valid in an expression in GDB. 4568 This includes conditional expressions, function calls, casts, and 4569 string constants. It also includes preprocessor macros, if you 4570 compiled your program to include this information; see *Note 4571 Compilation::. 4572 4573 GDB supports array constants in expressions input by the user. The 4574 syntax is {ELEMENT, ELEMENT...}. For example, you can use the command 4575 `print {1, 2, 3}' to build up an array in memory that is `malloc'ed in 4576 the target program. 4577 4578 Because C is so widespread, most of the expressions shown in 4579 examples in this manual are in C. *Note Using GDB with Different 4580 Languages: Languages, for information on how to use expressions in other 4581 languages. 4582 4583 In this section, we discuss operators that you can use in GDB 4584 expressions regardless of your programming language. 4585 4586 Casts are supported in all languages, not just in C, because it is so 4587 useful to cast a number into a pointer in order to examine a structure 4588 at that address in memory. 4589 4590 GDB supports these operators, in addition to those common to 4591 programming languages: 4592 4593 `@' 4594 `@' is a binary operator for treating parts of memory as arrays. 4595 *Note Artificial arrays: Arrays, for more information. 4596 4597 `::' 4598 `::' allows you to specify a variable in terms of the file or 4599 function where it is defined. *Note Program variables: Variables. 4600 4601 `{TYPE} ADDR' 4602 Refers to an object of type TYPE stored at address ADDR in memory. 4603 ADDR may be any expression whose value is an integer or pointer 4604 (but parentheses are required around binary operators, just as in 4605 a cast). This construct is allowed regardless of what kind of 4606 data is normally supposed to reside at ADDR. 4607 4608 4609 File: gdb.info, Node: Variables, Next: Arrays, Prev: Expressions, Up: Data 4610 4611 8.2 Program variables 4612 ===================== 4613 4614 The most common kind of expression to use is the name of a variable in 4615 your program. 4616 4617 Variables in expressions are understood in the selected stack frame 4618 (*note Selecting a frame: Selection.); they must be either: 4619 4620 * global (or file-static) 4621 4622 or 4623 4624 * visible according to the scope rules of the programming language 4625 from the point of execution in that frame 4626 4627 This means that in the function 4628 4629 foo (a) 4630 int a; 4631 { 4632 bar (a); 4633 { 4634 int b = test (); 4635 bar (b); 4636 } 4637 } 4638 4639 you can examine and use the variable `a' whenever your program is 4640 executing within the function `foo', but you can only use or examine 4641 the variable `b' while your program is executing inside the block where 4642 `b' is declared. 4643 4644 There is an exception: you can refer to a variable or function whose 4645 scope is a single source file even if the current execution point is not 4646 in this file. But it is possible to have more than one such variable or 4647 function with the same name (in different source files). If that 4648 happens, referring to that name has unpredictable effects. If you wish, 4649 you can specify a static variable in a particular function or file, 4650 using the colon-colon (`::') notation: 4651 4652 FILE::VARIABLE 4653 FUNCTION::VARIABLE 4654 4655 Here FILE or FUNCTION is the name of the context for the static 4656 VARIABLE. In the case of file names, you can use quotes to make sure 4657 GDB parses the file name as a single word--for example, to print a 4658 global value of `x' defined in `f2.c': 4659 4660 (gdb) p 'f2.c'::x 4661 4662 This use of `::' is very rarely in conflict with the very similar 4663 use of the same notation in C++. GDB also supports use of the C++ 4664 scope resolution operator in GDB expressions. 4665 4666 _Warning:_ Occasionally, a local variable may appear to have the 4667 wrong value at certain points in a function--just after entry to a 4668 new scope, and just before exit. 4669 You may see this problem when you are stepping by machine 4670 instructions. This is because, on most machines, it takes more than 4671 one instruction to set up a stack frame (including local variable 4672 definitions); if you are stepping by machine instructions, variables 4673 may appear to have the wrong values until the stack frame is completely 4674 built. On exit, it usually also takes more than one machine 4675 instruction to destroy a stack frame; after you begin stepping through 4676 that group of instructions, local variable definitions may be gone. 4677 4678 This may also happen when the compiler does significant 4679 optimizations. To be sure of always seeing accurate values, turn off 4680 all optimization when compiling. 4681 4682 Another possible effect of compiler optimizations is to optimize 4683 unused variables out of existence, or assign variables to registers (as 4684 opposed to memory addresses). Depending on the support for such cases 4685 offered by the debug info format used by the compiler, GDB might not be 4686 able to display values for such local variables. If that happens, GDB 4687 will print a message like this: 4688 4689 No symbol "foo" in current context. 4690 4691 To solve such problems, either recompile without optimizations, or 4692 use a different debug info format, if the compiler supports several such 4693 formats. For example, GCC, the GNU C/C++ compiler, usually supports 4694 the `-gstabs+' option. `-gstabs+' produces debug info in a format that 4695 is superior to formats such as COFF. You may be able to use DWARF 2 4696 (`-gdwarf-2'), which is also an effective form for debug info. *Note 4697 Options for Debugging Your Program or GNU CC: (gcc.info)Debugging 4698 Options. *Note Debugging C++: C, for more info about debug info formats 4699 that are best suited to C++ programs. 4700 4701 If you ask to print an object whose contents are unknown to GDB, 4702 e.g., because its data type is not completely specified by the debug 4703 information, GDB will say `<incomplete type>'. *Note incomplete type: 4704 Symbols, for more about this. 4705 4706 4707 File: gdb.info, Node: Arrays, Next: Output Formats, Prev: Variables, Up: Data 4708 4709 8.3 Artificial arrays 4710 ===================== 4711 4712 It is often useful to print out several successive objects of the same 4713 type in memory; a section of an array, or an array of dynamically 4714 determined size for which only a pointer exists in the program. 4715 4716 You can do this by referring to a contiguous span of memory as an 4717 "artificial array", using the binary operator `@'. The left operand of 4718 `@' should be the first element of the desired array and be an 4719 individual object. The right operand should be the desired length of 4720 the array. The result is an array value whose elements are all of the 4721 type of the left argument. The first element is actually the left 4722 argument; the second element comes from bytes of memory immediately 4723 following those that hold the first element, and so on. Here is an 4724 example. If a program says 4725 4726 int *array = (int *) malloc (len * sizeof (int)); 4727 4728 you can print the contents of `array' with 4729 4730 p *array@len 4731 4732 The left operand of `@' must reside in memory. Array values made 4733 with `@' in this way behave just like other arrays in terms of 4734 subscripting, and are coerced to pointers when used in expressions. 4735 Artificial arrays most often appear in expressions via the value history 4736 (*note Value history: Value History.), after printing one out. 4737 4738 Another way to create an artificial array is to use a cast. This 4739 re-interprets a value as if it were an array. The value need not be in 4740 memory: 4741 (gdb) p/x (short[2])0x12345678 4742 $1 = {0x1234, 0x5678} 4743 4744 As a convenience, if you leave the array length out (as in 4745 `(TYPE[])VALUE') GDB calculates the size to fill the value (as 4746 `sizeof(VALUE)/sizeof(TYPE)': 4747 (gdb) p/x (short[])0x12345678 4748 $2 = {0x1234, 0x5678} 4749 4750 Sometimes the artificial array mechanism is not quite enough; in 4751 moderately complex data structures, the elements of interest may not 4752 actually be adjacent--for example, if you are interested in the values 4753 of pointers in an array. One useful work-around in this situation is 4754 to use a convenience variable (*note Convenience variables: Convenience 4755 Vars.) as a counter in an expression that prints the first interesting 4756 value, and then repeat that expression via <RET>. For instance, 4757 suppose you have an array `dtab' of pointers to structures, and you are 4758 interested in the values of a field `fv' in each structure. Here is an 4759 example of what you might type: 4760 4761 set $i = 0 4762 p dtab[$i++]->fv 4763 <RET> 4764 <RET> 4765 ... 4766 4767 4768 File: gdb.info, Node: Output Formats, Next: Memory, Prev: Arrays, Up: Data 4769 4770 8.4 Output formats 4771 ================== 4772 4773 By default, GDB prints a value according to its data type. Sometimes 4774 this is not what you want. For example, you might want to print a 4775 number in hex, or a pointer in decimal. Or you might want to view data 4776 in memory at a certain address as a character string or as an 4777 instruction. To do these things, specify an "output format" when you 4778 print a value. 4779 4780 The simplest use of output formats is to say how to print a value 4781 already computed. This is done by starting the arguments of the 4782 `print' command with a slash and a format letter. The format letters 4783 supported are: 4784 4785 `x' 4786 Regard the bits of the value as an integer, and print the integer 4787 in hexadecimal. 4788 4789 `d' 4790 Print as integer in signed decimal. 4791 4792 `u' 4793 Print as integer in unsigned decimal. 4794 4795 `o' 4796 Print as integer in octal. 4797 4798 `t' 4799 Print as integer in binary. The letter `t' stands for "two". (1) 4800 4801 `a' 4802 Print as an address, both absolute in hexadecimal and as an offset 4803 from the nearest preceding symbol. You can use this format used 4804 to discover where (in what function) an unknown address is located: 4805 4806 (gdb) p/a 0x54320 4807 $3 = 0x54320 <_initialize_vx+396> 4808 4809 The command `info symbol 0x54320' yields similar results. *Note 4810 info symbol: Symbols. 4811 4812 `c' 4813 Regard as an integer and print it as a character constant. This 4814 prints both the numerical value and its character representation. 4815 The character representation is replaced with the octal escape 4816 `\nnn' for characters outside the 7-bit ASCII range. 4817 4818 `f' 4819 Regard the bits of the value as a floating point number and print 4820 using typical floating point syntax. 4821 4822 For example, to print the program counter in hex (*note 4823 Registers::), type 4824 4825 p/x $pc 4826 4827 Note that no space is required before the slash; this is because command 4828 names in GDB cannot contain a slash. 4829 4830 To reprint the last value in the value history with a different 4831 format, you can use the `print' command with just a format and no 4832 expression. For example, `p/x' reprints the last value in hex. 4833 4834 ---------- Footnotes ---------- 4835 4836 (1) `b' cannot be used because these format letters are also used 4837 with the `x' command, where `b' stands for "byte"; see *Note Examining 4838 memory: Memory. 4839 4840 4841 File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data 4842 4843 8.5 Examining memory 4844 ==================== 4845 4846 You can use the command `x' (for "examine") to examine memory in any of 4847 several formats, independently of your program's data types. 4848 4849 `x/NFU ADDR' 4850 `x ADDR' 4851 `x' 4852 Use the `x' command to examine memory. 4853 4854 N, F, and U are all optional parameters that specify how much memory 4855 to display and how to format it; ADDR is an expression giving the 4856 address where you want to start displaying memory. If you use defaults 4857 for NFU, you need not type the slash `/'. Several commands set 4858 convenient defaults for ADDR. 4859 4860 N, the repeat count 4861 The repeat count is a decimal integer; the default is 1. It 4862 specifies how much memory (counting by units U) to display. 4863 4864 F, the display format 4865 The display format is one of the formats used by `print' (`x', 4866 `d', `u', `o', `t', `a', `c', `f'), and in addition `s' (for 4867 null-terminated strings) and `i' (for machine instructions). The 4868 default is `x' (hexadecimal) initially. The default changes each 4869 time you use either `x' or `print'. 4870 4871 U, the unit size 4872 The unit size is any of 4873 4874 `b' 4875 Bytes. 4876 4877 `h' 4878 Halfwords (two bytes). 4879 4880 `w' 4881 Words (four bytes). This is the initial default. 4882 4883 `g' 4884 Giant words (eight bytes). 4885 4886 Each time you specify a unit size with `x', that size becomes the 4887 default unit the next time you use `x'. (For the `s' and `i' 4888 formats, the unit size is ignored and is normally not written.) 4889 4890 ADDR, starting display address 4891 ADDR is the address where you want GDB to begin displaying memory. 4892 The expression need not have a pointer value (though it may); it 4893 is always interpreted as an integer address of a byte of memory. 4894 *Note Expressions: Expressions, for more information on 4895 expressions. The default for ADDR is usually just after the last 4896 address examined--but several other commands also set the default 4897 address: `info breakpoints' (to the address of the last breakpoint 4898 listed), `info line' (to the starting address of a line), and 4899 `print' (if you use it to display a value from memory). 4900 4901 For example, `x/3uh 0x54320' is a request to display three halfwords 4902 (`h') of memory, formatted as unsigned decimal integers (`u'), starting 4903 at address `0x54320'. `x/4xw $sp' prints the four words (`w') of 4904 memory above the stack pointer (here, `$sp'; *note Registers: 4905 Registers.) in hexadecimal (`x'). 4906 4907 Since the letters indicating unit sizes are all distinct from the 4908 letters specifying output formats, you do not have to remember whether 4909 unit size or format comes first; either order works. The output 4910 specifications `4xw' and `4wx' mean exactly the same thing. (However, 4911 the count N must come first; `wx4' does not work.) 4912 4913 Even though the unit size U is ignored for the formats `s' and `i', 4914 you might still want to use a count N; for example, `3i' specifies that 4915 you want to see three machine instructions, including any operands. 4916 The command `disassemble' gives an alternative way of inspecting 4917 machine instructions; see *Note Source and machine code: Machine Code. 4918 4919 All the defaults for the arguments to `x' are designed to make it 4920 easy to continue scanning memory with minimal specifications each time 4921 you use `x'. For example, after you have inspected three machine 4922 instructions with `x/3i ADDR', you can inspect the next seven with just 4923 `x/7'. If you use <RET> to repeat the `x' command, the repeat count N 4924 is used again; the other arguments default as for successive uses of 4925 `x'. 4926 4927 The addresses and contents printed by the `x' command are not saved 4928 in the value history because there is often too much of them and they 4929 would get in the way. Instead, GDB makes these values available for 4930 subsequent use in expressions as values of the convenience variables 4931 `$_' and `$__'. After an `x' command, the last address examined is 4932 available for use in expressions in the convenience variable `$_'. The 4933 contents of that address, as examined, are available in the convenience 4934 variable `$__'. 4935 4936 If the `x' command has a repeat count, the address and contents saved 4937 are from the last memory unit printed; this is not the same as the last 4938 address printed if several units were printed on the last line of 4939 output. 4940 4941 When you are debugging a program running on a remote target machine 4942 (*note Remote::), you may wish to verify the program's image in the 4943 remote machine's memory against the executable file you downloaded to 4944 the target. The `compare-sections' command is provided for such 4945 situations. 4946 4947 `compare-sections [SECTION-NAME]' 4948 Compare the data of a loadable section SECTION-NAME in the 4949 executable file of the program being debugged with the same 4950 section in the remote machine's memory, and report any mismatches. 4951 With no arguments, compares all loadable sections. This command's 4952 availability depends on the target's support for the `"qCRC"' 4953 remote request. 4954 4955 4956 File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up: Data 4957 4958 8.6 Automatic display 4959 ===================== 4960 4961 If you find that you want to print the value of an expression frequently 4962 (to see how it changes), you might want to add it to the "automatic 4963 display list" so that GDB prints its value each time your program stops. 4964 Each expression added to the list is given a number to identify it; to 4965 remove an expression from the list, you specify that number. The 4966 automatic display looks like this: 4967 4968 2: foo = 38 4969 3: bar[5] = (struct hack *) 0x3804 4970 4971 This display shows item numbers, expressions and their current values. 4972 As with displays you request manually using `x' or `print', you can 4973 specify the output format you prefer; in fact, `display' decides 4974 whether to use `print' or `x' depending on how elaborate your format 4975 specification is--it uses `x' if you specify a unit size, or one of the 4976 two formats (`i' and `s') that are only supported by `x'; otherwise it 4977 uses `print'. 4978 4979 `display EXPR' 4980 Add the expression EXPR to the list of expressions to display each 4981 time your program stops. *Note Expressions: Expressions. 4982 4983 `display' does not repeat if you press <RET> again after using it. 4984 4985 `display/FMT EXPR' 4986 For FMT specifying only a display format and not a size or count, 4987 add the expression EXPR to the auto-display list but arrange to 4988 display it each time in the specified format FMT. *Note Output 4989 formats: Output Formats. 4990 4991 `display/FMT ADDR' 4992 For FMT `i' or `s', or including a unit-size or a number of units, 4993 add the expression ADDR as a memory address to be examined each 4994 time your program stops. Examining means in effect doing `x/FMT 4995 ADDR'. *Note Examining memory: Memory. 4996 4997 For example, `display/i $pc' can be helpful, to see the machine 4998 instruction about to be executed each time execution stops (`$pc' is a 4999 common name for the program counter; *note Registers: Registers.). 5000 5001 `undisplay DNUMS...' 5002 `delete display DNUMS...' 5003 Remove item numbers DNUMS from the list of expressions to display. 5004 5005 `undisplay' does not repeat if you press <RET> after using it. 5006 (Otherwise you would just get the error `No display number ...'.) 5007 5008 `disable display DNUMS...' 5009 Disable the display of item numbers DNUMS. A disabled display 5010 item is not printed automatically, but is not forgotten. It may be 5011 enabled again later. 5012 5013 `enable display DNUMS...' 5014 Enable display of item numbers DNUMS. It becomes effective once 5015 again in auto display of its expression, until you specify 5016 otherwise. 5017 5018 `display' 5019 Display the current values of the expressions on the list, just as 5020 is done when your program stops. 5021 5022 `info display' 5023 Print the list of expressions previously set up to display 5024 automatically, each one with its item number, but without showing 5025 the values. This includes disabled expressions, which are marked 5026 as such. It also includes expressions which would not be 5027 displayed right now because they refer to automatic variables not 5028 currently available. 5029 5030 If a display expression refers to local variables, then it does not 5031 make sense outside the lexical context for which it was set up. Such an 5032 expression is disabled when execution enters a context where one of its 5033 variables is not defined. For example, if you give the command 5034 `display last_char' while inside a function with an argument 5035 `last_char', GDB displays this argument while your program continues to 5036 stop inside that function. When it stops elsewhere--where there is no 5037 variable `last_char'--the display is disabled automatically. The next 5038 time your program stops where `last_char' is meaningful, you can enable 5039 the display expression once again. 5040 5041 5042 File: gdb.info, Node: Print Settings, Next: Value History, Prev: Auto Display, Up: Data 5043 5044 8.7 Print settings 5045 ================== 5046 5047 GDB provides the following ways to control how arrays, structures, and 5048 symbols are printed. 5049 5050 These settings are useful for debugging programs in any language: 5051 5052 `set print address' 5053 `set print address on' 5054 GDB prints memory addresses showing the location of stack traces, 5055 structure values, pointer values, breakpoints, and so forth, even 5056 when it also displays the contents of those addresses. The default 5057 is `on'. For example, this is what a stack frame display looks 5058 like with `set print address on': 5059 5060 (gdb) f 5061 #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>") 5062 at input.c:530 5063 530 if (lquote != def_lquote) 5064 5065 `set print address off' 5066 Do not print addresses when displaying their contents. For 5067 example, this is the same stack frame displayed with `set print 5068 address off': 5069 5070 (gdb) set print addr off 5071 (gdb) f 5072 #0 set_quotes (lq="<<", rq=">>") at input.c:530 5073 530 if (lquote != def_lquote) 5074 5075 You can use `set print address off' to eliminate all machine 5076 dependent displays from the GDB interface. For example, with 5077 `print address off', you should get the same text for backtraces on 5078 all machines--whether or not they involve pointer arguments. 5079 5080 `show print address' 5081 Show whether or not addresses are to be printed. 5082 5083 When GDB prints a symbolic address, it normally prints the closest 5084 earlier symbol plus an offset. If that symbol does not uniquely 5085 identify the address (for example, it is a name whose scope is a single 5086 source file), you may need to clarify. One way to do this is with 5087 `info line', for example `info line *0x4537'. Alternately, you can set 5088 GDB to print the source file and line number when it prints a symbolic 5089 address: 5090 5091 `set print symbol-filename on' 5092 Tell GDB to print the source file name and line number of a symbol 5093 in the symbolic form of an address. 5094 5095 `set print symbol-filename off' 5096 Do not print source file name and line number of a symbol. This 5097 is the default. 5098 5099 `show print symbol-filename' 5100 Show whether or not GDB will print the source file name and line 5101 number of a symbol in the symbolic form of an address. 5102 5103 Another situation where it is helpful to show symbol filenames and 5104 line numbers is when disassembling code; GDB shows you the line number 5105 and source file that corresponds to each instruction. 5106 5107 Also, you may wish to see the symbolic form only if the address being 5108 printed is reasonably close to the closest earlier symbol: 5109 5110 `set print max-symbolic-offset MAX-OFFSET' 5111 Tell GDB to only display the symbolic form of an address if the 5112 offset between the closest earlier symbol and the address is less 5113 than MAX-OFFSET. The default is 0, which tells GDB to always 5114 print the symbolic form of an address if any symbol precedes it. 5115 5116 `show print max-symbolic-offset' 5117 Ask how large the maximum offset is that GDB prints in a symbolic 5118 address. 5119 5120 If you have a pointer and you are not sure where it points, try `set 5121 print symbol-filename on'. Then you can determine the name and source 5122 file location of the variable where it points, using `p/a POINTER'. 5123 This interprets the address in symbolic form. For example, here GDB 5124 shows that a variable `ptt' points at another variable `t', defined in 5125 `hi2.c': 5126 5127 (gdb) set print symbol-filename on 5128 (gdb) p/a ptt 5129 $4 = 0xe008 <t in hi2.c> 5130 5131 _Warning:_ For pointers that point to a local variable, `p/a' does 5132 not show the symbol name and filename of the referent, even with 5133 the appropriate `set print' options turned on. 5134 5135 Other settings control how different kinds of objects are printed: 5136 5137 `set print array' 5138 `set print array on' 5139 Pretty print arrays. This format is more convenient to read, but 5140 uses more space. The default is off. 5141 5142 `set print array off' 5143 Return to compressed format for arrays. 5144 5145 `show print array' 5146 Show whether compressed or pretty format is selected for displaying 5147 arrays. 5148 5149 `set print array-indexes' 5150 `set print array-indexes on' 5151 Print the index of each element when displaying arrays. May be 5152 more convenient to locate a given element in the array or quickly 5153 find the index of a given element in that printed array. The 5154 default is off. 5155 5156 `set print array-indexes off' 5157 Stop printing element indexes when displaying arrays. 5158 5159 `show print array-indexes' 5160 Show whether the index of each element is printed when displaying 5161 arrays. 5162 5163 `set print elements NUMBER-OF-ELEMENTS' 5164 Set a limit on how many elements of an array GDB will print. If 5165 GDB is printing a large array, it stops printing after it has 5166 printed the number of elements set by the `set print elements' 5167 command. This limit also applies to the display of strings. When 5168 GDB starts, this limit is set to 200. Setting NUMBER-OF-ELEMENTS 5169 to zero means that the printing is unlimited. 5170 5171 `show print elements' 5172 Display the number of elements of a large array that GDB will 5173 print. If the number is 0, then the printing is unlimited. 5174 5175 `set print repeats' 5176 Set the threshold for suppressing display of repeated array 5177 elelments. When the number of consecutive identical elements of an 5178 array exceeds the threshold, GDB prints the string `"<repeats N 5179 times>"', where N is the number of identical repetitions, instead 5180 of displaying the identical elements themselves. Setting the 5181 threshold to zero will cause all elements to be individually 5182 printed. The default threshold is 10. 5183 5184 `show print repeats' 5185 Display the current threshold for printing repeated identical 5186 elements. 5187 5188 `set print null-stop' 5189 Cause GDB to stop printing the characters of an array when the 5190 first NULL is encountered. This is useful when large arrays 5191 actually contain only short strings. The default is off. 5192 5193 `show print null-stop' 5194 Show whether GDB stops printing an array on the first NULL 5195 character. 5196 5197 `set print pretty on' 5198 Cause GDB to print structures in an indented format with one member 5199 per line, like this: 5200 5201 $1 = { 5202 next = 0x0, 5203 flags = { 5204 sweet = 1, 5205 sour = 1 5206 }, 5207 meat = 0x54 "Pork" 5208 } 5209 5210 `set print pretty off' 5211 Cause GDB to print structures in a compact format, like this: 5212 5213 $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \ 5214 meat = 0x54 "Pork"} 5215 5216 This is the default format. 5217 5218 `show print pretty' 5219 Show which format GDB is using to print structures. 5220 5221 `set print sevenbit-strings on' 5222 Print using only seven-bit characters; if this option is set, GDB 5223 displays any eight-bit characters (in strings or character values) 5224 using the notation `\'NNN. This setting is best if you are 5225 working in English (ASCII) and you use the high-order bit of 5226 characters as a marker or "meta" bit. 5227 5228 `set print sevenbit-strings off' 5229 Print full eight-bit characters. This allows the use of more 5230 international character sets, and is the default. 5231 5232 `show print sevenbit-strings' 5233 Show whether or not GDB is printing only seven-bit characters. 5234 5235 `set print union on' 5236 Tell GDB to print unions which are contained in structures and 5237 other unions. This is the default setting. 5238 5239 `set print union off' 5240 Tell GDB not to print unions which are contained in structures and 5241 other unions. GDB will print `"{...}"' instead. 5242 5243 `show print union' 5244 Ask GDB whether or not it will print unions which are contained in 5245 structures and other unions. 5246 5247 For example, given the declarations 5248 5249 typedef enum {Tree, Bug} Species; 5250 typedef enum {Big_tree, Acorn, Seedling} Tree_forms; 5251 typedef enum {Caterpillar, Cocoon, Butterfly} 5252 Bug_forms; 5253 5254 struct thing { 5255 Species it; 5256 union { 5257 Tree_forms tree; 5258 Bug_forms bug; 5259 } form; 5260 }; 5261 5262 struct thing foo = {Tree, {Acorn}}; 5263 5264 with `set print union on' in effect `p foo' would print 5265 5266 $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}} 5267 5268 and with `set print union off' in effect it would print 5269 5270 $1 = {it = Tree, form = {...}} 5271 5272 `set print union' affects programs written in C-like languages and 5273 in Pascal. 5274 5275 These settings are of interest when debugging C++ programs: 5276 5277 `set print demangle' 5278 `set print demangle on' 5279 Print C++ names in their source form rather than in the encoded 5280 ("mangled") form passed to the assembler and linker for type-safe 5281 linkage. The default is on. 5282 5283 `show print demangle' 5284 Show whether C++ names are printed in mangled or demangled form. 5285 5286 `set print asm-demangle' 5287 `set print asm-demangle on' 5288 Print C++ names in their source form rather than their mangled 5289 form, even in assembler code printouts such as instruction 5290 disassemblies. The default is off. 5291 5292 `show print asm-demangle' 5293 Show whether C++ names in assembly listings are printed in mangled 5294 or demangled form. 5295 5296 `set demangle-style STYLE' 5297 Choose among several encoding schemes used by different compilers 5298 to represent C++ names. The choices for STYLE are currently: 5299 5300 `auto' 5301 Allow GDB to choose a decoding style by inspecting your 5302 program. 5303 5304 `gnu' 5305 Decode based on the GNU C++ compiler (`g++') encoding 5306 algorithm. This is the default. 5307 5308 `hp' 5309 Decode based on the HP ANSI C++ (`aCC') encoding algorithm. 5310 5311 `lucid' 5312 Decode based on the Lucid C++ compiler (`lcc') encoding 5313 algorithm. 5314 5315 `arm' 5316 Decode using the algorithm in the `C++ Annotated Reference 5317 Manual'. *Warning:* this setting alone is not sufficient to 5318 allow debugging `cfront'-generated executables. GDB would 5319 require further enhancement to permit that. 5320 5321 If you omit STYLE, you will see a list of possible formats. 5322 5323 `show demangle-style' 5324 Display the encoding style currently in use for decoding C++ 5325 symbols. 5326 5327 `set print object' 5328 `set print object on' 5329 When displaying a pointer to an object, identify the _actual_ 5330 (derived) type of the object rather than the _declared_ type, using 5331 the virtual function table. 5332 5333 `set print object off' 5334 Display only the declared type of objects, without reference to the 5335 virtual function table. This is the default setting. 5336 5337 `show print object' 5338 Show whether actual, or declared, object types are displayed. 5339 5340 `set print static-members' 5341 `set print static-members on' 5342 Print static members when displaying a C++ object. The default is 5343 on. 5344 5345 `set print static-members off' 5346 Do not print static members when displaying a C++ object. 5347 5348 `show print static-members' 5349 Show whether C++ static members are printed or not. 5350 5351 `set print pascal_static-members' 5352 `set print pascal_static-members on' 5353 Print static members when displaying a Pascal object. The default 5354 is on. 5355 5356 `set print pascal_static-members off' 5357 Do not print static members when displaying a Pascal object. 5358 5359 `show print pascal_static-members' 5360 Show whether Pascal static members are printed or not. 5361 5362 `set print vtbl' 5363 `set print vtbl on' 5364 Pretty print C++ virtual function tables. The default is off. 5365 (The `vtbl' commands do not work on programs compiled with the HP 5366 ANSI C++ compiler (`aCC').) 5367 5368 `set print vtbl off' 5369 Do not pretty print C++ virtual function tables. 5370 5371 `show print vtbl' 5372 Show whether C++ virtual function tables are pretty printed, or 5373 not. 5374 5375 5376 File: gdb.info, Node: Value History, Next: Convenience Vars, Prev: Print Settings, Up: Data 5377 5378 8.8 Value history 5379 ================= 5380 5381 Values printed by the `print' command are saved in the GDB "value 5382 history". This allows you to refer to them in other expressions. 5383 Values are kept until the symbol table is re-read or discarded (for 5384 example with the `file' or `symbol-file' commands). When the symbol 5385 table changes, the value history is discarded, since the values may 5386 contain pointers back to the types defined in the symbol table. 5387 5388 The values printed are given "history numbers" by which you can 5389 refer to them. These are successive integers starting with one. 5390 `print' shows you the history number assigned to a value by printing 5391 `$NUM = ' before the value; here NUM is the history number. 5392 5393 To refer to any previous value, use `$' followed by the value's 5394 history number. The way `print' labels its output is designed to 5395 remind you of this. Just `$' refers to the most recent value in the 5396 history, and `$$' refers to the value before that. `$$N' refers to the 5397 Nth value from the end; `$$2' is the value just prior to `$$', `$$1' is 5398 equivalent to `$$', and `$$0' is equivalent to `$'. 5399 5400 For example, suppose you have just printed a pointer to a structure 5401 and want to see the contents of the structure. It suffices to type 5402 5403 p *$ 5404 5405 If you have a chain of structures where the component `next' points 5406 to the next one, you can print the contents of the next one with this: 5407 5408 p *$.next 5409 5410 You can print successive links in the chain by repeating this 5411 command--which you can do by just typing <RET>. 5412 5413 Note that the history records values, not expressions. If the value 5414 of `x' is 4 and you type these commands: 5415 5416 print x 5417 set x=5 5418 5419 then the value recorded in the value history by the `print' command 5420 remains 4 even though the value of `x' has changed. 5421 5422 `show values' 5423 Print the last ten values in the value history, with their item 5424 numbers. This is like `p $$9' repeated ten times, except that 5425 `show values' does not change the history. 5426 5427 `show values N' 5428 Print ten history values centered on history item number N. 5429 5430 `show values +' 5431 Print ten history values just after the values last printed. If 5432 no more values are available, `show values +' produces no display. 5433 5434 Pressing <RET> to repeat `show values N' has exactly the same effect 5435 as `show values +'. 5436 5437 5438 File: gdb.info, Node: Convenience Vars, Next: Registers, Prev: Value History, Up: Data 5439 5440 8.9 Convenience variables 5441 ========================= 5442 5443 GDB provides "convenience variables" that you can use within GDB to 5444 hold on to a value and refer to it later. These variables exist 5445 entirely within GDB; they are not part of your program, and setting a 5446 convenience variable has no direct effect on further execution of your 5447 program. That is why you can use them freely. 5448 5449 Convenience variables are prefixed with `$'. Any name preceded by 5450 `$' can be used for a convenience variable, unless it is one of the 5451 predefined machine-specific register names (*note Registers: 5452 Registers.). (Value history references, in contrast, are _numbers_ 5453 preceded by `$'. *Note Value history: Value History.) 5454 5455 You can save a value in a convenience variable with an assignment 5456 expression, just as you would set a variable in your program. For 5457 example: 5458 5459 set $foo = *object_ptr 5460 5461 would save in `$foo' the value contained in the object pointed to by 5462 `object_ptr'. 5463 5464 Using a convenience variable for the first time creates it, but its 5465 value is `void' until you assign a new value. You can alter the value 5466 with another assignment at any time. 5467 5468 Convenience variables have no fixed types. You can assign a 5469 convenience variable any type of value, including structures and 5470 arrays, even if that variable already has a value of a different type. 5471 The convenience variable, when used as an expression, has the type of 5472 its current value. 5473 5474 `show convenience' 5475 Print a list of convenience variables used so far, and their 5476 values. Abbreviated `show conv'. 5477 5478 `init-if-undefined $VARIABLE = EXPRESSION' 5479 Set a convenience variable if it has not already been set. This 5480 is useful for user-defined commands that keep some state. It is 5481 similar, in concept, to using local static variables with 5482 initializers in C (except that convenience variables are global). 5483 It can also be used to allow users to override default values used 5484 in a command script. 5485 5486 If the variable is already defined then the expression is not 5487 evaluated so any side-effects do not occur. 5488 5489 One of the ways to use a convenience variable is as a counter to be 5490 incremented or a pointer to be advanced. For example, to print a field 5491 from successive elements of an array of structures: 5492 5493 set $i = 0 5494 print bar[$i++]->contents 5495 5496 Repeat that command by typing <RET>. 5497 5498 Some convenience variables are created automatically by GDB and given 5499 values likely to be useful. 5500 5501 `$_' 5502 The variable `$_' is automatically set by the `x' command to the 5503 last address examined (*note Examining memory: Memory.). Other 5504 commands which provide a default address for `x' to examine also 5505 set `$_' to that address; these commands include `info line' and 5506 `info breakpoint'. The type of `$_' is `void *' except when set 5507 by the `x' command, in which case it is a pointer to the type of 5508 `$__'. 5509 5510 `$__' 5511 The variable `$__' is automatically set by the `x' command to the 5512 value found in the last address examined. Its type is chosen to 5513 match the format in which the data was printed. 5514 5515 `$_exitcode' 5516 The variable `$_exitcode' is automatically set to the exit code 5517 when the program being debugged terminates. 5518 5519 On HP-UX systems, if you refer to a function or variable name that 5520 begins with a dollar sign, GDB searches for a user or system name 5521 first, before it searches for a convenience variable. 5522 5523 5524 File: gdb.info, Node: Registers, Next: Floating Point Hardware, Prev: Convenience Vars, Up: Data 5525 5526 8.10 Registers 5527 ============== 5528 5529 You can refer to machine register contents, in expressions, as variables 5530 with names starting with `$'. The names of registers are different for 5531 each machine; use `info registers' to see the names used on your 5532 machine. 5533 5534 `info registers' 5535 Print the names and values of all registers except floating-point 5536 and vector registers (in the selected stack frame). 5537 5538 `info all-registers' 5539 Print the names and values of all registers, including 5540 floating-point and vector registers (in the selected stack frame). 5541 5542 `info registers REGNAME ...' 5543 Print the "relativized" value of each specified register REGNAME. 5544 As discussed in detail below, register values are normally 5545 relative to the selected stack frame. REGNAME may be any register 5546 name valid on the machine you are using, with or without the 5547 initial `$'. 5548 5549 GDB has four "standard" register names that are available (in 5550 expressions) on most machines--whenever they do not conflict with an 5551 architecture's canonical mnemonics for registers. The register names 5552 `$pc' and `$sp' are used for the program counter register and the stack 5553 pointer. `$fp' is used for a register that contains a pointer to the 5554 current stack frame, and `$ps' is used for a register that contains the 5555 processor status. For example, you could print the program counter in 5556 hex with 5557 5558 p/x $pc 5559 5560 or print the instruction to be executed next with 5561 5562 x/i $pc 5563 5564 or add four to the stack pointer(1) with 5565 5566 set $sp += 4 5567 5568 Whenever possible, these four standard register names are available 5569 on your machine even though the machine has different canonical 5570 mnemonics, so long as there is no conflict. The `info registers' 5571 command shows the canonical names. For example, on the SPARC, `info 5572 registers' displays the processor status register as `$psr' but you can 5573 also refer to it as `$ps'; and on x86-based machines `$ps' is an alias 5574 for the EFLAGS register. 5575 5576 GDB always considers the contents of an ordinary register as an 5577 integer when the register is examined in this way. Some machines have 5578 special registers which can hold nothing but floating point; these 5579 registers are considered to have floating point values. There is no way 5580 to refer to the contents of an ordinary register as floating point value 5581 (although you can _print_ it as a floating point value with `print/f 5582 $REGNAME'). 5583 5584 Some registers have distinct "raw" and "virtual" data formats. This 5585 means that the data format in which the register contents are saved by 5586 the operating system is not the same one that your program normally 5587 sees. For example, the registers of the 68881 floating point 5588 coprocessor are always saved in "extended" (raw) format, but all C 5589 programs expect to work with "double" (virtual) format. In such cases, 5590 GDB normally works with the virtual format only (the format that makes 5591 sense for your program), but the `info registers' command prints the 5592 data in both formats. 5593 5594 Some machines have special registers whose contents can be 5595 interpreted in several different ways. For example, modern x86-based 5596 machines have SSE and MMX registers that can hold several values packed 5597 together in several different formats. GDB refers to such registers in 5598 `struct' notation: 5599 5600 (gdb) print $xmm1 5601 $1 = { 5602 v4_float = {0, 3.43859137e-038, 1.54142831e-044, 1.821688e-044}, 5603 v2_double = {9.92129282474342e-303, 2.7585945287983262e-313}, 5604 v16_int8 = "\000\000\000\000\3706;\001\v\000\000\000\r\000\000", 5605 v8_int16 = {0, 0, 14072, 315, 11, 0, 13, 0}, 5606 v4_int32 = {0, 20657912, 11, 13}, 5607 v2_int64 = {88725056443645952, 55834574859}, 5608 uint128 = 0x0000000d0000000b013b36f800000000 5609 } 5610 5611 To set values of such registers, you need to tell GDB which view of the 5612 register you wish to change, as if you were assigning value to a 5613 `struct' member: 5614 5615 (gdb) set $xmm1.uint128 = 0x000000000000000000000000FFFFFFFF 5616 5617 Normally, register values are relative to the selected stack frame 5618 (*note Selecting a frame: Selection.). This means that you get the 5619 value that the register would contain if all stack frames farther in 5620 were exited and their saved registers restored. In order to see the 5621 true contents of hardware registers, you must select the innermost 5622 frame (with `frame 0'). 5623 5624 However, GDB must deduce where registers are saved, from the machine 5625 code generated by your compiler. If some registers are not saved, or if 5626 GDB is unable to locate the saved registers, the selected stack frame 5627 makes no difference. 5628 5629 ---------- Footnotes ---------- 5630 5631 (1) This is a way of removing one word from the stack, on machines 5632 where stacks grow downward in memory (most machines, nowadays). This 5633 assumes that the innermost stack frame is selected; setting `$sp' is 5634 not allowed when other stack frames are selected. To pop entire frames 5635 off the stack, regardless of machine architecture, use `return'; see 5636 *Note Returning from a function: Returning. 5637 5638 5639 File: gdb.info, Node: Floating Point Hardware, Next: Vector Unit, Prev: Registers, Up: Data 5640 5641 8.11 Floating point hardware 5642 ============================ 5643 5644 Depending on the configuration, GDB may be able to give you more 5645 information about the status of the floating point hardware. 5646 5647 `info float' 5648 Display hardware-dependent information about the floating point 5649 unit. The exact contents and layout vary depending on the 5650 floating point chip. Currently, `info float' is supported on the 5651 ARM and x86 machines. 5652 5653 5654 File: gdb.info, Node: Vector Unit, Next: OS Information, Prev: Floating Point Hardware, Up: Data 5655 5656 8.12 Vector Unit 5657 ================ 5658 5659 Depending on the configuration, GDB may be able to give you more 5660 information about the status of the vector unit. 5661 5662 `info vector' 5663 Display information about the vector unit. The exact contents and 5664 layout vary depending on the hardware. 5665 5666 5667 File: gdb.info, Node: OS Information, Next: Memory Region Attributes, Prev: Vector Unit, Up: Data 5668 5669 8.13 Operating system auxiliary information 5670 =========================================== 5671 5672 GDB provides interfaces to useful OS facilities that can help you debug 5673 your program. 5674 5675 When GDB runs on a "Posix system" (such as GNU or Unix machines), it 5676 interfaces with the inferior via the `ptrace' system call. The 5677 operating system creates a special sata structure, called `struct 5678 user', for this interface. You can use the command `info udot' to 5679 display the contents of this data structure. 5680 5681 `info udot' 5682 Display the contents of the `struct user' maintained by the OS 5683 kernel for the program being debugged. GDB displays the contents 5684 of `struct user' as a list of hex numbers, similar to the 5685 `examine' command. 5686 5687 Some operating systems supply an "auxiliary vector" to programs at 5688 startup. This is akin to the arguments and environment that you 5689 specify for a program, but contains a system-dependent variety of 5690 binary values that tell system libraries important details about the 5691 hardware, operating system, and process. Each value's purpose is 5692 identified by an integer tag; the meanings are well-known but 5693 system-specific. Depending on the configuration and operating system 5694 facilities, GDB may be able to show you this information. For remote 5695 targets, this functionality may further depend on the remote stub's 5696 support of the `qXfer:auxv:read' packet, see *Note qXfer auxiliary 5697 vector read::. 5698 5699 `info auxv' 5700 Display the auxiliary vector of the inferior, which can be either a 5701 live process or a core dump file. GDB prints each tag value 5702 numerically, and also shows names and text descriptions for 5703 recognized tags. Some values in the vector are numbers, some bit 5704 masks, and some pointers to strings or other data. GDB displays 5705 each value in the most appropriate form for a recognized tag, and 5706 in hexadecimal for an unrecognized tag. 5707 5708 5709 File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Prev: OS Information, Up: Data 5710 5711 8.14 Memory region attributes 5712 ============================= 5713 5714 "Memory region attributes" allow you to describe special handling 5715 required by regions of your target's memory. GDB uses attributes to 5716 determine whether to allow certain types of memory accesses; whether to 5717 use specific width accesses; and whether to cache target memory. By 5718 default the description of memory regions is fetched from the target 5719 (if the current target supports this), but the user can override the 5720 fetched regions. 5721 5722 Defined memory regions can be individually enabled and disabled. 5723 When a memory region is disabled, GDB uses the default attributes when 5724 accessing memory in that region. Similarly, if no memory regions have 5725 been defined, GDB uses the default attributes when accessing all memory. 5726 5727 When a memory region is defined, it is given a number to identify it; 5728 to enable, disable, or remove a memory region, you specify that number. 5729 5730 `mem LOWER UPPER ATTRIBUTES...' 5731 Define a memory region bounded by LOWER and UPPER with attributes 5732 ATTRIBUTES..., and add it to the list of regions monitored by GDB. 5733 Note that UPPER == 0 is a special case: it is treated as the the 5734 target's maximum memory address. (0xffff on 16 bit targets, 5735 0xffffffff on 32 bit targets, etc.) 5736 5737 `mem auto' 5738 Discard any user changes to the memory regions and use 5739 target-supplied regions, if available, or no regions if the target 5740 does not support. 5741 5742 `delete mem NUMS...' 5743 Remove memory regions NUMS... from the list of regions monitored 5744 by GDB. 5745 5746 `disable mem NUMS...' 5747 Disable monitoring of memory regions NUMS.... A disabled memory 5748 region is not forgotten. It may be enabled again later. 5749 5750 `enable mem NUMS...' 5751 Enable monitoring of memory regions NUMS.... 5752 5753 `info mem' 5754 Print a table of all defined memory regions, with the following 5755 columns for each region: 5756 5757 _Memory Region Number_ 5758 5759 _Enabled or Disabled._ 5760 Enabled memory regions are marked with `y'. Disabled memory 5761 regions are marked with `n'. 5762 5763 _Lo Address_ 5764 The address defining the inclusive lower bound of the memory 5765 region. 5766 5767 _Hi Address_ 5768 The address defining the exclusive upper bound of the memory 5769 region. 5770 5771 _Attributes_ 5772 The list of attributes set for this memory region. 5773 5774 8.14.1 Attributes 5775 ----------------- 5776 5777 8.14.1.1 Memory Access Mode 5778 ........................... 5779 5780 The access mode attributes set whether GDB may make read or write 5781 accesses to a memory region. 5782 5783 While these attributes prevent GDB from performing invalid memory 5784 accesses, they do nothing to prevent the target system, I/O DMA, etc. 5785 from accessing memory. 5786 5787 `ro' 5788 Memory is read only. 5789 5790 `wo' 5791 Memory is write only. 5792 5793 `rw' 5794 Memory is read/write. This is the default. 5795 5796 8.14.1.2 Memory Access Size 5797 ........................... 5798 5799 The acccess size attributes tells GDB to use specific sized accesses in 5800 the memory region. Often memory mapped device registers require 5801 specific sized accesses. If no access size attribute is specified, GDB 5802 may use accesses of any size. 5803 5804 `8' 5805 Use 8 bit memory accesses. 5806 5807 `16' 5808 Use 16 bit memory accesses. 5809 5810 `32' 5811 Use 32 bit memory accesses. 5812 5813 `64' 5814 Use 64 bit memory accesses. 5815 5816 8.14.1.3 Data Cache 5817 ................... 5818 5819 The data cache attributes set whether GDB will cache target memory. 5820 While this generally improves performance by reducing debug protocol 5821 overhead, it can lead to incorrect results because GDB does not know 5822 about volatile variables or memory mapped device registers. 5823 5824 `cache' 5825 Enable GDB to cache target memory. 5826 5827 `nocache' 5828 Disable GDB from caching target memory. This is the default. 5829 5830 5831 File: gdb.info, Node: Dump/Restore Files, Next: Core File Generation, Prev: Memory Region Attributes, Up: Data 5832 5833 8.15 Copy between memory and a file 5834 =================================== 5835 5836 You can use the commands `dump', `append', and `restore' to copy data 5837 between target memory and a file. The `dump' and `append' commands 5838 write data to a file, and the `restore' command reads data from a file 5839 back into the inferior's memory. Files may be in binary, Motorola 5840 S-record, Intel hex, or Tektronix Hex format; however, GDB can only 5841 append to binary files. 5842 5843 `dump [FORMAT] memory FILENAME START_ADDR END_ADDR' 5844 `dump [FORMAT] value FILENAME EXPR' 5845 Dump the contents of memory from START_ADDR to END_ADDR, or the 5846 value of EXPR, to FILENAME in the given format. 5847 5848 The FORMAT parameter may be any one of: 5849 `binary' 5850 Raw binary form. 5851 5852 `ihex' 5853 Intel hex format. 5854 5855 `srec' 5856 Motorola S-record format. 5857 5858 `tekhex' 5859 Tektronix Hex format. 5860 5861 GDB uses the same definitions of these formats as the GNU binary 5862 utilities, like `objdump' and `objcopy'. If FORMAT is omitted, 5863 GDB dumps the data in raw binary form. 5864 5865 `append [binary] memory FILENAME START_ADDR END_ADDR' 5866 `append [binary] value FILENAME EXPR' 5867 Append the contents of memory from START_ADDR to END_ADDR, or the 5868 value of EXPR, to the file FILENAME, in raw binary form. (GDB can 5869 only append data to files in raw binary form.) 5870 5871 `restore FILENAME [binary] BIAS START END' 5872 Restore the contents of file FILENAME into memory. The `restore' 5873 command can automatically recognize any known BFD file format, 5874 except for raw binary. To restore a raw binary file you must 5875 specify the optional keyword `binary' after the filename. 5876 5877 If BIAS is non-zero, its value will be added to the addresses 5878 contained in the file. Binary files always start at address zero, 5879 so they will be restored at address BIAS. Other bfd files have a 5880 built-in location; they will be restored at offset BIAS from that 5881 location. 5882 5883 If START and/or END are non-zero, then only data between file 5884 offset START and file offset END will be restored. These offsets 5885 are relative to the addresses in the file, before the BIAS 5886 argument is applied. 5887 5888 5889 5890 File: gdb.info, Node: Core File Generation, Next: Character Sets, Prev: Dump/Restore Files, Up: Data 5891 5892 8.16 How to Produce a Core File from Your Program 5893 ================================================= 5894 5895 A "core file" or "core dump" is a file that records the memory image of 5896 a running process and its process status (register values etc.). Its 5897 primary use is post-mortem debugging of a program that crashed while it 5898 ran outside a debugger. A program that crashes automatically produces 5899 a core file, unless this feature is disabled by the user. *Note 5900 Files::, for information on invoking GDB in the post-mortem debugging 5901 mode. 5902 5903 Occasionally, you may wish to produce a core file of the program you 5904 are debugging in order to preserve a snapshot of its state. GDB has a 5905 special command for that. 5906 5907 `generate-core-file [FILE]' 5908 `gcore [FILE]' 5909 Produce a core dump of the inferior process. The optional argument 5910 FILE specifies the file name where to put the core dump. If not 5911 specified, the file name defaults to `core.PID', where PID is the 5912 inferior process ID. 5913 5914 Note that this command is implemented only for some systems (as of 5915 this writing, GNU/Linux, FreeBSD, Solaris, Unixware, and S390). 5916 5917 5918 File: gdb.info, Node: Character Sets, Next: Caching Remote Data, Prev: Core File Generation, Up: Data 5919 5920 8.17 Character Sets 5921 =================== 5922 5923 If the program you are debugging uses a different character set to 5924 represent characters and strings than the one GDB uses itself, GDB can 5925 automatically translate between the character sets for you. The 5926 character set GDB uses we call the "host character set"; the one the 5927 inferior program uses we call the "target character set". 5928 5929 For example, if you are running GDB on a GNU/Linux system, which 5930 uses the ISO Latin 1 character set, but you are using GDB's remote 5931 protocol (*note Remote Debugging: Remote.) to debug a program running 5932 on an IBM mainframe, which uses the EBCDIC character set, then the host 5933 character set is Latin-1, and the target character set is EBCDIC. If 5934 you give GDB the command `set target-charset EBCDIC-US', then GDB 5935 translates between EBCDIC and Latin 1 as you print character or string 5936 values, or use character and string literals in expressions. 5937 5938 GDB has no way to automatically recognize which character set the 5939 inferior program uses; you must tell it, using the `set target-charset' 5940 command, described below. 5941 5942 Here are the commands for controlling GDB's character set support: 5943 5944 `set target-charset CHARSET' 5945 Set the current target character set to CHARSET. We list the 5946 character set names GDB recognizes below, but if you type `set 5947 target-charset' followed by <TAB><TAB>, GDB will list the target 5948 character sets it supports. 5949 5950 `set host-charset CHARSET' 5951 Set the current host character set to CHARSET. 5952 5953 By default, GDB uses a host character set appropriate to the 5954 system it is running on; you can override that default using the 5955 `set host-charset' command. 5956 5957 GDB can only use certain character sets as its host character set. 5958 We list the character set names GDB recognizes below, and 5959 indicate which can be host character sets, but if you type `set 5960 target-charset' followed by <TAB><TAB>, GDB will list the host 5961 character sets it supports. 5962 5963 `set charset CHARSET' 5964 Set the current host and target character sets to CHARSET. As 5965 above, if you type `set charset' followed by <TAB><TAB>, GDB will 5966 list the name of the character sets that can be used for both host 5967 and target. 5968 5969 `show charset' 5970 Show the names of the current host and target charsets. 5971 5972 `show host-charset' 5973 Show the name of the current host charset. 5974 5975 `show target-charset' 5976 Show the name of the current target charset. 5977 5978 5979 GDB currently includes support for the following character sets: 5980 5981 `ASCII' 5982 Seven-bit U.S. ASCII. GDB can use this as its host character set. 5983 5984 `ISO-8859-1' 5985 The ISO Latin 1 character set. This extends ASCII with accented 5986 characters needed for French, German, and Spanish. GDB can use 5987 this as its host character set. 5988 5989 `EBCDIC-US' 5990 `IBM1047' 5991 Variants of the EBCDIC character set, used on some of IBM's 5992 mainframe operating systems. (GNU/Linux on the S/390 uses U.S. 5993 ASCII.) GDB cannot use these as its host character set. 5994 5995 5996 Note that these are all single-byte character sets. More work inside 5997 GDB is needed to support multi-byte or variable-width character 5998 encodings, like the UTF-8 and UCS-2 encodings of Unicode. 5999 6000 Here is an example of GDB's character set support in action. Assume 6001 that the following source code has been placed in the file 6002 `charset-test.c': 6003 6004 #include <stdio.h> 6005 6006 char ascii_hello[] 6007 = {72, 101, 108, 108, 111, 44, 32, 119, 6008 111, 114, 108, 100, 33, 10, 0}; 6009 char ibm1047_hello[] 6010 = {200, 133, 147, 147, 150, 107, 64, 166, 6011 150, 153, 147, 132, 90, 37, 0}; 6012 6013 main () 6014 { 6015 printf ("Hello, world!\n"); 6016 } 6017 6018 In this program, `ascii_hello' and `ibm1047_hello' are arrays 6019 containing the string `Hello, world!' followed by a newline, encoded in 6020 the ASCII and IBM1047 character sets. 6021 6022 We compile the program, and invoke the debugger on it: 6023 6024 $ gcc -g charset-test.c -o charset-test 6025 $ gdb -nw charset-test 6026 GNU gdb 2001-12-19-cvs 6027 Copyright 2001 Free Software Foundation, Inc. 6028 ... 6029 (gdb) 6030 6031 We can use the `show charset' command to see what character sets GDB 6032 is currently using to interpret and display characters and strings: 6033 6034 (gdb) show charset 6035 The current host and target character set is `ISO-8859-1'. 6036 (gdb) 6037 6038 For the sake of printing this manual, let's use ASCII as our initial 6039 character set: 6040 (gdb) set charset ASCII 6041 (gdb) show charset 6042 The current host and target character set is `ASCII'. 6043 (gdb) 6044 6045 Let's assume that ASCII is indeed the correct character set for our 6046 host system -- in other words, let's assume that if GDB prints 6047 characters using the ASCII character set, our terminal will display 6048 them properly. Since our current target character set is also ASCII, 6049 the contents of `ascii_hello' print legibly: 6050 6051 (gdb) print ascii_hello 6052 $1 = 0x401698 "Hello, world!\n" 6053 (gdb) print ascii_hello[0] 6054 $2 = 72 'H' 6055 (gdb) 6056 6057 GDB uses the target character set for character and string literals 6058 you use in expressions: 6059 6060 (gdb) print '+' 6061 $3 = 43 '+' 6062 (gdb) 6063 6064 The ASCII character set uses the number 43 to encode the `+' 6065 character. 6066 6067 GDB relies on the user to tell it which character set the target 6068 program uses. If we print `ibm1047_hello' while our target character 6069 set is still ASCII, we get jibberish: 6070 6071 (gdb) print ibm1047_hello 6072 $4 = 0x4016a8 "\310\205\223\223\226k@\246\226\231\223\204Z%" 6073 (gdb) print ibm1047_hello[0] 6074 $5 = 200 '\310' 6075 (gdb) 6076 6077 If we invoke the `set target-charset' followed by <TAB><TAB>, GDB 6078 tells us the character sets it supports: 6079 6080 (gdb) set target-charset 6081 ASCII EBCDIC-US IBM1047 ISO-8859-1 6082 (gdb) set target-charset 6083 6084 We can select IBM1047 as our target character set, and examine the 6085 program's strings again. Now the ASCII string is wrong, but GDB 6086 translates the contents of `ibm1047_hello' from the target character 6087 set, IBM1047, to the host character set, ASCII, and they display 6088 correctly: 6089 6090 (gdb) set target-charset IBM1047 6091 (gdb) show charset 6092 The current host character set is `ASCII'. 6093 The current target character set is `IBM1047'. 6094 (gdb) print ascii_hello 6095 $6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012" 6096 (gdb) print ascii_hello[0] 6097 $7 = 72 '\110' 6098 (gdb) print ibm1047_hello 6099 $8 = 0x4016a8 "Hello, world!\n" 6100 (gdb) print ibm1047_hello[0] 6101 $9 = 200 'H' 6102 (gdb) 6103 6104 As above, GDB uses the target character set for character and string 6105 literals you use in expressions: 6106 6107 (gdb) print '+' 6108 $10 = 78 '+' 6109 (gdb) 6110 6111 The IBM1047 character set uses the number 78 to encode the `+' 6112 character. 6113 6114 6115 File: gdb.info, Node: Caching Remote Data, Prev: Character Sets, Up: Data 6116 6117 8.18 Caching Data of Remote Targets 6118 =================================== 6119 6120 GDB can cache data exchanged between the debugger and a remote target 6121 (*note Remote::). Such caching generally improves performance, because 6122 it reduces the overhead of the remote protocol by bundling memory reads 6123 and writes into large chunks. Unfortunately, GDB does not currently 6124 know anything about volatile registers, and thus data caching will 6125 produce incorrect results when volatile registers are in use. 6126 6127 `set remotecache on' 6128 `set remotecache off' 6129 Set caching state for remote targets. When `ON', use data 6130 caching. By default, this option is `OFF'. 6131 6132 `show remotecache' 6133 Show the current state of data caching for remote targets. 6134 6135 `info dcache' 6136 Print the information about the data cache performance. The 6137 information displayed includes: the dcache width and depth; and for 6138 each cache line, how many times it was referenced, and its data and 6139 state (dirty, bad, ok, etc.). This command is useful for debugging 6140 the data cache operation. 6141 6142 6143 File: gdb.info, Node: Macros, Next: Tracepoints, Prev: Data, Up: Top 6144 6145 9 C Preprocessor Macros 6146 *********************** 6147 6148 Some languages, such as C and C++, provide a way to define and invoke 6149 "preprocessor macros" which expand into strings of tokens. GDB can 6150 evaluate expressions containing macro invocations, show the result of 6151 macro expansion, and show a macro's definition, including where it was 6152 defined. 6153 6154 You may need to compile your program specially to provide GDB with 6155 information about preprocessor macros. Most compilers do not include 6156 macros in their debugging information, even when you compile with the 6157 `-g' flag. *Note Compilation::. 6158 6159 A program may define a macro at one point, remove that definition 6160 later, and then provide a different definition after that. Thus, at 6161 different points in the program, a macro may have different 6162 definitions, or have no definition at all. If there is a current stack 6163 frame, GDB uses the macros in scope at that frame's source code line. 6164 Otherwise, GDB uses the macros in scope at the current listing location; 6165 see *Note List::. 6166 6167 At the moment, GDB does not support the `##' token-splicing 6168 operator, the `#' stringification operator, or variable-arity macros. 6169 6170 Whenever GDB evaluates an expression, it always expands any macro 6171 invocations present in the expression. GDB also provides the following 6172 commands for working with macros explicitly. 6173 6174 `macro expand EXPRESSION' 6175 `macro exp EXPRESSION' 6176 Show the results of expanding all preprocessor macro invocations in 6177 EXPRESSION. Since GDB simply expands macros, but does not parse 6178 the result, EXPRESSION need not be a valid expression; it can be 6179 any string of tokens. 6180 6181 `macro expand-once EXPRESSION' 6182 `macro exp1 EXPRESSION' 6183 (This command is not yet implemented.) Show the results of 6184 expanding those preprocessor macro invocations that appear 6185 explicitly in EXPRESSION. Macro invocations appearing in that 6186 expansion are left unchanged. This command allows you to see the 6187 effect of a particular macro more clearly, without being confused 6188 by further expansions. Since GDB simply expands macros, but does 6189 not parse the result, EXPRESSION need not be a valid expression; it 6190 can be any string of tokens. 6191 6192 `info macro MACRO' 6193 Show the definition of the macro named MACRO, and describe the 6194 source location where that definition was established. 6195 6196 `macro define MACRO REPLACEMENT-LIST' 6197 `macro define MACRO(ARGLIST) REPLACEMENT-LIST' 6198 (This command is not yet implemented.) Introduce a definition for 6199 a preprocessor macro named MACRO, invocations of which are replaced 6200 by the tokens given in REPLACEMENT-LIST. The first form of this 6201 command defines an "object-like" macro, which takes no arguments; 6202 the second form defines a "function-like" macro, which takes the 6203 arguments given in ARGLIST. 6204 6205 A definition introduced by this command is in scope in every 6206 expression evaluated in GDB, until it is removed with the `macro 6207 undef' command, described below. The definition overrides all 6208 definitions for MACRO present in the program being debugged, as 6209 well as any previous user-supplied definition. 6210 6211 `macro undef MACRO' 6212 (This command is not yet implemented.) Remove any user-supplied 6213 definition for the macro named MACRO. This command only affects 6214 definitions provided with the `macro define' command, described 6215 above; it cannot remove definitions present in the program being 6216 debugged. 6217 6218 `macro list' 6219 (This command is not yet implemented.) List all the macros 6220 defined using the `macro define' command. 6221 6222 Here is a transcript showing the above commands in action. First, we 6223 show our source files: 6224 6225 $ cat sample.c 6226 #include <stdio.h> 6227 #include "sample.h" 6228 6229 #define M 42 6230 #define ADD(x) (M + x) 6231 6232 main () 6233 { 6234 #define N 28 6235 printf ("Hello, world!\n"); 6236 #undef N 6237 printf ("We're so creative.\n"); 6238 #define N 1729 6239 printf ("Goodbye, world!\n"); 6240 } 6241 $ cat sample.h 6242 #define Q < 6243 $ 6244 6245 Now, we compile the program using the GNU C compiler, GCC. We pass 6246 the `-gdwarf-2' and `-g3' flags to ensure the compiler includes 6247 information about preprocessor macros in the debugging information. 6248 6249 $ gcc -gdwarf-2 -g3 sample.c -o sample 6250 $ 6251 6252 Now, we start GDB on our sample program: 6253 6254 $ gdb -nw sample 6255 GNU gdb 2002-05-06-cvs 6256 Copyright 2002 Free Software Foundation, Inc. 6257 GDB is free software, ... 6258 (gdb) 6259 6260 We can expand macros and examine their definitions, even when the 6261 program is not running. GDB uses the current listing position to 6262 decide which macro definitions are in scope: 6263 6264 (gdb) list main 6265 3 6266 4 #define M 42 6267 5 #define ADD(x) (M + x) 6268 6 6269 7 main () 6270 8 { 6271 9 #define N 28 6272 10 printf ("Hello, world!\n"); 6273 11 #undef N 6274 12 printf ("We're so creative.\n"); 6275 (gdb) info macro ADD 6276 Defined at /home/jimb/gdb/macros/play/sample.c:5 6277 #define ADD(x) (M + x) 6278 (gdb) info macro Q 6279 Defined at /home/jimb/gdb/macros/play/sample.h:1 6280 included at /home/jimb/gdb/macros/play/sample.c:2 6281 #define Q < 6282 (gdb) macro expand ADD(1) 6283 expands to: (42 + 1) 6284 (gdb) macro expand-once ADD(1) 6285 expands to: once (M + 1) 6286 (gdb) 6287 6288 In the example above, note that `macro expand-once' expands only the 6289 macro invocation explicit in the original text -- the invocation of 6290 `ADD' -- but does not expand the invocation of the macro `M', which was 6291 introduced by `ADD'. 6292 6293 Once the program is running, GDB uses the macro definitions in force 6294 at the source line of the current stack frame: 6295 6296 (gdb) break main 6297 Breakpoint 1 at 0x8048370: file sample.c, line 10. 6298 (gdb) run 6299 Starting program: /home/jimb/gdb/macros/play/sample 6300 6301 Breakpoint 1, main () at sample.c:10 6302 10 printf ("Hello, world!\n"); 6303 (gdb) 6304 6305 At line 10, the definition of the macro `N' at line 9 is in force: 6306 6307 (gdb) info macro N 6308 Defined at /home/jimb/gdb/macros/play/sample.c:9 6309 #define N 28 6310 (gdb) macro expand N Q M 6311 expands to: 28 < 42 6312 (gdb) print N Q M 6313 $1 = 1 6314 (gdb) 6315 6316 As we step over directives that remove `N''s definition, and then 6317 give it a new definition, GDB finds the definition (or lack thereof) in 6318 force at each point: 6319 6320 (gdb) next 6321 Hello, world! 6322 12 printf ("We're so creative.\n"); 6323 (gdb) info macro N 6324 The symbol `N' has no definition as a C/C++ preprocessor macro 6325 at /home/jimb/gdb/macros/play/sample.c:12 6326 (gdb) next 6327 We're so creative. 6328 14 printf ("Goodbye, world!\n"); 6329 (gdb) info macro N 6330 Defined at /home/jimb/gdb/macros/play/sample.c:13 6331 #define N 1729 6332 (gdb) macro expand N Q M 6333 expands to: 1729 < 42 6334 (gdb) print N Q M 6335 $2 = 0 6336 (gdb) 6337 6338 6339 File: gdb.info, Node: Tracepoints, Next: Overlays, Prev: Macros, Up: Top 6340 6341 10 Tracepoints 6342 ************** 6343 6344 In some applications, it is not feasible for the debugger to interrupt 6345 the program's execution long enough for the developer to learn anything 6346 helpful about its behavior. If the program's correctness depends on 6347 its real-time behavior, delays introduced by a debugger might cause the 6348 program to change its behavior drastically, or perhaps fail, even when 6349 the code itself is correct. It is useful to be able to observe the 6350 program's behavior without interrupting it. 6351 6352 Using GDB's `trace' and `collect' commands, you can specify 6353 locations in the program, called "tracepoints", and arbitrary 6354 expressions to evaluate when those tracepoints are reached. Later, 6355 using the `tfind' command, you can examine the values those expressions 6356 had when the program hit the tracepoints. The expressions may also 6357 denote objects in memory--structures or arrays, for example--whose 6358 values GDB should record; while visiting a particular tracepoint, you 6359 may inspect those objects as if they were in memory at that moment. 6360 However, because GDB records these values without interacting with you, 6361 it can do so quickly and unobtrusively, hopefully not disturbing the 6362 program's behavior. 6363 6364 The tracepoint facility is currently available only for remote 6365 targets. *Note Targets::. In addition, your remote target must know 6366 how to collect trace data. This functionality is implemented in the 6367 remote stub; however, none of the stubs distributed with GDB support 6368 tracepoints as of this writing. The format of the remote packets used 6369 to implement tracepoints are described in *Note Tracepoint Packets::. 6370 6371 This chapter describes the tracepoint commands and features. 6372 6373 * Menu: 6374 6375 * Set Tracepoints:: 6376 * Analyze Collected Data:: 6377 * Tracepoint Variables:: 6378 6379 6380 File: gdb.info, Node: Set Tracepoints, Next: Analyze Collected Data, Up: Tracepoints 6381 6382 10.1 Commands to Set Tracepoints 6383 ================================ 6384 6385 Before running such a "trace experiment", an arbitrary number of 6386 tracepoints can be set. Like a breakpoint (*note Set Breaks::), a 6387 tracepoint has a number assigned to it by GDB. Like with breakpoints, 6388 tracepoint numbers are successive integers starting from one. Many of 6389 the commands associated with tracepoints take the tracepoint number as 6390 their argument, to identify which tracepoint to work on. 6391 6392 For each tracepoint, you can specify, in advance, some arbitrary set 6393 of data that you want the target to collect in the trace buffer when it 6394 hits that tracepoint. The collected data can include registers, local 6395 variables, or global data. Later, you can use GDB commands to examine 6396 the values these data had at the time the tracepoint was hit. 6397 6398 This section describes commands to set tracepoints and associated 6399 conditions and actions. 6400 6401 * Menu: 6402 6403 * Create and Delete Tracepoints:: 6404 * Enable and Disable Tracepoints:: 6405 * Tracepoint Passcounts:: 6406 * Tracepoint Actions:: 6407 * Listing Tracepoints:: 6408 * Starting and Stopping Trace Experiment:: 6409 6410 6411 File: gdb.info, Node: Create and Delete Tracepoints, Next: Enable and Disable Tracepoints, Up: Set Tracepoints 6412 6413 10.1.1 Create and Delete Tracepoints 6414 ------------------------------------ 6415 6416 `trace' 6417 The `trace' command is very similar to the `break' command. Its 6418 argument can be a source line, a function name, or an address in 6419 the target program. *Note Set Breaks::. The `trace' command 6420 defines a tracepoint, which is a point in the target program where 6421 the debugger will briefly stop, collect some data, and then allow 6422 the program to continue. Setting a tracepoint or changing its 6423 commands doesn't take effect until the next `tstart' command; 6424 thus, you cannot change the tracepoint attributes once a trace 6425 experiment is running. 6426 6427 Here are some examples of using the `trace' command: 6428 6429 (gdb) trace foo.c:121 // a source file and line number 6430 6431 (gdb) trace +2 // 2 lines forward 6432 6433 (gdb) trace my_function // first source line of function 6434 6435 (gdb) trace *my_function // EXACT start address of function 6436 6437 (gdb) trace *0x2117c4 // an address 6438 6439 You can abbreviate `trace' as `tr'. 6440 6441 The convenience variable `$tpnum' records the tracepoint number of 6442 the most recently set tracepoint. 6443 6444 `delete tracepoint [NUM]' 6445 Permanently delete one or more tracepoints. With no argument, the 6446 default is to delete all tracepoints. 6447 6448 Examples: 6449 6450 (gdb) delete trace 1 2 3 // remove three tracepoints 6451 6452 (gdb) delete trace // remove all tracepoints 6453 6454 You can abbreviate this command as `del tr'. 6455 6456 6457 File: gdb.info, Node: Enable and Disable Tracepoints, Next: Tracepoint Passcounts, Prev: Create and Delete Tracepoints, Up: Set Tracepoints 6458 6459 10.1.2 Enable and Disable Tracepoints 6460 ------------------------------------- 6461 6462 `disable tracepoint [NUM]' 6463 Disable tracepoint NUM, or all tracepoints if no argument NUM is 6464 given. A disabled tracepoint will have no effect during the next 6465 trace experiment, but it is not forgotten. You can re-enable a 6466 disabled tracepoint using the `enable tracepoint' command. 6467 6468 `enable tracepoint [NUM]' 6469 Enable tracepoint NUM, or all tracepoints. The enabled 6470 tracepoints will become effective the next time a trace experiment 6471 is run. 6472 6473 6474 File: gdb.info, Node: Tracepoint Passcounts, Next: Tracepoint Actions, Prev: Enable and Disable Tracepoints, Up: Set Tracepoints 6475 6476 10.1.3 Tracepoint Passcounts 6477 ---------------------------- 6478 6479 `passcount [N [NUM]]' 6480 Set the "passcount" of a tracepoint. The passcount is a way to 6481 automatically stop a trace experiment. If a tracepoint's 6482 passcount is N, then the trace experiment will be automatically 6483 stopped on the N'th time that tracepoint is hit. If the 6484 tracepoint number NUM is not specified, the `passcount' command 6485 sets the passcount of the most recently defined tracepoint. If no 6486 passcount is given, the trace experiment will run until stopped 6487 explicitly by the user. 6488 6489 Examples: 6490 6491 (gdb) passcount 5 2 // Stop on the 5th execution of 6492 `// tracepoint 2' 6493 6494 (gdb) passcount 12 // Stop on the 12th execution of the 6495 `// most recently defined tracepoint.' 6496 (gdb) trace foo 6497 (gdb) pass 3 6498 (gdb) trace bar 6499 (gdb) pass 2 6500 (gdb) trace baz 6501 (gdb) pass 1 // Stop tracing when foo has been 6502 `// executed 3 times OR when bar has' 6503 `// been executed 2 times' 6504 `// OR when baz has been executed 1 time.' 6505 6506 6507 6508 File: gdb.info, Node: Tracepoint Actions, Next: Listing Tracepoints, Prev: Tracepoint Passcounts, Up: Set Tracepoints 6509 6510 10.1.4 Tracepoint Action Lists 6511 ------------------------------ 6512 6513 `actions [NUM]' 6514 This command will prompt for a list of actions to be taken when the 6515 tracepoint is hit. If the tracepoint number NUM is not specified, 6516 this command sets the actions for the one that was most recently 6517 defined (so that you can define a tracepoint and then say 6518 `actions' without bothering about its number). You specify the 6519 actions themselves on the following lines, one action at a time, 6520 and terminate the actions list with a line containing just `end'. 6521 So far, the only defined actions are `collect' and 6522 `while-stepping'. 6523 6524 To remove all actions from a tracepoint, type `actions NUM' and 6525 follow it immediately with `end'. 6526 6527 (gdb) collect DATA // collect some data 6528 6529 (gdb) while-stepping 5 // single-step 5 times, collect data 6530 6531 (gdb) end // signals the end of actions. 6532 6533 In the following example, the action list begins with `collect' 6534 commands indicating the things to be collected when the tracepoint 6535 is hit. Then, in order to single-step and collect additional data 6536 following the tracepoint, a `while-stepping' command is used, 6537 followed by the list of things to be collected while stepping. The 6538 `while-stepping' command is terminated by its own separate `end' 6539 command. Lastly, the action list is terminated by an `end' 6540 command. 6541 6542 (gdb) trace foo 6543 (gdb) actions 6544 Enter actions for tracepoint 1, one per line: 6545 > collect bar,baz 6546 > collect $regs 6547 > while-stepping 12 6548 > collect $fp, $sp 6549 > end 6550 end 6551 6552 `collect EXPR1, EXPR2, ...' 6553 Collect values of the given expressions when the tracepoint is hit. 6554 This command accepts a comma-separated list of any valid 6555 expressions. In addition to global, static, or local variables, 6556 the following special arguments are supported: 6557 6558 `$regs' 6559 collect all registers 6560 6561 `$args' 6562 collect all function arguments 6563 6564 `$locals' 6565 collect all local variables. 6566 6567 You can give several consecutive `collect' commands, each one with 6568 a single argument, or one `collect' command with several arguments 6569 separated by commas: the effect is the same. 6570 6571 The command `info scope' (*note info scope: Symbols.) is 6572 particularly useful for figuring out what data to collect. 6573 6574 `while-stepping N' 6575 Perform N single-step traces after the tracepoint, collecting new 6576 data at each step. The `while-stepping' command is followed by 6577 the list of what to collect while stepping (followed by its own 6578 `end' command): 6579 6580 > while-stepping 12 6581 > collect $regs, myglobal 6582 > end 6583 > 6584 6585 You may abbreviate `while-stepping' as `ws' or `stepping'. 6586 6587 6588 File: gdb.info, Node: Listing Tracepoints, Next: Starting and Stopping Trace Experiment, Prev: Tracepoint Actions, Up: Set Tracepoints 6589 6590 10.1.5 Listing Tracepoints 6591 -------------------------- 6592 6593 `info tracepoints [NUM]' 6594 Display information about the tracepoint NUM. If you don't specify 6595 a tracepoint number, displays information about all the tracepoints 6596 defined so far. For each tracepoint, the following information is 6597 shown: 6598 6599 * its number 6600 6601 * whether it is enabled or disabled 6602 6603 * its address 6604 6605 * its passcount as given by the `passcount N' command 6606 6607 * its step count as given by the `while-stepping N' command 6608 6609 * where in the source files is the tracepoint set 6610 6611 * its action list as given by the `actions' command 6612 6613 (gdb) info trace 6614 Num Enb Address PassC StepC What 6615 1 y 0x002117c4 0 0 <gdb_asm> 6616 2 y 0x0020dc64 0 0 in g_test at g_test.c:1375 6617 3 y 0x0020b1f4 0 0 in get_data at ../foo.c:41 6618 (gdb) 6619 6620 This command can be abbreviated `info tp'. 6621 6622 6623 File: gdb.info, Node: Starting and Stopping Trace Experiment, Prev: Listing Tracepoints, Up: Set Tracepoints 6624 6625 10.1.6 Starting and Stopping Trace Experiment 6626 --------------------------------------------- 6627 6628 `tstart' 6629 This command takes no arguments. It starts the trace experiment, 6630 and begins collecting data. This has the side effect of 6631 discarding all the data collected in the trace buffer during the 6632 previous trace experiment. 6633 6634 `tstop' 6635 This command takes no arguments. It ends the trace experiment, and 6636 stops collecting data. 6637 6638 *Note*: a trace experiment and data collection may stop 6639 automatically if any tracepoint's passcount is reached (*note 6640 Tracepoint Passcounts::), or if the trace buffer becomes full. 6641 6642 `tstatus' 6643 This command displays the status of the current trace data 6644 collection. 6645 6646 Here is an example of the commands we described so far: 6647 6648 (gdb) trace gdb_c_test 6649 (gdb) actions 6650 Enter actions for tracepoint #1, one per line. 6651 > collect $regs,$locals,$args 6652 > while-stepping 11 6653 > collect $regs 6654 > end 6655 > end 6656 (gdb) tstart 6657 [time passes ...] 6658 (gdb) tstop 6659 6660 6661 File: gdb.info, Node: Analyze Collected Data, Next: Tracepoint Variables, Prev: Set Tracepoints, Up: Tracepoints 6662 6663 10.2 Using the collected data 6664 ============================= 6665 6666 After the tracepoint experiment ends, you use GDB commands for 6667 examining the trace data. The basic idea is that each tracepoint 6668 collects a trace "snapshot" every time it is hit and another snapshot 6669 every time it single-steps. All these snapshots are consecutively 6670 numbered from zero and go into a buffer, and you can examine them 6671 later. The way you examine them is to "focus" on a specific trace 6672 snapshot. When the remote stub is focused on a trace snapshot, it will 6673 respond to all GDB requests for memory and registers by reading from 6674 the buffer which belongs to that snapshot, rather than from _real_ 6675 memory or registers of the program being debugged. This means that 6676 *all* GDB commands (`print', `info registers', `backtrace', etc.) will 6677 behave as if we were currently debugging the program state as it was 6678 when the tracepoint occurred. Any requests for data that are not in 6679 the buffer will fail. 6680 6681 * Menu: 6682 6683 * tfind:: How to select a trace snapshot 6684 * tdump:: How to display all data for a snapshot 6685 * save-tracepoints:: How to save tracepoints for a future run 6686 6687 6688 File: gdb.info, Node: tfind, Next: tdump, Up: Analyze Collected Data 6689 6690 10.2.1 `tfind N' 6691 ---------------- 6692 6693 The basic command for selecting a trace snapshot from the buffer is 6694 `tfind N', which finds trace snapshot number N, counting from zero. If 6695 no argument N is given, the next snapshot is selected. 6696 6697 Here are the various forms of using the `tfind' command. 6698 6699 `tfind start' 6700 Find the first snapshot in the buffer. This is a synonym for 6701 `tfind 0' (since 0 is the number of the first snapshot). 6702 6703 `tfind none' 6704 Stop debugging trace snapshots, resume _live_ debugging. 6705 6706 `tfind end' 6707 Same as `tfind none'. 6708 6709 `tfind' 6710 No argument means find the next trace snapshot. 6711 6712 `tfind -' 6713 Find the previous trace snapshot before the current one. This 6714 permits retracing earlier steps. 6715 6716 `tfind tracepoint NUM' 6717 Find the next snapshot associated with tracepoint NUM. Search 6718 proceeds forward from the last examined trace snapshot. If no 6719 argument NUM is given, it means find the next snapshot collected 6720 for the same tracepoint as the current snapshot. 6721 6722 `tfind pc ADDR' 6723 Find the next snapshot associated with the value ADDR of the 6724 program counter. Search proceeds forward from the last examined 6725 trace snapshot. If no argument ADDR is given, it means find the 6726 next snapshot with the same value of PC as the current snapshot. 6727 6728 `tfind outside ADDR1, ADDR2' 6729 Find the next snapshot whose PC is outside the given range of 6730 addresses. 6731 6732 `tfind range ADDR1, ADDR2' 6733 Find the next snapshot whose PC is between ADDR1 and ADDR2. 6734 6735 `tfind line [FILE:]N' 6736 Find the next snapshot associated with the source line N. If the 6737 optional argument FILE is given, refer to line N in that source 6738 file. Search proceeds forward from the last examined trace 6739 snapshot. If no argument N is given, it means find the next line 6740 other than the one currently being examined; thus saying `tfind 6741 line' repeatedly can appear to have the same effect as stepping 6742 from line to line in a _live_ debugging session. 6743 6744 The default arguments for the `tfind' commands are specifically 6745 designed to make it easy to scan through the trace buffer. For 6746 instance, `tfind' with no argument selects the next trace snapshot, and 6747 `tfind -' with no argument selects the previous trace snapshot. So, by 6748 giving one `tfind' command, and then simply hitting <RET> repeatedly 6749 you can examine all the trace snapshots in order. Or, by saying `tfind 6750 -' and then hitting <RET> repeatedly you can examine the snapshots in 6751 reverse order. The `tfind line' command with no argument selects the 6752 snapshot for the next source line executed. The `tfind pc' command with 6753 no argument selects the next snapshot with the same program counter 6754 (PC) as the current frame. The `tfind tracepoint' command with no 6755 argument selects the next trace snapshot collected by the same 6756 tracepoint as the current one. 6757 6758 In addition to letting you scan through the trace buffer manually, 6759 these commands make it easy to construct GDB scripts that scan through 6760 the trace buffer and print out whatever collected data you are 6761 interested in. Thus, if we want to examine the PC, FP, and SP 6762 registers from each trace frame in the buffer, we can say this: 6763 6764 (gdb) tfind start 6765 (gdb) while ($trace_frame != -1) 6766 > printf "Frame %d, PC = %08X, SP = %08X, FP = %08X\n", \ 6767 $trace_frame, $pc, $sp, $fp 6768 > tfind 6769 > end 6770 6771 Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44 6772 Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44 6773 Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44 6774 Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44 6775 Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44 6776 Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44 6777 Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44 6778 Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44 6779 Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44 6780 Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44 6781 Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14 6782 6783 Or, if we want to examine the variable `X' at each source line in 6784 the buffer: 6785 6786 (gdb) tfind start 6787 (gdb) while ($trace_frame != -1) 6788 > printf "Frame %d, X == %d\n", $trace_frame, X 6789 > tfind line 6790 > end 6791 6792 Frame 0, X = 1 6793 Frame 7, X = 2 6794 Frame 13, X = 255 6795 6796 6797 File: gdb.info, Node: tdump, Next: save-tracepoints, Prev: tfind, Up: Analyze Collected Data 6798 6799 10.2.2 `tdump' 6800 -------------- 6801 6802 This command takes no arguments. It prints all the data collected at 6803 the current trace snapshot. 6804 6805 (gdb) trace 444 6806 (gdb) actions 6807 Enter actions for tracepoint #2, one per line: 6808 > collect $regs, $locals, $args, gdb_long_test 6809 > end 6810 6811 (gdb) tstart 6812 6813 (gdb) tfind line 444 6814 #0 gdb_test (p1=0x11, p2=0x22, p3=0x33, p4=0x44, p5=0x55, p6=0x66) 6815 at gdb_test.c:444 6816 444 printp( "%s: arguments = 0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n", ) 6817 6818 (gdb) tdump 6819 Data collected at tracepoint 2, trace frame 1: 6820 d0 0xc4aa0085 -995491707 6821 d1 0x18 24 6822 d2 0x80 128 6823 d3 0x33 51 6824 d4 0x71aea3d 119204413 6825 d5 0x22 34 6826 d6 0xe0 224 6827 d7 0x380035 3670069 6828 a0 0x19e24a 1696330 6829 a1 0x3000668 50333288 6830 a2 0x100 256 6831 a3 0x322000 3284992 6832 a4 0x3000698 50333336 6833 a5 0x1ad3cc 1758156 6834 fp 0x30bf3c 0x30bf3c 6835 sp 0x30bf34 0x30bf34 6836 ps 0x0 0 6837 pc 0x20b2c8 0x20b2c8 6838 fpcontrol 0x0 0 6839 fpstatus 0x0 0 6840 fpiaddr 0x0 0 6841 p = 0x20e5b4 "gdb-test" 6842 p1 = (void *) 0x11 6843 p2 = (void *) 0x22 6844 p3 = (void *) 0x33 6845 p4 = (void *) 0x44 6846 p5 = (void *) 0x55 6847 p6 = (void *) 0x66 6848 gdb_long_test = 17 '\021' 6849 6850 (gdb) 6851 6852 6853 File: gdb.info, Node: save-tracepoints, Prev: tdump, Up: Analyze Collected Data 6854 6855 10.2.3 `save-tracepoints FILENAME' 6856 ---------------------------------- 6857 6858 This command saves all current tracepoint definitions together with 6859 their actions and passcounts, into a file `FILENAME' suitable for use 6860 in a later debugging session. To read the saved tracepoint 6861 definitions, use the `source' command (*note Command Files::). 6862 6863 6864 File: gdb.info, Node: Tracepoint Variables, Prev: Analyze Collected Data, Up: Tracepoints 6865 6866 10.3 Convenience Variables for Tracepoints 6867 ========================================== 6868 6869 `(int) $trace_frame' 6870 The current trace snapshot (a.k.a. "frame") number, or -1 if no 6871 snapshot is selected. 6872 6873 `(int) $tracepoint' 6874 The tracepoint for the current trace snapshot. 6875 6876 `(int) $trace_line' 6877 The line number for the current trace snapshot. 6878 6879 `(char []) $trace_file' 6880 The source file for the current trace snapshot. 6881 6882 `(char []) $trace_func' 6883 The name of the function containing `$tracepoint'. 6884 6885 Note: `$trace_file' is not suitable for use in `printf', use 6886 `output' instead. 6887 6888 Here's a simple example of using these convenience variables for 6889 stepping through all the trace snapshots and printing some of their 6890 data. 6891 6892 (gdb) tfind start 6893 6894 (gdb) while $trace_frame != -1 6895 > output $trace_file 6896 > printf ", line %d (tracepoint #%d)\n", $trace_line, $tracepoint 6897 > tfind 6898 > end 6899 6900 6901 File: gdb.info, Node: Overlays, Next: Languages, Prev: Tracepoints, Up: Top 6902 6903 11 Debugging Programs That Use Overlays 6904 *************************************** 6905 6906 If your program is too large to fit completely in your target system's 6907 memory, you can sometimes use "overlays" to work around this problem. 6908 GDB provides some support for debugging programs that use overlays. 6909 6910 * Menu: 6911 6912 * How Overlays Work:: A general explanation of overlays. 6913 * Overlay Commands:: Managing overlays in GDB. 6914 * Automatic Overlay Debugging:: GDB can find out which overlays are 6915 mapped by asking the inferior. 6916 * Overlay Sample Program:: A sample program using overlays. 6917 6918 6919 File: gdb.info, Node: How Overlays Work, Next: Overlay Commands, Up: Overlays 6920 6921 11.1 How Overlays Work 6922 ====================== 6923 6924 Suppose you have a computer whose instruction address space is only 64 6925 kilobytes long, but which has much more memory which can be accessed by 6926 other means: special instructions, segment registers, or memory 6927 management hardware, for example. Suppose further that you want to 6928 adapt a program which is larger than 64 kilobytes to run on this system. 6929 6930 One solution is to identify modules of your program which are 6931 relatively independent, and need not call each other directly; call 6932 these modules "overlays". Separate the overlays from the main program, 6933 and place their machine code in the larger memory. Place your main 6934 program in instruction memory, but leave at least enough space there to 6935 hold the largest overlay as well. 6936 6937 Now, to call a function located in an overlay, you must first copy 6938 that overlay's machine code from the large memory into the space set 6939 aside for it in the instruction memory, and then jump to its entry point 6940 there. 6941 6942 Data Instruction Larger 6943 Address Space Address Space Address Space 6944 +-----------+ +-----------+ +-----------+ 6945 | | | | | | 6946 +-----------+ +-----------+ +-----------+<-- overlay 1 6947 | program | | main | .----| overlay 1 | load address 6948 | variables | | program | | +-----------+ 6949 | and heap | | | | | | 6950 +-----------+ | | | +-----------+<-- overlay 2 6951 | | +-----------+ | | | load address 6952 +-----------+ | | | .-| overlay 2 | 6953 | | | | | | 6954 mapped --->+-----------+ | | +-----------+ 6955 address | | | | | | 6956 | overlay | <-' | | | 6957 | area | <---' +-----------+<-- overlay 3 6958 | | <---. | | load address 6959 +-----------+ `--| overlay 3 | 6960 | | | | 6961 +-----------+ | | 6962 +-----------+ 6963 | | 6964 +-----------+ 6965 6966 A code overlay 6967 6968 The diagram (*note A code overlay::) shows a system with separate 6969 data and instruction address spaces. To map an overlay, the program 6970 copies its code from the larger address space to the instruction 6971 address space. Since the overlays shown here all use the same mapped 6972 address, only one may be mapped at a time. For a system with a single 6973 address space for data and instructions, the diagram would be similar, 6974 except that the program variables and heap would share an address space 6975 with the main program and the overlay area. 6976 6977 An overlay loaded into instruction memory and ready for use is 6978 called a "mapped" overlay; its "mapped address" is its address in the 6979 instruction memory. An overlay not present (or only partially present) 6980 in instruction memory is called "unmapped"; its "load address" is its 6981 address in the larger memory. The mapped address is also called the 6982 "virtual memory address", or "VMA"; the load address is also called the 6983 "load memory address", or "LMA". 6984 6985 Unfortunately, overlays are not a completely transparent way to 6986 adapt a program to limited instruction memory. They introduce a new 6987 set of global constraints you must keep in mind as you design your 6988 program: 6989 6990 * Before calling or returning to a function in an overlay, your 6991 program must make sure that overlay is actually mapped. 6992 Otherwise, the call or return will transfer control to the right 6993 address, but in the wrong overlay, and your program will probably 6994 crash. 6995 6996 * If the process of mapping an overlay is expensive on your system, 6997 you will need to choose your overlays carefully to minimize their 6998 effect on your program's performance. 6999 7000 * The executable file you load onto your system must contain each 7001 overlay's instructions, appearing at the overlay's load address, 7002 not its mapped address. However, each overlay's instructions must 7003 be relocated and its symbols defined as if the overlay were at its 7004 mapped address. You can use GNU linker scripts to specify 7005 different load and relocation addresses for pieces of your 7006 program; see *Note Overlay Description: (ld.info)Overlay 7007 Description. 7008 7009 * The procedure for loading executable files onto your system must 7010 be able to load their contents into the larger address space as 7011 well as the instruction and data spaces. 7012 7013 7014 The overlay system described above is rather simple, and could be 7015 improved in many ways: 7016 7017 * If your system has suitable bank switch registers or memory 7018 management hardware, you could use those facilities to make an 7019 overlay's load area contents simply appear at their mapped address 7020 in instruction space. This would probably be faster than copying 7021 the overlay to its mapped area in the usual way. 7022 7023 * If your overlays are small enough, you could set aside more than 7024 one overlay area, and have more than one overlay mapped at a time. 7025 7026 * You can use overlays to manage data, as well as instructions. In 7027 general, data overlays are even less transparent to your design 7028 than code overlays: whereas code overlays only require care when 7029 you call or return to functions, data overlays require care every 7030 time you access the data. Also, if you change the contents of a 7031 data overlay, you must copy its contents back out to its load 7032 address before you can copy a different data overlay into the same 7033 mapped area. 7034 7035 7036 7037 File: gdb.info, Node: Overlay Commands, Next: Automatic Overlay Debugging, Prev: How Overlays Work, Up: Overlays 7038 7039 11.2 Overlay Commands 7040 ===================== 7041 7042 To use GDB's overlay support, each overlay in your program must 7043 correspond to a separate section of the executable file. The section's 7044 virtual memory address and load memory address must be the overlay's 7045 mapped and load addresses. Identifying overlays with sections allows 7046 GDB to determine the appropriate address of a function or variable, 7047 depending on whether the overlay is mapped or not. 7048 7049 GDB's overlay commands all start with the word `overlay'; you can 7050 abbreviate this as `ov' or `ovly'. The commands are: 7051 7052 `overlay off' 7053 Disable GDB's overlay support. When overlay support is disabled, 7054 GDB assumes that all functions and variables are always present at 7055 their mapped addresses. By default, GDB's overlay support is 7056 disabled. 7057 7058 `overlay manual' 7059 Enable "manual" overlay debugging. In this mode, GDB relies on 7060 you to tell it which overlays are mapped, and which are not, using 7061 the `overlay map-overlay' and `overlay unmap-overlay' commands 7062 described below. 7063 7064 `overlay map-overlay OVERLAY' 7065 `overlay map OVERLAY' 7066 Tell GDB that OVERLAY is now mapped; OVERLAY must be the name of 7067 the object file section containing the overlay. When an overlay 7068 is mapped, GDB assumes it can find the overlay's functions and 7069 variables at their mapped addresses. GDB assumes that any other 7070 overlays whose mapped ranges overlap that of OVERLAY are now 7071 unmapped. 7072 7073 `overlay unmap-overlay OVERLAY' 7074 `overlay unmap OVERLAY' 7075 Tell GDB that OVERLAY is no longer mapped; OVERLAY must be the 7076 name of the object file section containing the overlay. When an 7077 overlay is unmapped, GDB assumes it can find the overlay's 7078 functions and variables at their load addresses. 7079 7080 `overlay auto' 7081 Enable "automatic" overlay debugging. In this mode, GDB consults 7082 a data structure the overlay manager maintains in the inferior to 7083 see which overlays are mapped. For details, see *Note Automatic 7084 Overlay Debugging::. 7085 7086 `overlay load-target' 7087 `overlay load' 7088 Re-read the overlay table from the inferior. Normally, GDB 7089 re-reads the table GDB automatically each time the inferior stops, 7090 so this command should only be necessary if you have changed the 7091 overlay mapping yourself using GDB. This command is only useful 7092 when using automatic overlay debugging. 7093 7094 `overlay list-overlays' 7095 `overlay list' 7096 Display a list of the overlays currently mapped, along with their 7097 mapped addresses, load addresses, and sizes. 7098 7099 7100 Normally, when GDB prints a code address, it includes the name of 7101 the function the address falls in: 7102 7103 (gdb) print main 7104 $3 = {int ()} 0x11a0 <main> 7105 When overlay debugging is enabled, GDB recognizes code in unmapped 7106 overlays, and prints the names of unmapped functions with asterisks 7107 around them. For example, if `foo' is a function in an unmapped 7108 overlay, GDB prints it this way: 7109 7110 (gdb) overlay list 7111 No sections are mapped. 7112 (gdb) print foo 7113 $5 = {int (int)} 0x100000 <*foo*> 7114 When `foo''s overlay is mapped, GDB prints the function's name 7115 normally: 7116 7117 (gdb) overlay list 7118 Section .ov.foo.text, loaded at 0x100000 - 0x100034, 7119 mapped at 0x1016 - 0x104a 7120 (gdb) print foo 7121 $6 = {int (int)} 0x1016 <foo> 7122 7123 When overlay debugging is enabled, GDB can find the correct address 7124 for functions and variables in an overlay, whether or not the overlay 7125 is mapped. This allows most GDB commands, like `break' and 7126 `disassemble', to work normally, even on unmapped code. However, GDB's 7127 breakpoint support has some limitations: 7128 7129 * You can set breakpoints in functions in unmapped overlays, as long 7130 as GDB can write to the overlay at its load address. 7131 7132 * GDB can not set hardware or simulator-based breakpoints in 7133 unmapped overlays. However, if you set a breakpoint at the end of 7134 your overlay manager (and tell GDB which overlays are now mapped, 7135 if you are using manual overlay management), GDB will re-set its 7136 breakpoints properly. 7137 7138 7139 File: gdb.info, Node: Automatic Overlay Debugging, Next: Overlay Sample Program, Prev: Overlay Commands, Up: Overlays 7140 7141 11.3 Automatic Overlay Debugging 7142 ================================ 7143 7144 GDB can automatically track which overlays are mapped and which are 7145 not, given some simple co-operation from the overlay manager in the 7146 inferior. If you enable automatic overlay debugging with the `overlay 7147 auto' command (*note Overlay Commands::), GDB looks in the inferior's 7148 memory for certain variables describing the current state of the 7149 overlays. 7150 7151 Here are the variables your overlay manager must define to support 7152 GDB's automatic overlay debugging: 7153 7154 `_ovly_table': 7155 This variable must be an array of the following structures: 7156 7157 struct 7158 { 7159 /* The overlay's mapped address. */ 7160 unsigned long vma; 7161 7162 /* The size of the overlay, in bytes. */ 7163 unsigned long size; 7164 7165 /* The overlay's load address. */ 7166 unsigned long lma; 7167 7168 /* Non-zero if the overlay is currently mapped; 7169 zero otherwise. */ 7170 unsigned long mapped; 7171 } 7172 7173 `_novlys': 7174 This variable must be a four-byte signed integer, holding the total 7175 number of elements in `_ovly_table'. 7176 7177 7178 To decide whether a particular overlay is mapped or not, GDB looks 7179 for an entry in `_ovly_table' whose `vma' and `lma' members equal the 7180 VMA and LMA of the overlay's section in the executable file. When GDB 7181 finds a matching entry, it consults the entry's `mapped' member to 7182 determine whether the overlay is currently mapped. 7183 7184 In addition, your overlay manager may define a function called 7185 `_ovly_debug_event'. If this function is defined, GDB will silently 7186 set a breakpoint there. If the overlay manager then calls this 7187 function whenever it has changed the overlay table, this will enable 7188 GDB to accurately keep track of which overlays are in program memory, 7189 and update any breakpoints that may be set in overlays. This will 7190 allow breakpoints to work even if the overlays are kept in ROM or other 7191 non-writable memory while they are not being executed. 7192 7193 7194 File: gdb.info, Node: Overlay Sample Program, Prev: Automatic Overlay Debugging, Up: Overlays 7195 7196 11.4 Overlay Sample Program 7197 =========================== 7198 7199 When linking a program which uses overlays, you must place the overlays 7200 at their load addresses, while relocating them to run at their mapped 7201 addresses. To do this, you must write a linker script (*note Overlay 7202 Description: (ld.info)Overlay Description.). Unfortunately, since 7203 linker scripts are specific to a particular host system, target 7204 architecture, and target memory layout, this manual cannot provide 7205 portable sample code demonstrating GDB's overlay support. 7206 7207 However, the GDB source distribution does contain an overlaid 7208 program, with linker scripts for a few systems, as part of its test 7209 suite. The program consists of the following files from 7210 `gdb/testsuite/gdb.base': 7211 7212 `overlays.c' 7213 The main program file. 7214 7215 `ovlymgr.c' 7216 A simple overlay manager, used by `overlays.c'. 7217 7218 `foo.c' 7219 `bar.c' 7220 `baz.c' 7221 `grbx.c' 7222 Overlay modules, loaded and used by `overlays.c'. 7223 7224 `d10v.ld' 7225 `m32r.ld' 7226 Linker scripts for linking the test program on the `d10v-elf' and 7227 `m32r-elf' targets. 7228 7229 You can build the test program using the `d10v-elf' GCC 7230 cross-compiler like this: 7231 7232 $ d10v-elf-gcc -g -c overlays.c 7233 $ d10v-elf-gcc -g -c ovlymgr.c 7234 $ d10v-elf-gcc -g -c foo.c 7235 $ d10v-elf-gcc -g -c bar.c 7236 $ d10v-elf-gcc -g -c baz.c 7237 $ d10v-elf-gcc -g -c grbx.c 7238 $ d10v-elf-gcc -g overlays.o ovlymgr.o foo.o bar.o \ 7239 baz.o grbx.o -Wl,-Td10v.ld -o overlays 7240 7241 The build process is identical for any other architecture, except 7242 that you must substitute the appropriate compiler and linker script for 7243 the target system for `d10v-elf-gcc' and `d10v.ld'. 7244 7245 7246 File: gdb.info, Node: Languages, Next: Symbols, Prev: Overlays, Up: Top 7247 7248 12 Using GDB with Different Languages 7249 ************************************* 7250 7251 Although programming languages generally have common aspects, they are 7252 rarely expressed in the same manner. For instance, in ANSI C, 7253 dereferencing a pointer `p' is accomplished by `*p', but in Modula-2, 7254 it is accomplished by `p^'. Values can also be represented (and 7255 displayed) differently. Hex numbers in C appear as `0x1ae', while in 7256 Modula-2 they appear as `1AEH'. 7257 7258 Language-specific information is built into GDB for some languages, 7259 allowing you to express operations like the above in your program's 7260 native language, and allowing GDB to output values in a manner 7261 consistent with the syntax of your program's native language. The 7262 language you use to build expressions is called the "working language". 7263 7264 * Menu: 7265 7266 * Setting:: Switching between source languages 7267 * Show:: Displaying the language 7268 * Checks:: Type and range checks 7269 * Supported languages:: Supported languages 7270 * Unsupported languages:: Unsupported languages 7271 7272 7273 File: gdb.info, Node: Setting, Next: Show, Up: Languages 7274 7275 12.1 Switching between source languages 7276 ======================================= 7277 7278 There are two ways to control the working language--either have GDB set 7279 it automatically, or select it manually yourself. You can use the `set 7280 language' command for either purpose. On startup, GDB defaults to 7281 setting the language automatically. The working language is used to 7282 determine how expressions you type are interpreted, how values are 7283 printed, etc. 7284 7285 In addition to the working language, every source file that GDB 7286 knows about has its own working language. For some object file 7287 formats, the compiler might indicate which language a particular source 7288 file is in. However, most of the time GDB infers the language from the 7289 name of the file. The language of a source file controls whether C++ 7290 names are demangled--this way `backtrace' can show each frame 7291 appropriately for its own language. There is no way to set the 7292 language of a source file from within GDB, but you can set the language 7293 associated with a filename extension. *Note Displaying the language: 7294 Show. 7295 7296 This is most commonly a problem when you use a program, such as 7297 `cfront' or `f2c', that generates C but is written in another language. 7298 In that case, make the program use `#line' directives in its C output; 7299 that way GDB will know the correct language of the source code of the 7300 original program, and will display that source code, not the generated 7301 C code. 7302 7303 * Menu: 7304 7305 * Filenames:: Filename extensions and languages. 7306 * Manually:: Setting the working language manually 7307 * Automatically:: Having GDB infer the source language 7308 7309 7310 File: gdb.info, Node: Filenames, Next: Manually, Up: Setting 7311 7312 12.1.1 List of filename extensions and languages 7313 ------------------------------------------------ 7314 7315 If a source file name ends in one of the following extensions, then GDB 7316 infers that its language is the one indicated. 7317 7318 `.ada' 7319 `.ads' 7320 `.adb' 7321 `.a' 7322 Ada source file. 7323 7324 `.c' 7325 C source file 7326 7327 `.C' 7328 `.cc' 7329 `.cp' 7330 `.cpp' 7331 `.cxx' 7332 `.c++' 7333 C++ source file 7334 7335 `.m' 7336 Objective-C source file 7337 7338 `.f' 7339 `.F' 7340 Fortran source file 7341 7342 `.mod' 7343 Modula-2 source file 7344 7345 `.s' 7346 `.S' 7347 Assembler source file. This actually behaves almost like C, but 7348 GDB does not skip over function prologues when stepping. 7349 7350 In addition, you may set the language associated with a filename 7351 extension. *Note Displaying the language: Show. 7352 7353 7354 File: gdb.info, Node: Manually, Next: Automatically, Prev: Filenames, Up: Setting 7355 7356 12.1.2 Setting the working language 7357 ----------------------------------- 7358 7359 If you allow GDB to set the language automatically, expressions are 7360 interpreted the same way in your debugging session and your program. 7361 7362 If you wish, you may set the language manually. To do this, issue 7363 the command `set language LANG', where LANG is the name of a language, 7364 such as `c' or `modula-2'. For a list of the supported languages, type 7365 `set language'. 7366 7367 Setting the language manually prevents GDB from updating the working 7368 language automatically. This can lead to confusion if you try to debug 7369 a program when the working language is not the same as the source 7370 language, when an expression is acceptable to both languages--but means 7371 different things. For instance, if the current source file were 7372 written in C, and GDB was parsing Modula-2, a command such as: 7373 7374 print a = b + c 7375 7376 might not have the effect you intended. In C, this means to add `b' 7377 and `c' and place the result in `a'. The result printed would be the 7378 value of `a'. In Modula-2, this means to compare `a' to the result of 7379 `b+c', yielding a `BOOLEAN' value. 7380 7381 7382 File: gdb.info, Node: Automatically, Prev: Manually, Up: Setting 7383 7384 12.1.3 Having GDB infer the source language 7385 ------------------------------------------- 7386 7387 To have GDB set the working language automatically, use `set language 7388 local' or `set language auto'. GDB then infers the working language. 7389 That is, when your program stops in a frame (usually by encountering a 7390 breakpoint), GDB sets the working language to the language recorded for 7391 the function in that frame. If the language for a frame is unknown 7392 (that is, if the function or block corresponding to the frame was 7393 defined in a source file that does not have a recognized extension), 7394 the current working language is not changed, and GDB issues a warning. 7395 7396 This may not seem necessary for most programs, which are written 7397 entirely in one source language. However, program modules and libraries 7398 written in one source language can be used by a main program written in 7399 a different source language. Using `set language auto' in this case 7400 frees you from having to set the working language manually. 7401 7402 7403 File: gdb.info, Node: Show, Next: Checks, Prev: Setting, Up: Languages 7404 7405 12.2 Displaying the language 7406 ============================ 7407 7408 The following commands help you find out which language is the working 7409 language, and also what language source files were written in. 7410 7411 `show language' 7412 Display the current working language. This is the language you 7413 can use with commands such as `print' to build and compute 7414 expressions that may involve variables in your program. 7415 7416 `info frame' 7417 Display the source language for this frame. This language becomes 7418 the working language if you use an identifier from this frame. 7419 *Note Information about a frame: Frame Info, to identify the other 7420 information listed here. 7421 7422 `info source' 7423 Display the source language of this source file. *Note Examining 7424 the Symbol Table: Symbols, to identify the other information 7425 listed here. 7426 7427 In unusual circumstances, you may have source files with extensions 7428 not in the standard list. You can then set the extension associated 7429 with a language explicitly: 7430 7431 `set extension-language EXT LANGUAGE' 7432 Tell GDB that source files with extension EXT are to be assumed as 7433 written in the source language LANGUAGE. 7434 7435 `info extensions' 7436 List all the filename extensions and the associated languages. 7437 7438 7439 File: gdb.info, Node: Checks, Next: Supported languages, Prev: Show, Up: Languages 7440 7441 12.3 Type and range checking 7442 ============================ 7443 7444 _Warning:_ In this release, the GDB commands for type and range 7445 checking are included, but they do not yet have any effect. This 7446 section documents the intended facilities. 7447 7448 Some languages are designed to guard you against making seemingly 7449 common errors through a series of compile- and run-time checks. These 7450 include checking the type of arguments to functions and operators, and 7451 making sure mathematical overflows are caught at run time. Checks such 7452 as these help to ensure a program's correctness once it has been 7453 compiled by eliminating type mismatches, and providing active checks 7454 for range errors when your program is running. 7455 7456 GDB can check for conditions like the above if you wish. Although 7457 GDB does not check the statements in your program, it can check 7458 expressions entered directly into GDB for evaluation via the `print' 7459 command, for example. As with the working language, GDB can also 7460 decide whether or not to check automatically based on your program's 7461 source language. *Note Supported languages: Supported languages, for 7462 the default settings of supported languages. 7463 7464 * Menu: 7465 7466 * Type Checking:: An overview of type checking 7467 * Range Checking:: An overview of range checking 7468 7469 7470 File: gdb.info, Node: Type Checking, Next: Range Checking, Up: Checks 7471 7472 12.3.1 An overview of type checking 7473 ----------------------------------- 7474 7475 Some languages, such as Modula-2, are strongly typed, meaning that the 7476 arguments to operators and functions have to be of the correct type, 7477 otherwise an error occurs. These checks prevent type mismatch errors 7478 from ever causing any run-time problems. For example, 7479 7480 1 + 2 => 3 7481 but 7482 error--> 1 + 2.3 7483 7484 The second example fails because the `CARDINAL' 1 is not 7485 type-compatible with the `REAL' 2.3. 7486 7487 For the expressions you use in GDB commands, you can tell the GDB 7488 type checker to skip checking; to treat any mismatches as errors and 7489 abandon the expression; or to only issue warnings when type mismatches 7490 occur, but evaluate the expression anyway. When you choose the last of 7491 these, GDB evaluates expressions like the second example above, but 7492 also issues a warning. 7493 7494 Even if you turn type checking off, there may be other reasons 7495 related to type that prevent GDB from evaluating an expression. For 7496 instance, GDB does not know how to add an `int' and a `struct foo'. 7497 These particular type errors have nothing to do with the language in 7498 use, and usually arise from expressions, such as the one described 7499 above, which make little sense to evaluate anyway. 7500 7501 Each language defines to what degree it is strict about type. For 7502 instance, both Modula-2 and C require the arguments to arithmetical 7503 operators to be numbers. In C, enumerated types and pointers can be 7504 represented as numbers, so that they are valid arguments to mathematical 7505 operators. *Note Supported languages: Supported languages, for further 7506 details on specific languages. 7507 7508 GDB provides some additional commands for controlling the type 7509 checker: 7510 7511 `set check type auto' 7512 Set type checking on or off based on the current working language. 7513 *Note Supported languages: Supported languages, for the default 7514 settings for each language. 7515 7516 `set check type on' 7517 `set check type off' 7518 Set type checking on or off, overriding the default setting for the 7519 current working language. Issue a warning if the setting does not 7520 match the language default. If any type mismatches occur in 7521 evaluating an expression while type checking is on, GDB prints a 7522 message and aborts evaluation of the expression. 7523 7524 `set check type warn' 7525 Cause the type checker to issue warnings, but to always attempt to 7526 evaluate the expression. Evaluating the expression may still be 7527 impossible for other reasons. For example, GDB cannot add numbers 7528 and structures. 7529 7530 `show type' 7531 Show the current setting of the type checker, and whether or not 7532 GDB is setting it automatically. 7533 7534 7535 File: gdb.info, Node: Range Checking, Prev: Type Checking, Up: Checks 7536 7537 12.3.2 An overview of range checking 7538 ------------------------------------ 7539 7540 In some languages (such as Modula-2), it is an error to exceed the 7541 bounds of a type; this is enforced with run-time checks. Such range 7542 checking is meant to ensure program correctness by making sure 7543 computations do not overflow, or indices on an array element access do 7544 not exceed the bounds of the array. 7545 7546 For expressions you use in GDB commands, you can tell GDB to treat 7547 range errors in one of three ways: ignore them, always treat them as 7548 errors and abandon the expression, or issue warnings but evaluate the 7549 expression anyway. 7550 7551 A range error can result from numerical overflow, from exceeding an 7552 array index bound, or when you type a constant that is not a member of 7553 any type. Some languages, however, do not treat overflows as an error. 7554 In many implementations of C, mathematical overflow causes the result 7555 to "wrap around" to lower values--for example, if M is the largest 7556 integer value, and S is the smallest, then 7557 7558 M + 1 => S 7559 7560 This, too, is specific to individual languages, and in some cases 7561 specific to individual compilers or machines. *Note Supported 7562 languages: Supported languages, for further details on specific 7563 languages. 7564 7565 GDB provides some additional commands for controlling the range 7566 checker: 7567 7568 `set check range auto' 7569 Set range checking on or off based on the current working language. 7570 *Note Supported languages: Supported languages, for the default 7571 settings for each language. 7572 7573 `set check range on' 7574 `set check range off' 7575 Set range checking on or off, overriding the default setting for 7576 the current working language. A warning is issued if the setting 7577 does not match the language default. If a range error occurs and 7578 range checking is on, then a message is printed and evaluation of 7579 the expression is aborted. 7580 7581 `set check range warn' 7582 Output messages when the GDB range checker detects a range error, 7583 but attempt to evaluate the expression anyway. Evaluating the 7584 expression may still be impossible for other reasons, such as 7585 accessing memory that the process does not own (a typical example 7586 from many Unix systems). 7587 7588 `show range' 7589 Show the current setting of the range checker, and whether or not 7590 it is being set automatically by GDB. 7591 7592 7593 File: gdb.info, Node: Supported languages, Next: Unsupported languages, Prev: Checks, Up: Languages 7594 7595 12.4 Supported languages 7596 ======================== 7597 7598 GDB supports C, C++, Objective-C, Fortran, Java, Pascal, assembly, 7599 Modula-2, and Ada. Some GDB features may be used in expressions 7600 regardless of the language you use: the GDB `@' and `::' operators, and 7601 the `{type}addr' construct (*note Expressions: Expressions.) can be 7602 used with the constructs of any supported language. 7603 7604 The following sections detail to what degree each source language is 7605 supported by GDB. These sections are not meant to be language 7606 tutorials or references, but serve only as a reference guide to what the 7607 GDB expression parser accepts, and what input and output formats should 7608 look like for different languages. There are many good books written 7609 on each of these languages; please look to these for a language 7610 reference or tutorial. 7611 7612 * Menu: 7613 7614 * C:: C and C++ 7615 * Objective-C:: Objective-C 7616 * Fortran:: Fortran 7617 * Pascal:: Pascal 7618 * Modula-2:: Modula-2 7619 * Ada:: Ada 7620 7621 7622 File: gdb.info, Node: C, Next: Objective-C, Up: Supported languages 7623 7624 12.4.1 C and C++ 7625 ---------------- 7626 7627 Since C and C++ are so closely related, many features of GDB apply to 7628 both languages. Whenever this is the case, we discuss those languages 7629 together. 7630 7631 The C++ debugging facilities are jointly implemented by the C++ 7632 compiler and GDB. Therefore, to debug your C++ code effectively, you 7633 must compile your C++ programs with a supported C++ compiler, such as 7634 GNU `g++', or the HP ANSI C++ compiler (`aCC'). 7635 7636 For best results when using GNU C++, use the DWARF 2 debugging 7637 format; if it doesn't work on your system, try the stabs+ debugging 7638 format. You can select those formats explicitly with the `g++' 7639 command-line options `-gdwarf-2' and `-gstabs+'. *Note Options for 7640 Debugging Your Program or GNU CC: (gcc.info)Debugging Options. 7641 7642 * Menu: 7643 7644 * C Operators:: C and C++ operators 7645 * C Constants:: C and C++ constants 7646 * C plus plus expressions:: C++ expressions 7647 * C Defaults:: Default settings for C and C++ 7648 * C Checks:: C and C++ type and range checks 7649 * Debugging C:: GDB and C 7650 * Debugging C plus plus:: GDB features for C++ 7651 7652 7653 File: gdb.info, Node: C Operators, Next: C Constants, Up: C 7654 7655 12.4.1.1 C and C++ operators 7656 ............................ 7657 7658 Operators must be defined on values of specific types. For instance, 7659 `+' is defined on numbers, but not on structures. Operators are often 7660 defined on groups of types. 7661 7662 For the purposes of C and C++, the following definitions hold: 7663 7664 * _Integral types_ include `int' with any of its storage-class 7665 specifiers; `char'; `enum'; and, for C++, `bool'. 7666 7667 * _Floating-point types_ include `float', `double', and `long 7668 double' (if supported by the target platform). 7669 7670 * _Pointer types_ include all types defined as `(TYPE *)'. 7671 7672 * _Scalar types_ include all of the above. 7673 7674 7675 The following operators are supported. They are listed here in order 7676 of increasing precedence: 7677 7678 `,' 7679 The comma or sequencing operator. Expressions in a 7680 comma-separated list are evaluated from left to right, with the 7681 result of the entire expression being the last expression 7682 evaluated. 7683 7684 `=' 7685 Assignment. The value of an assignment expression is the value 7686 assigned. Defined on scalar types. 7687 7688 `OP=' 7689 Used in an expression of the form `A OP= B', and translated to 7690 `A = A OP B'. `OP=' and `=' have the same precedence. OP is any 7691 one of the operators `|', `^', `&', `<<', `>>', `+', `-', `*', 7692 `/', `%'. 7693 7694 `?:' 7695 The ternary operator. `A ? B : C' can be thought of as: if A 7696 then B else C. A should be of an integral type. 7697 7698 `||' 7699 Logical OR. Defined on integral types. 7700 7701 `&&' 7702 Logical AND. Defined on integral types. 7703 7704 `|' 7705 Bitwise OR. Defined on integral types. 7706 7707 `^' 7708 Bitwise exclusive-OR. Defined on integral types. 7709 7710 `&' 7711 Bitwise AND. Defined on integral types. 7712 7713 `==, !=' 7714 Equality and inequality. Defined on scalar types. The value of 7715 these expressions is 0 for false and non-zero for true. 7716 7717 `<, >, <=, >=' 7718 Less than, greater than, less than or equal, greater than or equal. 7719 Defined on scalar types. The value of these expressions is 0 for 7720 false and non-zero for true. 7721 7722 `<<, >>' 7723 left shift, and right shift. Defined on integral types. 7724 7725 `@' 7726 The GDB "artificial array" operator (*note Expressions: 7727 Expressions.). 7728 7729 `+, -' 7730 Addition and subtraction. Defined on integral types, 7731 floating-point types and pointer types. 7732 7733 `*, /, %' 7734 Multiplication, division, and modulus. Multiplication and 7735 division are defined on integral and floating-point types. 7736 Modulus is defined on integral types. 7737 7738 `++, --' 7739 Increment and decrement. When appearing before a variable, the 7740 operation is performed before the variable is used in an 7741 expression; when appearing after it, the variable's value is used 7742 before the operation takes place. 7743 7744 `*' 7745 Pointer dereferencing. Defined on pointer types. Same precedence 7746 as `++'. 7747 7748 `&' 7749 Address operator. Defined on variables. Same precedence as `++'. 7750 7751 For debugging C++, GDB implements a use of `&' beyond what is 7752 allowed in the C++ language itself: you can use `&(&REF)' (or, if 7753 you prefer, simply `&&REF') to examine the address where a C++ 7754 reference variable (declared with `&REF') is stored. 7755 7756 `-' 7757 Negative. Defined on integral and floating-point types. Same 7758 precedence as `++'. 7759 7760 `!' 7761 Logical negation. Defined on integral types. Same precedence as 7762 `++'. 7763 7764 `~' 7765 Bitwise complement operator. Defined on integral types. Same 7766 precedence as `++'. 7767 7768 `., ->' 7769 Structure member, and pointer-to-structure member. For 7770 convenience, GDB regards the two as equivalent, choosing whether 7771 to dereference a pointer based on the stored type information. 7772 Defined on `struct' and `union' data. 7773 7774 `.*, ->*' 7775 Dereferences of pointers to members. 7776 7777 `[]' 7778 Array indexing. `A[I]' is defined as `*(A+I)'. Same precedence 7779 as `->'. 7780 7781 `()' 7782 Function parameter list. Same precedence as `->'. 7783 7784 `::' 7785 C++ scope resolution operator. Defined on `struct', `union', and 7786 `class' types. 7787 7788 `::' 7789 Doubled colons also represent the GDB scope operator (*note 7790 Expressions: Expressions.). Same precedence as `::', above. 7791 7792 If an operator is redefined in the user code, GDB usually attempts 7793 to invoke the redefined version instead of using the operator's 7794 predefined meaning. 7795 7796 * Menu: 7797 7798 * C Constants:: 7799 7800 7801 File: gdb.info, Node: C Constants, Next: C plus plus expressions, Prev: C Operators, Up: C 7802 7803 12.4.1.2 C and C++ constants 7804 ............................ 7805 7806 GDB allows you to express the constants of C and C++ in the following 7807 ways: 7808 7809 * Integer constants are a sequence of digits. Octal constants are 7810 specified by a leading `0' (i.e. zero), and hexadecimal constants 7811 by a leading `0x' or `0X'. Constants may also end with a letter 7812 `l', specifying that the constant should be treated as a `long' 7813 value. 7814 7815 * Floating point constants are a sequence of digits, followed by a 7816 decimal point, followed by a sequence of digits, and optionally 7817 followed by an exponent. An exponent is of the form: 7818 `e[[+]|-]NNN', where NNN is another sequence of digits. The `+' 7819 is optional for positive exponents. A floating-point constant may 7820 also end with a letter `f' or `F', specifying that the constant 7821 should be treated as being of the `float' (as opposed to the 7822 default `double') type; or with a letter `l' or `L', which 7823 specifies a `long double' constant. 7824 7825 * Enumerated constants consist of enumerated identifiers, or their 7826 integral equivalents. 7827 7828 * Character constants are a single character surrounded by single 7829 quotes (`''), or a number--the ordinal value of the corresponding 7830 character (usually its ASCII value). Within quotes, the single 7831 character may be represented by a letter or by "escape sequences", 7832 which are of the form `\NNN', where NNN is the octal representation 7833 of the character's ordinal value; or of the form `\X', where `X' 7834 is a predefined special character--for example, `\n' for newline. 7835 7836 * String constants are a sequence of character constants surrounded 7837 by double quotes (`"'). Any valid character constant (as described 7838 above) may appear. Double quotes within the string must be 7839 preceded by a backslash, so for instance `"a\"b'c"' is a string of 7840 five characters. 7841 7842 * Pointer constants are an integral value. You can also write 7843 pointers to constants using the C operator `&'. 7844 7845 * Array constants are comma-separated lists surrounded by braces `{' 7846 and `}'; for example, `{1,2,3}' is a three-element array of 7847 integers, `{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and 7848 `{&"hi", &"there", &"fred"}' is a three-element array of pointers. 7849 7850 * Menu: 7851 7852 * C plus plus expressions:: 7853 * C Defaults:: 7854 * C Checks:: 7855 7856 * Debugging C:: 7857 7858 7859 File: gdb.info, Node: C plus plus expressions, Next: C Defaults, Prev: C Constants, Up: C 7860 7861 12.4.1.3 C++ expressions 7862 ........................ 7863 7864 GDB expression handling can interpret most C++ expressions. 7865 7866 _Warning:_ GDB can only debug C++ code if you use the proper 7867 compiler and the proper debug format. Currently, GDB works best 7868 when debugging C++ code that is compiled with GCC 2.95.3 or with 7869 GCC 3.1 or newer, using the options `-gdwarf-2' or `-gstabs+'. 7870 DWARF 2 is preferred over stabs+. Most configurations of GCC emit 7871 either DWARF 2 or stabs+ as their default debug format, so you 7872 usually don't need to specify a debug format explicitly. Other 7873 compilers and/or debug formats are likely to work badly or not at 7874 all when using GDB to debug C++ code. 7875 7876 1. Member function calls are allowed; you can use expressions like 7877 7878 count = aml->GetOriginal(x, y) 7879 7880 2. While a member function is active (in the selected stack frame), 7881 your expressions have the same namespace available as the member 7882 function; that is, GDB allows implicit references to the class 7883 instance pointer `this' following the same rules as C++. 7884 7885 3. You can call overloaded functions; GDB resolves the function call 7886 to the right definition, with some restrictions. GDB does not 7887 perform overload resolution involving user-defined type 7888 conversions, calls to constructors, or instantiations of templates 7889 that do not exist in the program. It also cannot handle ellipsis 7890 argument lists or default arguments. 7891 7892 It does perform integral conversions and promotions, floating-point 7893 promotions, arithmetic conversions, pointer conversions, 7894 conversions of class objects to base classes, and standard 7895 conversions such as those of functions or arrays to pointers; it 7896 requires an exact match on the number of function arguments. 7897 7898 Overload resolution is always performed, unless you have specified 7899 `set overload-resolution off'. *Note GDB features for C++: 7900 Debugging C plus plus. 7901 7902 You must specify `set overload-resolution off' in order to use an 7903 explicit function signature to call an overloaded function, as in 7904 p 'foo(char,int)'('x', 13) 7905 7906 The GDB command-completion facility can simplify this; see *Note 7907 Command completion: Completion. 7908 7909 4. GDB understands variables declared as C++ references; you can use 7910 them in expressions just as you do in C++ source--they are 7911 automatically dereferenced. 7912 7913 In the parameter list shown when GDB displays a frame, the values 7914 of reference variables are not displayed (unlike other variables); 7915 this avoids clutter, since references are often used for large 7916 structures. The _address_ of a reference variable is always 7917 shown, unless you have specified `set print address off'. 7918 7919 5. GDB supports the C++ name resolution operator `::'--your 7920 expressions can use it just as expressions in your program do. 7921 Since one scope may be defined in another, you can use `::' 7922 repeatedly if necessary, for example in an expression like 7923 `SCOPE1::SCOPE2::NAME'. GDB also allows resolving name scope by 7924 reference to source files, in both C and C++ debugging (*note 7925 Program variables: Variables.). 7926 7927 In addition, when used with HP's C++ compiler, GDB supports calling 7928 virtual functions correctly, printing out virtual bases of objects, 7929 calling functions in a base subobject, casting objects, and invoking 7930 user-defined operators. 7931 7932 7933 File: gdb.info, Node: C Defaults, Next: C Checks, Prev: C plus plus expressions, Up: C 7934 7935 12.4.1.4 C and C++ defaults 7936 ........................... 7937 7938 If you allow GDB to set type and range checking automatically, they 7939 both default to `off' whenever the working language changes to C or 7940 C++. This happens regardless of whether you or GDB selects the working 7941 language. 7942 7943 If you allow GDB to set the language automatically, it recognizes 7944 source files whose names end with `.c', `.C', or `.cc', etc, and when 7945 GDB enters code compiled from one of these files, it sets the working 7946 language to C or C++. *Note Having GDB infer the source language: 7947 Automatically, for further details. 7948 7949 7950 File: gdb.info, Node: C Checks, Next: Debugging C, Prev: C Defaults, Up: C 7951 7952 12.4.1.5 C and C++ type and range checks 7953 ........................................ 7954 7955 By default, when GDB parses C or C++ expressions, type checking is not 7956 used. However, if you turn type checking on, GDB considers two 7957 variables type equivalent if: 7958 7959 * The two variables are structured and have the same structure, 7960 union, or enumerated tag. 7961 7962 * The two variables have the same type name, or types that have been 7963 declared equivalent through `typedef'. 7964 7965 7966 Range checking, if turned on, is done on mathematical operations. 7967 Array indices are not checked, since they are often used to index a 7968 pointer that is not itself an array. 7969 7970 7971 File: gdb.info, Node: Debugging C, Next: Debugging C plus plus, Prev: C Checks, Up: C 7972 7973 12.4.1.6 GDB and C 7974 .................. 7975 7976 The `set print union' and `show print union' commands apply to the 7977 `union' type. When set to `on', any `union' that is inside a `struct' 7978 or `class' is also printed. Otherwise, it appears as `{...}'. 7979 7980 The `@' operator aids in the debugging of dynamic arrays, formed 7981 with pointers and a memory allocation function. *Note Expressions: 7982 Expressions. 7983 7984 * Menu: 7985 7986 * Debugging C plus plus:: 7987 7988 7989 File: gdb.info, Node: Debugging C plus plus, Prev: Debugging C, Up: C 7990 7991 12.4.1.7 GDB features for C++ 7992 ............................. 7993 7994 Some GDB commands are particularly useful with C++, and some are 7995 designed specifically for use with C++. Here is a summary: 7996 7997 `breakpoint menus' 7998 When you want a breakpoint in a function whose name is overloaded, 7999 GDB breakpoint menus help you specify which function definition 8000 you want. *Note Breakpoint menus: Breakpoint Menus. 8001 8002 `rbreak REGEX' 8003 Setting breakpoints using regular expressions is helpful for 8004 setting breakpoints on overloaded functions that are not members 8005 of any special classes. *Note Setting breakpoints: Set Breaks. 8006 8007 `catch throw' 8008 `catch catch' 8009 Debug C++ exception handling using these commands. *Note Setting 8010 catchpoints: Set Catchpoints. 8011 8012 `ptype TYPENAME' 8013 Print inheritance relationships as well as other information for 8014 type TYPENAME. *Note Examining the Symbol Table: Symbols. 8015 8016 `set print demangle' 8017 `show print demangle' 8018 `set print asm-demangle' 8019 `show print asm-demangle' 8020 Control whether C++ symbols display in their source form, both when 8021 displaying code as C++ source and when displaying disassemblies. 8022 *Note Print settings: Print Settings. 8023 8024 `set print object' 8025 `show print object' 8026 Choose whether to print derived (actual) or declared types of 8027 objects. *Note Print settings: Print Settings. 8028 8029 `set print vtbl' 8030 `show print vtbl' 8031 Control the format for printing virtual function tables. *Note 8032 Print settings: Print Settings. (The `vtbl' commands do not work 8033 on programs compiled with the HP ANSI C++ compiler (`aCC').) 8034 8035 `set overload-resolution on' 8036 Enable overload resolution for C++ expression evaluation. The 8037 default is on. For overloaded functions, GDB evaluates the 8038 arguments and searches for a function whose signature matches the 8039 argument types, using the standard C++ conversion rules (see *Note 8040 C++ expressions: C plus plus expressions, for details). If it 8041 cannot find a match, it emits a message. 8042 8043 `set overload-resolution off' 8044 Disable overload resolution for C++ expression evaluation. For 8045 overloaded functions that are not class member functions, GDB 8046 chooses the first function of the specified name that it finds in 8047 the symbol table, whether or not its arguments are of the correct 8048 type. For overloaded functions that are class member functions, 8049 GDB searches for a function whose signature _exactly_ matches the 8050 argument types. 8051 8052 `show overload-resolution' 8053 Show the current setting of overload resolution. 8054 8055 `Overloaded symbol names' 8056 You can specify a particular definition of an overloaded symbol, 8057 using the same notation that is used to declare such symbols in 8058 C++: type `SYMBOL(TYPES)' rather than just SYMBOL. You can also 8059 use the GDB command-line word completion facilities to list the 8060 available choices, or to finish the type list for you. *Note 8061 Command completion: Completion, for details on how to do this. 8062 8063 8064 File: gdb.info, Node: Objective-C, Next: Fortran, Prev: C, Up: Supported languages 8065 8066 12.4.2 Objective-C 8067 ------------------ 8068 8069 This section provides information about some commands and command 8070 options that are useful for debugging Objective-C code. See also *Note 8071 info classes: Symbols, and *Note info selectors: Symbols, for a few 8072 more commands specific to Objective-C support. 8073 8074 * Menu: 8075 8076 * Method Names in Commands:: 8077 * The Print Command with Objective-C:: 8078 8079 8080 File: gdb.info, Node: Method Names in Commands, Next: The Print Command with Objective-C, Prev: Objective-C, Up: Objective-C 8081 8082 12.4.2.1 Method Names in Commands 8083 ................................. 8084 8085 The following commands have been extended to accept Objective-C method 8086 names as line specifications: 8087 8088 * `clear' 8089 8090 * `break' 8091 8092 * `info line' 8093 8094 * `jump' 8095 8096 * `list' 8097 8098 A fully qualified Objective-C method name is specified as 8099 8100 -[CLASS METHODNAME] 8101 8102 where the minus sign is used to indicate an instance method and a 8103 plus sign (not shown) is used to indicate a class method. The class 8104 name CLASS and method name METHODNAME are enclosed in brackets, similar 8105 to the way messages are specified in Objective-C source code. For 8106 example, to set a breakpoint at the `create' instance method of class 8107 `Fruit' in the program currently being debugged, enter: 8108 8109 break -[Fruit create] 8110 8111 To list ten program lines around the `initialize' class method, 8112 enter: 8113 8114 list +[NSText initialize] 8115 8116 In the current version of GDB, the plus or minus sign is required. 8117 In future versions of GDB, the plus or minus sign will be optional, but 8118 you can use it to narrow the search. It is also possible to specify 8119 just a method name: 8120 8121 break create 8122 8123 You must specify the complete method name, including any colons. If 8124 your program's source files contain more than one `create' method, 8125 you'll be presented with a numbered list of classes that implement that 8126 method. Indicate your choice by number, or type `0' to exit if none 8127 apply. 8128 8129 As another example, to clear a breakpoint established at the 8130 `makeKeyAndOrderFront:' method of the `NSWindow' class, enter: 8131 8132 clear -[NSWindow makeKeyAndOrderFront:] 8133 8134 8135 File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names in Commands, Up: Objective-C 8136 8137 12.4.2.2 The Print Command With Objective-C 8138 ........................................... 8139 8140 The print command has also been extended to accept methods. For 8141 example: 8142 8143 print -[OBJECT hash] 8144 8145 will tell GDB to send the `hash' message to OBJECT and print the 8146 result. Also, an additional command has been added, `print-object' or 8147 `po' for short, which is meant to print the description of an object. 8148 However, this command may only work with certain Objective-C libraries 8149 that have a particular hook function, `_NSPrintForDebugger', defined. 8150 8151 8152 File: gdb.info, Node: Fortran, Next: Pascal, Prev: Objective-C, Up: Supported languages 8153 8154 12.4.3 Fortran 8155 -------------- 8156 8157 GDB can be used to debug programs written in Fortran, but it currently 8158 supports only the features of Fortran 77 language. 8159 8160 Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers 8161 among them) append an underscore to the names of variables and 8162 functions. When you debug programs compiled by those compilers, you 8163 will need to refer to variables and functions with a trailing 8164 underscore. 8165 8166 * Menu: 8167 8168 * Fortran Operators:: Fortran operators and expressions 8169 * Fortran Defaults:: Default settings for Fortran 8170 * Special Fortran commands:: Special GDB commands for Fortran 8171 8172 8173 File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran 8174 8175 12.4.3.1 Fortran operators and expressions 8176 .......................................... 8177 8178 Operators must be defined on values of specific types. For instance, 8179 `+' is defined on numbers, but not on characters or other non- 8180 arithmetic types. Operators are often defined on groups of types. 8181 8182 `**' 8183 The exponentiation operator. It raises the first operand to the 8184 power of the second one. 8185 8186 `:' 8187 The range operator. Normally used in the form of array(low:high) 8188 to represent a section of array. 8189 8190 8191 File: gdb.info, Node: Fortran Defaults, Next: Special Fortran commands, Prev: Fortran Operators, Up: Fortran 8192 8193 12.4.3.2 Fortran Defaults 8194 ......................... 8195 8196 Fortran symbols are usually case-insensitive, so GDB by default uses 8197 case-insensitive matches for Fortran symbols. You can change that with 8198 the `set case-insensitive' command, see *Note Symbols::, for the 8199 details. 8200 8201 8202 File: gdb.info, Node: Special Fortran commands, Prev: Fortran Defaults, Up: Fortran 8203 8204 12.4.3.3 Special Fortran commands 8205 ................................. 8206 8207 GDB had some commands to support Fortran specific feature, such as 8208 common block displaying. 8209 8210 `info common [COMMON-NAME]' 8211 This command prints the values contained in the Fortran `COMMON' 8212 block whose name is COMMON-NAME. With no argument, the names of 8213 all `COMMON' blocks visible at current program location are 8214 printed. 8215 8216 8217 File: gdb.info, Node: Pascal, Next: Modula-2, Prev: Fortran, Up: Supported languages 8218 8219 12.4.4 Pascal 8220 ------------- 8221 8222 Debugging Pascal programs which use sets, subranges, file variables, or 8223 nested functions does not currently work. GDB does not support 8224 entering expressions, printing values, or similar features using Pascal 8225 syntax. 8226 8227 The Pascal-specific command `set print pascal_static-members' 8228 controls whether static members of Pascal objects are displayed. *Note 8229 pascal_static-members: Print Settings. 8230 8231 8232 File: gdb.info, Node: Modula-2, Next: Ada, Prev: Pascal, Up: Supported languages 8233 8234 12.4.5 Modula-2 8235 --------------- 8236 8237 The extensions made to GDB to support Modula-2 only support output from 8238 the GNU Modula-2 compiler (which is currently being developed). Other 8239 Modula-2 compilers are not currently supported, and attempting to debug 8240 executables produced by them is most likely to give an error as GDB 8241 reads in the executable's symbol table. 8242 8243 * Menu: 8244 8245 * M2 Operators:: Built-in operators 8246 * Built-In Func/Proc:: Built-in functions and procedures 8247 * M2 Constants:: Modula-2 constants 8248 * M2 Types:: Modula-2 types 8249 * M2 Defaults:: Default settings for Modula-2 8250 * Deviations:: Deviations from standard Modula-2 8251 * M2 Checks:: Modula-2 type and range checks 8252 * M2 Scope:: The scope operators `::' and `.' 8253 * GDB/M2:: GDB and Modula-2 8254 8255 8256 File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2 8257 8258 12.4.5.1 Operators 8259 .................. 8260 8261 Operators must be defined on values of specific types. For instance, 8262 `+' is defined on numbers, but not on structures. Operators are often 8263 defined on groups of types. For the purposes of Modula-2, the 8264 following definitions hold: 8265 8266 * _Integral types_ consist of `INTEGER', `CARDINAL', and their 8267 subranges. 8268 8269 * _Character types_ consist of `CHAR' and its subranges. 8270 8271 * _Floating-point types_ consist of `REAL'. 8272 8273 * _Pointer types_ consist of anything declared as `POINTER TO TYPE'. 8274 8275 * _Scalar types_ consist of all of the above. 8276 8277 * _Set types_ consist of `SET' and `BITSET' types. 8278 8279 * _Boolean types_ consist of `BOOLEAN'. 8280 8281 The following operators are supported, and appear in order of 8282 increasing precedence: 8283 8284 `,' 8285 Function argument or array index separator. 8286 8287 `:=' 8288 Assignment. The value of VAR `:=' VALUE is VALUE. 8289 8290 `<, >' 8291 Less than, greater than on integral, floating-point, or enumerated 8292 types. 8293 8294 `<=, >=' 8295 Less than or equal to, greater than or equal to on integral, 8296 floating-point and enumerated types, or set inclusion on set 8297 types. Same precedence as `<'. 8298 8299 `=, <>, #' 8300 Equality and two ways of expressing inequality, valid on scalar 8301 types. Same precedence as `<'. In GDB scripts, only `<>' is 8302 available for inequality, since `#' conflicts with the script 8303 comment character. 8304 8305 `IN' 8306 Set membership. Defined on set types and the types of their 8307 members. Same precedence as `<'. 8308 8309 `OR' 8310 Boolean disjunction. Defined on boolean types. 8311 8312 `AND, &' 8313 Boolean conjunction. Defined on boolean types. 8314 8315 `@' 8316 The GDB "artificial array" operator (*note Expressions: 8317 Expressions.). 8318 8319 `+, -' 8320 Addition and subtraction on integral and floating-point types, or 8321 union and difference on set types. 8322 8323 `*' 8324 Multiplication on integral and floating-point types, or set 8325 intersection on set types. 8326 8327 `/' 8328 Division on floating-point types, or symmetric set difference on 8329 set types. Same precedence as `*'. 8330 8331 `DIV, MOD' 8332 Integer division and remainder. Defined on integral types. Same 8333 precedence as `*'. 8334 8335 `-' 8336 Negative. Defined on `INTEGER' and `REAL' data. 8337 8338 `^' 8339 Pointer dereferencing. Defined on pointer types. 8340 8341 `NOT' 8342 Boolean negation. Defined on boolean types. Same precedence as 8343 `^'. 8344 8345 `.' 8346 `RECORD' field selector. Defined on `RECORD' data. Same 8347 precedence as `^'. 8348 8349 `[]' 8350 Array indexing. Defined on `ARRAY' data. Same precedence as `^'. 8351 8352 `()' 8353 Procedure argument list. Defined on `PROCEDURE' objects. Same 8354 precedence as `^'. 8355 8356 `::, .' 8357 GDB and Modula-2 scope operators. 8358 8359 _Warning:_ Set expressions and their operations are not yet 8360 supported, so GDB treats the use of the operator `IN', or the use 8361 of operators `+', `-', `*', `/', `=', , `<>', `#', `<=', and `>=' 8362 on sets as an error. 8363 8364 8365 File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operators, Up: Modula-2 8366 8367 12.4.5.2 Built-in functions and procedures 8368 .......................................... 8369 8370 Modula-2 also makes available several built-in procedures and functions. 8371 In describing these, the following metavariables are used: 8372 8373 A 8374 represents an `ARRAY' variable. 8375 8376 C 8377 represents a `CHAR' constant or variable. 8378 8379 I 8380 represents a variable or constant of integral type. 8381 8382 M 8383 represents an identifier that belongs to a set. Generally used in 8384 the same function with the metavariable S. The type of S should 8385 be `SET OF MTYPE' (where MTYPE is the type of M). 8386 8387 N 8388 represents a variable or constant of integral or floating-point 8389 type. 8390 8391 R 8392 represents a variable or constant of floating-point type. 8393 8394 T 8395 represents a type. 8396 8397 V 8398 represents a variable. 8399 8400 X 8401 represents a variable or constant of one of many types. See the 8402 explanation of the function for details. 8403 8404 All Modula-2 built-in procedures also return a result, described 8405 below. 8406 8407 `ABS(N)' 8408 Returns the absolute value of N. 8409 8410 `CAP(C)' 8411 If C is a lower case letter, it returns its upper case equivalent, 8412 otherwise it returns its argument. 8413 8414 `CHR(I)' 8415 Returns the character whose ordinal value is I. 8416 8417 `DEC(V)' 8418 Decrements the value in the variable V by one. Returns the new 8419 value. 8420 8421 `DEC(V,I)' 8422 Decrements the value in the variable V by I. Returns the new 8423 value. 8424 8425 `EXCL(M,S)' 8426 Removes the element M from the set S. Returns the new set. 8427 8428 `FLOAT(I)' 8429 Returns the floating point equivalent of the integer I. 8430 8431 `HIGH(A)' 8432 Returns the index of the last member of A. 8433 8434 `INC(V)' 8435 Increments the value in the variable V by one. Returns the new 8436 value. 8437 8438 `INC(V,I)' 8439 Increments the value in the variable V by I. Returns the new 8440 value. 8441 8442 `INCL(M,S)' 8443 Adds the element M to the set S if it is not already there. 8444 Returns the new set. 8445 8446 `MAX(T)' 8447 Returns the maximum value of the type T. 8448 8449 `MIN(T)' 8450 Returns the minimum value of the type T. 8451 8452 `ODD(I)' 8453 Returns boolean TRUE if I is an odd number. 8454 8455 `ORD(X)' 8456 Returns the ordinal value of its argument. For example, the 8457 ordinal value of a character is its ASCII value (on machines 8458 supporting the ASCII character set). X must be of an ordered 8459 type, which include integral, character and enumerated types. 8460 8461 `SIZE(X)' 8462 Returns the size of its argument. X can be a variable or a type. 8463 8464 `TRUNC(R)' 8465 Returns the integral part of R. 8466 8467 `VAL(T,I)' 8468 Returns the member of the type T whose ordinal value is I. 8469 8470 _Warning:_ Sets and their operations are not yet supported, so 8471 GDB treats the use of procedures `INCL' and `EXCL' as an error. 8472 8473 8474 File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc, Up: Modula-2 8475 8476 12.4.5.3 Constants 8477 .................. 8478 8479 GDB allows you to express the constants of Modula-2 in the following 8480 ways: 8481 8482 * Integer constants are simply a sequence of digits. When used in an 8483 expression, a constant is interpreted to be type-compatible with 8484 the rest of the expression. Hexadecimal integers are specified by 8485 a trailing `H', and octal integers by a trailing `B'. 8486 8487 * Floating point constants appear as a sequence of digits, followed 8488 by a decimal point and another sequence of digits. An optional 8489 exponent can then be specified, in the form `E[+|-]NNN', where 8490 `[+|-]NNN' is the desired exponent. All of the digits of the 8491 floating point constant must be valid decimal (base 10) digits. 8492 8493 * Character constants consist of a single character enclosed by a 8494 pair of like quotes, either single (`'') or double (`"'). They may 8495 also be expressed by their ordinal value (their ASCII value, 8496 usually) followed by a `C'. 8497 8498 * String constants consist of a sequence of characters enclosed by a 8499 pair of like quotes, either single (`'') or double (`"'). Escape 8500 sequences in the style of C are also allowed. *Note C and C++ 8501 constants: C Constants, for a brief explanation of escape 8502 sequences. 8503 8504 * Enumerated constants consist of an enumerated identifier. 8505 8506 * Boolean constants consist of the identifiers `TRUE' and `FALSE'. 8507 8508 * Pointer constants consist of integral values only. 8509 8510 * Set constants are not yet supported. 8511 8512 8513 File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: Modula-2 8514 8515 12.4.5.4 Modula-2 Types 8516 ....................... 8517 8518 Currently GDB can print the following data types in Modula-2 syntax: 8519 array types, record types, set types, pointer types, procedure types, 8520 enumerated types, subrange types and base types. You can also print 8521 the contents of variables declared using these type. This section 8522 gives a number of simple source code examples together with sample GDB 8523 sessions. 8524 8525 The first example contains the following section of code: 8526 8527 VAR 8528 s: SET OF CHAR ; 8529 r: [20..40] ; 8530 8531 and you can request GDB to interrogate the type and value of `r' and 8532 `s'. 8533 8534 (gdb) print s 8535 {'A'..'C', 'Z'} 8536 (gdb) ptype s 8537 SET OF CHAR 8538 (gdb) print r 8539 21 8540 (gdb) ptype r 8541 [20..40] 8542 8543 Likewise if your source code declares `s' as: 8544 8545 VAR 8546 s: SET ['A'..'Z'] ; 8547 8548 then you may query the type of `s' by: 8549 8550 (gdb) ptype s 8551 type = SET ['A'..'Z'] 8552 8553 Note that at present you cannot interactively manipulate set 8554 expressions using the debugger. 8555 8556 The following example shows how you might declare an array in 8557 Modula-2 and how you can interact with GDB to print its type and 8558 contents: 8559 8560 VAR 8561 s: ARRAY [-10..10] OF CHAR ; 8562 8563 (gdb) ptype s 8564 ARRAY [-10..10] OF CHAR 8565 8566 Note that the array handling is not yet complete and although the 8567 type is printed correctly, expression handling still assumes that all 8568 arrays have a lower bound of zero and not `-10' as in the example 8569 above. Unbounded arrays are also not yet recognized in GDB. 8570 8571 Here are some more type related Modula-2 examples: 8572 8573 TYPE 8574 colour = (blue, red, yellow, green) ; 8575 t = [blue..yellow] ; 8576 VAR 8577 s: t ; 8578 BEGIN 8579 s := blue ; 8580 8581 The GDB interaction shows how you can query the data type and value of 8582 a variable. 8583 8584 (gdb) print s 8585 $1 = blue 8586 (gdb) ptype t 8587 type = [blue..yellow] 8588 8589 In this example a Modula-2 array is declared and its contents 8590 displayed. Observe that the contents are written in the same way as 8591 their `C' counterparts. 8592 8593 VAR 8594 s: ARRAY [1..5] OF CARDINAL ; 8595 BEGIN 8596 s[1] := 1 ; 8597 8598 (gdb) print s 8599 $1 = {1, 0, 0, 0, 0} 8600 (gdb) ptype s 8601 type = ARRAY [1..5] OF CARDINAL 8602 8603 The Modula-2 language interface to GDB also understands pointer 8604 types as shown in this example: 8605 8606 VAR 8607 s: POINTER TO ARRAY [1..5] OF CARDINAL ; 8608 BEGIN 8609 NEW(s) ; 8610 s^[1] := 1 ; 8611 8612 and you can request that GDB describes the type of `s'. 8613 8614 (gdb) ptype s 8615 type = POINTER TO ARRAY [1..5] OF CARDINAL 8616 8617 GDB handles compound types as we can see in this example. Here we 8618 combine array types, record types, pointer types and subrange types: 8619 8620 TYPE 8621 foo = RECORD 8622 f1: CARDINAL ; 8623 f2: CHAR ; 8624 f3: myarray ; 8625 END ; 8626 8627 myarray = ARRAY myrange OF CARDINAL ; 8628 myrange = [-2..2] ; 8629 VAR 8630 s: POINTER TO ARRAY myrange OF foo ; 8631 8632 and you can ask GDB to describe the type of `s' as shown below. 8633 8634 (gdb) ptype s 8635 type = POINTER TO ARRAY [-2..2] OF foo = RECORD 8636 f1 : CARDINAL; 8637 f2 : CHAR; 8638 f3 : ARRAY [-2..2] OF CARDINAL; 8639 END 8640 8641 8642 File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Modula-2 8643 8644 12.4.5.5 Modula-2 defaults 8645 .......................... 8646 8647 If type and range checking are set automatically by GDB, they both 8648 default to `on' whenever the working language changes to Modula-2. 8649 This happens regardless of whether you or GDB selected the working 8650 language. 8651 8652 If you allow GDB to set the language automatically, then entering 8653 code compiled from a file whose name ends with `.mod' sets the working 8654 language to Modula-2. *Note Having GDB set the language automatically: 8655 Automatically, for further details. 8656 8657 8658 File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Modula-2 8659 8660 12.4.5.6 Deviations from standard Modula-2 8661 .......................................... 8662 8663 A few changes have been made to make Modula-2 programs easier to debug. 8664 This is done primarily via loosening its type strictness: 8665 8666 * Unlike in standard Modula-2, pointer constants can be formed by 8667 integers. This allows you to modify pointer variables during 8668 debugging. (In standard Modula-2, the actual address contained in 8669 a pointer variable is hidden from you; it can only be modified 8670 through direct assignment to another pointer variable or 8671 expression that returned a pointer.) 8672 8673 * C escape sequences can be used in strings and characters to 8674 represent non-printable characters. GDB prints out strings with 8675 these escape sequences embedded. Single non-printable characters 8676 are printed using the `CHR(NNN)' format. 8677 8678 * The assignment operator (`:=') returns the value of its right-hand 8679 argument. 8680 8681 * All built-in procedures both modify _and_ return their argument. 8682 8683 8684 File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modula-2 8685 8686 12.4.5.7 Modula-2 type and range checks 8687 ....................................... 8688 8689 _Warning:_ in this release, GDB does not yet perform type or range 8690 checking. 8691 8692 GDB considers two Modula-2 variables type equivalent if: 8693 8694 * They are of types that have been declared equivalent via a `TYPE 8695 T1 = T2' statement 8696 8697 * They have been declared on the same line. (Note: This is true of 8698 the GNU Modula-2 compiler, but it may not be true of other 8699 compilers.) 8700 8701 As long as type checking is enabled, any attempt to combine variables 8702 whose types are not equivalent is an error. 8703 8704 Range checking is done on all mathematical operations, assignment, 8705 array index bounds, and all built-in functions and procedures. 8706 8707 8708 File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2 8709 8710 12.4.5.8 The scope operators `::' and `.' 8711 ......................................... 8712 8713 There are a few subtle differences between the Modula-2 scope operator 8714 (`.') and the GDB scope operator (`::'). The two have similar syntax: 8715 8716 8717 MODULE . ID 8718 SCOPE :: ID 8719 8720 where SCOPE is the name of a module or a procedure, MODULE the name of 8721 a module, and ID is any declared identifier within your program, except 8722 another module. 8723 8724 Using the `::' operator makes GDB search the scope specified by 8725 SCOPE for the identifier ID. If it is not found in the specified 8726 scope, then GDB searches all scopes enclosing the one specified by 8727 SCOPE. 8728 8729 Using the `.' operator makes GDB search the current scope for the 8730 identifier specified by ID that was imported from the definition module 8731 specified by MODULE. With this operator, it is an error if the 8732 identifier ID was not imported from definition module MODULE, or if ID 8733 is not an identifier in MODULE. 8734 8735 8736 File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2 8737 8738 12.4.5.9 GDB and Modula-2 8739 ......................... 8740 8741 Some GDB commands have little use when debugging Modula-2 programs. 8742 Five subcommands of `set print' and `show print' apply specifically to 8743 C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'. 8744 The first four apply to C++, and the last to the C `union' type, which 8745 has no direct analogue in Modula-2. 8746 8747 The `@' operator (*note Expressions: Expressions.), while available 8748 with any language, is not useful with Modula-2. Its intent is to aid 8749 the debugging of "dynamic arrays", which cannot be created in Modula-2 8750 as they can in C or C++. However, because an address can be specified 8751 by an integral constant, the construct `{TYPE}ADREXP' is still useful. 8752 8753 In GDB scripts, the Modula-2 inequality operator `#' is interpreted 8754 as the beginning of a comment. Use `<>' instead. 8755 8756 8757 File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported languages 8758 8759 12.4.6 Ada 8760 ---------- 8761 8762 The extensions made to GDB for Ada only support output from the GNU Ada 8763 (GNAT) compiler. Other Ada compilers are not currently supported, and 8764 attempting to debug executables produced by them is most likely to be 8765 difficult. 8766 8767 * Menu: 8768 8769 * Ada Mode Intro:: General remarks on the Ada syntax 8770 and semantics supported by Ada mode 8771 in GDB. 8772 * Omissions from Ada:: Restrictions on the Ada expression syntax. 8773 * Additions to Ada:: Extensions of the Ada expression syntax. 8774 * Stopping Before Main Program:: Debugging the program during elaboration. 8775 * Ada Glitches:: Known peculiarities of Ada mode. 8776 8777 8778 File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada 8779 8780 12.4.6.1 Introduction 8781 ..................... 8782 8783 The Ada mode of GDB supports a fairly large subset of Ada expression 8784 syntax, with some extensions. The philosophy behind the design of this 8785 subset is 8786 8787 * That GDB should provide basic literals and access to operations for 8788 arithmetic, dereferencing, field selection, indexing, and 8789 subprogram calls, leaving more sophisticated computations to 8790 subprograms written into the program (which therefore may be 8791 called from GDB). 8792 8793 * That type safety and strict adherence to Ada language restrictions 8794 are not particularly important to the GDB user. 8795 8796 * That brevity is important to the GDB user. 8797 8798 Thus, for brevity, the debugger acts as if there were implicit 8799 `with' and `use' clauses in effect for all user-written packages, 8800 making it unnecessary to fully qualify most names with their packages, 8801 regardless of context. Where this causes ambiguity, GDB asks the 8802 user's intent. 8803 8804 The debugger will start in Ada mode if it detects an Ada main 8805 program. As for other languages, it will enter Ada mode when stopped 8806 in a program that was translated from an Ada source file. 8807 8808 While in Ada mode, you may use `-' for comments. This is useful 8809 mostly for documenting command files. The standard GDB comment (`#') 8810 still works at the beginning of a line in Ada mode, but not in the 8811 middle (to allow based literals). 8812 8813 The debugger supports limited overloading. Given a subprogram call 8814 in which the function symbol has multiple definitions, it will use the 8815 number of actual parameters and some information about their types to 8816 attempt to narrow the set of definitions. It also makes very limited 8817 use of context, preferring procedures to functions in the context of 8818 the `call' command, and functions to procedures elsewhere. 8819 8820 8821 File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada Mode Intro, Up: Ada 8822 8823 12.4.6.2 Omissions from Ada 8824 ........................... 8825 8826 Here are the notable omissions from the subset: 8827 8828 * Only a subset of the attributes are supported: 8829 8830 - 'First, 'Last, and 'Length on array objects (not on types 8831 and subtypes). 8832 8833 - 'Min and 'Max. 8834 8835 - 'Pos and 'Val. 8836 8837 - 'Tag. 8838 8839 - 'Range on array objects (not subtypes), but only as the right 8840 operand of the membership (`in') operator. 8841 8842 - 'Access, 'Unchecked_Access, and 'Unrestricted_Access (a GNAT 8843 extension). 8844 8845 - 'Address. 8846 8847 * The names in `Characters.Latin_1' are not available and 8848 concatenation is not implemented. Thus, escape characters in 8849 strings are not currently available. 8850 8851 * Equality tests (`=' and `/=') on arrays test for bitwise equality 8852 of representations. They will generally work correctly for 8853 strings and arrays whose elements have integer or enumeration 8854 types. They may not work correctly for arrays whose element types 8855 have user-defined equality, for arrays of real values (in 8856 particular, IEEE-conformant floating point, because of negative 8857 zeroes and NaNs), and for arrays whose elements contain unused 8858 bits with indeterminate values. 8859 8860 * The other component-by-component array operations (`and', `or', 8861 `xor', `not', and relational tests other than equality) are not 8862 implemented. 8863 8864 * There is limited support for array and record aggregates. They are 8865 permitted only on the right sides of assignments, as in these 8866 examples: 8867 8868 set An_Array := (1, 2, 3, 4, 5, 6) 8869 set An_Array := (1, others => 0) 8870 set An_Array := (0|4 => 1, 1..3 => 2, 5 => 6) 8871 set A_2D_Array := ((1, 2, 3), (4, 5, 6), (7, 8, 9)) 8872 set A_Record := (1, "Peter", True); 8873 set A_Record := (Name => "Peter", Id => 1, Alive => True) 8874 8875 Changing a discriminant's value by assigning an aggregate has an 8876 undefined effect if that discriminant is used within the record. 8877 However, you can first modify discriminants by directly assigning 8878 to them (which normally would not be allowed in Ada), and then 8879 performing an aggregate assignment. For example, given a variable 8880 `A_Rec' declared to have a type such as: 8881 8882 type Rec (Len : Small_Integer := 0) is record 8883 Id : Integer; 8884 Vals : IntArray (1 .. Len); 8885 end record; 8886 8887 you can assign a value with a different size of `Vals' with two 8888 assignments: 8889 8890 set A_Rec.Len := 4 8891 set A_Rec := (Id => 42, Vals => (1, 2, 3, 4)) 8892 8893 As this example also illustrates, GDB is very loose about the usual 8894 rules concerning aggregates. You may leave out some of the 8895 components of an array or record aggregate (such as the `Len' 8896 component in the assignment to `A_Rec' above); they will retain 8897 their original values upon assignment. You may freely use dynamic 8898 values as indices in component associations. You may even use 8899 overlapping or redundant component associations, although which 8900 component values are assigned in such cases is not defined. 8901 8902 * Calls to dispatching subprograms are not implemented. 8903 8904 * The overloading algorithm is much more limited (i.e., less 8905 selective) than that of real Ada. It makes only limited use of 8906 the context in which a subexpression appears to resolve its 8907 meaning, and it is much looser in its rules for allowing type 8908 matches. As a result, some function calls will be ambiguous, and 8909 the user will be asked to choose the proper resolution. 8910 8911 * The `new' operator is not implemented. 8912 8913 * Entry calls are not implemented. 8914 8915 * Aside from printing, arithmetic operations on the native VAX 8916 floating-point formats are not supported. 8917 8918 * It is not possible to slice a packed array. 8919 8920 8921 File: gdb.info, Node: Additions to Ada, Next: Stopping Before Main Program, Prev: Omissions from Ada, Up: Ada 8922 8923 12.4.6.3 Additions to Ada 8924 ......................... 8925 8926 As it does for other languages, GDB makes certain generic extensions to 8927 Ada (*note Expressions::): 8928 8929 * If the expression E is a variable residing in memory (typically a 8930 local variable or array element) and N is a positive integer, then 8931 `E@N' displays the values of E and the N-1 adjacent variables 8932 following it in memory as an array. In Ada, this operator is 8933 generally not necessary, since its prime use is in displaying 8934 parts of an array, and slicing will usually do this in Ada. 8935 However, there are occasional uses when debugging programs in 8936 which certain debugging information has been optimized away. 8937 8938 * `B::VAR' means "the variable named VAR that appears in function or 8939 file B." When B is a file name, you must typically surround it in 8940 single quotes. 8941 8942 * The expression `{TYPE} ADDR' means "the variable of type TYPE that 8943 appears at address ADDR." 8944 8945 * A name starting with `$' is a convenience variable (*note 8946 Convenience Vars::) or a machine register (*note Registers::). 8947 8948 In addition, GDB provides a few other shortcuts and outright 8949 additions specific to Ada: 8950 8951 * The assignment statement is allowed as an expression, returning 8952 its right-hand operand as its value. Thus, you may enter 8953 8954 set x := y + 3 8955 print A(tmp := y + 1) 8956 8957 * The semicolon is allowed as an "operator," returning as its value 8958 the value of its right-hand operand. This allows, for example, 8959 complex conditional breaks: 8960 8961 break f 8962 condition 1 (report(i); k += 1; A(k) > 100) 8963 8964 * Rather than use catenation and symbolic character names to 8965 introduce special characters into strings, one may instead use a 8966 special bracket notation, which is also used to print strings. A 8967 sequence of characters of the form `["XX"]' within a string or 8968 character literal denotes the (single) character whose numeric 8969 encoding is XX in hexadecimal. The sequence of characters `["""]' 8970 also denotes a single quotation mark in strings. For example, 8971 "One line.["0a"]Next line.["0a"]" 8972 contains an ASCII newline character (`Ada.Characters.Latin_1.LF') 8973 after each period. 8974 8975 * The subtype used as a prefix for the attributes 'Pos, 'Min, and 8976 'Max is optional (and is ignored in any case). For example, it is 8977 valid to write 8978 8979 print 'max(x, y) 8980 8981 * When printing arrays, GDB uses positional notation when the array 8982 has a lower bound of 1, and uses a modified named notation 8983 otherwise. For example, a one-dimensional array of three integers 8984 with a lower bound of 3 might print as 8985 8986 (3 => 10, 17, 1) 8987 8988 That is, in contrast to valid Ada, only the first component has a 8989 `=>' clause. 8990 8991 * You may abbreviate attributes in expressions with any unique, 8992 multi-character subsequence of their names (an exact match gets 8993 preference). For example, you may use a'len, a'gth, or a'lh in 8994 place of a'length. 8995 8996 * Since Ada is case-insensitive, the debugger normally maps 8997 identifiers you type to lower case. The GNAT compiler uses 8998 upper-case characters for some of its internal identifiers, which 8999 are normally of no interest to users. For the rare occasions when 9000 you actually have to look at them, enclose them in angle brackets 9001 to avoid the lower-case mapping. For example, 9002 gdb print <JMPBUF_SAVE>[0] 9003 9004 * Printing an object of class-wide type or dereferencing an 9005 access-to-class-wide value will display all the components of the 9006 object's specific type (as indicated by its run-time tag). 9007 Likewise, component selection on such a value will operate on the 9008 specific type of the object. 9009 9010 9011 9012 File: gdb.info, Node: Stopping Before Main Program, Next: Ada Glitches, Prev: Additions to Ada, Up: Ada 9013 9014 12.4.6.4 Stopping at the Very Beginning 9015 ....................................... 9016 9017 It is sometimes necessary to debug the program during elaboration, and 9018 before reaching the main procedure. As defined in the Ada Reference 9019 Manual, the elaboration code is invoked from a procedure called 9020 `adainit'. To run your program up to the beginning of elaboration, 9021 simply use the following two commands: `tbreak adainit' and `run'. 9022 9023 9024 File: gdb.info, Node: Ada Glitches, Prev: Stopping Before Main Program, Up: Ada 9025 9026 12.4.6.5 Known Peculiarities of Ada Mode 9027 ........................................ 9028 9029 Besides the omissions listed previously (*note Omissions from Ada::), 9030 we know of several problems with and limitations of Ada mode in GDB, 9031 some of which will be fixed with planned future releases of the debugger 9032 and the GNU Ada compiler. 9033 9034 * Currently, the debugger has insufficient information to determine 9035 whether certain pointers represent pointers to objects or the 9036 objects themselves. Thus, the user may have to tack an extra 9037 `.all' after an expression to get it printed properly. 9038 9039 * Static constants that the compiler chooses not to materialize as 9040 objects in storage are invisible to the debugger. 9041 9042 * Named parameter associations in function argument lists are 9043 ignored (the argument lists are treated as positional). 9044 9045 * Many useful library packages are currently invisible to the 9046 debugger. 9047 9048 * Fixed-point arithmetic, conversions, input, and output is carried 9049 out using floating-point arithmetic, and may give results that 9050 only approximate those on the host machine. 9051 9052 * The type of the 'Address attribute may not be `System.Address'. 9053 9054 * The GNAT compiler never generates the prefix `Standard' for any of 9055 the standard symbols defined by the Ada language. GDB knows about 9056 this: it will strip the prefix from names when you use it, and 9057 will never look for a name you have so qualified among local 9058 symbols, nor match against symbols in other packages or 9059 subprograms. If you have defined entities anywhere in your 9060 program other than parameters and local variables whose simple 9061 names match names in `Standard', GNAT's lack of qualification here 9062 can cause confusion. When this happens, you can usually resolve 9063 the confusion by qualifying the problematic names with package 9064 `Standard' explicitly. 9065 9066 9067 File: gdb.info, Node: Unsupported languages, Prev: Supported languages, Up: Languages 9068 9069 12.5 Unsupported languages 9070 ========================== 9071 9072 In addition to the other fully-supported programming languages, GDB 9073 also provides a pseudo-language, called `minimal'. It does not 9074 represent a real programming language, but provides a set of 9075 capabilities close to what the C or assembly languages provide. This 9076 should allow most simple operations to be performed while debugging an 9077 application that uses a language currently not supported by GDB. 9078 9079 If the language is set to `auto', GDB will automatically select this 9080 language if the current frame corresponds to an unsupported language. 9081 9082 9083 File: gdb.info, Node: Symbols, Next: Altering, Prev: Languages, Up: Top 9084 9085 13 Examining the Symbol Table 9086 ***************************** 9087 9088 The commands described in this chapter allow you to inquire about the 9089 symbols (names of variables, functions and types) defined in your 9090 program. This information is inherent in the text of your program and 9091 does not change as your program executes. GDB finds it in your 9092 program's symbol table, in the file indicated when you started GDB 9093 (*note Choosing files: File Options.), or by one of the file-management 9094 commands (*note Commands to specify files: Files.). 9095 9096 Occasionally, you may need to refer to symbols that contain unusual 9097 characters, which GDB ordinarily treats as word delimiters. The most 9098 frequent case is in referring to static variables in other source files 9099 (*note Program variables: Variables.). File names are recorded in 9100 object files as debugging symbols, but GDB would ordinarily parse a 9101 typical file name, like `foo.c', as the three words `foo' `.' `c'. To 9102 allow GDB to recognize `foo.c' as a single symbol, enclose it in single 9103 quotes; for example, 9104 9105 p 'foo.c'::x 9106 9107 looks up the value of `x' in the scope of the file `foo.c'. 9108 9109 `set case-sensitive on' 9110 `set case-sensitive off' 9111 `set case-sensitive auto' 9112 Normally, when GDB looks up symbols, it matches their names with 9113 case sensitivity determined by the current source language. 9114 Occasionally, you may wish to control that. The command `set 9115 case-sensitive' lets you do that by specifying `on' for 9116 case-sensitive matches or `off' for case-insensitive ones. If you 9117 specify `auto', case sensitivity is reset to the default suitable 9118 for the source language. The default is case-sensitive matches 9119 for all languages except for Fortran, for which the default is 9120 case-insensitive matches. 9121 9122 `show case-sensitive' 9123 This command shows the current setting of case sensitivity for 9124 symbols lookups. 9125 9126 `info address SYMBOL' 9127 Describe where the data for SYMBOL is stored. For a register 9128 variable, this says which register it is kept in. For a 9129 non-register local variable, this prints the stack-frame offset at 9130 which the variable is always stored. 9131 9132 Note the contrast with `print &SYMBOL', which does not work at all 9133 for a register variable, and for a stack local variable prints the 9134 exact address of the current instantiation of the variable. 9135 9136 `info symbol ADDR' 9137 Print the name of a symbol which is stored at the address ADDR. 9138 If no symbol is stored exactly at ADDR, GDB prints the nearest 9139 symbol and an offset from it: 9140 9141 (gdb) info symbol 0x54320 9142 _initialize_vx + 396 in section .text 9143 9144 This is the opposite of the `info address' command. You can use 9145 it to find out the name of a variable or a function given its 9146 address. 9147 9148 `whatis [ARG]' 9149 Print the data type of ARG, which can be either an expression or a 9150 data type. With no argument, print the data type of `$', the last 9151 value in the value history. If ARG is an expression, it is not 9152 actually evaluated, and any side-effecting operations (such as 9153 assignments or function calls) inside it do not take place. If 9154 ARG is a type name, it may be the name of a type or typedef, or 9155 for C code it may have the form `class CLASS-NAME', `struct 9156 STRUCT-TAG', `union UNION-TAG' or `enum ENUM-TAG'. *Note 9157 Expressions: Expressions. 9158 9159 `ptype [ARG]' 9160 `ptype' accepts the same arguments as `whatis', but prints a 9161 detailed description of the type, instead of just the name of the 9162 type. *Note Expressions: Expressions. 9163 9164 For example, for this variable declaration: 9165 9166 struct complex {double real; double imag;} v; 9167 9168 the two commands give this output: 9169 9170 (gdb) whatis v 9171 type = struct complex 9172 (gdb) ptype v 9173 type = struct complex { 9174 double real; 9175 double imag; 9176 } 9177 9178 As with `whatis', using `ptype' without an argument refers to the 9179 type of `$', the last value in the value history. 9180 9181 Sometimes, programs use opaque data types or incomplete 9182 specifications of complex data structure. If the debug 9183 information included in the program does not allow GDB to display 9184 a full declaration of the data type, it will say `<incomplete 9185 type>'. For example, given these declarations: 9186 9187 struct foo; 9188 struct foo *fooptr; 9189 9190 but no definition for `struct foo' itself, GDB will say: 9191 9192 (gdb) ptype foo 9193 $1 = <incomplete type> 9194 9195 "Incomplete type" is C terminology for data types that are not 9196 completely specified. 9197 9198 `info types REGEXP' 9199 `info types' 9200 Print a brief description of all types whose names match the 9201 regular expression REGEXP (or all types in your program, if you 9202 supply no argument). Each complete typename is matched as though 9203 it were a complete line; thus, `i type value' gives information on 9204 all types in your program whose names include the string `value', 9205 but `i type ^value$' gives information only on types whose complete 9206 name is `value'. 9207 9208 This command differs from `ptype' in two ways: first, like 9209 `whatis', it does not print a detailed description; second, it 9210 lists all source files where a type is defined. 9211 9212 `info scope LOCATION' 9213 List all the variables local to a particular scope. This command 9214 accepts a LOCATION argument--a function name, a source line, or an 9215 address preceded by a `*', and prints all the variables local to 9216 the scope defined by that location. For example: 9217 9218 (gdb) info scope command_line_handler 9219 Scope for command_line_handler: 9220 Symbol rl is an argument at stack/frame offset 8, length 4. 9221 Symbol linebuffer is in static storage at address 0x150a18, length 4. 9222 Symbol linelength is in static storage at address 0x150a1c, length 4. 9223 Symbol p is a local variable in register $esi, length 4. 9224 Symbol p1 is a local variable in register $ebx, length 4. 9225 Symbol nline is a local variable in register $edx, length 4. 9226 Symbol repeat is a local variable at frame offset -8, length 4. 9227 9228 This command is especially useful for determining what data to 9229 collect during a "trace experiment", see *Note collect: Tracepoint 9230 Actions. 9231 9232 `info source' 9233 Show information about the current source file--that is, the 9234 source file for the function containing the current point of 9235 execution: 9236 * the name of the source file, and the directory containing it, 9237 9238 * the directory it was compiled in, 9239 9240 * its length, in lines, 9241 9242 * which programming language it is written in, 9243 9244 * whether the executable includes debugging information for 9245 that file, and if so, what format the information is in 9246 (e.g., STABS, Dwarf 2, etc.), and 9247 9248 * whether the debugging information includes information about 9249 preprocessor macros. 9250 9251 `info sources' 9252 Print the names of all source files in your program for which 9253 there is debugging information, organized into two lists: files 9254 whose symbols have already been read, and files whose symbols will 9255 be read when needed. 9256 9257 `info functions' 9258 Print the names and data types of all defined functions. 9259 9260 `info functions REGEXP' 9261 Print the names and data types of all defined functions whose 9262 names contain a match for regular expression REGEXP. Thus, `info 9263 fun step' finds all functions whose names include `step'; `info 9264 fun ^step' finds those whose names start with `step'. If a 9265 function name contains characters that conflict with the regular 9266 expression language (e.g. `operator*()'), they may be quoted with 9267 a backslash. 9268 9269 `info variables' 9270 Print the names and data types of all variables that are declared 9271 outside of functions (i.e. excluding local variables). 9272 9273 `info variables REGEXP' 9274 Print the names and data types of all variables (except for local 9275 variables) whose names contain a match for regular expression 9276 REGEXP. 9277 9278 `info classes' 9279 `info classes REGEXP' 9280 Display all Objective-C classes in your program, or (with the 9281 REGEXP argument) all those matching a particular regular 9282 expression. 9283 9284 `info selectors' 9285 `info selectors REGEXP' 9286 Display all Objective-C selectors in your program, or (with the 9287 REGEXP argument) all those matching a particular regular 9288 expression. 9289 9290 Some systems allow individual object files that make up your 9291 program to be replaced without stopping and restarting your 9292 program. For example, in VxWorks you can simply recompile a 9293 defective object file and keep on running. If you are running on 9294 one of these systems, you can allow GDB to reload the symbols for 9295 automatically relinked modules: 9296 9297 `set symbol-reloading on' 9298 Replace symbol definitions for the corresponding source file 9299 when an object file with a particular name is seen again. 9300 9301 `set symbol-reloading off' 9302 Do not replace symbol definitions when encountering object 9303 files of the same name more than once. This is the default 9304 state; if you are not running on a system that permits 9305 automatic relinking of modules, you should leave 9306 `symbol-reloading' off, since otherwise GDB may discard 9307 symbols when linking large programs, that may contain several 9308 modules (from different directories or libraries) with the 9309 same name. 9310 9311 `show symbol-reloading' 9312 Show the current `on' or `off' setting. 9313 9314 `set opaque-type-resolution on' 9315 Tell GDB to resolve opaque types. An opaque type is a type 9316 declared as a pointer to a `struct', `class', or `union'--for 9317 example, `struct MyType *'--that is used in one source file 9318 although the full declaration of `struct MyType' is in another 9319 source file. The default is on. 9320 9321 A change in the setting of this subcommand will not take effect 9322 until the next time symbols for a file are loaded. 9323 9324 `set opaque-type-resolution off' 9325 Tell GDB not to resolve opaque types. In this case, the type is 9326 printed as follows: 9327 {<no data fields>} 9328 9329 `show opaque-type-resolution' 9330 Show whether opaque types are resolved or not. 9331 9332 `maint print symbols FILENAME' 9333 `maint print psymbols FILENAME' 9334 `maint print msymbols FILENAME' 9335 Write a dump of debugging symbol data into the file FILENAME. 9336 These commands are used to debug the GDB symbol-reading code. Only 9337 symbols with debugging data are included. If you use `maint print 9338 symbols', GDB includes all the symbols for which it has already 9339 collected full details: that is, FILENAME reflects symbols for 9340 only those files whose symbols GDB has read. You can use the 9341 command `info sources' to find out which files these are. If you 9342 use `maint print psymbols' instead, the dump shows information 9343 about symbols that GDB only knows partially--that is, symbols 9344 defined in files that GDB has skimmed, but not yet read 9345 completely. Finally, `maint print msymbols' dumps just the 9346 minimal symbol information required for each object file from 9347 which GDB has read some symbols. *Note Commands to specify files: 9348 Files, for a discussion of how GDB reads symbols (in the 9349 description of `symbol-file'). 9350 9351 `maint info symtabs [ REGEXP ]' 9352 `maint info psymtabs [ REGEXP ]' 9353 List the `struct symtab' or `struct partial_symtab' structures 9354 whose names match REGEXP. If REGEXP is not given, list them all. 9355 The output includes expressions which you can copy into a GDB 9356 debugging this one to examine a particular structure in more 9357 detail. For example: 9358 9359 (gdb) maint info psymtabs dwarf2read 9360 { objfile /home/gnu/build/gdb/gdb 9361 ((struct objfile *) 0x82e69d0) 9362 { psymtab /home/gnu/src/gdb/dwarf2read.c 9363 ((struct partial_symtab *) 0x8474b10) 9364 readin no 9365 fullname (null) 9366 text addresses 0x814d3c8 -- 0x8158074 9367 globals (* (struct partial_symbol **) 0x8507a08 @ 9) 9368 statics (* (struct partial_symbol **) 0x40e95b78 @ 2882) 9369 dependencies (none) 9370 } 9371 } 9372 (gdb) maint info symtabs 9373 (gdb) 9374 We see that there is one partial symbol table whose filename 9375 contains the string `dwarf2read', belonging to the `gdb' 9376 executable; and we see that GDB has not read in any symtabs yet at 9377 all. If we set a breakpoint on a function, that will cause GDB to 9378 read the symtab for the compilation unit containing that function: 9379 9380 (gdb) break dwarf2_psymtab_to_symtab 9381 Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c, 9382 line 1574. 9383 (gdb) maint info symtabs 9384 { objfile /home/gnu/build/gdb/gdb 9385 ((struct objfile *) 0x82e69d0) 9386 { symtab /home/gnu/src/gdb/dwarf2read.c 9387 ((struct symtab *) 0x86c1f38) 9388 dirname (null) 9389 fullname (null) 9390 blockvector ((struct blockvector *) 0x86c1bd0) (primary) 9391 debugformat DWARF 2 9392 } 9393 } 9394 (gdb) 9395 9396 9397 File: gdb.info, Node: Altering, Next: GDB Files, Prev: Symbols, Up: Top 9398 9399 14 Altering Execution 9400 ********************* 9401 9402 Once you think you have found an error in your program, you might want 9403 to find out for certain whether correcting the apparent error would 9404 lead to correct results in the rest of the run. You can find the 9405 answer by experiment, using the GDB features for altering execution of 9406 the program. 9407 9408 For example, you can store new values into variables or memory 9409 locations, give your program a signal, restart it at a different 9410 address, or even return prematurely from a function. 9411 9412 * Menu: 9413 9414 * Assignment:: Assignment to variables 9415 * Jumping:: Continuing at a different address 9416 * Signaling:: Giving your program a signal 9417 * Returning:: Returning from a function 9418 * Calling:: Calling your program's functions 9419 * Patching:: Patching your program 9420 9421 9422 File: gdb.info, Node: Assignment, Next: Jumping, Up: Altering 9423 9424 14.1 Assignment to variables 9425 ============================ 9426 9427 To alter the value of a variable, evaluate an assignment expression. 9428 *Note Expressions: Expressions. For example, 9429 9430 print x=4 9431 9432 stores the value 4 into the variable `x', and then prints the value of 9433 the assignment expression (which is 4). *Note Using GDB with Different 9434 Languages: Languages, for more information on operators in supported 9435 languages. 9436 9437 If you are not interested in seeing the value of the assignment, use 9438 the `set' command instead of the `print' command. `set' is really the 9439 same as `print' except that the expression's value is not printed and 9440 is not put in the value history (*note Value history: Value History.). 9441 The expression is evaluated only for its effects. 9442 9443 If the beginning of the argument string of the `set' command appears 9444 identical to a `set' subcommand, use the `set variable' command instead 9445 of just `set'. This command is identical to `set' except for its lack 9446 of subcommands. For example, if your program has a variable `width', 9447 you get an error if you try to set a new value with just `set 9448 width=13', because GDB has the command `set width': 9449 9450 (gdb) whatis width 9451 type = double 9452 (gdb) p width 9453 $4 = 13 9454 (gdb) set width=47 9455 Invalid syntax in expression. 9456 9457 The invalid expression, of course, is `=47'. In order to actually set 9458 the program's variable `width', use 9459 9460 (gdb) set var width=47 9461 9462 Because the `set' command has many subcommands that can conflict 9463 with the names of program variables, it is a good idea to use the `set 9464 variable' command instead of just `set'. For example, if your program 9465 has a variable `g', you run into problems if you try to set a new value 9466 with just `set g=4', because GDB has the command `set gnutarget', 9467 abbreviated `set g': 9468 9469 (gdb) whatis g 9470 type = double 9471 (gdb) p g 9472 $1 = 1 9473 (gdb) set g=4 9474 (gdb) p g 9475 $2 = 1 9476 (gdb) r 9477 The program being debugged has been started already. 9478 Start it from the beginning? (y or n) y 9479 Starting program: /home/smith/cc_progs/a.out 9480 "/home/smith/cc_progs/a.out": can't open to read symbols: 9481 Invalid bfd target. 9482 (gdb) show g 9483 The current BFD target is "=4". 9484 9485 The program variable `g' did not change, and you silently set the 9486 `gnutarget' to an invalid value. In order to set the variable `g', use 9487 9488 (gdb) set var g=4 9489 9490 GDB allows more implicit conversions in assignments than C; you can 9491 freely store an integer value into a pointer variable or vice versa, 9492 and you can convert any structure to any other structure that is the 9493 same length or shorter. 9494 9495 To store values into arbitrary places in memory, use the `{...}' 9496 construct to generate a value of specified type at a specified address 9497 (*note Expressions: Expressions.). For example, `{int}0x83040' refers 9498 to memory location `0x83040' as an integer (which implies a certain size 9499 and representation in memory), and 9500 9501 set {int}0x83040 = 4 9502 9503 stores the value 4 into that memory location. 9504 9505 9506 File: gdb.info, Node: Jumping, Next: Signaling, Prev: Assignment, Up: Altering 9507 9508 14.2 Continuing at a different address 9509 ====================================== 9510 9511 Ordinarily, when you continue your program, you do so at the place where 9512 it stopped, with the `continue' command. You can instead continue at 9513 an address of your own choosing, with the following commands: 9514 9515 `jump LINESPEC' 9516 Resume execution at line LINESPEC. Execution stops again 9517 immediately if there is a breakpoint there. *Note Printing source 9518 lines: List, for a description of the different forms of LINESPEC. 9519 It is common practice to use the `tbreak' command in conjunction 9520 with `jump'. *Note Setting breakpoints: Set Breaks. 9521 9522 The `jump' command does not change the current stack frame, or the 9523 stack pointer, or the contents of any memory location or any 9524 register other than the program counter. If line LINESPEC is in a 9525 different function from the one currently executing, the results 9526 may be bizarre if the two functions expect different patterns of 9527 arguments or of local variables. For this reason, the `jump' 9528 command requests confirmation if the specified line is not in the 9529 function currently executing. However, even bizarre results are 9530 predictable if you are well acquainted with the machine-language 9531 code of your program. 9532 9533 `jump *ADDRESS' 9534 Resume execution at the instruction at address ADDRESS. 9535 9536 On many systems, you can get much the same effect as the `jump' 9537 command by storing a new value into the register `$pc'. The difference 9538 is that this does not start your program running; it only changes the 9539 address of where it _will_ run when you continue. For example, 9540 9541 set $pc = 0x485 9542 9543 makes the next `continue' command or stepping command execute at 9544 address `0x485', rather than at the address where your program stopped. 9545 *Note Continuing and stepping: Continuing and Stepping. 9546 9547 The most common occasion to use the `jump' command is to back 9548 up--perhaps with more breakpoints set--over a portion of a program that 9549 has already executed, in order to examine its execution in more detail. 9550 9551 9552 File: gdb.info, Node: Signaling, Next: Returning, Prev: Jumping, Up: Altering 9553 9554 14.3 Giving your program a signal 9555 ================================= 9556 9557 `signal SIGNAL' 9558 Resume execution where your program stopped, but immediately give 9559 it the signal SIGNAL. SIGNAL can be the name or the number of a 9560 signal. For example, on many systems `signal 2' and `signal 9561 SIGINT' are both ways of sending an interrupt signal. 9562 9563 Alternatively, if SIGNAL is zero, continue execution without 9564 giving a signal. This is useful when your program stopped on 9565 account of a signal and would ordinary see the signal when resumed 9566 with the `continue' command; `signal 0' causes it to resume 9567 without a signal. 9568 9569 `signal' does not repeat when you press <RET> a second time after 9570 executing the command. 9571 9572 Invoking the `signal' command is not the same as invoking the `kill' 9573 utility from the shell. Sending a signal with `kill' causes GDB to 9574 decide what to do with the signal depending on the signal handling 9575 tables (*note Signals::). The `signal' command passes the signal 9576 directly to your program. 9577 9578 9579 File: gdb.info, Node: Returning, Next: Calling, Prev: Signaling, Up: Altering 9580 9581 14.4 Returning from a function 9582 ============================== 9583 9584 `return' 9585 `return EXPRESSION' 9586 You can cancel execution of a function call with the `return' 9587 command. If you give an EXPRESSION argument, its value is used as 9588 the function's return value. 9589 9590 When you use `return', GDB discards the selected stack frame (and 9591 all frames within it). You can think of this as making the discarded 9592 frame return prematurely. If you wish to specify a value to be 9593 returned, give that value as the argument to `return'. 9594 9595 This pops the selected stack frame (*note Selecting a frame: 9596 Selection.), and any other frames inside of it, leaving its caller as 9597 the innermost remaining frame. That frame becomes selected. The 9598 specified value is stored in the registers used for returning values of 9599 functions. 9600 9601 The `return' command does not resume execution; it leaves the 9602 program stopped in the state that would exist if the function had just 9603 returned. In contrast, the `finish' command (*note Continuing and 9604 stepping: Continuing and Stepping.) resumes execution until the 9605 selected stack frame returns naturally. 9606 9607 9608 File: gdb.info, Node: Calling, Next: Patching, Prev: Returning, Up: Altering 9609 9610 14.5 Calling program functions 9611 ============================== 9612 9613 `print EXPR' 9614 Evaluate the expression EXPR and display the resuling value. EXPR 9615 may include calls to functions in the program being debugged. 9616 9617 `call EXPR' 9618 Evaluate the expression EXPR without displaying `void' returned 9619 values. 9620 9621 You can use this variant of the `print' command if you want to 9622 execute a function from your program that does not return anything 9623 (a.k.a. "a void function"), but without cluttering the output with 9624 `void' returned values that GDB will otherwise print. If the 9625 result is not void, it is printed and saved in the value history. 9626 9627 It is possible for the function you call via the `print' or `call' 9628 command to generate a signal (e.g., if there's a bug in the function, 9629 or if you passed it incorrect arguments). What happens in that case is 9630 controlled by the `set unwindonsignal' command. 9631 9632 `set unwindonsignal' 9633 Set unwinding of the stack if a signal is received while in a 9634 function that GDB called in the program being debugged. If set to 9635 on, GDB unwinds the stack it created for the call and restores the 9636 context to what it was before the call. If set to off (the 9637 default), GDB stops in the frame where the signal was received. 9638 9639 `show unwindonsignal' 9640 Show the current setting of stack unwinding in the functions 9641 called by GDB. 9642 9643 Sometimes, a function you wish to call is actually a "weak alias" 9644 for another function. In such case, GDB might not pick up the type 9645 information, including the types of the function arguments, which 9646 causes GDB to call the inferior function incorrectly. As a result, the 9647 called function will function erroneously and may even crash. A 9648 solution to that is to use the name of the aliased function instead. 9649 9650 9651 File: gdb.info, Node: Patching, Prev: Calling, Up: Altering 9652 9653 14.6 Patching programs 9654 ====================== 9655 9656 By default, GDB opens the file containing your program's executable 9657 code (or the corefile) read-only. This prevents accidental alterations 9658 to machine code; but it also prevents you from intentionally patching 9659 your program's binary. 9660 9661 If you'd like to be able to patch the binary, you can specify that 9662 explicitly with the `set write' command. For example, you might want 9663 to turn on internal debugging flags, or even to make emergency repairs. 9664 9665 `set write on' 9666 `set write off' 9667 If you specify `set write on', GDB opens executable and core files 9668 for both reading and writing; if you specify `set write off' (the 9669 default), GDB opens them read-only. 9670 9671 If you have already loaded a file, you must load it again (using 9672 the `exec-file' or `core-file' command) after changing `set 9673 write', for your new setting to take effect. 9674 9675 `show write' 9676 Display whether executable files and core files are opened for 9677 writing as well as reading. 9678 9679 9680 File: gdb.info, Node: GDB Files, Next: Targets, Prev: Altering, Up: Top 9681 9682 15 GDB Files 9683 ************ 9684 9685 GDB needs to know the file name of the program to be debugged, both in 9686 order to read its symbol table and in order to start your program. To 9687 debug a core dump of a previous run, you must also tell GDB the name of 9688 the core dump file. 9689 9690 * Menu: 9691 9692 * Files:: Commands to specify files 9693 * Separate Debug Files:: Debugging information in separate files 9694 * Symbol Errors:: Errors reading symbol files 9695 9696 9697 File: gdb.info, Node: Files, Next: Separate Debug Files, Up: GDB Files 9698 9699 15.1 Commands to specify files 9700 ============================== 9701 9702 You may want to specify executable and core dump file names. The usual 9703 way to do this is at start-up time, using the arguments to GDB's 9704 start-up commands (*note Getting In and Out of GDB: Invocation.). 9705 9706 Occasionally it is necessary to change to a different file during a 9707 GDB session. Or you may run GDB and forget to specify a file you want 9708 to use. Or you are debugging a remote target via `gdbserver' (*note 9709 file: Server.). In these situations the GDB commands to specify new 9710 files are useful. 9711 9712 `file FILENAME' 9713 Use FILENAME as the program to be debugged. It is read for its 9714 symbols and for the contents of pure memory. It is also the 9715 program executed when you use the `run' command. If you do not 9716 specify a directory and the file is not found in the GDB working 9717 directory, GDB uses the environment variable `PATH' as a list of 9718 directories to search, just as the shell does when looking for a 9719 program to run. You can change the value of this variable, for 9720 both GDB and your program, using the `path' command. 9721 9722 You can load unlinked object `.o' files into GDB using the `file' 9723 command. You will not be able to "run" an object file, but you 9724 can disassemble functions and inspect variables. Also, if the 9725 underlying BFD functionality supports it, you could use `gdb 9726 -write' to patch object files using this technique. Note that GDB 9727 can neither interpret nor modify relocations in this case, so 9728 branches and some initialized variables will appear to go to the 9729 wrong place. But this feature is still handy from time to time. 9730 9731 `file' 9732 `file' with no argument makes GDB discard any information it has 9733 on both executable file and the symbol table. 9734 9735 `exec-file [ FILENAME ]' 9736 Specify that the program to be run (but not the symbol table) is 9737 found in FILENAME. GDB searches the environment variable `PATH' 9738 if necessary to locate your program. Omitting FILENAME means to 9739 discard information on the executable file. 9740 9741 `symbol-file [ FILENAME ]' 9742 Read symbol table information from file FILENAME. `PATH' is 9743 searched when necessary. Use the `file' command to get both symbol 9744 table and program to run from the same file. 9745 9746 `symbol-file' with no argument clears out GDB information on your 9747 program's symbol table. 9748 9749 The `symbol-file' command causes GDB to forget the contents of 9750 some breakpoints and auto-display expressions. This is because 9751 they may contain pointers to the internal data recording symbols 9752 and data types, which are part of the old symbol table data being 9753 discarded inside GDB. 9754 9755 `symbol-file' does not repeat if you press <RET> again after 9756 executing it once. 9757 9758 When GDB is configured for a particular environment, it 9759 understands debugging information in whatever format is the 9760 standard generated for that environment; you may use either a GNU 9761 compiler, or other compilers that adhere to the local conventions. 9762 Best results are usually obtained from GNU compilers; for example, 9763 using `gcc' you can generate debugging information for optimized 9764 code. 9765 9766 For most kinds of object files, with the exception of old SVR3 9767 systems using COFF, the `symbol-file' command does not normally 9768 read the symbol table in full right away. Instead, it scans the 9769 symbol table quickly to find which source files and which symbols 9770 are present. The details are read later, one source file at a 9771 time, as they are needed. 9772 9773 The purpose of this two-stage reading strategy is to make GDB 9774 start up faster. For the most part, it is invisible except for 9775 occasional pauses while the symbol table details for a particular 9776 source file are being read. (The `set verbose' command can turn 9777 these pauses into messages if desired. *Note Optional warnings 9778 and messages: Messages/Warnings.) 9779 9780 We have not implemented the two-stage strategy for COFF yet. When 9781 the symbol table is stored in COFF format, `symbol-file' reads the 9782 symbol table data in full right away. Note that "stabs-in-COFF" 9783 still does the two-stage strategy, since the debug info is actually 9784 in stabs format. 9785 9786 `symbol-file FILENAME [ -readnow ]' 9787 `file FILENAME [ -readnow ]' 9788 You can override the GDB two-stage strategy for reading symbol 9789 tables by using the `-readnow' option with any of the commands that 9790 load symbol table information, if you want to be sure GDB has the 9791 entire symbol table available. 9792 9793 `core-file [FILENAME]' 9794 `core' 9795 Specify the whereabouts of a core dump file to be used as the 9796 "contents of memory". Traditionally, core files contain only some 9797 parts of the address space of the process that generated them; GDB 9798 can access the executable file itself for other parts. 9799 9800 `core-file' with no argument specifies that no core file is to be 9801 used. 9802 9803 Note that the core file is ignored when your program is actually 9804 running under GDB. So, if you have been running your program and 9805 you wish to debug a core file instead, you must kill the 9806 subprocess in which the program is running. To do this, use the 9807 `kill' command (*note Killing the child process: Kill Process.). 9808 9809 `add-symbol-file FILENAME ADDRESS' 9810 `add-symbol-file FILENAME ADDRESS [ -readnow ]' 9811 `add-symbol-file FILENAME -sSECTION ADDRESS ...' 9812 The `add-symbol-file' command reads additional symbol table 9813 information from the file FILENAME. You would use this command 9814 when FILENAME has been dynamically loaded (by some other means) 9815 into the program that is running. ADDRESS should be the memory 9816 address at which the file has been loaded; GDB cannot figure this 9817 out for itself. You can additionally specify an arbitrary number 9818 of `-sSECTION ADDRESS' pairs, to give an explicit section name and 9819 base address for that section. You can specify any ADDRESS as an 9820 expression. 9821 9822 The symbol table of the file FILENAME is added to the symbol table 9823 originally read with the `symbol-file' command. You can use the 9824 `add-symbol-file' command any number of times; the new symbol data 9825 thus read keeps adding to the old. To discard all old symbol data 9826 instead, use the `symbol-file' command without any arguments. 9827 9828 Although FILENAME is typically a shared library file, an 9829 executable file, or some other object file which has been fully 9830 relocated for loading into a process, you can also load symbolic 9831 information from relocatable `.o' files, as long as: 9832 9833 * the file's symbolic information refers only to linker symbols 9834 defined in that file, not to symbols defined by other object 9835 files, 9836 9837 * every section the file's symbolic information refers to has 9838 actually been loaded into the inferior, as it appears in the 9839 file, and 9840 9841 * you can determine the address at which every section was 9842 loaded, and provide these to the `add-symbol-file' command. 9843 9844 Some embedded operating systems, like Sun Chorus and VxWorks, can 9845 load relocatable files into an already running program; such 9846 systems typically make the requirements above easy to meet. 9847 However, it's important to recognize that many native systems use 9848 complex link procedures (`.linkonce' section factoring and C++ 9849 constructor table assembly, for example) that make the 9850 requirements difficult to meet. In general, one cannot assume 9851 that using `add-symbol-file' to read a relocatable object file's 9852 symbolic information will have the same effect as linking the 9853 relocatable object file into the program in the normal way. 9854 9855 `add-symbol-file' does not repeat if you press <RET> after using 9856 it. 9857 9858 `add-symbol-file-from-memory ADDRESS' 9859 Load symbols from the given ADDRESS in a dynamically loaded object 9860 file whose image is mapped directly into the inferior's memory. 9861 For example, the Linux kernel maps a `syscall DSO' into each 9862 process's address space; this DSO provides kernel-specific code for 9863 some system calls. The argument can be any expression whose 9864 evaluation yields the address of the file's shared object file 9865 header. For this command to work, you must have used 9866 `symbol-file' or `exec-file' commands in advance. 9867 9868 `add-shared-symbol-files LIBRARY-FILE' 9869 `assf LIBRARY-FILE' 9870 The `add-shared-symbol-files' command can currently be used only 9871 in the Cygwin build of GDB on MS-Windows OS, where it is an alias 9872 for the `dll-symbols' command (*note Cygwin Native::). GDB 9873 automatically looks for shared libraries, however if GDB does not 9874 find yours, you can invoke `add-shared-symbol-files'. It takes 9875 one argument: the shared library's file name. `assf' is a 9876 shorthand alias for `add-shared-symbol-files'. 9877 9878 `section SECTION ADDR' 9879 The `section' command changes the base address of the named 9880 SECTION of the exec file to ADDR. This can be used if the exec 9881 file does not contain section addresses, (such as in the `a.out' 9882 format), or when the addresses specified in the file itself are 9883 wrong. Each section must be changed separately. The `info files' 9884 command, described below, lists all the sections and their 9885 addresses. 9886 9887 `info files' 9888 `info target' 9889 `info files' and `info target' are synonymous; both print the 9890 current target (*note Specifying a Debugging Target: Targets.), 9891 including the names of the executable and core dump files 9892 currently in use by GDB, and the files from which symbols were 9893 loaded. The command `help target' lists all possible targets 9894 rather than current ones. 9895 9896 `maint info sections' 9897 Another command that can give you extra information about program 9898 sections is `maint info sections'. In addition to the section 9899 information displayed by `info files', this command displays the 9900 flags and file offset of each section in the executable and core 9901 dump files. In addition, `maint info sections' provides the 9902 following command options (which may be arbitrarily combined): 9903 9904 `ALLOBJ' 9905 Display sections for all loaded object files, including 9906 shared libraries. 9907 9908 `SECTIONS' 9909 Display info only for named SECTIONS. 9910 9911 `SECTION-FLAGS' 9912 Display info only for sections for which SECTION-FLAGS are 9913 true. The section flags that GDB currently knows about are: 9914 `ALLOC' 9915 Section will have space allocated in the process when 9916 loaded. Set for all sections except those containing 9917 debug information. 9918 9919 `LOAD' 9920 Section will be loaded from the file into the child 9921 process memory. Set for pre-initialized code and data, 9922 clear for `.bss' sections. 9923 9924 `RELOC' 9925 Section needs to be relocated before loading. 9926 9927 `READONLY' 9928 Section cannot be modified by the child process. 9929 9930 `CODE' 9931 Section contains executable code only. 9932 9933 `DATA' 9934 Section contains data only (no executable code). 9935 9936 `ROM' 9937 Section will reside in ROM. 9938 9939 `CONSTRUCTOR' 9940 Section contains data for constructor/destructor lists. 9941 9942 `HAS_CONTENTS' 9943 Section is not empty. 9944 9945 `NEVER_LOAD' 9946 An instruction to the linker to not output the section. 9947 9948 `COFF_SHARED_LIBRARY' 9949 A notification to the linker that the section contains 9950 COFF shared library information. 9951 9952 `IS_COMMON' 9953 Section contains common symbols. 9954 9955 `set trust-readonly-sections on' 9956 Tell GDB that readonly sections in your object file really are 9957 read-only (i.e. that their contents will not change). In that 9958 case, GDB can fetch values from these sections out of the object 9959 file, rather than from the target program. For some targets 9960 (notably embedded ones), this can be a significant enhancement to 9961 debugging performance. 9962 9963 The default is off. 9964 9965 `set trust-readonly-sections off' 9966 Tell GDB not to trust readonly sections. This means that the 9967 contents of the section might change while the program is running, 9968 and must therefore be fetched from the target when needed. 9969 9970 `show trust-readonly-sections' 9971 Show the current setting of trusting readonly sections. 9972 9973 All file-specifying commands allow both absolute and relative file 9974 names as arguments. GDB always converts the file name to an absolute 9975 file name and remembers it that way. 9976 9977 GDB supports GNU/Linux, MS-Windows, HP-UX, SunOS, SVr4, Irix, and 9978 IBM RS/6000 AIX shared libraries. 9979 9980 GDB automatically loads symbol definitions from shared libraries 9981 when you use the `run' command, or when you examine a core file. 9982 (Before you issue the `run' command, GDB does not understand references 9983 to a function in a shared library, however--unless you are debugging a 9984 core file). 9985 9986 On HP-UX, if the program loads a library explicitly, GDB 9987 automatically loads the symbols at the time of the `shl_load' call. 9988 9989 There are times, however, when you may wish to not automatically load 9990 symbol definitions from shared libraries, such as when they are 9991 particularly large or there are many of them. 9992 9993 To control the automatic loading of shared library symbols, use the 9994 commands: 9995 9996 `set auto-solib-add MODE' 9997 If MODE is `on', symbols from all shared object libraries will be 9998 loaded automatically when the inferior begins execution, you 9999 attach to an independently started inferior, or when the dynamic 10000 linker informs GDB that a new library has been loaded. If MODE is 10001 `off', symbols must be loaded manually, using the `sharedlibrary' 10002 command. The default value is `on'. 10003 10004 If your program uses lots of shared libraries with debug info that 10005 takes large amounts of memory, you can decrease the GDB memory 10006 footprint by preventing it from automatically loading the symbols 10007 from shared libraries. To that end, type `set auto-solib-add off' 10008 before running the inferior, then load each library whose debug 10009 symbols you do need with `sharedlibrary REGEXP', where REGEXP is a 10010 regular expresion that matches the libraries whose symbols you 10011 want to be loaded. 10012 10013 `show auto-solib-add' 10014 Display the current autoloading mode. 10015 10016 To explicitly load shared library symbols, use the `sharedlibrary' 10017 command: 10018 10019 `info share' 10020 `info sharedlibrary' 10021 Print the names of the shared libraries which are currently loaded. 10022 10023 `sharedlibrary REGEX' 10024 `share REGEX' 10025 Load shared object library symbols for files matching a Unix 10026 regular expression. As with files loaded automatically, it only 10027 loads shared libraries required by your program for a core file or 10028 after typing `run'. If REGEX is omitted all shared libraries 10029 required by your program are loaded. 10030 10031 `nosharedlibrary' 10032 Unload all shared object library symbols. This discards all 10033 symbols that have been loaded from all shared libraries. Symbols 10034 from shared libraries that were loaded by explicit user requests 10035 are not discarded. 10036 10037 Sometimes you may wish that GDB stops and gives you control when any 10038 of shared library events happen. Use the `set stop-on-solib-events' 10039 command for this: 10040 10041 `set stop-on-solib-events' 10042 This command controls whether GDB should give you control when the 10043 dynamic linker notifies it about some shared library event. The 10044 most common event of interest is loading or unloading of a new 10045 shared library. 10046 10047 `show stop-on-solib-events' 10048 Show whether GDB stops and gives you control when shared library 10049 events happen. 10050 10051 Shared libraries are also supported in many cross or remote debugging 10052 configurations. A copy of the target's libraries need to be present on 10053 the host system; they need to be the same as the target libraries, 10054 although the copies on the target can be stripped as long as the copies 10055 on the host are not. 10056 10057 For remote debugging, you need to tell GDB where the target 10058 libraries are, so that it can load the correct copies--otherwise, it 10059 may try to load the host's libraries. GDB has two variables to specify 10060 the search directories for target libraries. 10061 10062 `set solib-absolute-prefix PATH' 10063 If this variable is set, PATH will be used as a prefix for any 10064 absolute shared library paths; many runtime loaders store the 10065 absolute paths to the shared library in the target program's 10066 memory. If you use `solib-absolute-prefix' to find shared 10067 libraries, they need to be laid out in the same way that they are 10068 on the target, with e.g. a `/usr/lib' hierarchy under PATH. 10069 10070 You can set the default value of `solib-absolute-prefix' by using 10071 the configure-time `--with-sysroot' option. 10072 10073 `show solib-absolute-prefix' 10074 Display the current shared library prefix. 10075 10076 `set solib-search-path PATH' 10077 If this variable is set, PATH is a colon-separated list of 10078 directories to search for shared libraries. `solib-search-path' 10079 is used after `solib-absolute-prefix' fails to locate the library, 10080 or if the path to the library is relative instead of absolute. If 10081 you want to use `solib-search-path' instead of 10082 `solib-absolute-prefix', be sure to set `solib-absolute-prefix' to 10083 a nonexistant directory to prevent GDB from finding your host's 10084 libraries. 10085 10086 `show solib-search-path' 10087 Display the current shared library search path. 10088 10089 10090 File: gdb.info, Node: Separate Debug Files, Next: Symbol Errors, Prev: Files, Up: GDB Files 10091 10092 15.2 Debugging Information in Separate Files 10093 ============================================ 10094 10095 GDB allows you to put a program's debugging information in a file 10096 separate from the executable itself, in a way that allows GDB to find 10097 and load the debugging information automatically. Since debugging 10098 information can be very large -- sometimes larger than the executable 10099 code itself -- some systems distribute debugging information for their 10100 executables in separate files, which users can install only when they 10101 need to debug a problem. 10102 10103 If an executable's debugging information has been extracted to a 10104 separate file, the executable should contain a "debug link" giving the 10105 name of the debugging information file (with no directory components), 10106 and a checksum of its contents. (The exact form of a debug link is 10107 described below.) If the full name of the directory containing the 10108 executable is EXECDIR, and the executable has a debug link that 10109 specifies the name DEBUGFILE, then GDB will automatically search for 10110 the debugging information file in three places: 10111 10112 * the directory containing the executable file (that is, it will look 10113 for a file named `EXECDIR/DEBUGFILE', 10114 10115 * a subdirectory of that directory named `.debug' (that is, the file 10116 `EXECDIR/.debug/DEBUGFILE', and 10117 10118 * a subdirectory of the global debug file directory that includes the 10119 executable's full path, and the name from the link (that is, the 10120 file `GLOBALDEBUGDIR/EXECDIR/DEBUGFILE', where GLOBALDEBUGDIR is 10121 the global debug file directory, and EXECDIR has been turned into 10122 a relative path). 10123 GDB checks under each of these names for a debugging information 10124 file whose checksum matches that given in the link, and reads the 10125 debugging information from the first one it finds. 10126 10127 So, for example, if you ask GDB to debug `/usr/bin/ls', which has a 10128 link containing the name `ls.debug', and the global debug directory is 10129 `/usr/lib/debug', then GDB will look for debug information in 10130 `/usr/bin/ls.debug', `/usr/bin/.debug/ls.debug', and 10131 `/usr/lib/debug/usr/bin/ls.debug'. 10132 10133 You can set the global debugging info directory's name, and view the 10134 name GDB is currently using. 10135 10136 `set debug-file-directory DIRECTORY' 10137 Set the directory which GDB searches for separate debugging 10138 information files to DIRECTORY. 10139 10140 `show debug-file-directory' 10141 Show the directory GDB searches for separate debugging information 10142 files. 10143 10144 10145 A debug link is a special section of the executable file named 10146 `.gnu_debuglink'. The section must contain: 10147 10148 * A filename, with any leading directory components removed, 10149 followed by a zero byte, 10150 10151 * zero to three bytes of padding, as needed to reach the next 10152 four-byte boundary within the section, and 10153 10154 * a four-byte CRC checksum, stored in the same endianness used for 10155 the executable file itself. The checksum is computed on the 10156 debugging information file's full contents by the function given 10157 below, passing zero as the CRC argument. 10158 10159 Any executable file format can carry a debug link, as long as it can 10160 contain a section named `.gnu_debuglink' with the contents described 10161 above. 10162 10163 The debugging information file itself should be an ordinary 10164 executable, containing a full set of linker symbols, sections, and 10165 debugging information. The sections of the debugging information file 10166 should have the same names, addresses and sizes as the original file, 10167 but they need not contain any data -- much like a `.bss' section in an 10168 ordinary executable. 10169 10170 As of December 2002, there is no standard GNU utility to produce 10171 separated executable / debugging information file pairs. Ulrich 10172 Drepper's `elfutils' package, starting with version 0.53, contains a 10173 version of the `strip' command such that the command `strip foo -f 10174 foo.debug' removes the debugging information from the executable file 10175 `foo', places it in the file `foo.debug', and leaves behind a debug 10176 link in `foo'. 10177 10178 Since there are many different ways to compute CRC's (different 10179 polynomials, reversals, byte ordering, etc.), the simplest way to 10180 describe the CRC used in `.gnu_debuglink' sections is to give the 10181 complete code for a function that computes it: 10182 10183 unsigned long 10184 gnu_debuglink_crc32 (unsigned long crc, 10185 unsigned char *buf, size_t len) 10186 { 10187 static const unsigned long crc32_table[256] = 10188 { 10189 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 10190 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 10191 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 10192 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 10193 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 10194 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 10195 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 10196 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 10197 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 10198 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 10199 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 10200 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 10201 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 10202 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 10203 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 10204 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 10205 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 10206 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 10207 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 10208 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 10209 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 10210 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 10211 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 10212 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 10213 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 10214 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 10215 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 10216 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 10217 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 10218 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 10219 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 10220 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 10221 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 10222 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 10223 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 10224 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 10225 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 10226 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 10227 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 10228 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 10229 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 10230 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 10231 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 10232 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 10233 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 10234 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 10235 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 10236 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 10237 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 10238 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 10239 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 10240 0x2d02ef8d 10241 }; 10242 unsigned char *end; 10243 10244 crc = ~crc & 0xffffffff; 10245 for (end = buf + len; buf < end; ++buf) 10246 crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); 10247 return ~crc & 0xffffffff; 10248 } 10249 10250 10251 File: gdb.info, Node: Symbol Errors, Prev: Separate Debug Files, Up: GDB Files 10252 10253 15.3 Errors reading symbol files 10254 ================================ 10255 10256 While reading a symbol file, GDB occasionally encounters problems, such 10257 as symbol types it does not recognize, or known bugs in compiler 10258 output. By default, GDB does not notify you of such problems, since 10259 they are relatively common and primarily of interest to people 10260 debugging compilers. If you are interested in seeing information about 10261 ill-constructed symbol tables, you can either ask GDB to print only one 10262 message about each such type of problem, no matter how many times the 10263 problem occurs; or you can ask GDB to print more messages, to see how 10264 many times the problems occur, with the `set complaints' command (*note 10265 Optional warnings and messages: Messages/Warnings.). 10266 10267 The messages currently printed, and their meanings, include: 10268 10269 `inner block not inside outer block in SYMBOL' 10270 The symbol information shows where symbol scopes begin and end 10271 (such as at the start of a function or a block of statements). 10272 This error indicates that an inner scope block is not fully 10273 contained in its outer scope blocks. 10274 10275 GDB circumvents the problem by treating the inner block as if it 10276 had the same scope as the outer block. In the error message, 10277 SYMBOL may be shown as "`(don't know)'" if the outer block is not a 10278 function. 10279 10280 `block at ADDRESS out of order' 10281 The symbol information for symbol scope blocks should occur in 10282 order of increasing addresses. This error indicates that it does 10283 not do so. 10284 10285 GDB does not circumvent this problem, and has trouble locating 10286 symbols in the source file whose symbols it is reading. (You can 10287 often determine what source file is affected by specifying `set 10288 verbose on'. *Note Optional warnings and messages: 10289 Messages/Warnings.) 10290 10291 `bad block start address patched' 10292 The symbol information for a symbol scope block has a start address 10293 smaller than the address of the preceding source line. This is 10294 known to occur in the SunOS 4.1.1 (and earlier) C compiler. 10295 10296 GDB circumvents the problem by treating the symbol scope block as 10297 starting on the previous source line. 10298 10299 `bad string table offset in symbol N' 10300 Symbol number N contains a pointer into the string table which is 10301 larger than the size of the string table. 10302 10303 GDB circumvents the problem by considering the symbol to have the 10304 name `foo', which may cause other problems if many symbols end up 10305 with this name. 10306 10307 `unknown symbol type `0xNN'' 10308 The symbol information contains new data types that GDB does not 10309 yet know how to read. `0xNN' is the symbol type of the 10310 uncomprehended information, in hexadecimal. 10311 10312 GDB circumvents the error by ignoring this symbol information. 10313 This usually allows you to debug your program, though certain 10314 symbols are not accessible. If you encounter such a problem and 10315 feel like debugging it, you can debug `gdb' with itself, breakpoint 10316 on `complain', then go up to the function `read_dbx_symtab' and 10317 examine `*bufp' to see the symbol. 10318 10319 `stub type has NULL name' 10320 GDB could not find the full definition for a struct or class. 10321 10322 `const/volatile indicator missing (ok if using g++ v1.x), got...' 10323 The symbol information for a C++ member function is missing some 10324 information that recent versions of the compiler should have 10325 output for it. 10326 10327 `info mismatch between compiler and debugger' 10328 GDB could not parse a type specification output by the compiler. 10329 10330 10331 10332 File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up: Top 10333 10334 16 Specifying a Debugging Target 10335 ******************************** 10336 10337 A "target" is the execution environment occupied by your program. 10338 10339 Often, GDB runs in the same host environment as your program; in 10340 that case, the debugging target is specified as a side effect when you 10341 use the `file' or `core' commands. When you need more flexibility--for 10342 example, running GDB on a physically separate host, or controlling a 10343 standalone system over a serial port or a realtime system over a TCP/IP 10344 connection--you can use the `target' command to specify one of the 10345 target types configured for GDB (*note Commands for managing targets: 10346 Target Commands.). 10347 10348 It is possible to build GDB for several different "target 10349 architectures". When GDB is built like that, you can choose one of the 10350 available architectures with the `set architecture' command. 10351 10352 `set architecture ARCH' 10353 This command sets the current target architecture to ARCH. The 10354 value of ARCH can be `"auto"', in addition to one of the supported 10355 architectures. 10356 10357 `show architecture' 10358 Show the current target architecture. 10359 10360 `set processor' 10361 `processor' 10362 These are alias commands for, respectively, `set architecture' and 10363 `show architecture'. 10364 10365 * Menu: 10366 10367 * Active Targets:: Active targets 10368 * Target Commands:: Commands for managing targets 10369 * Byte Order:: Choosing target byte order 10370 * Remote:: Remote debugging 10371 10372 10373 File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets 10374 10375 16.1 Active targets 10376 =================== 10377 10378 There are three classes of targets: processes, core files, and 10379 executable files. GDB can work concurrently on up to three active 10380 targets, one in each class. This allows you to (for example) start a 10381 process and inspect its activity without abandoning your work on a core 10382 file. 10383 10384 For example, if you execute `gdb a.out', then the executable file 10385 `a.out' is the only active target. If you designate a core file as 10386 well--presumably from a prior run that crashed and coredumped--then GDB 10387 has two active targets and uses them in tandem, looking first in the 10388 corefile target, then in the executable file, to satisfy requests for 10389 memory addresses. (Typically, these two classes of target are 10390 complementary, since core files contain only a program's read-write 10391 memory--variables and so on--plus machine status, while executable 10392 files contain only the program text and initialized data.) 10393 10394 When you type `run', your executable file becomes an active process 10395 target as well. When a process target is active, all GDB commands 10396 requesting memory addresses refer to that target; addresses in an 10397 active core file or executable file target are obscured while the 10398 process target is active. 10399 10400 Use the `core-file' and `exec-file' commands to select a new core 10401 file or executable target (*note Commands to specify files: Files.). 10402 To specify as a target a process that is already running, use the 10403 `attach' command (*note Debugging an already-running process: Attach.). 10404 10405 10406 File: gdb.info, Node: Target Commands, Next: Byte Order, Prev: Active Targets, Up: Targets 10407 10408 16.2 Commands for managing targets 10409 ================================== 10410 10411 `target TYPE PARAMETERS' 10412 Connects the GDB host environment to a target machine or process. 10413 A target is typically a protocol for talking to debugging 10414 facilities. You use the argument TYPE to specify the type or 10415 protocol of the target machine. 10416 10417 Further PARAMETERS are interpreted by the target protocol, but 10418 typically include things like device names or host names to connect 10419 with, process numbers, and baud rates. 10420 10421 The `target' command does not repeat if you press <RET> again 10422 after executing the command. 10423 10424 `help target' 10425 Displays the names of all targets available. To display targets 10426 currently selected, use either `info target' or `info files' 10427 (*note Commands to specify files: Files.). 10428 10429 `help target NAME' 10430 Describe a particular target, including any parameters necessary to 10431 select it. 10432 10433 `set gnutarget ARGS' 10434 GDB uses its own library BFD to read your files. GDB knows 10435 whether it is reading an "executable", a "core", or a ".o" file; 10436 however, you can specify the file format with the `set gnutarget' 10437 command. Unlike most `target' commands, with `gnutarget' the 10438 `target' refers to a program, not a machine. 10439 10440 _Warning:_ To specify a file format with `set gnutarget', you 10441 must know the actual BFD name. 10442 10443 *Note Commands to specify files: Files. 10444 10445 `show gnutarget' 10446 Use the `show gnutarget' command to display what file format 10447 `gnutarget' is set to read. If you have not set `gnutarget', GDB 10448 will determine the file format for each file automatically, and 10449 `show gnutarget' displays `The current BDF target is "auto"'. 10450 10451 Here are some common targets (available, or not, depending on the GDB 10452 configuration): 10453 10454 `target exec PROGRAM' 10455 An executable file. `target exec PROGRAM' is the same as 10456 `exec-file PROGRAM'. 10457 10458 `target core FILENAME' 10459 A core dump file. `target core FILENAME' is the same as 10460 `core-file FILENAME'. 10461 10462 `target remote MEDIUM' 10463 A remote system connected to GDB via a serial line or network 10464 connection. This command tells GDB to use its own remote protocol 10465 over MEDIUM for debugging. *Note Remote Debugging::. 10466 10467 For example, if you have a board connected to `/dev/ttya' on the 10468 machine running GDB, you could say: 10469 10470 target remote /dev/ttya 10471 10472 `target remote' supports the `load' command. This is only useful 10473 if you have some other way of getting the stub to the target 10474 system, and you can put it somewhere in memory where it won't get 10475 clobbered by the download. 10476 10477 `target sim' 10478 Builtin CPU simulator. GDB includes simulators for most 10479 architectures. In general, 10480 target sim 10481 load 10482 run 10483 works; however, you cannot assume that a specific memory map, 10484 device drivers, or even basic I/O is available, although some 10485 simulators do provide these. For info about any 10486 processor-specific simulator details, see the appropriate section 10487 in *Note Embedded Processors: Embedded Processors. 10488 10489 10490 Some configurations may include these targets as well: 10491 10492 `target nrom DEV' 10493 NetROM ROM emulator. This target only supports downloading. 10494 10495 10496 Different targets are available on different configurations of GDB; 10497 your configuration may have more or fewer targets. 10498 10499 Many remote targets require you to download the executable's code 10500 once you've successfully established a connection. You may wish to 10501 control various aspects of this process. 10502 10503 `set hash' 10504 This command controls whether a hash mark `#' is displayed while 10505 downloading a file to the remote monitor. If on, a hash mark is 10506 displayed after each S-record is successfully downloaded to the 10507 monitor. 10508 10509 `show hash' 10510 Show the current status of displaying the hash mark. 10511 10512 `set debug monitor' 10513 Enable or disable display of communications messages between GDB 10514 and the remote monitor. 10515 10516 `show debug monitor' 10517 Show the current status of displaying communications between GDB 10518 and the remote monitor. 10519 10520 `load FILENAME' 10521 Depending on what remote debugging facilities are configured into 10522 GDB, the `load' command may be available. Where it exists, it is 10523 meant to make FILENAME (an executable) available for debugging on 10524 the remote system--by downloading, or dynamic linking, for example. 10525 `load' also records the FILENAME symbol table in GDB, like the 10526 `add-symbol-file' command. 10527 10528 If your GDB does not have a `load' command, attempting to execute 10529 it gets the error message "`You can't do that when your target is 10530 ...'" 10531 10532 The file is loaded at whatever address is specified in the 10533 executable. For some object file formats, you can specify the 10534 load address when you link the program; for other formats, like 10535 a.out, the object file format specifies a fixed address. 10536 10537 Depending on the remote side capabilities, GDB may be able to load 10538 programs into flash memory. 10539 10540 `load' does not repeat if you press <RET> again after using it. 10541 10542 10543 File: gdb.info, Node: Byte Order, Next: Remote, Prev: Target Commands, Up: Targets 10544 10545 16.3 Choosing target byte order 10546 =============================== 10547 10548 Some types of processors, such as the MIPS, PowerPC, and Renesas SH, 10549 offer the ability to run either big-endian or little-endian byte 10550 orders. Usually the executable or symbol will include a bit to 10551 designate the endian-ness, and you will not need to worry about which 10552 to use. However, you may still find it useful to adjust GDB's idea of 10553 processor endian-ness manually. 10554 10555 `set endian big' 10556 Instruct GDB to assume the target is big-endian. 10557 10558 `set endian little' 10559 Instruct GDB to assume the target is little-endian. 10560 10561 `set endian auto' 10562 Instruct GDB to use the byte order associated with the executable. 10563 10564 `show endian' 10565 Display GDB's current idea of the target byte order. 10566 10567 10568 Note that these commands merely adjust interpretation of symbolic 10569 data on the host, and that they have absolutely no effect on the target 10570 system. 10571 10572 10573 File: gdb.info, Node: Remote, Prev: Byte Order, Up: Targets 10574 10575 16.4 Remote debugging 10576 ===================== 10577 10578 If you are trying to debug a program running on a machine that cannot 10579 run GDB in the usual way, it is often useful to use remote debugging. 10580 For example, you might use remote debugging on an operating system 10581 kernel, or on a small system which does not have a general purpose 10582 operating system powerful enough to run a full-featured debugger. 10583 10584 Some configurations of GDB have special serial or TCP/IP interfaces 10585 to make this work with particular debugging targets. In addition, GDB 10586 comes with a generic serial protocol (specific to GDB, but not specific 10587 to any particular target system) which you can use if you write the 10588 remote stubs--the code that runs on the remote system to communicate 10589 with GDB. 10590 10591 Other remote targets may be available in your configuration of GDB; 10592 use `help target' to list them. 10593 10594 Once you've connected to the remote target, GDB allows you to send 10595 arbitrary commands to the remote monitor: 10596 10597 `remote COMMAND' 10598 Send an arbitrary COMMAND string to the remote monitor. 10599 10600 10601 File: gdb.info, Node: Remote Debugging, Next: Configurations, Prev: Targets, Up: Top 10602 10603 17 Debugging remote programs 10604 **************************** 10605 10606 * Menu: 10607 10608 * Connecting:: Connecting to a remote target 10609 * Server:: Using the gdbserver program 10610 * Remote configuration:: Remote configuration 10611 * remote stub:: Implementing a remote stub 10612 10613 10614 File: gdb.info, Node: Connecting, Next: Server, Up: Remote Debugging 10615 10616 17.1 Connecting to a remote target 10617 ================================== 10618 10619 On the GDB host machine, you will need an unstripped copy of your 10620 program, since GDB needs symobl and debugging information. Start up 10621 GDB as usual, using the name of the local copy of your program as the 10622 first argument. 10623 10624 GDB can communicate with the target over a serial line, or over an 10625 IP network using TCP or UDP. In each case, GDB uses the same protocol 10626 for debugging your program; only the medium carrying the debugging 10627 packets varies. The `target remote' command establishes a connection 10628 to the target. Its arguments indicate which medium to use: 10629 10630 `target remote SERIAL-DEVICE' 10631 Use SERIAL-DEVICE to communicate with the target. For example, to 10632 use a serial line connected to the device named `/dev/ttyb': 10633 10634 target remote /dev/ttyb 10635 10636 If you're using a serial line, you may want to give GDB the 10637 `--baud' option, or use the `set remotebaud' command (*note set 10638 remotebaud: Remote configuration.) before the `target' command. 10639 10640 `target remote `HOST:PORT'' 10641 `target remote `tcp:HOST:PORT'' 10642 Debug using a TCP connection to PORT on HOST. The HOST may be 10643 either a host name or a numeric IP address; PORT must be a decimal 10644 number. The HOST could be the target machine itself, if it is 10645 directly connected to the net, or it might be a terminal server 10646 which in turn has a serial line to the target. 10647 10648 For example, to connect to port 2828 on a terminal server named 10649 `manyfarms': 10650 10651 target remote manyfarms:2828 10652 10653 If your remote target is actually running on the same machine as 10654 your debugger session (e.g. a simulator for your target running on 10655 the same host), you can omit the hostname. For example, to 10656 connect to port 1234 on your local machine: 10657 10658 target remote :1234 10659 Note that the colon is still required here. 10660 10661 `target remote `udp:HOST:PORT'' 10662 Debug using UDP packets to PORT on HOST. For example, to connect 10663 to UDP port 2828 on a terminal server named `manyfarms': 10664 10665 target remote udp:manyfarms:2828 10666 10667 When using a UDP connection for remote debugging, you should keep 10668 in mind that the `U' stands for "Unreliable". UDP can silently 10669 drop packets on busy or unreliable networks, which will cause 10670 havoc with your debugging session. 10671 10672 `target remote | COMMAND' 10673 Run COMMAND in the background and communicate with it using a 10674 pipe. The COMMAND is a shell command, to be parsed and expanded 10675 by the system's command shell, `/bin/sh'; it should expect remote 10676 protocol packets on its standard input, and send replies on its 10677 standard output. You could use this to run a stand-alone simulator 10678 that speaks the remote debugging protocol, to make net connections 10679 using programs like `ssh', or for other similar tricks. 10680 10681 If COMMAND closes its standard output (perhaps by exiting), GDB 10682 will try to send it a `SIGTERM' signal. (If the program has 10683 already exited, this will have no effect.) 10684 10685 10686 Once the connection has been established, you can use all the usual 10687 commands to examine and change data and to step and continue the remote 10688 program. 10689 10690 Whenever GDB is waiting for the remote program, if you type the 10691 interrupt character (often `Ctrl-c'), GDB attempts to stop the program. 10692 This may or may not succeed, depending in part on the hardware and the 10693 serial drivers the remote system uses. If you type the interrupt 10694 character once again, GDB displays this prompt: 10695 10696 Interrupted while waiting for the program. 10697 Give up (and stop debugging it)? (y or n) 10698 10699 If you type `y', GDB abandons the remote debugging session. (If you 10700 decide you want to try again later, you can use `target remote' again 10701 to connect once more.) If you type `n', GDB goes back to waiting. 10702 10703 `detach' 10704 When you have finished debugging the remote program, you can use 10705 the `detach' command to release it from GDB control. Detaching 10706 from the target normally resumes its execution, but the results 10707 will depend on your particular remote stub. After the `detach' 10708 command, GDB is free to connect to another target. 10709 10710 `disconnect' 10711 The `disconnect' command behaves like `detach', except that the 10712 target is generally not resumed. It will wait for GDB (this 10713 instance or another one) to connect and continue debugging. After 10714 the `disconnect' command, GDB is again free to connect to another 10715 target. 10716 10717 `monitor CMD' 10718 This command allows you to send arbitrary commands directly to the 10719 remote monitor. Since GDB doesn't care about the commands it 10720 sends like this, this command is the way to extend GDB--you can 10721 add new commands that only the external monitor will understand 10722 and implement. 10723 10724 10725 File: gdb.info, Node: Server, Next: Remote configuration, Prev: Connecting, Up: Remote Debugging 10726 10727 17.2 Using the `gdbserver' program 10728 ================================== 10729 10730 `gdbserver' is a control program for Unix-like systems, which allows 10731 you to connect your program with a remote GDB via `target remote'--but 10732 without linking in the usual debugging stub. 10733 10734 `gdbserver' is not a complete replacement for the debugging stubs, 10735 because it requires essentially the same operating-system facilities 10736 that GDB itself does. In fact, a system that can run `gdbserver' to 10737 connect to a remote GDB could also run GDB locally! `gdbserver' is 10738 sometimes useful nevertheless, because it is a much smaller program 10739 than GDB itself. It is also easier to port than all of GDB, so you may 10740 be able to get started more quickly on a new system by using 10741 `gdbserver'. Finally, if you develop code for real-time systems, you 10742 may find that the tradeoffs involved in real-time operation make it 10743 more convenient to do as much development work as possible on another 10744 system, for example by cross-compiling. You can use `gdbserver' to 10745 make a similar choice for debugging. 10746 10747 GDB and `gdbserver' communicate via either a serial line or a TCP 10748 connection, using the standard GDB remote serial protocol. 10749 10750 _On the target machine,_ 10751 you need to have a copy of the program you want to debug. 10752 `gdbserver' does not need your program's symbol table, so you can 10753 strip the program if necessary to save space. GDB on the host 10754 system does all the symbol handling. 10755 10756 To use the server, you must tell it how to communicate with GDB; 10757 the name of your program; and the arguments for your program. The 10758 usual syntax is: 10759 10760 target> gdbserver COMM PROGRAM [ ARGS ... ] 10761 10762 COMM is either a device name (to use a serial line) or a TCP 10763 hostname and portnumber. For example, to debug Emacs with the 10764 argument `foo.txt' and communicate with GDB over the serial port 10765 `/dev/com1': 10766 10767 target> gdbserver /dev/com1 emacs foo.txt 10768 10769 `gdbserver' waits passively for the host GDB to communicate with 10770 it. 10771 10772 To use a TCP connection instead of a serial line: 10773 10774 target> gdbserver host:2345 emacs foo.txt 10775 10776 The only difference from the previous example is the first 10777 argument, specifying that you are communicating with the host GDB 10778 via TCP. The `host:2345' argument means that `gdbserver' is to 10779 expect a TCP connection from machine `host' to local TCP port 2345. 10780 (Currently, the `host' part is ignored.) You can choose any number 10781 you want for the port number as long as it does not conflict with 10782 any TCP ports already in use on the target system (for example, 10783 `23' is reserved for `telnet').(1) You must use the same port 10784 number with the host GDB `target remote' command. 10785 10786 On some targets, `gdbserver' can also attach to running programs. 10787 This is accomplished via the `--attach' argument. The syntax is: 10788 10789 target> gdbserver COMM --attach PID 10790 10791 PID is the process ID of a currently running process. It isn't 10792 necessary to point `gdbserver' at a binary for the running process. 10793 10794 You can debug processes by name instead of process ID if your 10795 target has the `pidof' utility: 10796 10797 target> gdbserver COMM --attach `pidof PROGRAM` 10798 10799 In case more than one copy of PROGRAM is running, or PROGRAM has 10800 multiple threads, most versions of `pidof' support the `-s' option 10801 to only return the first process ID. 10802 10803 _On the host machine,_ 10804 connect to your target (*note Connecting to a remote target: 10805 Connecting.). For TCP connections, you must start up `gdbserver' 10806 prior to using the `target remote' command. Otherwise you may get 10807 an error whose text depends on the host system, but which usually 10808 looks something like `Connection refused'. You don't need to use 10809 the `load' command in GDB when using `gdbserver', since the 10810 program is already on the target. However, if you want to load 10811 the symbols (as you normally would), do that with the `file' 10812 command, and issue it _before_ connecting to the server; 10813 otherwise, you will get an error message saying `"Program is 10814 already running"', since the program is considered running after 10815 the connection. 10816 10817 10818 ---------- Footnotes ---------- 10819 10820 (1) If you choose a port number that conflicts with another service, 10821 `gdbserver' prints an error message and exits. 10822 10823 10824 File: gdb.info, Node: Remote configuration, Next: remote stub, Prev: Server, Up: Remote Debugging 10825 10826 17.3 Remote configuration 10827 ========================= 10828 10829 This section documents the configuration options available when 10830 debugging remote programs. For the options related to the File I/O 10831 extensions of the remote protocol, see *Note system-call-allowed: 10832 system. 10833 10834 `set remoteaddresssize BITS' 10835 Set the maximum size of address in a memory packet to the specified 10836 number of bits. GDB will mask off the address bits above that 10837 number, when it passes addresses to the remote target. The 10838 default value is the number of bits in the target's address. 10839 10840 `show remoteaddresssize' 10841 Show the current value of remote address size in bits. 10842 10843 `set remotebaud N' 10844 Set the baud rate for the remote serial I/O to N baud. The value 10845 is used to set the speed of the serial port used for debugging 10846 remote targets. 10847 10848 `show remotebaud' 10849 Show the current speed of the remote connection. 10850 10851 `set remotebreak' 10852 If set to on, GDB sends a `BREAK' signal to the remote when you 10853 type `Ctrl-c' to interrupt the program running on the remote. If 10854 set to off, GDB sends the `Ctrl-C' character instead. The default 10855 is off, since most remote systems expect to see `Ctrl-C' as the 10856 interrupt signal. 10857 10858 `show remotebreak' 10859 Show whether GDB sends `BREAK' or `Ctrl-C' to interrupt the remote 10860 program. 10861 10862 `set remotedevice DEVICE' 10863 Set the name of the serial port through which to communicate to the 10864 remote target to DEVICE. This is the device used by GDB to open 10865 the serial communications line to the remote target. There's no 10866 default, so you must set a valid port name for the remote serial 10867 communications to work. (Some varieties of the `target' command 10868 accept the port name as part of their arguments.) 10869 10870 `show remotedevice' 10871 Show the current name of the serial port. 10872 10873 `set remotelogbase BASE' 10874 Set the base (a.k.a. radix) of logging serial protocol 10875 communications to BASE. Supported values of BASE are: `ascii', 10876 `octal', and `hex'. The default is `ascii'. 10877 10878 `show remotelogbase' 10879 Show the current setting of the radix for logging remote serial 10880 protocol. 10881 10882 `set remotelogfile FILE' 10883 Record remote serial communications on the named FILE. The 10884 default is not to record at all. 10885 10886 `show remotelogfile.' 10887 Show the current setting of the file name on which to record the 10888 serial communications. 10889 10890 `set remotetimeout NUM' 10891 Set the timeout limit to wait for the remote target to respond to 10892 NUM seconds. The default is 2 seconds. 10893 10894 `show remotetimeout' 10895 Show the current number of seconds to wait for the remote target 10896 responses. 10897 10898 `set remote hardware-watchpoint-limit LIMIT' 10899 `set remote hardware-breakpoint-limit LIMIT' 10900 Restrict GDB to using LIMIT remote hardware breakpoint or 10901 watchpoints. A limit of -1, the default, is treated as unlimited. 10902 10903 The GDB remote protocol autodetects the packets supported by your 10904 debugging stub. If you need to override the autodetection, you can use 10905 these commands to enable or disable individual packets. Each packet 10906 can be set to `on' (the remote target supports this packet), `off' (the 10907 remote target does not support this packet), or `auto' (detect remote 10908 target support for this packet). They all default to `auto'. For more 10909 information about each packet, see *Note Remote Protocol::. 10910 10911 During normal use, you should not have to use any of these commands. 10912 If you do, that may be a bug in your remote debugging stub, or a bug in 10913 GDB. You may want to report the problem to the GDB developers. 10914 10915 The available settings are: 10916 10917 Command Name Remote Packet Related Features 10918 `fetch-register-packet'`p' `info registers' 10919 `set-register-packet' `P' `set' 10920 `binary-download-packet'`X' `load', `set' 10921 `read-aux-vector-packet'`qXfer:auxv:read'`info auxv' 10922 `symbol-lookup-packet' `qSymbol' Detecting multiple 10923 threads 10924 `verbose-resume-packet'`vCont' Stepping or resuming 10925 multiple threads 10926 `software-breakpoint-packet'`Z0' `break' 10927 `hardware-breakpoint-packet'`Z1' `hbreak' 10928 `write-watchpoint-packet'`Z2' `watch' 10929 `read-watchpoint-packet'`Z3' `rwatch' 10930 `access-watchpoint-packet'`Z4' `awatch' 10931 `get-thread-local-storage-address-packet'`qGetTLSAddr' Displaying `__thread' 10932 variables 10933 `supported-packets' `qSupported' Remote communications 10934 parameters 10935 10936 10937 File: gdb.info, Node: remote stub, Prev: Remote configuration, Up: Remote Debugging 10938 10939 17.4 Implementing a remote stub 10940 =============================== 10941 10942 The stub files provided with GDB implement the target side of the 10943 communication protocol, and the GDB side is implemented in the GDB 10944 source file `remote.c'. Normally, you can simply allow these 10945 subroutines to communicate, and ignore the details. (If you're 10946 implementing your own stub file, you can still ignore the details: start 10947 with one of the existing stub files. `sparc-stub.c' is the best 10948 organized, and therefore the easiest to read.) 10949 10950 To debug a program running on another machine (the debugging 10951 "target" machine), you must first arrange for all the usual 10952 prerequisites for the program to run by itself. For example, for a C 10953 program, you need: 10954 10955 1. A startup routine to set up the C runtime environment; these 10956 usually have a name like `crt0'. The startup routine may be 10957 supplied by your hardware supplier, or you may have to write your 10958 own. 10959 10960 2. A C subroutine library to support your program's subroutine calls, 10961 notably managing input and output. 10962 10963 3. A way of getting your program to the other machine--for example, a 10964 download program. These are often supplied by the hardware 10965 manufacturer, but you may have to write your own from hardware 10966 documentation. 10967 10968 The next step is to arrange for your program to use a serial port to 10969 communicate with the machine where GDB is running (the "host" machine). 10970 In general terms, the scheme looks like this: 10971 10972 _On the host,_ 10973 GDB already understands how to use this protocol; when everything 10974 else is set up, you can simply use the `target remote' command 10975 (*note Specifying a Debugging Target: Targets.). 10976 10977 _On the target,_ 10978 you must link with your program a few special-purpose subroutines 10979 that implement the GDB remote serial protocol. The file 10980 containing these subroutines is called a "debugging stub". 10981 10982 On certain remote targets, you can use an auxiliary program 10983 `gdbserver' instead of linking a stub into your program. *Note 10984 Using the `gdbserver' program: Server, for details. 10985 10986 The debugging stub is specific to the architecture of the remote 10987 machine; for example, use `sparc-stub.c' to debug programs on SPARC 10988 boards. 10989 10990 These working remote stubs are distributed with GDB: 10991 10992 `i386-stub.c' 10993 For Intel 386 and compatible architectures. 10994 10995 `m68k-stub.c' 10996 For Motorola 680x0 architectures. 10997 10998 `sh-stub.c' 10999 For Renesas SH architectures. 11000 11001 `sparc-stub.c' 11002 For SPARC architectures. 11003 11004 `sparcl-stub.c' 11005 For Fujitsu SPARCLITE architectures. 11006 11007 11008 The `README' file in the GDB distribution may list other recently 11009 added stubs. 11010 11011 * Menu: 11012 11013 * Stub Contents:: What the stub can do for you 11014 * Bootstrapping:: What you must do for the stub 11015 * Debug Session:: Putting it all together 11016 11017 11018 File: gdb.info, Node: Stub Contents, Next: Bootstrapping, Up: remote stub 11019 11020 17.4.1 What the stub can do for you 11021 ----------------------------------- 11022 11023 The debugging stub for your architecture supplies these three 11024 subroutines: 11025 11026 `set_debug_traps' 11027 This routine arranges for `handle_exception' to run when your 11028 program stops. You must call this subroutine explicitly near the 11029 beginning of your program. 11030 11031 `handle_exception' 11032 This is the central workhorse, but your program never calls it 11033 explicitly--the setup code arranges for `handle_exception' to run 11034 when a trap is triggered. 11035 11036 `handle_exception' takes control when your program stops during 11037 execution (for example, on a breakpoint), and mediates 11038 communications with GDB on the host machine. This is where the 11039 communications protocol is implemented; `handle_exception' acts as 11040 the GDB representative on the target machine. It begins by 11041 sending summary information on the state of your program, then 11042 continues to execute, retrieving and transmitting any information 11043 GDB needs, until you execute a GDB command that makes your program 11044 resume; at that point, `handle_exception' returns control to your 11045 own code on the target machine. 11046 11047 `breakpoint' 11048 Use this auxiliary subroutine to make your program contain a 11049 breakpoint. Depending on the particular situation, this may be 11050 the only way for GDB to get control. For instance, if your target 11051 machine has some sort of interrupt button, you won't need to call 11052 this; pressing the interrupt button transfers control to 11053 `handle_exception'--in effect, to GDB. On some machines, simply 11054 receiving characters on the serial port may also trigger a trap; 11055 again, in that situation, you don't need to call `breakpoint' from 11056 your own program--simply running `target remote' from the host GDB 11057 session gets control. 11058 11059 Call `breakpoint' if none of these is true, or if you simply want 11060 to make certain your program stops at a predetermined point for the 11061 start of your debugging session. 11062 11063 11064 File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: remote stub 11065 11066 17.4.2 What you must do for the stub 11067 ------------------------------------ 11068 11069 The debugging stubs that come with GDB are set up for a particular chip 11070 architecture, but they have no information about the rest of your 11071 debugging target machine. 11072 11073 First of all you need to tell the stub how to communicate with the 11074 serial port. 11075 11076 `int getDebugChar()' 11077 Write this subroutine to read a single character from the serial 11078 port. It may be identical to `getchar' for your target system; a 11079 different name is used to allow you to distinguish the two if you 11080 wish. 11081 11082 `void putDebugChar(int)' 11083 Write this subroutine to write a single character to the serial 11084 port. It may be identical to `putchar' for your target system; a 11085 different name is used to allow you to distinguish the two if you 11086 wish. 11087 11088 If you want GDB to be able to stop your program while it is running, 11089 you need to use an interrupt-driven serial driver, and arrange for it 11090 to stop when it receives a `^C' (`\003', the control-C character). 11091 That is the character which GDB uses to tell the remote system to stop. 11092 11093 Getting the debugging target to return the proper status to GDB 11094 probably requires changes to the standard stub; one quick and dirty way 11095 is to just execute a breakpoint instruction (the "dirty" part is that 11096 GDB reports a `SIGTRAP' instead of a `SIGINT'). 11097 11098 Other routines you need to supply are: 11099 11100 `void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)' 11101 Write this function to install EXCEPTION_ADDRESS in the exception 11102 handling tables. You need to do this because the stub does not 11103 have any way of knowing what the exception handling tables on your 11104 target system are like (for example, the processor's table might 11105 be in ROM, containing entries which point to a table in RAM). 11106 EXCEPTION_NUMBER is the exception number which should be changed; 11107 its meaning is architecture-dependent (for example, different 11108 numbers might represent divide by zero, misaligned access, etc). 11109 When this exception occurs, control should be transferred directly 11110 to EXCEPTION_ADDRESS, and the processor state (stack, registers, 11111 and so on) should be just as it is when a processor exception 11112 occurs. So if you want to use a jump instruction to reach 11113 EXCEPTION_ADDRESS, it should be a simple jump, not a jump to 11114 subroutine. 11115 11116 For the 386, EXCEPTION_ADDRESS should be installed as an interrupt 11117 gate so that interrupts are masked while the handler runs. The 11118 gate should be at privilege level 0 (the most privileged level). 11119 The SPARC and 68k stubs are able to mask interrupts themselves 11120 without help from `exceptionHandler'. 11121 11122 `void flush_i_cache()' 11123 On SPARC and SPARCLITE only, write this subroutine to flush the 11124 instruction cache, if any, on your target machine. If there is no 11125 instruction cache, this subroutine may be a no-op. 11126 11127 On target machines that have instruction caches, GDB requires this 11128 function to make certain that the state of your program is stable. 11129 11130 You must also make sure this library routine is available: 11131 11132 `void *memset(void *, int, int)' 11133 This is the standard library function `memset' that sets an area of 11134 memory to a known value. If you have one of the free versions of 11135 `libc.a', `memset' can be found there; otherwise, you must either 11136 obtain it from your hardware manufacturer, or write your own. 11137 11138 If you do not use the GNU C compiler, you may need other standard 11139 library subroutines as well; this varies from one stub to another, but 11140 in general the stubs are likely to use any of the common library 11141 subroutines which `gcc' generates as inline code. 11142 11143 11144 File: gdb.info, Node: Debug Session, Prev: Bootstrapping, Up: remote stub 11145 11146 17.4.3 Putting it all together 11147 ------------------------------ 11148 11149 In summary, when your program is ready to debug, you must follow these 11150 steps. 11151 11152 1. Make sure you have defined the supporting low-level routines 11153 (*note What you must do for the stub: Bootstrapping.): 11154 `getDebugChar', `putDebugChar', 11155 `flush_i_cache', `memset', `exceptionHandler'. 11156 11157 2. Insert these lines near the top of your program: 11158 11159 set_debug_traps(); 11160 breakpoint(); 11161 11162 3. For the 680x0 stub only, you need to provide a variable called 11163 `exceptionHook'. Normally you just use: 11164 11165 void (*exceptionHook)() = 0; 11166 11167 but if before calling `set_debug_traps', you set it to point to a 11168 function in your program, that function is called when `GDB' 11169 continues after stopping on a trap (for example, bus error). The 11170 function indicated by `exceptionHook' is called with one 11171 parameter: an `int' which is the exception number. 11172 11173 4. Compile and link together: your program, the GDB debugging stub for 11174 your target architecture, and the supporting subroutines. 11175 11176 5. Make sure you have a serial connection between your target machine 11177 and the GDB host, and identify the serial port on the host. 11178 11179 6. Download your program to your target machine (or get it there by 11180 whatever means the manufacturer provides), and start it. 11181 11182 7. Start GDB on the host, and connect to the target (*note Connecting 11183 to a remote target: Connecting.). 11184 11185 11186 11187 File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Remote Debugging, Up: Top 11188 11189 18 Configuration-Specific Information 11190 ************************************* 11191 11192 While nearly all GDB commands are available for all native and cross 11193 versions of the debugger, there are some exceptions. This chapter 11194 describes things that are only available in certain configurations. 11195 11196 There are three major categories of configurations: native 11197 configurations, where the host and target are the same, embedded 11198 operating system configurations, which are usually the same for several 11199 different processor architectures, and bare embedded processors, which 11200 are quite different from each other. 11201 11202 * Menu: 11203 11204 * Native:: 11205 * Embedded OS:: 11206 * Embedded Processors:: 11207 * Architectures:: 11208 11209 11210 File: gdb.info, Node: Native, Next: Embedded OS, Up: Configurations 11211 11212 18.1 Native 11213 =========== 11214 11215 This section describes details specific to particular native 11216 configurations. 11217 11218 * Menu: 11219 11220 * HP-UX:: HP-UX 11221 * BSD libkvm Interface:: Debugging BSD kernel memory images 11222 * SVR4 Process Information:: SVR4 process information 11223 * DJGPP Native:: Features specific to the DJGPP port 11224 * Cygwin Native:: Features specific to the Cygwin port 11225 * Hurd Native:: Features specific to GNU Hurd 11226 * Neutrino:: Features specific to QNX Neutrino 11227 11228 11229 File: gdb.info, Node: HP-UX, Next: BSD libkvm Interface, Up: Native 11230 11231 18.1.1 HP-UX 11232 ------------ 11233 11234 On HP-UX systems, if you refer to a function or variable name that 11235 begins with a dollar sign, GDB searches for a user or system name 11236 first, before it searches for a convenience variable. 11237 11238 11239 File: gdb.info, Node: BSD libkvm Interface, Next: SVR4 Process Information, Prev: HP-UX, Up: Native 11240 11241 18.1.2 BSD libkvm Interface 11242 --------------------------- 11243 11244 BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory 11245 interface that provides a uniform interface for accessing kernel virtual 11246 memory images, including live systems and crash dumps. GDB uses this 11247 interface to allow you to debug live kernels and kernel crash dumps on 11248 many native BSD configurations. This is implemented as a special `kvm' 11249 debugging target. For debugging a live system, load the currently 11250 running kernel into GDB and connect to the `kvm' target: 11251 11252 (gdb) target kvm 11253 11254 For debugging crash dumps, provide the file name of the crash dump 11255 as an argument: 11256 11257 (gdb) target kvm /var/crash/bsd.0 11258 11259 Once connected to the `kvm' target, the following commands are 11260 available: 11261 11262 `kvm pcb' 11263 Set current context from the "Process Control Block" (PCB) address. 11264 11265 `kvm proc' 11266 Set current context from proc address. This command isn't 11267 available on modern FreeBSD systems. 11268 11269 11270 File: gdb.info, Node: SVR4 Process Information, Next: DJGPP Native, Prev: BSD libkvm Interface, Up: Native 11271 11272 18.1.3 SVR4 process information 11273 ------------------------------- 11274 11275 Many versions of SVR4 and compatible systems provide a facility called 11276 `/proc' that can be used to examine the image of a running process 11277 using file-system subroutines. If GDB is configured for an operating 11278 system with this facility, the command `info proc' is available to 11279 report information about the process running your program, or about any 11280 process running on your system. `info proc' works only on SVR4 systems 11281 that include the `procfs' code. This includes, as of this writing, 11282 GNU/Linux, OSF/1 (Digital Unix), Solaris, Irix, and Unixware, but not 11283 HP-UX, for example. 11284 11285 `info proc' 11286 `info proc PROCESS-ID' 11287 Summarize available information about any running process. If a 11288 process ID is specified by PROCESS-ID, display information about 11289 that process; otherwise display information about the program being 11290 debugged. The summary includes the debugged process ID, the 11291 command line used to invoke it, its current working directory, and 11292 its executable file's absolute file name. 11293 11294 On some systems, PROCESS-ID can be of the form `[PID]/TID' which 11295 specifies a certain thread ID within a process. If the optional 11296 PID part is missing, it means a thread from the process being 11297 debugged (the leading `/' still needs to be present, or else GDB 11298 will interpret the number as a process ID rather than a thread ID). 11299 11300 `info proc mappings' 11301 Report the memory address space ranges accessible in the program, 11302 with information on whether the process has read, write, or 11303 execute access rights to each range. On GNU/Linux systems, each 11304 memory range includes the object file which is mapped to that 11305 range, instead of the memory access rights to that range. 11306 11307 `info proc stat' 11308 `info proc status' 11309 These subcommands are specific to GNU/Linux systems. They show 11310 the process-related information, including the user ID and group 11311 ID; how many threads are there in the process; its virtual memory 11312 usage; the signals that are pending, blocked, and ignored; its 11313 TTY; its consumption of system and user time; its stack size; its 11314 `nice' value; etc. For more information, see the `proc' man page 11315 (type `man 5 proc' from your shell prompt). 11316 11317 `info proc all' 11318 Show all the information about the process described under all of 11319 the above `info proc' subcommands. 11320 11321 `set procfs-trace' 11322 This command enables and disables tracing of `procfs' API calls. 11323 11324 `show procfs-trace' 11325 Show the current state of `procfs' API call tracing. 11326 11327 `set procfs-file FILE' 11328 Tell GDB to write `procfs' API trace to the named FILE. GDB 11329 appends the trace info to the previous contents of the file. The 11330 default is to display the trace on the standard output. 11331 11332 `show procfs-file' 11333 Show the file to which `procfs' API trace is written. 11334 11335 `proc-trace-entry' 11336 `proc-trace-exit' 11337 `proc-untrace-entry' 11338 `proc-untrace-exit' 11339 These commands enable and disable tracing of entries into and exits 11340 from the `syscall' interface. 11341 11342 `info pidlist' 11343 For QNX Neutrino only, this command displays the list of all the 11344 processes and all the threads within each process. 11345 11346 `info meminfo' 11347 For QNX Neutrino only, this command displays the list of all 11348 mapinfos. 11349 11350 11351 File: gdb.info, Node: DJGPP Native, Next: Cygwin Native, Prev: SVR4 Process Information, Up: Native 11352 11353 18.1.4 Features for Debugging DJGPP Programs 11354 -------------------------------------------- 11355 11356 DJGPP is a port of the GNU development tools to MS-DOS and MS-Windows. 11357 DJGPP programs are 32-bit protected-mode programs that use the "DPMI" 11358 (DOS Protected-Mode Interface) API to run on top of real-mode DOS 11359 systems and their emulations. 11360 11361 GDB supports native debugging of DJGPP programs, and defines a few 11362 commands specific to the DJGPP port. This subsection describes those 11363 commands. 11364 11365 `info dos' 11366 This is a prefix of DJGPP-specific commands which print 11367 information about the target system and important OS structures. 11368 11369 `info dos sysinfo' 11370 This command displays assorted information about the underlying 11371 platform: the CPU type and features, the OS version and flavor, the 11372 DPMI version, and the available conventional and DPMI memory. 11373 11374 `info dos gdt' 11375 `info dos ldt' 11376 `info dos idt' 11377 These 3 commands display entries from, respectively, Global, Local, 11378 and Interrupt Descriptor Tables (GDT, LDT, and IDT). The 11379 descriptor tables are data structures which store a descriptor for 11380 each segment that is currently in use. The segment's selector is 11381 an index into a descriptor table; the table entry for that index 11382 holds the descriptor's base address and limit, and its attributes 11383 and access rights. 11384 11385 A typical DJGPP program uses 3 segments: a code segment, a data 11386 segment (used for both data and the stack), and a DOS segment 11387 (which allows access to DOS/BIOS data structures and absolute 11388 addresses in conventional memory). However, the DPMI host will 11389 usually define additional segments in order to support the DPMI 11390 environment. 11391 11392 These commands allow to display entries from the descriptor tables. 11393 Without an argument, all entries from the specified table are 11394 displayed. An argument, which should be an integer expression, 11395 means display a single entry whose index is given by the argument. 11396 For example, here's a convenient way to display information about 11397 the debugged program's data segment: 11398 11399 `(gdb) info dos ldt $ds' 11400 `0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)' 11401 11402 11403 This comes in handy when you want to see whether a pointer is 11404 outside the data segment's limit (i.e. "garbled"). 11405 11406 `info dos pde' 11407 `info dos pte' 11408 These two commands display entries from, respectively, the Page 11409 Directory and the Page Tables. Page Directories and Page Tables 11410 are data structures which control how virtual memory addresses are 11411 mapped into physical addresses. A Page Table includes an entry 11412 for every page of memory that is mapped into the program's address 11413 space; there may be several Page Tables, each one holding up to 11414 4096 entries. A Page Directory has up to 4096 entries, one each 11415 for every Page Table that is currently in use. 11416 11417 Without an argument, `info dos pde' displays the entire Page 11418 Directory, and `info dos pte' displays all the entries in all of 11419 the Page Tables. An argument, an integer expression, given to the 11420 `info dos pde' command means display only that entry from the Page 11421 Directory table. An argument given to the `info dos pte' command 11422 means display entries from a single Page Table, the one pointed to 11423 by the specified entry in the Page Directory. 11424 11425 These commands are useful when your program uses "DMA" (Direct 11426 Memory Access), which needs physical addresses to program the DMA 11427 controller. 11428 11429 These commands are supported only with some DPMI servers. 11430 11431 `info dos address-pte ADDR' 11432 This command displays the Page Table entry for a specified linear 11433 address. The argument ADDR is a linear address which should 11434 already have the appropriate segment's base address added to it, 11435 because this command accepts addresses which may belong to _any_ 11436 segment. For example, here's how to display the Page Table entry 11437 for the page where a variable `i' is stored: 11438 11439 `(gdb) info dos address-pte __djgpp_base_address + (char *)&i' 11440 `Page Table entry for address 0x11a00d30:' 11441 `Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30' 11442 11443 11444 This says that `i' is stored at offset `0xd30' from the page whose 11445 physical base address is `0x02698000', and shows all the 11446 attributes of that page. 11447 11448 Note that you must cast the addresses of variables to a `char *', 11449 since otherwise the value of `__djgpp_base_address', the base 11450 address of all variables and functions in a DJGPP program, will be 11451 added using the rules of C pointer arithmetics: if `i' is declared 11452 an `int', GDB will add 4 times the value of `__djgpp_base_address' 11453 to the address of `i'. 11454 11455 Here's another example, it displays the Page Table entry for the 11456 transfer buffer: 11457 11458 `(gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)' 11459 `Page Table entry for address 0x29110:' 11460 `Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110' 11461 11462 11463 (The `+ 3' offset is because the transfer buffer's address is the 11464 3rd member of the `_go32_info_block' structure.) The output 11465 clearly shows that this DPMI server maps the addresses in 11466 conventional memory 1:1, i.e. the physical (`0x00029000' + 11467 `0x110') and linear (`0x29110') addresses are identical. 11468 11469 This command is supported only with some DPMI servers. 11470 11471 In addition to native debugging, the DJGPP port supports remote 11472 debugging via a serial data link. The following commands are specific 11473 to remote serial debugging in the DJGPP port of GDB. 11474 11475 `set com1base ADDR' 11476 This command sets the base I/O port address of the `COM1' serial 11477 port. 11478 11479 `set com1irq IRQ' 11480 This command sets the "Interrupt Request" (`IRQ') line to use for 11481 the `COM1' serial port. 11482 11483 There are similar commands `set com2base', `set com3irq', etc. for 11484 setting the port address and the `IRQ' lines for the other 3 COM 11485 ports. 11486 11487 The related commands `show com1base', `show com1irq' etc. display 11488 the current settings of the base address and the `IRQ' lines used 11489 by the COM ports. 11490 11491 `info serial' 11492 This command prints the status of the 4 DOS serial ports. For each 11493 port, it prints whether it's active or not, its I/O base address 11494 and IRQ number, whether it uses a 16550-style FIFO, its baudrate, 11495 and the counts of various errors encountered so far. 11496 11497 11498 File: gdb.info, Node: Cygwin Native, Next: Hurd Native, Prev: DJGPP Native, Up: Native 11499 11500 18.1.5 Features for Debugging MS Windows PE executables 11501 ------------------------------------------------------- 11502 11503 GDB supports native debugging of MS Windows programs, including DLLs 11504 with and without symbolic debugging information. There are various 11505 additional Cygwin-specific commands, described in this subsection. The 11506 subsubsection *note Non-debug DLL symbols:: describes working with DLLs 11507 that have no debugging symbols. 11508 11509 `info w32' 11510 This is a prefix of MS Windows specific commands which print 11511 information about the target system and important OS structures. 11512 11513 `info w32 selector' 11514 This command displays information returned by the Win32 API 11515 `GetThreadSelectorEntry' function. It takes an optional argument 11516 that is evaluated to a long value to give the information about 11517 this given selector. Without argument, this command displays 11518 information about the the six segment registers. 11519 11520 `info dll' 11521 This is a Cygwin specific alias of info shared. 11522 11523 `dll-symbols' 11524 This command loads symbols from a dll similarly to add-sym command 11525 but without the need to specify a base address. 11526 11527 `set cygwin-exceptions MODE' 11528 If MODE is `on', GDB will break on exceptions that happen inside 11529 the Cygwin DLL. If MODE is `off', GDB will delay recognition of 11530 exceptions, and may ignore some exceptions which seem to be caused 11531 by internal Cygwin DLL "bookkeeping". This option is meant 11532 primarily for debugging the Cygwin DLL itself; the default value 11533 is `off' to avoid annoying GDB users with false `SIGSEGV' signals. 11534 11535 `show cygwin-exceptions' 11536 Displays whether GDB will break on exceptions that happen inside 11537 the Cygwin DLL itself. 11538 11539 `set new-console MODE' 11540 If MODE is `on' the debuggee will be started in a new console on 11541 next start. If MODE is `off'i, the debuggee will be started in 11542 the same console as the debugger. 11543 11544 `show new-console' 11545 Displays whether a new console is used when the debuggee is 11546 started. 11547 11548 `set new-group MODE' 11549 This boolean value controls whether the debuggee should start a 11550 new group or stay in the same group as the debugger. This affects 11551 the way the Windows OS handles `Ctrl-C'. 11552 11553 `show new-group' 11554 Displays current value of new-group boolean. 11555 11556 `set debugevents' 11557 This boolean value adds debug output concerning kernel events 11558 related to the debuggee seen by the debugger. This includes 11559 events that signal thread and process creation and exit, DLL 11560 loading and unloading, console interrupts, and debugging messages 11561 produced by the Windows `OutputDebugString' API call. 11562 11563 `set debugexec' 11564 This boolean value adds debug output concerning execute events 11565 (such as resume thread) seen by the debugger. 11566 11567 `set debugexceptions' 11568 This boolean value adds debug output concerning exceptions in the 11569 debuggee seen by the debugger. 11570 11571 `set debugmemory' 11572 This boolean value adds debug output concerning debuggee memory 11573 reads and writes by the debugger. 11574 11575 `set shell' 11576 This boolean values specifies whether the debuggee is called via a 11577 shell or directly (default value is on). 11578 11579 `show shell' 11580 Displays if the debuggee will be started with a shell. 11581 11582 11583 * Menu: 11584 11585 * Non-debug DLL symbols:: Support for DLLs without debugging symbols 11586 11587 11588 File: gdb.info, Node: Non-debug DLL symbols, Up: Cygwin Native 11589 11590 18.1.5.1 Support for DLLs without debugging symbols 11591 ................................................... 11592 11593 Very often on windows, some of the DLLs that your program relies on do 11594 not include symbolic debugging information (for example, 11595 `kernel32.dll'). When GDB doesn't recognize any debugging symbols in a 11596 DLL, it relies on the minimal amount of symbolic information contained 11597 in the DLL's export table. This subsubsection describes working with 11598 such symbols, known internally to GDB as "minimal symbols". 11599 11600 Note that before the debugged program has started execution, no DLLs 11601 will have been loaded. The easiest way around this problem is simply to 11602 start the program -- either by setting a breakpoint or letting the 11603 program run once to completion. It is also possible to force GDB to 11604 load a particular DLL before starting the executable -- see the shared 11605 library information in *note Files:: or the `dll-symbols' command in 11606 *note Cygwin Native::. Currently, explicitly loading symbols from a DLL 11607 with no debugging information will cause the symbol names to be 11608 duplicated in GDB's lookup table, which may adversely affect symbol 11609 lookup performance. 11610 11611 18.1.5.2 DLL name prefixes 11612 .......................... 11613 11614 In keeping with the naming conventions used by the Microsoft debugging 11615 tools, DLL export symbols are made available with a prefix based on the 11616 DLL name, for instance `KERNEL32!CreateFileA'. The plain name is also 11617 entered into the symbol table, so `CreateFileA' is often sufficient. In 11618 some cases there will be name clashes within a program (particularly if 11619 the executable itself includes full debugging symbols) necessitating 11620 the use of the fully qualified name when referring to the contents of 11621 the DLL. Use single-quotes around the name to avoid the exclamation 11622 mark ("!") being interpreted as a language operator. 11623 11624 Note that the internal name of the DLL may be all upper-case, even 11625 though the file name of the DLL is lower-case, or vice-versa. Since 11626 symbols within GDB are _case-sensitive_ this may cause some confusion. 11627 If in doubt, try the `info functions' and `info variables' commands or 11628 even `maint print msymbols' (see *note Symbols::). Here's an example: 11629 11630 (gdb) info function CreateFileA 11631 All functions matching regular expression "CreateFileA": 11632 11633 Non-debugging symbols: 11634 0x77e885f4 CreateFileA 11635 0x77e885f4 KERNEL32!CreateFileA 11636 11637 (gdb) info function ! 11638 All functions matching regular expression "!": 11639 11640 Non-debugging symbols: 11641 0x6100114c cygwin1!__assert 11642 0x61004034 cygwin1!_dll_crt0@0 11643 0x61004240 cygwin1!dll_crt0(per_process *) 11644 [etc...] 11645 11646 18.1.5.3 Working with minimal symbols 11647 ..................................... 11648 11649 Symbols extracted from a DLL's export table do not contain very much 11650 type information. All that GDB can do is guess whether a symbol refers 11651 to a function or variable depending on the linker section that contains 11652 the symbol. Also note that the actual contents of the memory contained 11653 in a DLL are not available unless the program is running. This means 11654 that you cannot examine the contents of a variable or disassemble a 11655 function within a DLL without a running program. 11656 11657 Variables are generally treated as pointers and dereferenced 11658 automatically. For this reason, it is often necessary to prefix a 11659 variable name with the address-of operator ("&") and provide explicit 11660 type information in the command. Here's an example of the type of 11661 problem: 11662 11663 (gdb) print 'cygwin1!__argv' 11664 $1 = 268572168 11665 11666 (gdb) x 'cygwin1!__argv' 11667 0x10021610: "\230y\"" 11668 11669 And two possible solutions: 11670 11671 (gdb) print ((char **)'cygwin1!__argv')[0] 11672 $2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram" 11673 11674 (gdb) x/2x &'cygwin1!__argv' 11675 0x610c0aa8 <cygwin1!__argv>: 0x10021608 0x00000000 11676 (gdb) x/x 0x10021608 11677 0x10021608: 0x0022fd98 11678 (gdb) x/s 0x0022fd98 11679 0x22fd98: "/cygdrive/c/mydirectory/myprogram" 11680 11681 Setting a break point within a DLL is possible even before the 11682 program starts execution. However, under these circumstances, GDB can't 11683 examine the initial instructions of the function in order to skip the 11684 function's frame set-up code. You can work around this by using "*&" to 11685 set the breakpoint at a raw memory address: 11686 11687 (gdb) break *&'python22!PyOS_Readline' 11688 Breakpoint 1 at 0x1e04eff0 11689 11690 The author of these extensions is not entirely convinced that 11691 setting a break point within a shared DLL like `kernel32.dll' is 11692 completely safe. 11693 11694 11695 File: gdb.info, Node: Hurd Native, Next: Neutrino, Prev: Cygwin Native, Up: Native 11696 11697 18.1.6 Commands specific to GNU Hurd systems 11698 -------------------------------------------- 11699 11700 This subsection describes GDB commands specific to the GNU Hurd native 11701 debugging. 11702 11703 `set signals' 11704 `set sigs' 11705 This command toggles the state of inferior signal interception by 11706 GDB. Mach exceptions, such as breakpoint traps, are not affected 11707 by this command. `sigs' is a shorthand alias for `signals'. 11708 11709 `show signals' 11710 `show sigs' 11711 Show the current state of intercepting inferior's signals. 11712 11713 `set signal-thread' 11714 `set sigthread' 11715 This command tells GDB which thread is the `libc' signal thread. 11716 That thread is run when a signal is delivered to a running 11717 process. `set sigthread' is the shorthand alias of `set 11718 signal-thread'. 11719 11720 `show signal-thread' 11721 `show sigthread' 11722 These two commands show which thread will run when the inferior is 11723 delivered a signal. 11724 11725 `set stopped' 11726 This commands tells GDB that the inferior process is stopped, as 11727 with the `SIGSTOP' signal. The stopped process can be continued 11728 by delivering a signal to it. 11729 11730 `show stopped' 11731 This command shows whether GDB thinks the debuggee is stopped. 11732 11733 `set exceptions' 11734 Use this command to turn off trapping of exceptions in the 11735 inferior. When exception trapping is off, neither breakpoints nor 11736 single-stepping will work. To restore the default, set exception 11737 trapping on. 11738 11739 `show exceptions' 11740 Show the current state of trapping exceptions in the inferior. 11741 11742 `set task pause' 11743 This command toggles task suspension when GDB has control. 11744 Setting it to on takes effect immediately, and the task is 11745 suspended whenever GDB gets control. Setting it to off will take 11746 effect the next time the inferior is continued. If this option is 11747 set to off, you can use `set thread default pause on' or `set 11748 thread pause on' (see below) to pause individual threads. 11749 11750 `show task pause' 11751 Show the current state of task suspension. 11752 11753 `set task detach-suspend-count' 11754 This command sets the suspend count the task will be left with when 11755 GDB detaches from it. 11756 11757 `show task detach-suspend-count' 11758 Show the suspend count the task will be left with when detaching. 11759 11760 `set task exception-port' 11761 `set task excp' 11762 This command sets the task exception port to which GDB will 11763 forward exceptions. The argument should be the value of the "send 11764 rights" of the task. `set task excp' is a shorthand alias. 11765 11766 `set noninvasive' 11767 This command switches GDB to a mode that is the least invasive as 11768 far as interfering with the inferior is concerned. This is the 11769 same as using `set task pause', `set exceptions', and `set 11770 signals' to values opposite to the defaults. 11771 11772 `info send-rights' 11773 `info receive-rights' 11774 `info port-rights' 11775 `info port-sets' 11776 `info dead-names' 11777 `info ports' 11778 `info psets' 11779 These commands display information about, respectively, send 11780 rights, receive rights, port rights, port sets, and dead names of 11781 a task. There are also shorthand aliases: `info ports' for `info 11782 port-rights' and `info psets' for `info port-sets'. 11783 11784 `set thread pause' 11785 This command toggles current thread suspension when GDB has 11786 control. Setting it to on takes effect immediately, and the 11787 current thread is suspended whenever GDB gets control. Setting it 11788 to off will take effect the next time the inferior is continued. 11789 Normally, this command has no effect, since when GDB has control, 11790 the whole task is suspended. However, if you used `set task pause 11791 off' (see above), this command comes in handy to suspend only the 11792 current thread. 11793 11794 `show thread pause' 11795 This command shows the state of current thread suspension. 11796 11797 `set thread run' 11798 This comamnd sets whether the current thread is allowed to run. 11799 11800 `show thread run' 11801 Show whether the current thread is allowed to run. 11802 11803 `set thread detach-suspend-count' 11804 This command sets the suspend count GDB will leave on a thread 11805 when detaching. This number is relative to the suspend count 11806 found by GDB when it notices the thread; use `set thread 11807 takeover-suspend-count' to force it to an absolute value. 11808 11809 `show thread detach-suspend-count' 11810 Show the suspend count GDB will leave on the thread when detaching. 11811 11812 `set thread exception-port' 11813 `set thread excp' 11814 Set the thread exception port to which to forward exceptions. This 11815 overrides the port set by `set task exception-port' (see above). 11816 `set thread excp' is the shorthand alias. 11817 11818 `set thread takeover-suspend-count' 11819 Normally, GDB's thread suspend counts are relative to the value 11820 GDB finds when it notices each thread. This command changes the 11821 suspend counts to be absolute instead. 11822 11823 `set thread default' 11824 `show thread default' 11825 Each of the above `set thread' commands has a `set thread default' 11826 counterpart (e.g., `set thread default pause', `set thread default 11827 exception-port', etc.). The `thread default' variety of commands 11828 sets the default thread properties for all threads; you can then 11829 change the properties of individual threads with the non-default 11830 commands. 11831 11832 11833 File: gdb.info, Node: Neutrino, Prev: Hurd Native, Up: Native 11834 11835 18.1.7 QNX Neutrino 11836 ------------------- 11837 11838 GDB provides the following commands specific to the QNX Neutrino target: 11839 11840 `set debug nto-debug' 11841 When set to on, enables debugging messages specific to the QNX 11842 Neutrino support. 11843 11844 `show debug nto-debug' 11845 Show the current state of QNX Neutrino messages. 11846 11847 11848 File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: Configurations 11849 11850 18.2 Embedded Operating Systems 11851 =============================== 11852 11853 This section describes configurations involving the debugging of 11854 embedded operating systems that are available for several different 11855 architectures. 11856 11857 * Menu: 11858 11859 * VxWorks:: Using GDB with VxWorks 11860 11861 GDB includes the ability to debug programs running on various 11862 real-time operating systems. 11863 11864 11865 File: gdb.info, Node: VxWorks, Up: Embedded OS 11866 11867 18.2.1 Using GDB with VxWorks 11868 ----------------------------- 11869 11870 `target vxworks MACHINENAME' 11871 A VxWorks system, attached via TCP/IP. The argument MACHINENAME 11872 is the target system's machine name or IP address. 11873 11874 11875 On VxWorks, `load' links FILENAME dynamically on the current target 11876 system as well as adding its symbols in GDB. 11877 11878 GDB enables developers to spawn and debug tasks running on networked 11879 VxWorks targets from a Unix host. Already-running tasks spawned from 11880 the VxWorks shell can also be debugged. GDB uses code that runs on 11881 both the Unix host and on the VxWorks target. The program `gdb' is 11882 installed and executed on the Unix host. (It may be installed with the 11883 name `vxgdb', to distinguish it from a GDB for debugging programs on 11884 the host itself.) 11885 11886 `VxWorks-timeout ARGS' 11887 All VxWorks-based targets now support the option `vxworks-timeout'. 11888 This option is set by the user, and ARGS represents the number of 11889 seconds GDB waits for responses to rpc's. You might use this if 11890 your VxWorks target is a slow software simulator or is on the far 11891 side of a thin network line. 11892 11893 The following information on connecting to VxWorks was current when 11894 this manual was produced; newer releases of VxWorks may use revised 11895 procedures. 11896 11897 To use GDB with VxWorks, you must rebuild your VxWorks kernel to 11898 include the remote debugging interface routines in the VxWorks library 11899 `rdb.a'. To do this, define `INCLUDE_RDB' in the VxWorks configuration 11900 file `configAll.h' and rebuild your VxWorks kernel. The resulting 11901 kernel contains `rdb.a', and spawns the source debugging task 11902 `tRdbTask' when VxWorks is booted. For more information on configuring 11903 and remaking VxWorks, see the manufacturer's manual. 11904 11905 Once you have included `rdb.a' in your VxWorks system image and set 11906 your Unix execution search path to find GDB, you are ready to run GDB. 11907 From your Unix host, run `gdb' (or `vxgdb', depending on your 11908 installation). 11909 11910 GDB comes up showing the prompt: 11911 11912 (vxgdb) 11913 11914 * Menu: 11915 11916 * VxWorks Connection:: Connecting to VxWorks 11917 * VxWorks Download:: VxWorks download 11918 * VxWorks Attach:: Running tasks 11919 11920 11921 File: gdb.info, Node: VxWorks Connection, Next: VxWorks Download, Up: VxWorks 11922 11923 18.2.1.1 Connecting to VxWorks 11924 .............................. 11925 11926 The GDB command `target' lets you connect to a VxWorks target on the 11927 network. To connect to a target whose host name is "`tt'", type: 11928 11929 (vxgdb) target vxworks tt 11930 11931 GDB displays messages like these: 11932 11933 Attaching remote machine across net... 11934 Connected to tt. 11935 11936 GDB then attempts to read the symbol tables of any object modules 11937 loaded into the VxWorks target since it was last booted. GDB locates 11938 these files by searching the directories listed in the command search 11939 path (*note Your program's environment: Environment.); if it fails to 11940 find an object file, it displays a message such as: 11941 11942 prog.o: No such file or directory. 11943 11944 When this happens, add the appropriate directory to the search path 11945 with the GDB command `path', and execute the `target' command again. 11946 11947 11948 File: gdb.info, Node: VxWorks Download, Next: VxWorks Attach, Prev: VxWorks Connection, Up: VxWorks 11949 11950 18.2.1.2 VxWorks download 11951 ......................... 11952 11953 If you have connected to the VxWorks target and you want to debug an 11954 object that has not yet been loaded, you can use the GDB `load' command 11955 to download a file from Unix to VxWorks incrementally. The object file 11956 given as an argument to the `load' command is actually opened twice: 11957 first by the VxWorks target in order to download the code, then by GDB 11958 in order to read the symbol table. This can lead to problems if the 11959 current working directories on the two systems differ. If both systems 11960 have NFS mounted the same filesystems, you can avoid these problems by 11961 using absolute paths. Otherwise, it is simplest to set the working 11962 directory on both systems to the directory in which the object file 11963 resides, and then to reference the file by its name, without any path. 11964 For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in 11965 VxWorks and in `HOSTPATH/vw/demo/rdb' on the host. To load this 11966 program, type this on VxWorks: 11967 11968 -> cd "VXPATH/vw/demo/rdb" 11969 11970 Then, in GDB, type: 11971 11972 (vxgdb) cd HOSTPATH/vw/demo/rdb 11973 (vxgdb) load prog.o 11974 11975 GDB displays a response similar to this: 11976 11977 Reading symbol data from wherever/vw/demo/rdb/prog.o... done. 11978 11979 You can also use the `load' command to reload an object module after 11980 editing and recompiling the corresponding source file. Note that this 11981 makes GDB delete all currently-defined breakpoints, auto-displays, and 11982 convenience variables, and to clear the value history. (This is 11983 necessary in order to preserve the integrity of debugger's data 11984 structures that reference the target system's symbol table.) 11985 11986 11987 File: gdb.info, Node: VxWorks Attach, Prev: VxWorks Download, Up: VxWorks 11988 11989 18.2.1.3 Running tasks 11990 ...................... 11991 11992 You can also attach to an existing task using the `attach' command as 11993 follows: 11994 11995 (vxgdb) attach TASK 11996 11997 where TASK is the VxWorks hexadecimal task ID. The task can be running 11998 or suspended when you attach to it. Running tasks are suspended at the 11999 time of attachment. 12000 12001 12002 File: gdb.info, Node: Embedded Processors, Next: Architectures, Prev: Embedded OS, Up: Configurations 12003 12004 18.3 Embedded Processors 12005 ======================== 12006 12007 This section goes into details specific to particular embedded 12008 configurations. 12009 12010 Whenever a specific embedded processor has a simulator, GDB allows 12011 to send an arbitrary command to the simulator. 12012 12013 `sim COMMAND' 12014 Send an arbitrary COMMAND string to the simulator. Consult the 12015 documentation for the specific simulator in use for information 12016 about acceptable commands. 12017 12018 * Menu: 12019 12020 * ARM:: ARM RDI 12021 * H8/300:: Renesas H8/300 12022 * H8/500:: Renesas H8/500 12023 * M32R/D:: Renesas M32R/D 12024 * M68K:: Motorola M68K 12025 * MIPS Embedded:: MIPS Embedded 12026 * OpenRISC 1000:: OpenRisc 1000 12027 * PA:: HP PA Embedded 12028 * PowerPC: PowerPC 12029 * SH:: Renesas SH 12030 * Sparclet:: Tsqware Sparclet 12031 * Sparclite:: Fujitsu Sparclite 12032 * ST2000:: Tandem ST2000 12033 * Z8000:: Zilog Z8000 12034 * AVR:: Atmel AVR 12035 * CRIS:: CRIS 12036 * Super-H:: Renesas Super-H 12037 * WinCE:: Windows CE child processes 12038 12039 12040 File: gdb.info, Node: ARM, Next: H8/300, Up: Embedded Processors 12041 12042 18.3.1 ARM 12043 ---------- 12044 12045 `target rdi DEV' 12046 ARM Angel monitor, via RDI library interface to ADP protocol. You 12047 may use this target to communicate with both boards running the 12048 Angel monitor, or with the EmbeddedICE JTAG debug device. 12049 12050 `target rdp DEV' 12051 ARM Demon monitor. 12052 12053 12054 GDB provides the following ARM-specific commands: 12055 12056 `set arm disassembler' 12057 This commands selects from a list of disassembly styles. The 12058 `"std"' style is the standard style. 12059 12060 `show arm disassembler' 12061 Show the current disassembly style. 12062 12063 `set arm apcs32' 12064 This command toggles ARM operation mode between 32-bit and 26-bit. 12065 12066 `show arm apcs32' 12067 Display the current usage of the ARM 32-bit mode. 12068 12069 `set arm fpu FPUTYPE' 12070 This command sets the ARM floating-point unit (FPU) type. The 12071 argument FPUTYPE can be one of these: 12072 12073 `auto' 12074 Determine the FPU type by querying the OS ABI. 12075 12076 `softfpa' 12077 Software FPU, with mixed-endian doubles on little-endian ARM 12078 processors. 12079 12080 `fpa' 12081 GCC-compiled FPA co-processor. 12082 12083 `softvfp' 12084 Software FPU with pure-endian doubles. 12085 12086 `vfp' 12087 VFP co-processor. 12088 12089 `show arm fpu' 12090 Show the current type of the FPU. 12091 12092 `set arm abi' 12093 This command forces GDB to use the specified ABI. 12094 12095 `show arm abi' 12096 Show the currently used ABI. 12097 12098 `set debug arm' 12099 Toggle whether to display ARM-specific debugging messages from the 12100 ARM target support subsystem. 12101 12102 `show debug arm' 12103 Show whether ARM-specific debugging messages are enabled. 12104 12105 The following commands are available when an ARM target is debugged 12106 using the RDI interface: 12107 12108 `rdilogfile [FILE]' 12109 Set the filename for the ADP (Angel Debugger Protocol) packet log. 12110 With an argument, sets the log file to the specified FILE. With 12111 no argument, show the current log file name. The default log file 12112 is `rdi.log'. 12113 12114 `rdilogenable [ARG]' 12115 Control logging of ADP packets. With an argument of 1 or `"yes"' 12116 enables logging, with an argument 0 or `"no"' disables it. With 12117 no arguments displays the current setting. When logging is 12118 enabled, ADP packets exchanged between GDB and the RDI target 12119 device are logged to a file. 12120 12121 `set rdiromatzero' 12122 Tell GDB whether the target has ROM at address 0. If on, vector 12123 catching is disabled, so that zero address can be used. If off 12124 (the default), vector catching is enabled. For this command to 12125 take effect, it needs to be invoked prior to the `target rdi' 12126 command. 12127 12128 `show rdiromatzero' 12129 Show the current setting of ROM at zero address. 12130 12131 `set rdiheartbeat' 12132 Enable or disable RDI heartbeat packets. It is not recommended to 12133 turn on this option, since it confuses ARM and EPI JTAG interface, 12134 as well as the Angel monitor. 12135 12136 `show rdiheartbeat' 12137 Show the setting of RDI heartbeat packets. 12138 12139 12140 File: gdb.info, Node: H8/300, Next: H8/500, Prev: ARM, Up: Embedded Processors 12141 12142 18.3.2 Renesas H8/300 12143 --------------------- 12144 12145 `target hms DEV' 12146 A Renesas SH, H8/300, or H8/500 board, attached via serial line to 12147 your host. Use special commands `device' and `speed' to control 12148 the serial line and the communications speed used. 12149 12150 `target e7000 DEV' 12151 E7000 emulator for Renesas H8 and SH. 12152 12153 `target sh3 DEV' 12154 `target sh3e DEV' 12155 Renesas SH-3 and SH-3E target systems. 12156 12157 12158 When you select remote debugging to a Renesas SH, H8/300, or H8/500 12159 board, the `load' command downloads your program to the Renesas board 12160 and also opens it as the current executable target for GDB on your host 12161 (like the `file' command). 12162 12163 GDB needs to know these things to talk to your Renesas SH, H8/300, 12164 or H8/500: 12165 12166 1. that you want to use `target hms', the remote debugging interface 12167 for Renesas microprocessors, or `target e7000', the in-circuit 12168 emulator for the Renesas SH and the Renesas 300H. (`target hms' is 12169 the default when GDB is configured specifically for the Renesas SH, 12170 H8/300, or H8/500.) 12171 12172 2. what serial device connects your host to your Renesas board (the 12173 first serial device available on your host is the default). 12174 12175 3. what speed to use over the serial device. 12176 12177 * Menu: 12178 12179 * Renesas Boards:: Connecting to Renesas boards. 12180 * Renesas ICE:: Using the E7000 In-Circuit Emulator. 12181 * Renesas Special:: Special GDB commands for Renesas micros. 12182 12183 12184 File: gdb.info, Node: Renesas Boards, Next: Renesas ICE, Up: H8/300 12185 12186 18.3.2.1 Connecting to Renesas boards 12187 ..................................... 12188 12189 Use the special `GDB' command `device PORT' if you need to explicitly 12190 set the serial device. The default PORT is the first available port on 12191 your host. This is only necessary on Unix hosts, where it is typically 12192 something like `/dev/ttya'. 12193 12194 `GDB' has another special command to set the communications speed: 12195 `speed BPS'. This command also is only used from Unix hosts; on DOS 12196 hosts, set the line speed as usual from outside GDB with the DOS `mode' 12197 command (for instance, `mode com2:9600,n,8,1,p' for a 9600bps 12198 connection). 12199 12200 The `device' and `speed' commands are available only when you use a 12201 Unix host to debug your Renesas microprocessor programs. If you use a 12202 DOS host, GDB depends on an auxiliary terminate-and-stay-resident 12203 program called `asynctsr' to communicate with the development board 12204 through a PC serial port. You must also use the DOS `mode' command to 12205 set up the serial port on the DOS side. 12206 12207 The following sample session illustrates the steps needed to start a 12208 program under GDB control on an H8/300. The example uses a sample 12209 H8/300 program called `t.x'. The procedure is the same for the Renesas 12210 SH and the H8/500. 12211 12212 First hook up your development board. In this example, we use a 12213 board attached to serial port `COM2'; if you use a different serial 12214 port, substitute its name in the argument of the `mode' command. When 12215 you call `asynctsr', the auxiliary comms program used by the debugger, 12216 you give it just the numeric part of the serial port's name; for 12217 example, `asyncstr 2' below runs `asyncstr' on `COM2'. 12218 12219 C:\H8300\TEST> asynctsr 2 12220 C:\H8300\TEST> mode com2:9600,n,8,1,p 12221 12222 Resident portion of MODE loaded 12223 12224 COM2: 9600, n, 8, 1, p 12225 12226 _Warning:_ We have noticed a bug in PC-NFS that conflicts with 12227 `asynctsr'. If you also run PC-NFS on your DOS host, you may need 12228 to disable it, or even boot without it, to use `asynctsr' to 12229 control your development board. 12230 12231 Now that serial communications are set up, and the development board 12232 is connected, you can start up GDB. Call `GDB' with the name of your 12233 program as the argument. `GDB' prompts you, as usual, with the prompt 12234 `(gdb)'. Use two special commands to begin your debugging session: 12235 `target hms' to specify cross-debugging to the Renesas board, and the 12236 `load' command to download your program to the board. `load' displays 12237 the names of the program's sections, and a `*' for each 2K of data 12238 downloaded. (If you want to refresh GDB data on symbols or on the 12239 executable file without downloading, use the GDB commands `file' or 12240 `symbol-file'. These commands, and `load' itself, are described in 12241 *Note Commands to specify files: Files.) 12242 12243 (eg-C:\H8300\TEST) gdb t.x 12244 GDB is free software and you are welcome to distribute copies 12245 of it under certain conditions; type "show copying" to see 12246 the conditions. 12247 There is absolutely no warranty for GDB; type "show warranty" 12248 for details. 12249 GDB 6.6, Copyright 1992 Free Software Foundation, Inc... 12250 (gdb) target hms 12251 Connected to remote H8/300 HMS system. 12252 (gdb) load t.x 12253 .text : 0x8000 .. 0xabde *********** 12254 .data : 0xabde .. 0xad30 * 12255 .stack : 0xf000 .. 0xf014 * 12256 12257 At this point, you're ready to run or debug your program. From here 12258 on, you can use all the usual GDB commands. The `break' command sets 12259 breakpoints; the `run' command starts your program; `print' or `x' 12260 display data; the `continue' command resumes execution after stopping 12261 at a breakpoint. You can use the `help' command at any time to find 12262 out more about GDB commands. 12263 12264 Remember, however, that _operating system_ facilities aren't 12265 available on your development board; for example, if your program hangs, 12266 you can't send an interrupt--but you can press the RESET switch! 12267 12268 Use the RESET button on the development board 12269 * to interrupt your program (don't use `Ctrl-c' on the DOS host--it 12270 has no way to pass an interrupt signal to the development board); 12271 and 12272 12273 * to return to the GDB command prompt after your program finishes 12274 normally. The communications protocol provides no other way for 12275 GDB to detect program completion. 12276 12277 In either case, GDB sees the effect of a RESET on the development 12278 board as a "normal exit" of your program. 12279 12280 12281 File: gdb.info, Node: Renesas ICE, Next: Renesas Special, Prev: Renesas Boards, Up: H8/300 12282 12283 18.3.2.2 Using the E7000 in-circuit emulator 12284 ............................................ 12285 12286 You can use the E7000 in-circuit emulator to develop code for either the 12287 Renesas SH or the H8/300H. Use one of these forms of the `target 12288 e7000' command to connect GDB to your E7000: 12289 12290 `target e7000 PORT SPEED' 12291 Use this form if your E7000 is connected to a serial port. The 12292 PORT argument identifies what serial port to use (for example, 12293 `com2'). The third argument is the line speed in bits per second 12294 (for example, `9600'). 12295 12296 `target e7000 HOSTNAME' 12297 If your E7000 is installed as a host on a TCP/IP network, you can 12298 just specify its hostname; GDB uses `telnet' to connect. 12299 12300 The following special commands are available when debugging with the 12301 Renesas E7000 ICE: 12302 12303 `e7000 COMMAND' 12304 This sends the specified COMMAND to the E7000 monitor. 12305 12306 `ftplogin MACHINE USERNAME PASSWORD DIR' 12307 This command records information for subsequent interface with the 12308 E7000 monitor via the FTP protocol: GDB will log into the named 12309 MACHINE using specified USERNAME and PASSWORD, and then chdir to 12310 the named directory DIR. 12311 12312 `ftpload FILE' 12313 This command uses credentials recorded by `ftplogin' to fetch and 12314 load the named FILE from the E7000 monitor. 12315 12316 `drain' 12317 This command drains any pending text buffers stored on the E7000. 12318 12319 `set usehardbreakpoints' 12320 `show usehardbreakpoints' 12321 These commands set and show the use of hardware breakpoints for all 12322 breakpoints. *Note hardware-assisted breakpoint: Set Breaks, for 12323 more information about using hardware breakpoints selectively. 12324 12325 12326 File: gdb.info, Node: Renesas Special, Prev: Renesas ICE, Up: H8/300 12327 12328 18.3.2.3 Special GDB commands for Renesas micros 12329 ................................................ 12330 12331 Some GDB commands are available only for the H8/300: 12332 12333 `set machine h8300' 12334 `set machine h8300h' 12335 Condition GDB for one of the two variants of the H8/300 12336 architecture with `set machine'. You can use `show machine' to 12337 check which variant is currently in effect. 12338 12339 12340 12341 File: gdb.info, Node: H8/500, Next: M32R/D, Prev: H8/300, Up: Embedded Processors 12342 12343 18.3.3 H8/500 12344 ------------- 12345 12346 `set memory MOD' 12347 `show memory' 12348 Specify which H8/500 memory model (MOD) you are using with `set 12349 memory'; check which memory model is in effect with `show memory'. 12350 The accepted values for MOD are `small', `big', `medium', and 12351 `compact'. 12352 12353 12354 12355 File: gdb.info, Node: M32R/D, Next: M68K, Prev: H8/500, Up: Embedded Processors 12356 12357 18.3.4 Renesas M32R/D and M32R/SDI 12358 ---------------------------------- 12359 12360 `target m32r DEV' 12361 Renesas M32R/D ROM monitor. 12362 12363 `target m32rsdi DEV' 12364 Renesas M32R SDI server, connected via parallel port to the board. 12365 12366 The following GDB commands are specific to the M32R monitor: 12367 12368 `set download-path PATH' 12369 Set the default path for finding donwloadable SREC files. 12370 12371 `show download-path' 12372 Show the default path for downloadable SREC files. 12373 12374 `set board-address ADDR' 12375 Set the IP address for the M32R-EVA target board. 12376 12377 `show board-address' 12378 Show the current IP address of the target board. 12379 12380 `set server-address ADDR' 12381 Set the IP address for the download server, which is the GDB's 12382 host machine. 12383 12384 `show server-address' 12385 Display the IP address of the download server. 12386 12387 `upload [FILE]' 12388 Upload the specified SREC FILE via the monitor's Ethernet upload 12389 capability. If no FILE argument is given, the current executable 12390 file is uploaded. 12391 12392 `tload [FILE]' 12393 Test the `upload' command. 12394 12395 The following commands are available for M32R/SDI: 12396 12397 `sdireset' 12398 This command resets the SDI connection. 12399 12400 `sdistatus' 12401 This command shows the SDI connection status. 12402 12403 `debug_chaos' 12404 Instructs the remote that M32R/Chaos debugging is to be used. 12405 12406 `use_debug_dma' 12407 Instructs the remote to use the DEBUG_DMA method of accessing 12408 memory. 12409 12410 `use_mon_code' 12411 Instructs the remote to use the MON_CODE method of accessing 12412 memory. 12413 12414 `use_ib_break' 12415 Instructs the remote to set breakpoints by IB break. 12416 12417 `use_dbt_break' 12418 Instructs the remote to set breakpoints by DBT. 12419 12420 12421 File: gdb.info, Node: M68K, Next: MIPS Embedded, Prev: M32R/D, Up: Embedded Processors 12422 12423 18.3.5 M68k 12424 ----------- 12425 12426 The Motorola m68k configuration includes ColdFire support, and target 12427 command for the following ROM monitors. 12428 12429 `target abug DEV' 12430 ABug ROM monitor for M68K. 12431 12432 `target cpu32bug DEV' 12433 CPU32BUG monitor, running on a CPU32 (M68K) board. 12434 12435 `target dbug DEV' 12436 dBUG ROM monitor for Motorola ColdFire. 12437 12438 `target est DEV' 12439 EST-300 ICE monitor, running on a CPU32 (M68K) board. 12440 12441 `target rom68k DEV' 12442 ROM 68K monitor, running on an M68K IDP board. 12443 12444 12445 `target rombug DEV' 12446 ROMBUG ROM monitor for OS/9000. 12447 12448 12449 12450 File: gdb.info, Node: MIPS Embedded, Next: OpenRISC 1000, Prev: M68K, Up: Embedded Processors 12451 12452 18.3.6 MIPS Embedded 12453 -------------------- 12454 12455 GDB can use the MIPS remote debugging protocol to talk to a MIPS board 12456 attached to a serial line. This is available when you configure GDB 12457 with `--target=mips-idt-ecoff'. 12458 12459 Use these GDB commands to specify the connection to your target 12460 board: 12461 12462 `target mips PORT' 12463 To run a program on the board, start up `gdb' with the name of 12464 your program as the argument. To connect to the board, use the 12465 command `target mips PORT', where PORT is the name of the serial 12466 port connected to the board. If the program has not already been 12467 downloaded to the board, you may use the `load' command to 12468 download it. You can then use all the usual GDB commands. 12469 12470 For example, this sequence connects to the target board through a 12471 serial port, and loads and runs a program called PROG through the 12472 debugger: 12473 12474 host$ gdb PROG 12475 GDB is free software and ... 12476 (gdb) target mips /dev/ttyb 12477 (gdb) load PROG 12478 (gdb) run 12479 12480 `target mips HOSTNAME:PORTNUMBER' 12481 On some GDB host configurations, you can specify a TCP connection 12482 (for instance, to a serial line managed by a terminal 12483 concentrator) instead of a serial port, using the syntax 12484 `HOSTNAME:PORTNUMBER'. 12485 12486 `target pmon PORT' 12487 PMON ROM monitor. 12488 12489 `target ddb PORT' 12490 NEC's DDB variant of PMON for Vr4300. 12491 12492 `target lsi PORT' 12493 LSI variant of PMON. 12494 12495 `target r3900 DEV' 12496 Densan DVE-R3900 ROM monitor for Toshiba R3900 Mips. 12497 12498 `target array DEV' 12499 Array Tech LSI33K RAID controller board. 12500 12501 12502 GDB also supports these special commands for MIPS targets: 12503 12504 `set mipsfpu double' 12505 `set mipsfpu single' 12506 `set mipsfpu none' 12507 `set mipsfpu auto' 12508 `show mipsfpu' 12509 If your target board does not support the MIPS floating point 12510 coprocessor, you should use the command `set mipsfpu none' (if you 12511 need this, you may wish to put the command in your GDB init file). 12512 This tells GDB how to find the return value of functions which 12513 return floating point values. It also allows GDB to avoid saving 12514 the floating point registers when calling functions on the board. 12515 If you are using a floating point coprocessor with only single 12516 precision floating point support, as on the R4650 processor, use 12517 the command `set mipsfpu single'. The default double precision 12518 floating point coprocessor may be selected using `set mipsfpu 12519 double'. 12520 12521 In previous versions the only choices were double precision or no 12522 floating point, so `set mipsfpu on' will select double precision 12523 and `set mipsfpu off' will select no floating point. 12524 12525 As usual, you can inquire about the `mipsfpu' variable with `show 12526 mipsfpu'. 12527 12528 `set timeout SECONDS' 12529 `set retransmit-timeout SECONDS' 12530 `show timeout' 12531 `show retransmit-timeout' 12532 You can control the timeout used while waiting for a packet, in 12533 the MIPS remote protocol, with the `set timeout SECONDS' command. 12534 The default is 5 seconds. Similarly, you can control the timeout 12535 used while waiting for an acknowledgement of a packet with the `set 12536 retransmit-timeout SECONDS' command. The default is 3 seconds. 12537 You can inspect both values with `show timeout' and `show 12538 retransmit-timeout'. (These commands are _only_ available when 12539 GDB is configured for `--target=mips-idt-ecoff'.) 12540 12541 The timeout set by `set timeout' does not apply when GDB is 12542 waiting for your program to stop. In that case, GDB waits forever 12543 because it has no way of knowing how long the program is going to 12544 run before stopping. 12545 12546 `set syn-garbage-limit NUM' 12547 Limit the maximum number of characters GDB should ignore when it 12548 tries to synchronize with the remote target. The default is 10 12549 characters. Setting the limit to -1 means there's no limit. 12550 12551 `show syn-garbage-limit' 12552 Show the current limit on the number of characters to ignore when 12553 trying to synchronize with the remote system. 12554 12555 `set monitor-prompt PROMPT' 12556 Tell GDB to expect the specified PROMPT string from the remote 12557 monitor. The default depends on the target: 12558 pmon target 12559 `PMON' 12560 12561 ddb target 12562 `NEC010' 12563 12564 lsi target 12565 `PMON>' 12566 12567 `show monitor-prompt' 12568 Show the current strings GDB expects as the prompt from the remote 12569 monitor. 12570 12571 `set monitor-warnings' 12572 Enable or disable monitor warnings about hardware breakpoints. 12573 This has effect only for the `lsi' target. When on, GDB will 12574 display warning messages whose codes are returned by the `lsi' 12575 PMON monitor for breakpoint commands. 12576 12577 `show monitor-warnings' 12578 Show the current setting of printing monitor warnings. 12579 12580 `pmon COMMAND' 12581 This command allows sending an arbitrary COMMAND string to the 12582 monitor. The monitor must be in debug mode for this to work. 12583 12584 12585 File: gdb.info, Node: OpenRISC 1000, Next: PA, Prev: MIPS Embedded, Up: Embedded Processors 12586 12587 18.3.7 OpenRISC 1000 12588 -------------------- 12589 12590 See OR1k Architecture document (`www.opencores.org') for more 12591 information about platform and commands. 12592 12593 `target jtag jtag://HOST:PORT' 12594 Connects to remote JTAG server. JTAG remote server can be either 12595 an or1ksim or JTAG server, connected via parallel port to the 12596 board. 12597 12598 Example: `target jtag jtag://localhost:9999' 12599 12600 `or1ksim COMMAND' 12601 If connected to `or1ksim' OpenRISC 1000 Architectural Simulator, 12602 proprietary commands can be executed. 12603 12604 `info or1k spr' 12605 Displays spr groups. 12606 12607 `info or1k spr GROUP' 12608 `info or1k spr GROUPNO' 12609 Displays register names in selected group. 12610 12611 `info or1k spr GROUP REGISTER' 12612 `info or1k spr REGISTER' 12613 `info or1k spr GROUPNO REGISTERNO' 12614 `info or1k spr REGISTERNO' 12615 Shows information about specified spr register. 12616 12617 `spr GROUP REGISTER VALUE' 12618 `spr REGISTER VALUE' 12619 `spr GROUPNO REGISTERNO VALUE' 12620 `spr REGISTERNO VALUE' 12621 Writes VALUE to specified spr register. 12622 12623 Some implementations of OpenRISC 1000 Architecture also have 12624 hardware trace. It is very similar to GDB trace, except it does not 12625 interfere with normal program execution and is thus much faster. 12626 Hardware breakpoints/watchpoint triggers can be set using: 12627 `$LEA/$LDATA' 12628 Load effective address/data 12629 12630 `$SEA/$SDATA' 12631 Store effective address/data 12632 12633 `$AEA/$ADATA' 12634 Access effective address ($SEA or $LEA) or data ($SDATA/$LDATA) 12635 12636 `$FETCH' 12637 Fetch data 12638 12639 When triggered, it can capture low level data, like: `PC', `LSEA', 12640 `LDATA', `SDATA', `READSPR', `WRITESPR', `INSTR'. 12641 12642 `htrace' commands: 12643 `hwatch CONDITIONAL' 12644 Set hardware watchpoint on combination of Load/Store Effecive 12645 Address(es) or Data. For example: 12646 12647 `hwatch ($LEA == my_var) && ($LDATA < 50) || ($SEA == my_var) && 12648 ($SDATA >= 50)' 12649 12650 `hwatch ($LEA == my_var) && ($LDATA < 50) || ($SEA == my_var) && 12651 ($SDATA >= 50)' 12652 12653 `htrace info' 12654 Display information about current HW trace configuration. 12655 12656 `htrace trigger CONDITIONAL' 12657 Set starting criteria for HW trace. 12658 12659 `htrace qualifier CONDITIONAL' 12660 Set acquisition qualifier for HW trace. 12661 12662 `htrace stop CONDITIONAL' 12663 Set HW trace stopping criteria. 12664 12665 `htrace record [DATA]*' 12666 Selects the data to be recorded, when qualifier is met and HW 12667 trace was triggered. 12668 12669 `htrace enable' 12670 `htrace disable' 12671 Enables/disables the HW trace. 12672 12673 `htrace rewind [FILENAME]' 12674 Clears currently recorded trace data. 12675 12676 If filename is specified, new trace file is made and any newly 12677 collected data will be written there. 12678 12679 `htrace print [START [LEN]]' 12680 Prints trace buffer, using current record configuration. 12681 12682 `htrace mode continuous' 12683 Set continuous trace mode. 12684 12685 `htrace mode suspend' 12686 Set suspend trace mode. 12687 12688 12689 12690 File: gdb.info, Node: PowerPC, Next: SH, Prev: PA, Up: Embedded Processors 12691 12692 18.3.8 PowerPC 12693 -------------- 12694 12695 `target dink32 DEV' 12696 DINK32 ROM monitor. 12697 12698 `target ppcbug DEV' 12699 12700 `target ppcbug1 DEV' 12701 PPCBUG ROM monitor for PowerPC. 12702 12703 `target sds DEV' 12704 SDS monitor, running on a PowerPC board (such as Motorola's ADS). 12705 12706 The following commands specifi to the SDS protocol are supported 12707 byGDB: 12708 12709 `set sdstimeout NSEC' 12710 Set the timeout for SDS protocol reads to be NSEC seconds. The 12711 default is 2 seconds. 12712 12713 `show sdstimeout' 12714 Show the current value of the SDS timeout. 12715 12716 `sds COMMAND' 12717 Send the specified COMMAND string to the SDS monitor. 12718 12719 12720 File: gdb.info, Node: PA, Next: PowerPC, Prev: OpenRISC 1000, Up: Embedded Processors 12721 12722 18.3.9 HP PA Embedded 12723 --------------------- 12724 12725 `target op50n DEV' 12726 OP50N monitor, running on an OKI HPPA board. 12727 12728 `target w89k DEV' 12729 W89K monitor, running on a Winbond HPPA board. 12730 12731 12732 12733 File: gdb.info, Node: SH, Next: Sparclet, Prev: PowerPC, Up: Embedded Processors 12734 12735 18.3.10 Renesas SH 12736 ------------------ 12737 12738 `target hms DEV' 12739 A Renesas SH board attached via serial line to your host. Use 12740 special commands `device' and `speed' to control the serial line 12741 and the communications speed used. 12742 12743 `target e7000 DEV' 12744 E7000 emulator for Renesas SH. 12745 12746 `target sh3 DEV' 12747 12748 `target sh3e DEV' 12749 Renesas SH-3 and SH-3E target systems. 12750 12751 12752 12753 File: gdb.info, Node: Sparclet, Next: Sparclite, Prev: SH, Up: Embedded Processors 12754 12755 18.3.11 Tsqware Sparclet 12756 ------------------------ 12757 12758 GDB enables developers to debug tasks running on Sparclet targets from 12759 a Unix host. GDB uses code that runs on both the Unix host and on the 12760 Sparclet target. The program `gdb' is installed and executed on the 12761 Unix host. 12762 12763 `remotetimeout ARGS' 12764 GDB supports the option `remotetimeout'. This option is set by 12765 the user, and ARGS represents the number of seconds GDB waits for 12766 responses. 12767 12768 When compiling for debugging, include the options `-g' to get debug 12769 information and `-Ttext' to relocate the program to where you wish to 12770 load it on the target. You may also want to add the options `-n' or 12771 `-N' in order to reduce the size of the sections. Example: 12772 12773 sparclet-aout-gcc prog.c -Ttext 0x12010000 -g -o prog -N 12774 12775 You can use `objdump' to verify that the addresses are what you 12776 intended: 12777 12778 sparclet-aout-objdump --headers --syms prog 12779 12780 Once you have set your Unix execution search path to find GDB, you 12781 are ready to run GDB. From your Unix host, run `gdb' (or 12782 `sparclet-aout-gdb', depending on your installation). 12783 12784 GDB comes up showing the prompt: 12785 12786 (gdbslet) 12787 12788 * Menu: 12789 12790 * Sparclet File:: Setting the file to debug 12791 * Sparclet Connection:: Connecting to Sparclet 12792 * Sparclet Download:: Sparclet download 12793 * Sparclet Execution:: Running and debugging 12794 12795 12796 File: gdb.info, Node: Sparclet File, Next: Sparclet Connection, Up: Sparclet 12797 12798 18.3.11.1 Setting file to debug 12799 ............................... 12800 12801 The GDB command `file' lets you choose with program to debug. 12802 12803 (gdbslet) file prog 12804 12805 GDB then attempts to read the symbol table of `prog'. GDB locates 12806 the file by searching the directories listed in the command search path. 12807 If the file was compiled with debug information (option "-g"), source 12808 files will be searched as well. GDB locates the source files by 12809 searching the directories listed in the directory search path (*note 12810 Your program's environment: Environment.). If it fails to find a file, 12811 it displays a message such as: 12812 12813 prog: No such file or directory. 12814 12815 When this happens, add the appropriate directories to the search 12816 paths with the GDB commands `path' and `dir', and execute the `target' 12817 command again. 12818 12819 12820 File: gdb.info, Node: Sparclet Connection, Next: Sparclet Download, Prev: Sparclet File, Up: Sparclet 12821 12822 18.3.11.2 Connecting to Sparclet 12823 ................................ 12824 12825 The GDB command `target' lets you connect to a Sparclet target. To 12826 connect to a target on serial port "`ttya'", type: 12827 12828 (gdbslet) target sparclet /dev/ttya 12829 Remote target sparclet connected to /dev/ttya 12830 main () at ../prog.c:3 12831 12832 GDB displays messages like these: 12833 12834 Connected to ttya. 12835 12836 12837 File: gdb.info, Node: Sparclet Download, Next: Sparclet Execution, Prev: Sparclet Connection, Up: Sparclet 12838 12839 18.3.11.3 Sparclet download 12840 ........................... 12841 12842 Once connected to the Sparclet target, you can use the GDB `load' 12843 command to download the file from the host to the target. The file 12844 name and load offset should be given as arguments to the `load' command. 12845 Since the file format is aout, the program must be loaded to the 12846 starting address. You can use `objdump' to find out what this value 12847 is. The load offset is an offset which is added to the VMA (virtual 12848 memory address) of each of the file's sections. For instance, if the 12849 program `prog' was linked to text address 0x1201000, with data at 12850 0x12010160 and bss at 0x12010170, in GDB, type: 12851 12852 (gdbslet) load prog 0x12010000 12853 Loading section .text, size 0xdb0 vma 0x12010000 12854 12855 If the code is loaded at a different address then what the program 12856 was linked to, you may need to use the `section' and `add-symbol-file' 12857 commands to tell GDB where to map the symbol table. 12858 12859 12860 File: gdb.info, Node: Sparclet Execution, Prev: Sparclet Download, Up: Sparclet 12861 12862 18.3.11.4 Running and debugging 12863 ............................... 12864 12865 You can now begin debugging the task using GDB's execution control 12866 commands, `b', `step', `run', etc. See the GDB manual for the list of 12867 commands. 12868 12869 (gdbslet) b main 12870 Breakpoint 1 at 0x12010000: file prog.c, line 3. 12871 (gdbslet) run 12872 Starting program: prog 12873 Breakpoint 1, main (argc=1, argv=0xeffff21c) at prog.c:3 12874 3 char *symarg = 0; 12875 (gdbslet) step 12876 4 char *execarg = "hello!"; 12877 (gdbslet) 12878 12879 12880 File: gdb.info, Node: Sparclite, Next: ST2000, Prev: Sparclet, Up: Embedded Processors 12881 12882 18.3.12 Fujitsu Sparclite 12883 ------------------------- 12884 12885 `target sparclite DEV' 12886 Fujitsu sparclite boards, used only for the purpose of loading. 12887 You must use an additional command to debug the program. For 12888 example: target remote DEV using GDB standard remote protocol. 12889 12890 12891 12892 File: gdb.info, Node: ST2000, Next: Z8000, Prev: Sparclite, Up: Embedded Processors 12893 12894 18.3.13 Tandem ST2000 12895 --------------------- 12896 12897 GDB may be used with a Tandem ST2000 phone switch, running Tandem's 12898 STDBUG protocol. 12899 12900 To connect your ST2000 to the host system, see the manufacturer's 12901 manual. Once the ST2000 is physically attached, you can run: 12902 12903 target st2000 DEV SPEED 12904 12905 to establish it as your debugging environment. DEV is normally the 12906 name of a serial device, such as `/dev/ttya', connected to the ST2000 12907 via a serial line. You can instead specify DEV as a TCP connection 12908 (for example, to a serial line attached via a terminal concentrator) 12909 using the syntax `HOSTNAME:PORTNUMBER'. 12910 12911 The `load' and `attach' commands are _not_ defined for this target; 12912 you must load your program into the ST2000 as you normally would for 12913 standalone operation. GDB reads debugging information (such as 12914 symbols) from a separate, debugging version of the program available on 12915 your host computer. 12916 12917 These auxiliary GDB commands are available to help you with the 12918 ST2000 environment: 12919 12920 `st2000 COMMAND' 12921 Send a COMMAND to the STDBUG monitor. See the manufacturer's 12922 manual for available commands. 12923 12924 `connect' 12925 Connect the controlling terminal to the STDBUG command monitor. 12926 When you are done interacting with STDBUG, typing either of two 12927 character sequences gets you back to the GDB command prompt: 12928 `<RET> ~ .' (Return, followed by tilde and period) or `<RET> ~ 12929 Ctrl-d' (Return, followed by tilde and control-D). 12930 12931 12932 File: gdb.info, Node: Z8000, Next: AVR, Prev: ST2000, Up: Embedded Processors 12933 12934 18.3.14 Zilog Z8000 12935 ------------------- 12936 12937 When configured for debugging Zilog Z8000 targets, GDB includes a Z8000 12938 simulator. 12939 12940 For the Z8000 family, `target sim' simulates either the Z8002 (the 12941 unsegmented variant of the Z8000 architecture) or the Z8001 (the 12942 segmented variant). The simulator recognizes which architecture is 12943 appropriate by inspecting the object code. 12944 12945 `target sim ARGS' 12946 Debug programs on a simulated CPU. If the simulator supports setup 12947 options, specify them via ARGS. 12948 12949 After specifying this target, you can debug programs for the simulated 12950 CPU in the same style as programs for your host computer; use the 12951 `file' command to load a new program image, the `run' command to run 12952 your program, and so on. 12953 12954 As well as making available all the usual machine registers (*note 12955 Registers: Registers.), the Z8000 simulator provides three additional 12956 items of information as specially named registers: 12957 12958 `cycles' 12959 Counts clock-ticks in the simulator. 12960 12961 `insts' 12962 Counts instructions run in the simulator. 12963 12964 `time' 12965 Execution time in 60ths of a second. 12966 12967 12968 You can refer to these values in GDB expressions with the usual 12969 conventions; for example, `b fputc if $cycles>5000' sets a conditional 12970 breakpoint that suspends only after at least 5000 simulated clock ticks. 12971 12972 12973 File: gdb.info, Node: AVR, Next: CRIS, Prev: Z8000, Up: Embedded Processors 12974 12975 18.3.15 Atmel AVR 12976 ----------------- 12977 12978 When configured for debugging the Atmel AVR, GDB supports the following 12979 AVR-specific commands: 12980 12981 `info io_registers' 12982 This command displays information about the AVR I/O registers. For 12983 each register, GDB prints its number and value. 12984 12985 12986 File: gdb.info, Node: CRIS, Next: Super-H, Prev: AVR, Up: Embedded Processors 12987 12988 18.3.16 CRIS 12989 ------------ 12990 12991 When configured for debugging CRIS, GDB provides the following 12992 CRIS-specific commands: 12993 12994 `set cris-version VER' 12995 Set the current CRIS version to VER, either `10' or `32'. The 12996 CRIS version affects register names and sizes. This command is 12997 useful in case autodetection of the CRIS version fails. 12998 12999 `show cris-version' 13000 Show the current CRIS version. 13001 13002 `set cris-dwarf2-cfi' 13003 Set the usage of DWARF-2 CFI for CRIS debugging. The default is 13004 `on'. Change to `off' when using `gcc-cris' whose version is below 13005 `R59'. 13006 13007 `show cris-dwarf2-cfi' 13008 Show the current state of using DWARF-2 CFI. 13009 13010 `set cris-mode MODE' 13011 Set the current CRIS mode to MODE. It should only be changed when 13012 debugging in guru mode, in which case it should be set to `guru' 13013 (the default is `normal'). 13014 13015 `show cris-mode' 13016 Show the current CRIS mode. 13017 13018 13019 File: gdb.info, Node: Super-H, Next: WinCE, Prev: CRIS, Up: Embedded Processors 13020 13021 18.3.17 Renesas Super-H 13022 ----------------------- 13023 13024 For the Renesas Super-H processor, GDB provides these commands: 13025 13026 `regs' 13027 Show the values of all Super-H registers. 13028 13029 13030 File: gdb.info, Node: WinCE, Prev: Super-H, Up: Embedded Processors 13031 13032 18.3.18 Windows CE 13033 ------------------ 13034 13035 The following commands are available for Windows CE: 13036 13037 `set remotedirectory DIR' 13038 Tell GDB to upload files from the named directory DIR. The 13039 default is `/gdb', i.e. the root directory on the current drive. 13040 13041 `show remotedirectory' 13042 Show the current value of the upload directory. 13043 13044 `set remoteupload METHOD' 13045 Set the method used to upload files to remote device. Valid values 13046 for METHOD are `always', `newer', and `never'. The default is 13047 `newer'. 13048 13049 `show remoteupload' 13050 Show the current setting of the upload method. 13051 13052 `set remoteaddhost' 13053 Tell GDB whether to add this host to the remote stub's arguments 13054 when you debug over a network. 13055 13056 `show remoteaddhost' 13057 Show whether to add this host to remote stub's arguments when 13058 debugging over a network. 13059 13060 13061 File: gdb.info, Node: Architectures, Prev: Embedded Processors, Up: Configurations 13062 13063 18.4 Architectures 13064 ================== 13065 13066 This section describes characteristics of architectures that affect all 13067 uses of GDB with the architecture, both native and cross. 13068 13069 * Menu: 13070 13071 * i386:: 13072 * A29K:: 13073 * Alpha:: 13074 * MIPS:: 13075 * HPPA:: HP PA architecture 13076 13077 13078 File: gdb.info, Node: i386, Next: A29K, Up: Architectures 13079 13080 18.4.1 x86 Architecture-specific issues. 13081 ---------------------------------------- 13082 13083 `set struct-convention MODE' 13084 Set the convention used by the inferior to return `struct's and 13085 `union's from functions to MODE. Possible values of MODE are 13086 `"pcc"', `"reg"', and `"default"' (the default). `"default"' or 13087 `"pcc"' means that `struct's are returned on the stack, while 13088 `"reg"' means that a `struct' or a `union' whose size is 1, 2, 4, 13089 or 8 bytes will be returned in a register. 13090 13091 `show struct-convention' 13092 Show the current setting of the convention to return `struct's 13093 from functions. 13094 13095 13096 File: gdb.info, Node: A29K, Next: Alpha, Prev: i386, Up: Architectures 13097 13098 18.4.2 A29K 13099 ----------- 13100 13101 `set rstack_high_address ADDRESS' 13102 On AMD 29000 family processors, registers are saved in a separate 13103 "register stack". There is no way for GDB to determine the extent 13104 of this stack. Normally, GDB just assumes that the stack is 13105 "large enough". This may result in GDB referencing memory 13106 locations that do not exist. If necessary, you can get around 13107 this problem by specifying the ending address of the register 13108 stack with the `set rstack_high_address' command. The argument 13109 should be an address, which you probably want to precede with `0x' 13110 to specify in hexadecimal. 13111 13112 `show rstack_high_address' 13113 Display the current limit of the register stack, on AMD 29000 13114 family processors. 13115 13116 13117 13118 File: gdb.info, Node: Alpha, Next: MIPS, Prev: A29K, Up: Architectures 13119 13120 18.4.3 Alpha 13121 ------------ 13122 13123 See the following section. 13124 13125 13126 File: gdb.info, Node: MIPS, Next: HPPA, Prev: Alpha, Up: Architectures 13127 13128 18.4.4 MIPS 13129 ----------- 13130 13131 Alpha- and MIPS-based computers use an unusual stack frame, which 13132 sometimes requires GDB to search backward in the object code to find 13133 the beginning of a function. 13134 13135 To improve response time (especially for embedded applications, where 13136 GDB may be restricted to a slow serial line for this search) you may 13137 want to limit the size of this search, using one of these commands: 13138 13139 `set heuristic-fence-post LIMIT' 13140 Restrict GDB to examining at most LIMIT bytes in its search for 13141 the beginning of a function. A value of 0 (the default) means 13142 there is no limit. However, except for 0, the larger the limit 13143 the more bytes `heuristic-fence-post' must search and therefore 13144 the longer it takes to run. You should only need to use this 13145 command when debugging a stripped executable. 13146 13147 `show heuristic-fence-post' 13148 Display the current limit. 13149 13150 These commands are available _only_ when GDB is configured for 13151 debugging programs on Alpha or MIPS processors. 13152 13153 Several MIPS-specific commands are available when debugging MIPS 13154 programs: 13155 13156 `set mips saved-gpreg-size SIZE' 13157 Set the size of MIPS general-purpose registers saved on the stack. 13158 The argument SIZE can be one of the following: 13159 13160 `32' 13161 32-bit GP registers 13162 13163 `64' 13164 64-bit GP registers 13165 13166 `auto' 13167 Use the target's default setting or autodetect the saved size 13168 from the information contained in the executable. This is 13169 the default 13170 13171 `show mips saved-gpreg-size' 13172 Show the current size of MIPS GP registers on the stack. 13173 13174 `set mips stack-arg-size SIZE' 13175 Set the amount of stack space reserved for arguments to functions. 13176 The argument can be one of `"32"', `"64"' or `"auto"' (the 13177 default). 13178 13179 `set mips abi ARG' 13180 Tell GDB which MIPS ABI is used by the inferior. Possible values 13181 of ARG are: 13182 13183 `auto' 13184 The default ABI associated with the current binary (this is 13185 the default). 13186 13187 `o32' 13188 13189 `o64' 13190 13191 `n32' 13192 13193 `n64' 13194 13195 `eabi32' 13196 13197 `eabi64' 13198 13199 `auto' 13200 13201 `show mips abi' 13202 Show the MIPS ABI used by GDB to debug the inferior. 13203 13204 `set mipsfpu' 13205 `show mipsfpu' 13206 *Note set mipsfpu: MIPS Embedded. 13207 13208 `set mips mask-address ARG' 13209 This command determines whether the most-significant 32 bits of 13210 64-bit MIPS addresses are masked off. The argument ARG can be 13211 `on', `off', or `auto'. The latter is the default setting, which 13212 lets GDB determine the correct value. 13213 13214 `show mips mask-address' 13215 Show whether the upper 32 bits of MIPS addresses are masked off or 13216 not. 13217 13218 `set remote-mips64-transfers-32bit-regs' 13219 This command controls compatibility with 64-bit MIPS targets that 13220 transfer data in 32-bit quantities. If you have an old MIPS 64 13221 target that transfers 32 bits for some registers, like SR and FSR, 13222 and 64 bits for other registers, set this option to `on'. 13223 13224 `show remote-mips64-transfers-32bit-regs' 13225 Show the current setting of compatibility with older MIPS 64 13226 targets. 13227 13228 `set debug mips' 13229 This command turns on and off debugging messages for the 13230 MIPS-specific target code in GDB. 13231 13232 `show debug mips' 13233 Show the current setting of MIPS debugging messages. 13234 13235 13236 File: gdb.info, Node: HPPA, Prev: MIPS, Up: Architectures 13237 13238 18.4.5 HPPA 13239 ----------- 13240 13241 When GDB is debugging te HP PA architecture, it provides the following 13242 special commands: 13243 13244 `set debug hppa' 13245 THis command determines whether HPPA architecture specific 13246 debugging messages are to be displayed. 13247 13248 `show debug hppa' 13249 Show whether HPPA debugging messages are displayed. 13250 13251 `maint print unwind ADDRESS' 13252 This command displays the contents of the unwind table entry at the 13253 given ADDRESS. 13254 13255 13256 13257 File: gdb.info, Node: Controlling GDB, Next: Sequences, Prev: Configurations, Up: Top 13258 13259 19 Controlling GDB 13260 ****************** 13261 13262 You can alter the way GDB interacts with you by using the `set' 13263 command. For commands controlling how GDB displays data, see *Note 13264 Print settings: Print Settings. Other settings are described here. 13265 13266 * Menu: 13267 13268 * Prompt:: Prompt 13269 * Editing:: Command editing 13270 * Command History:: Command history 13271 * Screen Size:: Screen size 13272 * Numbers:: Numbers 13273 * ABI:: Configuring the current ABI 13274 * Messages/Warnings:: Optional warnings and messages 13275 * Debugging Output:: Optional messages about internal happenings 13276 13277 13278 File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB 13279 13280 19.1 Prompt 13281 =========== 13282 13283 GDB indicates its readiness to read a command by printing a string 13284 called the "prompt". This string is normally `(gdb)'. You can change 13285 the prompt string with the `set prompt' command. For instance, when 13286 debugging GDB with GDB, it is useful to change the prompt in one of the 13287 GDB sessions so that you can always tell which one you are talking to. 13288 13289 _Note:_ `set prompt' does not add a space for you after the prompt 13290 you set. This allows you to set a prompt which ends in a space or a 13291 prompt that does not. 13292 13293 `set prompt NEWPROMPT' 13294 Directs GDB to use NEWPROMPT as its prompt string henceforth. 13295 13296 `show prompt' 13297 Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT' 13298 13299 13300 File: gdb.info, Node: Editing, Next: Command History, Prev: Prompt, Up: Controlling GDB 13301 13302 19.2 Command editing 13303 ==================== 13304 13305 GDB reads its input commands via the "Readline" interface. This GNU 13306 library provides consistent behavior for programs which provide a 13307 command line interface to the user. Advantages are GNU Emacs-style or 13308 "vi"-style inline editing of commands, `csh'-like history substitution, 13309 and a storage and recall of command history across debugging sessions. 13310 13311 You may control the behavior of command line editing in GDB with the 13312 command `set'. 13313 13314 `set editing' 13315 `set editing on' 13316 Enable command line editing (enabled by default). 13317 13318 `set editing off' 13319 Disable command line editing. 13320 13321 `show editing' 13322 Show whether command line editing is enabled. 13323 13324 *Note Command Line Editing::, for more details about the Readline 13325 interface. Users unfamiliar with GNU Emacs or `vi' are encouraged to 13326 read that chapter. 13327 13328 13329 File: gdb.info, Node: Command History, Next: Screen Size, Prev: Editing, Up: Controlling GDB 13330 13331 19.3 Command history 13332 ==================== 13333 13334 GDB can keep track of the commands you type during your debugging 13335 sessions, so that you can be certain of precisely what happened. Use 13336 these commands to manage the GDB command history facility. 13337 13338 GDB uses the GNU History library, a part of the Readline package, to 13339 provide the history facility. *Note Using History Interactively::, for 13340 the detailed description of the History library. 13341 13342 To issue a command to GDB without affecting certain aspects of the 13343 state which is seen by users, prefix it with `server '. This means 13344 that this command will not affect the command history, nor will it 13345 affect GDB's notion of which command to repeat if <RET> is pressed on a 13346 line by itself. 13347 13348 The server prefix does not affect the recording of values into the 13349 value history; to print a value without recording it into the value 13350 history, use the `output' command instead of the `print' command. 13351 13352 Here is the description of GDB commands related to command history. 13353 13354 `set history filename FNAME' 13355 Set the name of the GDB command history file to FNAME. This is 13356 the file where GDB reads an initial command history list, and 13357 where it writes the command history from this session when it 13358 exits. You can access this list through history expansion or 13359 through the history command editing characters listed below. This 13360 file defaults to the value of the environment variable 13361 `GDBHISTFILE', or to `./.gdb_history' (`./_gdb_history' on MS-DOS) 13362 if this variable is not set. 13363 13364 `set history save' 13365 `set history save on' 13366 Record command history in a file, whose name may be specified with 13367 the `set history filename' command. By default, this option is 13368 disabled. 13369 13370 `set history save off' 13371 Stop recording command history in a file. 13372 13373 `set history size SIZE' 13374 Set the number of commands which GDB keeps in its history list. 13375 This defaults to the value of the environment variable `HISTSIZE', 13376 or to 256 if this variable is not set. 13377 13378 History expansion assigns special meaning to the character `!'. 13379 *Note Event Designators::, for more details. 13380 13381 Since `!' is also the logical not operator in C, history expansion 13382 is off by default. If you decide to enable history expansion with the 13383 `set history expansion on' command, you may sometimes need to follow 13384 `!' (when it is used as logical not, in an expression) with a space or 13385 a tab to prevent it from being expanded. The readline history 13386 facilities do not attempt substitution on the strings `!=' and `!(', 13387 even when history expansion is enabled. 13388 13389 The commands to control history expansion are: 13390 13391 `set history expansion on' 13392 `set history expansion' 13393 Enable history expansion. History expansion is off by default. 13394 13395 `set history expansion off' 13396 Disable history expansion. 13397 13398 `show history' 13399 `show history filename' 13400 `show history save' 13401 `show history size' 13402 `show history expansion' 13403 These commands display the state of the GDB history parameters. 13404 `show history' by itself displays all four states. 13405 13406 `show commands' 13407 Display the last ten commands in the command history. 13408 13409 `show commands N' 13410 Print ten commands centered on command number N. 13411 13412 `show commands +' 13413 Print ten commands just after the commands last printed. 13414 13415 13416 File: gdb.info, Node: Screen Size, Next: Numbers, Prev: Command History, Up: Controlling GDB 13417 13418 19.4 Screen size 13419 ================ 13420 13421 Certain commands to GDB may produce large amounts of information output 13422 to the screen. To help you read all of it, GDB pauses and asks you for 13423 input at the end of each page of output. Type <RET> when you want to 13424 continue the output, or `q' to discard the remaining output. Also, the 13425 screen width setting determines when to wrap lines of output. 13426 Depending on what is being printed, GDB tries to break the line at a 13427 readable place, rather than simply letting it overflow onto the 13428 following line. 13429 13430 Normally GDB knows the size of the screen from the terminal driver 13431 software. For example, on Unix GDB uses the termcap data base together 13432 with the value of the `TERM' environment variable and the `stty rows' 13433 and `stty cols' settings. If this is not correct, you can override it 13434 with the `set height' and `set width' commands: 13435 13436 `set height LPP' 13437 `show height' 13438 `set width CPL' 13439 `show width' 13440 These `set' commands specify a screen height of LPP lines and a 13441 screen width of CPL characters. The associated `show' commands 13442 display the current settings. 13443 13444 If you specify a height of zero lines, GDB does not pause during 13445 output no matter how long the output is. This is useful if output 13446 is to a file or to an editor buffer. 13447 13448 Likewise, you can specify `set width 0' to prevent GDB from 13449 wrapping its output. 13450 13451 `set pagination on' 13452 `set pagination off' 13453 Turn the output pagination on or off; the default is on. Turning 13454 pagination off is the alternative to `set height 0'. 13455 13456 `show pagination' 13457 Show the current pagination mode. 13458 13459 13460 File: gdb.info, Node: Numbers, Next: ABI, Prev: Screen Size, Up: Controlling GDB 13461 13462 19.5 Numbers 13463 ============ 13464 13465 You can always enter numbers in octal, decimal, or hexadecimal in GDB 13466 by the usual conventions: octal numbers begin with `0', decimal numbers 13467 end with `.', and hexadecimal numbers begin with `0x'. Numbers that 13468 neither begin with `0' or `0x', nor end with a `.' are, by default, 13469 entered in base 10; likewise, the default display for numbers--when no 13470 particular format is specified--is base 10. You can change the default 13471 base for both input and output with the commands described below. 13472 13473 `set input-radix BASE' 13474 Set the default base for numeric input. Supported choices for 13475 BASE are decimal 8, 10, or 16. BASE must itself be specified 13476 either unambiguously or using the current input radix; for 13477 example, any of 13478 13479 set input-radix 012 13480 set input-radix 10. 13481 set input-radix 0xa 13482 13483 sets the input base to decimal. On the other hand, `set 13484 input-radix 10' leaves the input radix unchanged, no matter what 13485 it was, since `10', being without any leading or trailing signs of 13486 its base, is interpreted in the current radix. Thus, if the 13487 current radix is 16, `10' is interpreted in hex, i.e. as 16 13488 decimal, which doesn't change the radix. 13489 13490 `set output-radix BASE' 13491 Set the default base for numeric display. Supported choices for 13492 BASE are decimal 8, 10, or 16. BASE must itself be specified 13493 either unambiguously or using the current input radix. 13494 13495 `show input-radix' 13496 Display the current default base for numeric input. 13497 13498 `show output-radix' 13499 Display the current default base for numeric display. 13500 13501 `set radix [BASE]' 13502 `show radix' 13503 These commands set and show the default base for both input and 13504 output of numbers. `set radix' sets the radix of input and output 13505 to the same base; without an argument, it resets the radix back to 13506 its default value of 10. 13507 13508 13509 13510 File: gdb.info, Node: ABI, Next: Messages/Warnings, Prev: Numbers, Up: Controlling GDB 13511 13512 19.6 Configuring the current ABI 13513 ================================ 13514 13515 GDB can determine the "ABI" (Application Binary Interface) of your 13516 application automatically. However, sometimes you need to override its 13517 conclusions. Use these commands to manage GDB's view of the current 13518 ABI. 13519 13520 One GDB configuration can debug binaries for multiple operating 13521 system targets, either via remote debugging or native emulation. GDB 13522 will autodetect the "OS ABI" (Operating System ABI) in use, but you can 13523 override its conclusion using the `set osabi' command. One example 13524 where this is useful is in debugging of binaries which use an alternate 13525 C library (e.g. UCLIBC for GNU/Linux) which does not have the same 13526 identifying marks that the standard C library for your platform 13527 provides. 13528 13529 `show osabi' 13530 Show the OS ABI currently in use. 13531 13532 `set osabi' 13533 With no argument, show the list of registered available OS ABI's. 13534 13535 `set osabi ABI' 13536 Set the current OS ABI to ABI. 13537 13538 Generally, the way that an argument of type `float' is passed to a 13539 function depends on whether the function is prototyped. For a 13540 prototyped (i.e. ANSI/ISO style) function, `float' arguments are passed 13541 unchanged, according to the architecture's convention for `float'. For 13542 unprototyped (i.e. K&R style) functions, `float' arguments are first 13543 promoted to type `double' and then passed. 13544 13545 Unfortunately, some forms of debug information do not reliably 13546 indicate whether a function is prototyped. If GDB calls a function 13547 that is not marked as prototyped, it consults `set 13548 coerce-float-to-double'. 13549 13550 `set coerce-float-to-double' 13551 `set coerce-float-to-double on' 13552 Arguments of type `float' will be promoted to `double' when passed 13553 to an unprototyped function. This is the default setting. 13554 13555 `set coerce-float-to-double off' 13556 Arguments of type `float' will be passed directly to unprototyped 13557 functions. 13558 13559 `show coerce-float-to-double' 13560 Show the current setting of promoting `float' to `double'. 13561 13562 GDB needs to know the ABI used for your program's C++ objects. The 13563 correct C++ ABI depends on which C++ compiler was used to build your 13564 application. GDB only fully supports programs with a single C++ ABI; 13565 if your program contains code using multiple C++ ABI's or if GDB can 13566 not identify your program's ABI correctly, you can tell GDB which ABI 13567 to use. Currently supported ABI's include "gnu-v2", for `g++' versions 13568 before 3.0, "gnu-v3", for `g++' versions 3.0 and later, and "hpaCC" for 13569 the HP ANSI C++ compiler. Other C++ compilers may use the "gnu-v2" or 13570 "gnu-v3" ABI's as well. The default setting is "auto". 13571 13572 `show cp-abi' 13573 Show the C++ ABI currently in use. 13574 13575 `set cp-abi' 13576 With no argument, show the list of supported C++ ABI's. 13577 13578 `set cp-abi ABI' 13579 `set cp-abi auto' 13580 Set the current C++ ABI to ABI, or return to automatic detection. 13581 13582 13583 File: gdb.info, Node: Messages/Warnings, Next: Debugging Output, Prev: ABI, Up: Controlling GDB 13584 13585 19.7 Optional warnings and messages 13586 =================================== 13587 13588 By default, GDB is silent about its inner workings. If you are running 13589 on a slow machine, you may want to use the `set verbose' command. This 13590 makes GDB tell you when it does a lengthy internal operation, so you 13591 will not think it has crashed. 13592 13593 Currently, the messages controlled by `set verbose' are those which 13594 announce that the symbol table for a source file is being read; see 13595 `symbol-file' in *Note Commands to specify files: Files. 13596 13597 `set verbose on' 13598 Enables GDB output of certain informational messages. 13599 13600 `set verbose off' 13601 Disables GDB output of certain informational messages. 13602 13603 `show verbose' 13604 Displays whether `set verbose' is on or off. 13605 13606 By default, if GDB encounters bugs in the symbol table of an object 13607 file, it is silent; but if you are debugging a compiler, you may find 13608 this information useful (*note Errors reading symbol files: Symbol 13609 Errors.). 13610 13611 `set complaints LIMIT' 13612 Permits GDB to output LIMIT complaints about each type of unusual 13613 symbols before becoming silent about the problem. Set LIMIT to 13614 zero to suppress all complaints; set it to a large number to 13615 prevent complaints from being suppressed. 13616 13617 `show complaints' 13618 Displays how many symbol complaints GDB is permitted to produce. 13619 13620 13621 By default, GDB is cautious, and asks what sometimes seems to be a 13622 lot of stupid questions to confirm certain commands. For example, if 13623 you try to run a program which is already running: 13624 13625 (gdb) run 13626 The program being debugged has been started already. 13627 Start it from the beginning? (y or n) 13628 13629 If you are willing to unflinchingly face the consequences of your own 13630 commands, you can disable this "feature": 13631 13632 `set confirm off' 13633 Disables confirmation requests. 13634 13635 `set confirm on' 13636 Enables confirmation requests (the default). 13637 13638 `show confirm' 13639 Displays state of confirmation requests. 13640 13641 13642 If you need to debug user-defined commands or sourced files you may 13643 find it useful to enable "command tracing". In this mode each command 13644 will be printed as it is executed, prefixed with one or more `+' 13645 symbols, the quantity denoting the call depth of each command. 13646 13647 `set trace-commands on' 13648 Enable command tracing. 13649 13650 `set trace-commands off' 13651 Disable command tracing. 13652 13653 `show trace-commands' 13654 Display the current state of command tracing. 13655 13656 13657 File: gdb.info, Node: Debugging Output, Prev: Messages/Warnings, Up: Controlling GDB 13658 13659 19.8 Optional messages about internal happenings 13660 ================================================ 13661 13662 GDB has commands that enable optional debugging messages from various 13663 GDB subsystems; normally these commands are of interest to GDB 13664 maintainers, or when reporting a bug. This section documents those 13665 commands. 13666 13667 `set exec-done-display' 13668 Turns on or off the notification of asynchronous commands' 13669 completion. When on, GDB will print a message when an 13670 asynchronous command finishes its execution. The default is off. 13671 13672 `show exec-done-display' 13673 Displays the current setting of asynchronous command completion 13674 notification. 13675 13676 `set debug arch' 13677 Turns on or off display of gdbarch debugging info. The default is 13678 off 13679 13680 `show debug arch' 13681 Displays the current state of displaying gdbarch debugging info. 13682 13683 `set debug aix-thread' 13684 Display debugging messages about inner workings of the AIX thread 13685 module. 13686 13687 `show debug aix-thread' 13688 Show the current state of AIX thread debugging info display. 13689 13690 `set debug event' 13691 Turns on or off display of GDB event debugging info. The default 13692 is off. 13693 13694 `show debug event' 13695 Displays the current state of displaying GDB event debugging info. 13696 13697 `set debug expression' 13698 Turns on or off display of debugging info about GDB expression 13699 parsing. The default is off. 13700 13701 `show debug expression' 13702 Displays the current state of displaying debugging info about GDB 13703 expression parsing. 13704 13705 `set debug frame' 13706 Turns on or off display of GDB frame debugging info. The default 13707 is off. 13708 13709 `show debug frame' 13710 Displays the current state of displaying GDB frame debugging info. 13711 13712 `set debug infrun' 13713 Turns on or off display of GDB debugging info for running the 13714 inferior. The default is off. `infrun.c' contains GDB's runtime 13715 state machine used for implementing operations such as 13716 single-stepping the inferior. 13717 13718 `show debug infrun' 13719 Displays the current state of GDB inferior debugging. 13720 13721 `set debug lin-lwp' 13722 Turns on or off debugging messages from the Linux LWP debug 13723 support. 13724 13725 `show debug lin-lwp' 13726 Show the current state of Linux LWP debugging messages. 13727 13728 `set debug observer' 13729 Turns on or off display of GDB observer debugging. This includes 13730 info such as the notification of observable events. 13731 13732 `show debug observer' 13733 Displays the current state of observer debugging. 13734 13735 `set debug overload' 13736 Turns on or off display of GDB C++ overload debugging info. This 13737 includes info such as ranking of functions, etc. The default is 13738 off. 13739 13740 `show debug overload' 13741 Displays the current state of displaying GDB C++ overload 13742 debugging info. 13743 13744 `set debug remote' 13745 Turns on or off display of reports on all packets sent back and 13746 forth across the serial line to the remote machine. The info is 13747 printed on the GDB standard output stream. The default is off. 13748 13749 `show debug remote' 13750 Displays the state of display of remote packets. 13751 13752 `set debug serial' 13753 Turns on or off display of GDB serial debugging info. The default 13754 is off. 13755 13756 `show debug serial' 13757 Displays the current state of displaying GDB serial debugging info. 13758 13759 `set debug solib-frv' 13760 Turns on or off debugging messages for FR-V shared-library code. 13761 13762 `show debug solib-frv' 13763 Display the current state of FR-V shared-library code debugging 13764 messages. 13765 13766 `set debug target' 13767 Turns on or off display of GDB target debugging info. This info 13768 includes what is going on at the target level of GDB, as it 13769 happens. The default is 0. Set it to 1 to track events, and to 2 13770 to also track the value of large memory transfers. Changes to 13771 this flag do not take effect until the next time you connect to a 13772 target or use the `run' command. 13773 13774 `show debug target' 13775 Displays the current state of displaying GDB target debugging info. 13776 13777 `set debugvarobj' 13778 Turns on or off display of GDB variable object debugging info. The 13779 default is off. 13780 13781 `show debugvarobj' 13782 Displays the current state of displaying GDB variable object 13783 debugging info. 13784 13785 13786 File: gdb.info, Node: Sequences, Next: TUI, Prev: Controlling GDB, Up: Top 13787 13788 20 Canned Sequences of Commands 13789 ******************************* 13790 13791 Aside from breakpoint commands (*note Breakpoint command lists: Break 13792 Commands.), GDB provides two ways to store sequences of commands for 13793 execution as a unit: user-defined commands and command files. 13794 13795 * Menu: 13796 13797 * Define:: How to define your own commands 13798 * Hooks:: Hooks for user-defined commands 13799 * Command Files:: How to write scripts of commands to be stored in a file 13800 * Output:: Commands for controlled output 13801 13802 13803 File: gdb.info, Node: Define, Next: Hooks, Up: Sequences 13804 13805 20.1 User-defined commands 13806 ========================== 13807 13808 A "user-defined command" is a sequence of GDB commands to which you 13809 assign a new name as a command. This is done with the `define' 13810 command. User commands may accept up to 10 arguments separated by 13811 whitespace. Arguments are accessed within the user command via 13812 `$arg0...$arg9'. A trivial example: 13813 13814 define adder 13815 print $arg0 + $arg1 + $arg2 13816 end 13817 13818 To execute the command use: 13819 13820 adder 1 2 3 13821 13822 This defines the command `adder', which prints the sum of its three 13823 arguments. Note the arguments are text substitutions, so they may 13824 reference variables, use complex expressions, or even perform inferior 13825 functions calls. 13826 13827 In addition, `$argc' may be used to find out how many arguments have 13828 been passed. This expands to a number in the range 0...10. 13829 13830 define adder 13831 if $argc == 2 13832 print $arg0 + $arg1 13833 end 13834 if $argc == 3 13835 print $arg0 + $arg1 + $arg2 13836 end 13837 end 13838 13839 `define COMMANDNAME' 13840 Define a command named COMMANDNAME. If there is already a command 13841 by that name, you are asked to confirm that you want to redefine 13842 it. 13843 13844 The definition of the command is made up of other GDB command 13845 lines, which are given following the `define' command. The end of 13846 these commands is marked by a line containing `end'. 13847 13848 `document COMMANDNAME' 13849 Document the user-defined command COMMANDNAME, so that it can be 13850 accessed by `help'. The command COMMANDNAME must already be 13851 defined. This command reads lines of documentation just as 13852 `define' reads the lines of the command definition, ending with 13853 `end'. After the `document' command is finished, `help' on command 13854 COMMANDNAME displays the documentation you have written. 13855 13856 You may use the `document' command again to change the 13857 documentation of a command. Redefining the command with `define' 13858 does not change the documentation. 13859 13860 `dont-repeat' 13861 Used inside a user-defined command, this tells GDB that this 13862 command should not be repeated when the user hits <RET> (*note 13863 repeat last command: Command Syntax.). 13864 13865 `help user-defined' 13866 List all user-defined commands, with the first line of the 13867 documentation (if any) for each. 13868 13869 `show user' 13870 `show user COMMANDNAME' 13871 Display the GDB commands used to define COMMANDNAME (but not its 13872 documentation). If no COMMANDNAME is given, display the 13873 definitions for all user-defined commands. 13874 13875 `show max-user-call-depth' 13876 `set max-user-call-depth' 13877 The value of `max-user-call-depth' controls how many recursion 13878 levels are allowed in user-defined commands before GDB suspects an 13879 infinite recursion and aborts the command. 13880 13881 In addition to the above commands, user-defined commands frequently 13882 use control flow commands, described in *Note Command Files::. 13883 13884 When user-defined commands are executed, the commands of the 13885 definition are not printed. An error in any command stops execution of 13886 the user-defined command. 13887 13888 If used interactively, commands that would ask for confirmation 13889 proceed without asking when used inside a user-defined command. Many 13890 GDB commands that normally print messages to say what they are doing 13891 omit the messages when used in a user-defined command. 13892 13893 13894 File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences 13895 13896 20.2 User-defined command hooks 13897 =============================== 13898 13899 You may define "hooks", which are a special kind of user-defined 13900 command. Whenever you run the command `foo', if the user-defined 13901 command `hook-foo' exists, it is executed (with no arguments) before 13902 that command. 13903 13904 A hook may also be defined which is run after the command you 13905 executed. Whenever you run the command `foo', if the user-defined 13906 command `hookpost-foo' exists, it is executed (with no arguments) after 13907 that command. Post-execution hooks may exist simultaneously with 13908 pre-execution hooks, for the same command. 13909 13910 It is valid for a hook to call the command which it hooks. If this 13911 occurs, the hook is not re-executed, thereby avoiding infinite 13912 recursion. 13913 13914 In addition, a pseudo-command, `stop' exists. Defining 13915 (`hook-stop') makes the associated commands execute every time 13916 execution stops in your program: before breakpoint commands are run, 13917 displays are printed, or the stack frame is printed. 13918 13919 For example, to ignore `SIGALRM' signals while single-stepping, but 13920 treat them normally during normal execution, you could define: 13921 13922 define hook-stop 13923 handle SIGALRM nopass 13924 end 13925 13926 define hook-run 13927 handle SIGALRM pass 13928 end 13929 13930 define hook-continue 13931 handle SIGLARM pass 13932 end 13933 13934 As a further example, to hook at the begining and end of the `echo' 13935 command, and to add extra text to the beginning and end of the message, 13936 you could define: 13937 13938 define hook-echo 13939 echo <<<--- 13940 end 13941 13942 define hookpost-echo 13943 echo --->>>\n 13944 end 13945 13946 (gdb) echo Hello World 13947 <<<---Hello World--->>> 13948 (gdb) 13949 13950 You can define a hook for any single-word command in GDB, but not 13951 for command aliases; you should define a hook for the basic command 13952 name, e.g. `backtrace' rather than `bt'. If an error occurs during 13953 the execution of your hook, execution of GDB commands stops and GDB 13954 issues a prompt (before the command that you actually typed had a 13955 chance to run). 13956 13957 If you try to define a hook which does not match any known command, 13958 you get a warning from the `define' command. 13959 13960 13961 File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences 13962 13963 20.3 Command files 13964 ================== 13965 13966 A command file for GDB is a text file made of lines that are GDB 13967 commands. Comments (lines starting with `#') may also be included. An 13968 empty line in a command file does nothing; it does not mean to repeat 13969 the last command, as it would from the terminal. 13970 13971 You can request the execution of a command file with the `source' 13972 command: 13973 13974 `source [`-v'] FILENAME' 13975 Execute the command file FILENAME. 13976 13977 The lines in a command file are generally executed sequentially, 13978 unless the order of execution is changed by one of the _flow-control 13979 commands_ described below. The commands are not printed as they are 13980 executed. An error in any command terminates execution of the command 13981 file and control is returned to the console. 13982 13983 GDB searches for FILENAME in the current directory and then on the 13984 search path (specified with the `directory' command). 13985 13986 If `-v', for verbose mode, is given then GDB displays each command 13987 as it is executed. The option must be given before FILENAME, and is 13988 interpreted as part of the filename anywhere else. 13989 13990 Commands that would ask for confirmation if used interactively 13991 proceed without asking when used in a command file. Many GDB commands 13992 that normally print messages to say what they are doing omit the 13993 messages when called from command files. 13994 13995 GDB also accepts command input from standard input. In this mode, 13996 normal output goes to standard output and error output goes to standard 13997 error. Errors in a command file supplied on standard input do not 13998 terminate execution of the command file--execution continues with the 13999 next command. 14000 14001 gdb < cmds > log 2>&1 14002 14003 (The syntax above will vary depending on the shell used.) This 14004 example will execute commands from the file `cmds'. All output and 14005 errors would be directed to `log'. 14006 14007 Since commands stored on command files tend to be more general than 14008 commands typed interactively, they frequently need to deal with 14009 complicated situations, such as different or unexpected values of 14010 variables and symbols, changes in how the program being debugged is 14011 built, etc. GDB provides a set of flow-control commands to deal with 14012 these complexities. Using these commands, you can write complex 14013 scripts that loop over data structures, execute commands conditionally, 14014 etc. 14015 14016 `if' 14017 `else' 14018 This command allows to include in your script conditionally 14019 executed commands. The `if' command takes a single argument, which 14020 is an expression to evaluate. It is followed by a series of 14021 commands that are executed only if the expression is true (its 14022 value is nonzero). There can then optionally be an `else' line, 14023 followed by a series of commands that are only executed if the 14024 expression was false. The end of the list is marked by a line 14025 containing `end'. 14026 14027 `while' 14028 This command allows to write loops. Its syntax is similar to 14029 `if': the command takes a single argument, which is an expression 14030 to evaluate, and must be followed by the commands to execute, one 14031 per line, terminated by an `end'. These commands are called the 14032 "body" of the loop. The commands in the body of `while' are 14033 executed repeatedly as long as the expression evaluates to true. 14034 14035 `loop_break' 14036 This command exits the `while' loop in whose body it is included. 14037 Execution of the script continues after that `while's `end' line. 14038 14039 `loop_continue' 14040 This command skips the execution of the rest of the body of 14041 commands in the `while' loop in whose body it is included. 14042 Execution branches to the beginning of the `while' loop, where it 14043 evaluates the controlling expression. 14044 14045 `end' 14046 Terminate the block of commands that are the body of `if', `else', 14047 or `while' flow-control commands. 14048 14049 14050 File: gdb.info, Node: Output, Prev: Command Files, Up: Sequences 14051 14052 20.4 Commands for controlled output 14053 =================================== 14054 14055 During the execution of a command file or a user-defined command, normal 14056 GDB output is suppressed; the only output that appears is what is 14057 explicitly printed by the commands in the definition. This section 14058 describes three commands useful for generating exactly the output you 14059 want. 14060 14061 `echo TEXT' 14062 Print TEXT. Nonprinting characters can be included in TEXT using 14063 C escape sequences, such as `\n' to print a newline. *No newline 14064 is printed unless you specify one.* In addition to the standard C 14065 escape sequences, a backslash followed by a space stands for a 14066 space. This is useful for displaying a string with spaces at the 14067 beginning or the end, since leading and trailing spaces are 14068 otherwise trimmed from all arguments. To print ` and foo = ', use 14069 the command `echo \ and foo = \ '. 14070 14071 A backslash at the end of TEXT can be used, as in C, to continue 14072 the command onto subsequent lines. For example, 14073 14074 echo This is some text\n\ 14075 which is continued\n\ 14076 onto several lines.\n 14077 14078 produces the same output as 14079 14080 echo This is some text\n 14081 echo which is continued\n 14082 echo onto several lines.\n 14083 14084 `output EXPRESSION' 14085 Print the value of EXPRESSION and nothing but that value: no 14086 newlines, no `$NN = '. The value is not entered in the value 14087 history either. *Note Expressions: Expressions, for more 14088 information on expressions. 14089 14090 `output/FMT EXPRESSION' 14091 Print the value of EXPRESSION in format FMT. You can use the same 14092 formats as for `print'. *Note Output formats: Output Formats, for 14093 more information. 14094 14095 `printf STRING, EXPRESSIONS...' 14096 Print the values of the EXPRESSIONS under the control of STRING. 14097 The EXPRESSIONS are separated by commas and may be either numbers 14098 or pointers. Their values are printed as specified by STRING, 14099 exactly as if your program were to execute the C subroutine 14100 14101 printf (STRING, EXPRESSIONS...); 14102 14103 For example, you can print two values in hex like this: 14104 14105 printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo 14106 14107 The only backslash-escape sequences that you can use in the format 14108 string are the simple ones that consist of backslash followed by a 14109 letter. 14110 14111 14112 File: gdb.info, Node: Interpreters, Next: Emacs, Prev: TUI, Up: Top 14113 14114 21 Command Interpreters 14115 *********************** 14116 14117 GDB supports multiple command interpreters, and some command 14118 infrastructure to allow users or user interface writers to switch 14119 between interpreters or run commands in other interpreters. 14120 14121 GDB currently supports two command interpreters, the console 14122 interpreter (sometimes called the command-line interpreter or CLI) and 14123 the machine interface interpreter (or GDB/MI). This manual describes 14124 both of these interfaces in great detail. 14125 14126 By default, GDB will start with the console interpreter. However, 14127 the user may choose to start GDB with another interpreter by specifying 14128 the `-i' or `--interpreter' startup options. Defined interpreters 14129 include: 14130 14131 `console' 14132 The traditional console or command-line interpreter. This is the 14133 most often used interpreter with GDB. With no interpreter 14134 specified at runtime, GDB will use this interpreter. 14135 14136 `mi' 14137 The newest GDB/MI interface (currently `mi2'). Used primarily by 14138 programs wishing to use GDB as a backend for a debugger GUI or an 14139 IDE. For more information, see *Note The GDB/MI Interface: GDB/MI. 14140 14141 `mi2' 14142 The current GDB/MI interface. 14143 14144 `mi1' 14145 The GDB/MI interface included in GDB 5.1, 5.2, and 5.3. 14146 14147 14148 The interpreter being used by GDB may not be dynamically switched at 14149 runtime. Although possible, this could lead to a very precarious 14150 situation. Consider an IDE using GDB/MI. If a user enters the command 14151 "interpreter-set console" in a console view, GDB would switch to using 14152 the console interpreter, rendering the IDE inoperable! 14153 14154 Although you may only choose a single interpreter at startup, you 14155 may execute commands in any interpreter from the current interpreter 14156 using the appropriate command. If you are running the console 14157 interpreter, simply use the `interpreter-exec' command: 14158 14159 interpreter-exec mi "-data-list-register-names" 14160 14161 GDB/MI has a similar command, although it is only available in 14162 versions of GDB which support GDB/MI version 2 (or greater). 14163 14164 14165 File: gdb.info, Node: TUI, Next: Interpreters, Prev: Sequences, Up: Top 14166 14167 22 GDB Text User Interface 14168 ************************** 14169 14170 * Menu: 14171 14172 * TUI Overview:: TUI overview 14173 * TUI Keys:: TUI key bindings 14174 * TUI Single Key Mode:: TUI single key mode 14175 * TUI Commands:: TUI specific commands 14176 * TUI Configuration:: TUI configuration variables 14177 14178 The GDB Text User Interface, TUI in short, is a terminal interface 14179 which uses the `curses' library to show the source file, the assembly 14180 output, the program registers and GDB commands in separate text windows. 14181 14182 The TUI is enabled by invoking GDB using either `gdbtui' or `gdb 14183 -tui'. 14184 14185 14186 File: gdb.info, Node: TUI Overview, Next: TUI Keys, Up: TUI 14187 14188 22.1 TUI overview 14189 ================= 14190 14191 The TUI has two display modes that can be switched while GDB runs: 14192 14193 * A curses (or TUI) mode in which it displays several text windows 14194 on the terminal. 14195 14196 * A standard mode which corresponds to the GDB configured without 14197 the TUI. 14198 14199 In the TUI mode, GDB can display several text window on the terminal: 14200 14201 _command_ 14202 This window is the GDB command window with the GDB prompt and the 14203 GDB outputs. The GDB input is still managed using readline but 14204 through the TUI. The _command_ window is always visible. 14205 14206 _source_ 14207 The source window shows the source file of the program. The 14208 current line as well as active breakpoints are displayed in this 14209 window. 14210 14211 _assembly_ 14212 The assembly window shows the disassembly output of the program. 14213 14214 _register_ 14215 This window shows the processor registers. It detects when a 14216 register is changed and when this is the case, registers that have 14217 changed are highlighted. 14218 14219 14220 The source and assembly windows show the current program position by 14221 highlighting the current line and marking them with the `>' marker. 14222 Breakpoints are also indicated with two markers. A first one indicates 14223 the breakpoint type: 14224 14225 `B' 14226 Breakpoint which was hit at least once. 14227 14228 `b' 14229 Breakpoint which was never hit. 14230 14231 `H' 14232 Hardware breakpoint which was hit at least once. 14233 14234 `h' 14235 Hardware breakpoint which was never hit. 14236 14237 14238 The second marker indicates whether the breakpoint is enabled or not: 14239 14240 `+' 14241 Breakpoint is enabled. 14242 14243 `-' 14244 Breakpoint is disabled. 14245 14246 14247 The source, assembly and register windows are attached to the thread 14248 and the frame position. They are updated when the current thread 14249 changes, when the frame changes or when the program counter changes. 14250 These three windows are arranged by the TUI according to several 14251 layouts. The layout defines which of these three windows are visible. 14252 The following layouts are available: 14253 14254 * source 14255 14256 * assembly 14257 14258 * source and assembly 14259 14260 * source and registers 14261 14262 * assembly and registers 14263 14264 14265 On top of the command window a status line gives various information 14266 concerning the current process begin debugged. The status line is 14267 updated when the information it shows changes. The following fields 14268 are displayed: 14269 14270 _target_ 14271 Indicates the current gdb target (*note Specifying a Debugging 14272 Target: Targets.). 14273 14274 _process_ 14275 Gives information about the current process or thread number. 14276 When no process is being debugged, this field is set to `No 14277 process'. 14278 14279 _function_ 14280 Gives the current function name for the selected frame. The name 14281 is demangled if demangling is turned on (*note Print Settings::). 14282 When there is no symbol corresponding to the current program 14283 counter the string `??' is displayed. 14284 14285 _line_ 14286 Indicates the current line number for the selected frame. When 14287 the current line number is not known the string `??' is displayed. 14288 14289 _pc_ 14290 Indicates the current program counter address. 14291 14292 14293 14294 File: gdb.info, Node: TUI Keys, Next: TUI Single Key Mode, Prev: TUI Overview, Up: TUI 14295 14296 22.2 TUI Key Bindings 14297 ===================== 14298 14299 The TUI installs several key bindings in the readline keymaps (*note 14300 Command Line Editing::). They allow to leave or enter in the TUI mode 14301 or they operate directly on the TUI layout and windows. The TUI also 14302 provides a _SingleKey_ keymap which binds several keys directly to GDB 14303 commands. The following key bindings are installed for both TUI mode 14304 and the GDB standard mode. 14305 14306 `C-x C-a' 14307 `C-x a' 14308 `C-x A' 14309 Enter or leave the TUI mode. When the TUI mode is left, the 14310 curses window management is left and GDB operates using its 14311 standard mode writing on the terminal directly. When the TUI mode 14312 is entered, the control is given back to the curses windows. The 14313 screen is then refreshed. 14314 14315 `C-x 1' 14316 Use a TUI layout with only one window. The layout will either be 14317 `source' or `assembly'. When the TUI mode is not active, it will 14318 switch to the TUI mode. 14319 14320 Think of this key binding as the Emacs `C-x 1' binding. 14321 14322 `C-x 2' 14323 Use a TUI layout with at least two windows. When the current 14324 layout shows already two windows, a next layout with two windows 14325 is used. When a new layout is chosen, one window will always be 14326 common to the previous layout and the new one. 14327 14328 Think of it as the Emacs `C-x 2' binding. 14329 14330 `C-x o' 14331 Change the active window. The TUI associates several key bindings 14332 (like scrolling and arrow keys) to the active window. This command 14333 gives the focus to the next TUI window. 14334 14335 Think of it as the Emacs `C-x o' binding. 14336 14337 `C-x s' 14338 Use the TUI _SingleKey_ keymap that binds single key to gdb 14339 commands (*note TUI Single Key Mode::). 14340 14341 14342 The following key bindings are handled only by the TUI mode: 14343 14344 <PgUp> 14345 Scroll the active window one page up. 14346 14347 <PgDn> 14348 Scroll the active window one page down. 14349 14350 <Up> 14351 Scroll the active window one line up. 14352 14353 <Down> 14354 Scroll the active window one line down. 14355 14356 <Left> 14357 Scroll the active window one column left. 14358 14359 <Right> 14360 Scroll the active window one column right. 14361 14362 <C-L> 14363 Refresh the screen. 14364 14365 14366 In the TUI mode, the arrow keys are used by the active window for 14367 scrolling. This means they are available for readline when the active 14368 window is the command window. When the command window does not have 14369 the focus, it is necessary to use other readline key bindings such as 14370 `C-p', `C-n', `C-b' and `C-f'. 14371 14372 14373 File: gdb.info, Node: TUI Single Key Mode, Next: TUI Commands, Prev: TUI Keys, Up: TUI 14374 14375 22.3 TUI Single Key Mode 14376 ======================== 14377 14378 The TUI provides a _SingleKey_ mode in which it installs a particular 14379 key binding in the readline keymaps to connect single keys to some gdb 14380 commands. 14381 14382 `c' 14383 continue 14384 14385 `d' 14386 down 14387 14388 `f' 14389 finish 14390 14391 `n' 14392 next 14393 14394 `q' 14395 exit the _SingleKey_ mode. 14396 14397 `r' 14398 run 14399 14400 `s' 14401 step 14402 14403 `u' 14404 up 14405 14406 `v' 14407 info locals 14408 14409 `w' 14410 where 14411 14412 14413 Other keys temporarily switch to the GDB command prompt. The key 14414 that was pressed is inserted in the editing buffer so that it is 14415 possible to type most GDB commands without interaction with the TUI 14416 _SingleKey_ mode. Once the command is entered the TUI _SingleKey_ mode 14417 is restored. The only way to permanently leave this mode is by typing 14418 `q' or `C-x s'. 14419 14420 14421 File: gdb.info, Node: TUI Commands, Next: TUI Configuration, Prev: TUI Single Key Mode, Up: TUI 14422 14423 22.4 TUI specific commands 14424 ========================== 14425 14426 The TUI has specific commands to control the text windows. These 14427 commands are always available, that is they do not depend on the 14428 current terminal mode in which GDB runs. When GDB is in the standard 14429 mode, using these commands will automatically switch in the TUI mode. 14430 14431 `info win' 14432 List and give the size of all displayed windows. 14433 14434 `layout next' 14435 Display the next layout. 14436 14437 `layout prev' 14438 Display the previous layout. 14439 14440 `layout src' 14441 Display the source window only. 14442 14443 `layout asm' 14444 Display the assembly window only. 14445 14446 `layout split' 14447 Display the source and assembly window. 14448 14449 `layout regs' 14450 Display the register window together with the source or assembly 14451 window. 14452 14453 `focus next | prev | src | asm | regs | split' 14454 Set the focus to the named window. This command allows to change 14455 the active window so that scrolling keys can be affected to 14456 another window. 14457 14458 `refresh' 14459 Refresh the screen. This is similar to typing `C-L'. 14460 14461 `tui reg float' 14462 Show the floating point registers in the register window. 14463 14464 `tui reg general' 14465 Show the general registers in the register window. 14466 14467 `tui reg next' 14468 Show the next register group. The list of register groups as well 14469 as their order is target specific. The predefined register groups 14470 are the following: `general', `float', `system', `vector', `all', 14471 `save', `restore'. 14472 14473 `tui reg system' 14474 Show the system registers in the register window. 14475 14476 `update' 14477 Update the source window and the current execution point. 14478 14479 `winheight NAME +COUNT' 14480 `winheight NAME -COUNT' 14481 Change the height of the window NAME by COUNT lines. Positive 14482 counts increase the height, while negative counts decrease it. 14483 14484 `tabset' 14485 Set the width of tab stops to be NCHARS characters. 14486 14487 14488 14489 File: gdb.info, Node: TUI Configuration, Prev: TUI Commands, Up: TUI 14490 14491 22.5 TUI configuration variables 14492 ================================ 14493 14494 The TUI has several configuration variables that control the appearance 14495 of windows on the terminal. 14496 14497 `set tui border-kind KIND' 14498 Select the border appearance for the source, assembly and register 14499 windows. The possible values are the following: 14500 `space' 14501 Use a space character to draw the border. 14502 14503 `ascii' 14504 Use ascii characters + - and | to draw the border. 14505 14506 `acs' 14507 Use the Alternate Character Set to draw the border. The 14508 border is drawn using character line graphics if the terminal 14509 supports them. 14510 14511 14512 `set tui active-border-mode MODE' 14513 Select the attributes to display the border of the active window. 14514 The possible values are `normal', `standout', `reverse', `half', 14515 `half-standout', `bold' and `bold-standout'. 14516 14517 `set tui border-mode MODE' 14518 Select the attributes to display the border of other windows. The 14519 MODE can be one of the following: 14520 `normal' 14521 Use normal attributes to display the border. 14522 14523 `standout' 14524 Use standout mode. 14525 14526 `reverse' 14527 Use reverse video mode. 14528 14529 `half' 14530 Use half bright mode. 14531 14532 `half-standout' 14533 Use half bright and standout mode. 14534 14535 `bold' 14536 Use extra bright or bold mode. 14537 14538 `bold-standout' 14539 Use extra bright or bold and standout mode. 14540 14541 14542 14543 14544 File: gdb.info, Node: Emacs, Next: Annotations, Prev: Interpreters, Up: Top 14545 14546 23 Using GDB under GNU Emacs 14547 **************************** 14548 14549 A special interface allows you to use GNU Emacs to view (and edit) the 14550 source files for the program you are debugging with GDB. 14551 14552 To use this interface, use the command `M-x gdb' in Emacs. Give the 14553 executable file you want to debug as an argument. This command starts 14554 GDB as a subprocess of Emacs, with input and output through a newly 14555 created Emacs buffer. 14556 14557 Using GDB under Emacs is just like using GDB normally except for two 14558 things: 14559 14560 * All "terminal" input and output goes through the Emacs buffer. 14561 14562 This applies both to GDB commands and their output, and to the input 14563 and output done by the program you are debugging. 14564 14565 This is useful because it means that you can copy the text of 14566 previous commands and input them again; you can even use parts of the 14567 output in this way. 14568 14569 All the facilities of Emacs' Shell mode are available for interacting 14570 with your program. In particular, you can send signals the usual 14571 way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop. 14572 14573 * GDB displays source code through Emacs. 14574 14575 Each time GDB displays a stack frame, Emacs automatically finds the 14576 source file for that frame and puts an arrow (`=>') at the left margin 14577 of the current line. Emacs uses a separate buffer for source display, 14578 and splits the screen to show both your GDB session and the source. 14579 14580 Explicit GDB `list' or search commands still produce output as 14581 usual, but you probably have no reason to use them from Emacs. 14582 14583 If you specify an absolute file name when prompted for the `M-x gdb' 14584 argument, then Emacs sets your current working directory to where your 14585 program resides. If you only specify the file name, then Emacs sets 14586 your current working directory to to the directory associated with the 14587 previous buffer. In this case, GDB may find your program by searching 14588 your environment's `PATH' variable, but on some operating systems it 14589 might not find the source. So, although the GDB input and output 14590 session proceeds normally, the auxiliary buffer does not display the 14591 current source and line of execution. 14592 14593 The initial working directory of GDB is printed on the top line of 14594 the GDB I/O buffer and this serves as a default for the commands that 14595 specify files for GDB to operate on. *Note Commands to specify files: 14596 Files. 14597 14598 By default, `M-x gdb' calls the program called `gdb'. If you need 14599 to call GDB by a different name (for example, if you keep several 14600 configurations around, with different names) you can customize the 14601 Emacs variable `gud-gdb-command-name' to run the one you want. 14602 14603 In the GDB I/O buffer, you can use these special Emacs commands in 14604 addition to the standard Shell mode commands: 14605 14606 `C-h m' 14607 Describe the features of Emacs' GDB Mode. 14608 14609 `C-c C-s' 14610 Execute to another source line, like the GDB `step' command; also 14611 update the display window to show the current file and location. 14612 14613 `C-c C-n' 14614 Execute to next source line in this function, skipping all function 14615 calls, like the GDB `next' command. Then update the display window 14616 to show the current file and location. 14617 14618 `C-c C-i' 14619 Execute one instruction, like the GDB `stepi' command; update 14620 display window accordingly. 14621 14622 `C-c C-f' 14623 Execute until exit from the selected stack frame, like the GDB 14624 `finish' command. 14625 14626 `C-c C-r' 14627 Continue execution of your program, like the GDB `continue' 14628 command. 14629 14630 `C-c <' 14631 Go up the number of frames indicated by the numeric argument 14632 (*note Numeric Arguments: (Emacs)Arguments.), like the GDB `up' 14633 command. 14634 14635 `C-c >' 14636 Go down the number of frames indicated by the numeric argument, 14637 like the GDB `down' command. 14638 14639 In any source file, the Emacs command `C-x <SPC>' (`gud-break') 14640 tells GDB to set a breakpoint on the source line point is on. 14641 14642 If you type `M-x speedbar', then Emacs displays a separate frame 14643 which shows a backtrace when the GDB I/O buffer is current. Move point 14644 to any frame in the stack and type <RET> to make it become the current 14645 frame and display the associated source in the source buffer. 14646 Alternatively, click `Mouse-2' to make the selected frame become the 14647 current one. 14648 14649 If you accidentally delete the source-display buffer, an easy way to 14650 get it back is to type the command `f' in the GDB buffer, to request a 14651 frame display; when you run under Emacs, this recreates the source 14652 buffer if necessary to show you the context of the current frame. 14653 14654 The source files displayed in Emacs are in ordinary Emacs buffers 14655 which are visiting the source files in the usual way. You can edit the 14656 files with these buffers if you wish; but keep in mind that GDB 14657 communicates with Emacs in terms of line numbers. If you add or delete 14658 lines from the text, the line numbers that GDB knows cease to 14659 correspond properly with the code. 14660 14661 The description given here is for GNU Emacs version 21.3 and a more 14662 detailed description of its interaction with GDB is given in the Emacs 14663 manual (*note Debuggers: (Emacs)Debuggers.). 14664 14665 14666 File: gdb.info, Node: GDB/MI, Next: GDB Bugs, Prev: Annotations, Up: Top 14667 14668 24 The GDB/MI Interface 14669 *********************** 14670 14671 Function and Purpose 14672 ==================== 14673 14674 GDB/MI is a line based machine oriented text interface to GDB and is 14675 activated by specifying using the `--interpreter' command line option 14676 (*note Mode Options::). It is specifically intended to support the 14677 development of systems which use the debugger as just one small 14678 component of a larger system. 14679 14680 This chapter is a specification of the GDB/MI interface. It is 14681 written in the form of a reference manual. 14682 14683 Note that GDB/MI is still under construction, so some of the 14684 features described below are incomplete and subject to change (*note 14685 GDB/MI Development and Front Ends: GDB/MI Development and Front Ends.). 14686 14687 Notation and Terminology 14688 ======================== 14689 14690 This chapter uses the following notation: 14691 14692 * `|' separates two alternatives. 14693 14694 * `[ SOMETHING ]' indicates that SOMETHING is optional: it may or 14695 may not be given. 14696 14697 * `( GROUP )*' means that GROUP inside the parentheses may repeat 14698 zero or more times. 14699 14700 * `( GROUP )+' means that GROUP inside the parentheses may repeat 14701 one or more times. 14702 14703 * `"STRING"' means a literal STRING. 14704 14705 * Menu: 14706 14707 * GDB/MI Command Syntax:: 14708 * GDB/MI Compatibility with CLI:: 14709 * GDB/MI Development and Front Ends:: 14710 * GDB/MI Output Records:: 14711 * GDB/MI Simple Examples:: 14712 * GDB/MI Command Description Format:: 14713 * GDB/MI Breakpoint Commands:: 14714 * GDB/MI Program Context:: 14715 * GDB/MI Thread Commands:: 14716 * GDB/MI Program Execution:: 14717 * GDB/MI Stack Manipulation:: 14718 * GDB/MI Variable Objects:: 14719 * GDB/MI Data Manipulation:: 14720 * GDB/MI Tracepoint Commands:: 14721 * GDB/MI Symbol Query:: 14722 * GDB/MI File Commands:: 14723 * GDB/MI Target Manipulation:: 14724 * GDB/MI Miscellaneous Commands:: 14725 14726 14727 File: gdb.info, Node: GDB/MI Command Syntax, Next: GDB/MI Compatibility with CLI, Up: GDB/MI 14728 14729 24.1 GDB/MI Command Syntax 14730 ========================== 14731 14732 * Menu: 14733 14734 * GDB/MI Input Syntax:: 14735 * GDB/MI Output Syntax:: 14736 14737 14738 File: gdb.info, Node: GDB/MI Input Syntax, Next: GDB/MI Output Syntax, Up: GDB/MI Command Syntax 14739 14740 24.1.1 GDB/MI Input Syntax 14741 -------------------------- 14742 14743 `COMMAND ==>' 14744 `CLI-COMMAND | MI-COMMAND' 14745 14746 `CLI-COMMAND ==>' 14747 `[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB 14748 CLI command. 14749 14750 `MI-COMMAND ==>' 14751 `[ TOKEN ] "-" OPERATION ( " " OPTION )* `[' " --" `]' ( " " 14752 PARAMETER )* NL' 14753 14754 `TOKEN ==>' 14755 "any sequence of digits" 14756 14757 `OPTION ==>' 14758 `"-" PARAMETER [ " " PARAMETER ]' 14759 14760 `PARAMETER ==>' 14761 `NON-BLANK-SEQUENCE | C-STRING' 14762 14763 `OPERATION ==>' 14764 _any of the operations described in this chapter_ 14765 14766 `NON-BLANK-SEQUENCE ==>' 14767 _anything, provided it doesn't contain special characters such as 14768 "-", NL, """ and of course " "_ 14769 14770 `C-STRING ==>' 14771 `""" SEVEN-BIT-ISO-C-STRING-CONTENT """' 14772 14773 `NL ==>' 14774 `CR | CR-LF' 14775 14776 Notes: 14777 14778 * The CLI commands are still handled by the MI interpreter; their 14779 output is described below. 14780 14781 * The `TOKEN', when present, is passed back when the command 14782 finishes. 14783 14784 * Some MI commands accept optional arguments as part of the parameter 14785 list. Each option is identified by a leading `-' (dash) and may be 14786 followed by an optional argument parameter. Options occur first 14787 in the parameter list and can be delimited from normal parameters 14788 using `--' (this is useful when some parameters begin with a dash). 14789 14790 Pragmatics: 14791 14792 * We want easy access to the existing CLI syntax (for debugging). 14793 14794 * We want it to be easy to spot a MI operation. 14795 14796 14797 File: gdb.info, Node: GDB/MI Output Syntax, Prev: GDB/MI Input Syntax, Up: GDB/MI Command Syntax 14798 14799 24.1.2 GDB/MI Output Syntax 14800 --------------------------- 14801 14802 The output from GDB/MI consists of zero or more out-of-band records 14803 followed, optionally, by a single result record. This result record is 14804 for the most recent command. The sequence of output records is 14805 terminated by `(gdb)'. 14806 14807 If an input command was prefixed with a `TOKEN' then the 14808 corresponding output for that command will also be prefixed by that same 14809 TOKEN. 14810 14811 `OUTPUT ==>' 14812 `( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL' 14813 14814 `RESULT-RECORD ==>' 14815 ` [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL' 14816 14817 `OUT-OF-BAND-RECORD ==>' 14818 `ASYNC-RECORD | STREAM-RECORD' 14819 14820 `ASYNC-RECORD ==>' 14821 `EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT' 14822 14823 `EXEC-ASYNC-OUTPUT ==>' 14824 `[ TOKEN ] "*" ASYNC-OUTPUT' 14825 14826 `STATUS-ASYNC-OUTPUT ==>' 14827 `[ TOKEN ] "+" ASYNC-OUTPUT' 14828 14829 `NOTIFY-ASYNC-OUTPUT ==>' 14830 `[ TOKEN ] "=" ASYNC-OUTPUT' 14831 14832 `ASYNC-OUTPUT ==>' 14833 `ASYNC-CLASS ( "," RESULT )* NL' 14834 14835 `RESULT-CLASS ==>' 14836 `"done" | "running" | "connected" | "error" | "exit"' 14837 14838 `ASYNC-CLASS ==>' 14839 `"stopped" | OTHERS' (where OTHERS will be added depending on the 14840 needs--this is still in development). 14841 14842 `RESULT ==>' 14843 ` VARIABLE "=" VALUE' 14844 14845 `VARIABLE ==>' 14846 ` STRING ' 14847 14848 `VALUE ==>' 14849 ` CONST | TUPLE | LIST ' 14850 14851 `CONST ==>' 14852 `C-STRING' 14853 14854 `TUPLE ==>' 14855 ` "{}" | "{" RESULT ( "," RESULT )* "}" ' 14856 14857 `LIST ==>' 14858 ` "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )* 14859 "]" ' 14860 14861 `STREAM-RECORD ==>' 14862 `CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT' 14863 14864 `CONSOLE-STREAM-OUTPUT ==>' 14865 `"~" C-STRING' 14866 14867 `TARGET-STREAM-OUTPUT ==>' 14868 `"@" C-STRING' 14869 14870 `LOG-STREAM-OUTPUT ==>' 14871 `"&" C-STRING' 14872 14873 `NL ==>' 14874 `CR | CR-LF' 14875 14876 `TOKEN ==>' 14877 _any sequence of digits_. 14878 14879 Notes: 14880 14881 * All output sequences end in a single line containing a period. 14882 14883 * The `TOKEN' is from the corresponding request. If an execution 14884 command is interrupted by the `-exec-interrupt' command, the TOKEN 14885 associated with the `*stopped' message is the one of the original 14886 execution command, not the one of the interrupt command. 14887 14888 * STATUS-ASYNC-OUTPUT contains on-going status information about the 14889 progress of a slow operation. It can be discarded. All status 14890 output is prefixed by `+'. 14891 14892 * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target 14893 (stopped, started, disappeared). All async output is prefixed by 14894 `*'. 14895 14896 * NOTIFY-ASYNC-OUTPUT contains supplementary information that the 14897 client should handle (e.g., a new breakpoint information). All 14898 notify output is prefixed by `='. 14899 14900 * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in 14901 the console. It is the textual response to a CLI command. All 14902 the console output is prefixed by `~'. 14903 14904 * TARGET-STREAM-OUTPUT is the output produced by the target program. 14905 All the target output is prefixed by `@'. 14906 14907 * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for 14908 instance messages that should be displayed as part of an error 14909 log. All the log output is prefixed by `&'. 14910 14911 * New GDB/MI commands should only output LISTS containing VALUES. 14912 14913 14914 *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details 14915 about the various output records. 14916 14917 14918 File: gdb.info, Node: GDB/MI Compatibility with CLI, Next: GDB/MI Development and Front Ends, Prev: GDB/MI Command Syntax, Up: GDB/MI 14919 14920 24.2 GDB/MI Compatibility with CLI 14921 ================================== 14922 14923 For the developers convenience CLI commands can be entered directly, 14924 but there may be some unexpected behaviour. For example, commands that 14925 query the user will behave as if the user replied yes, breakpoint 14926 command lists are not executed and some CLI commands, such as `if', 14927 `when' and `define', prompt for further input with `>', which is not 14928 valid MI output. 14929 14930 This feature may be removed at some stage in the future and it is 14931 recommended that front ends use the `-interpreter-exec' command (*note 14932 -interpreter-exec::). 14933 14934 14935 File: gdb.info, Node: GDB/MI Development and Front Ends, Next: GDB/MI Output Records, Prev: GDB/MI Compatibility with CLI, Up: GDB/MI 14936 14937 24.3 GDB/MI Development and Front Ends 14938 ====================================== 14939 14940 The application which takes the MI output and presents the state of the 14941 program being debugged to the user is called a "front end". 14942 14943 Although GDB/MI is still incomplete, it is currently being used by a 14944 variety of front ends to GDB. This makes it difficult to introduce new 14945 functionality without breaking existing usage. This section tries to 14946 minimize the problems by describing how the protocol might change. 14947 14948 Some changes in MI need not break a carefully designed front end, and 14949 for these the MI version will remain unchanged. The following is a 14950 list of changes that may occur within one level, so front ends should 14951 parse MI output in a way that can handle them: 14952 14953 * New MI commands may be added. 14954 14955 * New fields may be added to the output of any MI command. 14956 14957 14958 If the changes are likely to break front ends, the MI version level 14959 will be increased by one. This will allow the front end to parse the 14960 output according to the MI version. Apart from mi0, new versions of 14961 GDB will not support old versions of MI and it will be the 14962 responsibility of the front end to work with the new one. 14963 14964 The best way to avoid unexpected changes in MI that might break your 14965 front end is to make your project known to GDB developers and follow 14966 development on <gdb (a] sourceware.org> and <gdb-patches (a] sourceware.org>. 14967 There is also the mailing list <dmi-discuss (a] lists.freestandards.org>, 14968 hosted by the Free Standards Group, which has the aim of creating a a 14969 more general MI protocol called Debugger Machine Interface (DMI) that 14970 will become a standard for all debuggers, not just GDB. 14971 14972 14973 File: gdb.info, Node: GDB/MI Output Records, Next: GDB/MI Simple Examples, Prev: GDB/MI Development and Front Ends, Up: GDB/MI 14974 14975 24.4 GDB/MI Output Records 14976 ========================== 14977 14978 * Menu: 14979 14980 * GDB/MI Result Records:: 14981 * GDB/MI Stream Records:: 14982 * GDB/MI Out-of-band Records:: 14983 14984 14985 File: gdb.info, Node: GDB/MI Result Records, Next: GDB/MI Stream Records, Up: GDB/MI Output Records 14986 14987 24.4.1 GDB/MI Result Records 14988 ---------------------------- 14989 14990 In addition to a number of out-of-band notifications, the response to a 14991 GDB/MI command includes one of the following result indications: 14992 14993 `"^done" [ "," RESULTS ]' 14994 The synchronous operation was successful, `RESULTS' are the return 14995 values. 14996 14997 `"^running"' 14998 The asynchronous operation was successfully started. The target is 14999 running. 15000 15001 `"^connected"' 15002 GDB has connected to a remote target. 15003 15004 `"^error" "," C-STRING' 15005 The operation failed. The `C-STRING' contains the corresponding 15006 error message. 15007 15008 `"^exit"' 15009 GDB has terminated. 15010 15011 15012 15013 File: gdb.info, Node: GDB/MI Stream Records, Next: GDB/MI Out-of-band Records, Prev: GDB/MI Result Records, Up: GDB/MI Output Records 15014 15015 24.4.2 GDB/MI Stream Records 15016 ---------------------------- 15017 15018 GDB internally maintains a number of output streams: the console, the 15019 target, and the log. The output intended for each of these streams is 15020 funneled through the GDB/MI interface using "stream records". 15021 15022 Each stream record begins with a unique "prefix character" which 15023 identifies its stream (*note GDB/MI Output Syntax: GDB/MI Output 15024 Syntax.). In addition to the prefix, each stream record contains a 15025 `STRING-OUTPUT'. This is either raw text (with an implicit new line) 15026 or a quoted C string (which does not contain an implicit newline). 15027 15028 `"~" STRING-OUTPUT' 15029 The console output stream contains text that should be displayed 15030 in the CLI console window. It contains the textual responses to 15031 CLI commands. 15032 15033 `"@" STRING-OUTPUT' 15034 The target output stream contains any textual output from the 15035 running target. This is only present when GDB's event loop is 15036 truly asynchronous, which is currently only the case for remote 15037 targets. 15038 15039 `"&" STRING-OUTPUT' 15040 The log stream contains debugging messages being produced by GDB's 15041 internals. 15042 15043 15044 File: gdb.info, Node: GDB/MI Out-of-band Records, Prev: GDB/MI Stream Records, Up: GDB/MI Output Records 15045 15046 24.4.3 GDB/MI Out-of-band Records 15047 --------------------------------- 15048 15049 "Out-of-band" records are used to notify the GDB/MI client of 15050 additional changes that have occurred. Those changes can either be a 15051 consequence of GDB/MI (e.g., a breakpoint modified) or a result of 15052 target activity (e.g., target stopped). 15053 15054 The following is a preliminary list of possible out-of-band records. 15055 In particular, the EXEC-ASYNC-OUTPUT records. 15056 15057 `*stopped,reason="REASON"' 15058 15059 REASON can be one of the following: 15060 15061 `breakpoint-hit' 15062 A breakpoint was reached. 15063 15064 `watchpoint-trigger' 15065 A watchpoint was triggered. 15066 15067 `read-watchpoint-trigger' 15068 A read watchpoint was triggered. 15069 15070 `access-watchpoint-trigger' 15071 An access watchpoint was triggered. 15072 15073 `function-finished' 15074 An -exec-finish or similar CLI command was accomplished. 15075 15076 `location-reached' 15077 An -exec-until or similar CLI command was accomplished. 15078 15079 `watchpoint-scope' 15080 A watchpoint has gone out of scope. 15081 15082 `end-stepping-range' 15083 An -exec-next, -exec-next-instruction, -exec-step, 15084 -exec-step-instruction or similar CLI command was accomplished. 15085 15086 `exited-signalled' 15087 The inferior exited because of a signal. 15088 15089 `exited' 15090 The inferior exited. 15091 15092 `exited-normally' 15093 The inferior exited normally. 15094 15095 `signal-received' 15096 A signal was received by the inferior. 15097 15098 15099 File: gdb.info, Node: GDB/MI Simple Examples, Next: GDB/MI Command Description Format, Prev: GDB/MI Output Records, Up: GDB/MI 15100 15101 24.5 Simple Examples of GDB/MI Interaction 15102 ========================================== 15103 15104 This subsection presents several simple examples of interaction using 15105 the GDB/MI interface. In these examples, `->' means that the following 15106 line is passed to GDB/MI as input, while `<-' means the output received 15107 from GDB/MI. 15108 15109 Note the the line breaks shown in the examples are here only for 15110 readability, they don't appear in the real output. 15111 15112 Setting a breakpoint 15113 -------------------- 15114 15115 Setting a breakpoint generates synchronous output which contains 15116 detailed information of the breakpoint. 15117 15118 -> -break-insert main 15119 <- ^done,bkpt={number="1",type="breakpoint",disp="keep", 15120 enabled="y",addr="0x08048564",func="main",file="myprog.c", 15121 fullname="/home/nickrob/myprog.c",line="68",times="0"} 15122 <- (gdb) 15123 15124 Program Execution 15125 ----------------- 15126 15127 Program execution generates asynchronous records and MI gives the 15128 reason that execution stopped. 15129 15130 -> -exec-run 15131 <- ^running 15132 <- (gdb) 15133 <- *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0", 15134 frame={addr="0x08048564",func="main", 15135 args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}], 15136 file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"} 15137 <- (gdb) 15138 -> -exec-continue 15139 <- ^running 15140 <- (gdb) 15141 <- *stopped,reason="exited-normally" 15142 <- (gdb) 15143 15144 Quitting GDB 15145 ------------ 15146 15147 Quitting GDB just prints the result class `^exit'. 15148 15149 -> (gdb) 15150 <- -gdb-exit 15151 <- ^exit 15152 15153 A Bad Command 15154 ------------- 15155 15156 Here's what happens if you pass a non-existent command: 15157 15158 -> -rubbish 15159 <- ^error,msg="Undefined MI command: rubbish" 15160 <- (gdb) 15161 15162 15163 File: gdb.info, Node: GDB/MI Command Description Format, Next: GDB/MI Breakpoint Commands, Prev: GDB/MI Simple Examples, Up: GDB/MI 15164 15165 24.6 GDB/MI Command Description Format 15166 ====================================== 15167 15168 The remaining sections describe blocks of commands. Each block of 15169 commands is laid out in a fashion similar to this section. 15170 15171 Motivation 15172 ---------- 15173 15174 The motivation for this collection of commands. 15175 15176 Introduction 15177 ------------ 15178 15179 A brief introduction to this collection of commands as a whole. 15180 15181 Commands 15182 -------- 15183 15184 For each command in the block, the following is described: 15185 15186 Synopsis 15187 ........ 15188 15189 -command ARGS... 15190 15191 Result 15192 ...... 15193 15194 GDB Command 15195 ........... 15196 15197 The corresponding GDB CLI command(s), if any. 15198 15199 Example 15200 ....... 15201 15202 Example(s) formatted for readability. Some of the described commands 15203 have not been implemented yet and these are labeled N.A. (not 15204 available). 15205 15206 15207 File: gdb.info, Node: GDB/MI Breakpoint Commands, Next: GDB/MI Program Context, Prev: GDB/MI Command Description Format, Up: GDB/MI 15208 15209 24.7 GDB/MI Breakpoint Commands 15210 =============================== 15211 15212 This section documents GDB/MI commands for manipulating breakpoints. 15213 15214 The `-break-after' Command 15215 -------------------------- 15216 15217 Synopsis 15218 ........ 15219 15220 -break-after NUMBER COUNT 15221 15222 The breakpoint number NUMBER is not in effect until it has been hit 15223 COUNT times. To see how this is reflected in the output of the 15224 `-break-list' command, see the description of the `-break-list' command 15225 below. 15226 15227 GDB Command 15228 ........... 15229 15230 The corresponding GDB command is `ignore'. 15231 15232 Example 15233 ....... 15234 15235 (gdb) 15236 -break-insert main 15237 ^done,bkpt={number="1",addr="0x000100d0",file="hello.c", 15238 fullname="/home/foo/hello.c",line="5",times="0"} 15239 (gdb) 15240 -break-after 1 3 15241 ~ 15242 ^done 15243 (gdb) 15244 -break-list 15245 ^done,BreakpointTable={nr_rows="1",nr_cols="6", 15246 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15247 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15248 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15249 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15250 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15251 {width="40",alignment="2",col_name="what",colhdr="What"}], 15252 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", 15253 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", 15254 line="5",times="0",ignore="3"}]} 15255 (gdb) 15256 15257 The `-break-condition' Command 15258 ------------------------------ 15259 15260 Synopsis 15261 ........ 15262 15263 -break-condition NUMBER EXPR 15264 15265 Breakpoint NUMBER will stop the program only if the condition in 15266 EXPR is true. The condition becomes part of the `-break-list' output 15267 (see the description of the `-break-list' command below). 15268 15269 GDB Command 15270 ........... 15271 15272 The corresponding GDB command is `condition'. 15273 15274 Example 15275 ....... 15276 15277 (gdb) 15278 -break-condition 1 1 15279 ^done 15280 (gdb) 15281 -break-list 15282 ^done,BreakpointTable={nr_rows="1",nr_cols="6", 15283 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15284 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15285 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15286 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15287 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15288 {width="40",alignment="2",col_name="what",colhdr="What"}], 15289 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", 15290 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", 15291 line="5",cond="1",times="0",ignore="3"}]} 15292 (gdb) 15293 15294 The `-break-delete' Command 15295 --------------------------- 15296 15297 Synopsis 15298 ........ 15299 15300 -break-delete ( BREAKPOINT )+ 15301 15302 Delete the breakpoint(s) whose number(s) are specified in the 15303 argument list. This is obviously reflected in the breakpoint list. 15304 15305 GDB command 15306 ........... 15307 15308 The corresponding GDB command is `delete'. 15309 15310 Example 15311 ....... 15312 15313 (gdb) 15314 -break-delete 1 15315 ^done 15316 (gdb) 15317 -break-list 15318 ^done,BreakpointTable={nr_rows="0",nr_cols="6", 15319 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15320 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15321 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15322 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15323 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15324 {width="40",alignment="2",col_name="what",colhdr="What"}], 15325 body=[]} 15326 (gdb) 15327 15328 The `-break-disable' Command 15329 ---------------------------- 15330 15331 Synopsis 15332 ........ 15333 15334 -break-disable ( BREAKPOINT )+ 15335 15336 Disable the named BREAKPOINT(s). The field `enabled' in the break 15337 list is now set to `n' for the named BREAKPOINT(s). 15338 15339 GDB Command 15340 ........... 15341 15342 The corresponding GDB command is `disable'. 15343 15344 Example 15345 ....... 15346 15347 (gdb) 15348 -break-disable 2 15349 ^done 15350 (gdb) 15351 -break-list 15352 ^done,BreakpointTable={nr_rows="1",nr_cols="6", 15353 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15354 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15355 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15356 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15357 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15358 {width="40",alignment="2",col_name="what",colhdr="What"}], 15359 body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n", 15360 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", 15361 line="5",times="0"}]} 15362 (gdb) 15363 15364 The `-break-enable' Command 15365 --------------------------- 15366 15367 Synopsis 15368 ........ 15369 15370 -break-enable ( BREAKPOINT )+ 15371 15372 Enable (previously disabled) BREAKPOINT(s). 15373 15374 GDB Command 15375 ........... 15376 15377 The corresponding GDB command is `enable'. 15378 15379 Example 15380 ....... 15381 15382 (gdb) 15383 -break-enable 2 15384 ^done 15385 (gdb) 15386 -break-list 15387 ^done,BreakpointTable={nr_rows="1",nr_cols="6", 15388 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15389 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15390 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15391 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15392 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15393 {width="40",alignment="2",col_name="what",colhdr="What"}], 15394 body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y", 15395 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", 15396 line="5",times="0"}]} 15397 (gdb) 15398 15399 The `-break-info' Command 15400 ------------------------- 15401 15402 Synopsis 15403 ........ 15404 15405 -break-info BREAKPOINT 15406 15407 Get information about a single breakpoint. 15408 15409 GDB command 15410 ........... 15411 15412 The corresponding GDB command is `info break BREAKPOINT'. 15413 15414 Example 15415 ....... 15416 15417 N.A. 15418 15419 The `-break-insert' Command 15420 --------------------------- 15421 15422 Synopsis 15423 ........ 15424 15425 -break-insert [ -t ] [ -h ] [ -r ] 15426 [ -c CONDITION ] [ -i IGNORE-COUNT ] 15427 [ -p THREAD ] [ LINE | ADDR ] 15428 15429 If specified, LINE, can be one of: 15430 15431 * function 15432 15433 * filename:linenum 15434 15435 * filename:function 15436 15437 * *address 15438 15439 The possible optional parameters of this command are: 15440 15441 `-t' 15442 Insert a temporary breakpoint. 15443 15444 `-h' 15445 Insert a hardware breakpoint. 15446 15447 `-c CONDITION' 15448 Make the breakpoint conditional on CONDITION. 15449 15450 `-i IGNORE-COUNT' 15451 Initialize the IGNORE-COUNT. 15452 15453 `-r' 15454 Insert a regular breakpoint in all the functions whose names match 15455 the given regular expression. Other flags are not applicable to 15456 regular expresson. 15457 15458 Result 15459 ...... 15460 15461 The result is in the form: 15462 15463 ^done,bkpt={number="NUMBER",type="TYPE",disp="del"|"keep", 15464 enabled="y"|"n",addr="HEX",func="FUNCNAME",file="FILENAME", 15465 fullname="FULL_FILENAME",line="LINENO",[thread="THREADNO,] 15466 times="TIMES"} 15467 15468 where NUMBER is the GDB number for this breakpoint, FUNCNAME is the 15469 name of the function where the breakpoint was inserted, FILENAME is the 15470 name of the source file which contains this function, LINENO is the 15471 source line number within that file and TIMES the number of times that 15472 the breakpoint has been hit (always 0 for -break-insert but may be 15473 greater for -break-info or -break-list which use the same output). 15474 15475 Note: this format is open to change. 15476 15477 GDB Command 15478 ........... 15479 15480 The corresponding GDB commands are `break', `tbreak', `hbreak', 15481 `thbreak', and `rbreak'. 15482 15483 Example 15484 ....... 15485 15486 (gdb) 15487 -break-insert main 15488 ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c", 15489 fullname="/home/foo/recursive2.c,line="4",times="0"} 15490 (gdb) 15491 -break-insert -t foo 15492 ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c", 15493 fullname="/home/foo/recursive2.c,line="11",times="0"} 15494 (gdb) 15495 -break-list 15496 ^done,BreakpointTable={nr_rows="2",nr_cols="6", 15497 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15498 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15499 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15500 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15501 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15502 {width="40",alignment="2",col_name="what",colhdr="What"}], 15503 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", 15504 addr="0x0001072c", func="main",file="recursive2.c", 15505 fullname="/home/foo/recursive2.c,"line="4",times="0"}, 15506 bkpt={number="2",type="breakpoint",disp="del",enabled="y", 15507 addr="0x00010774",func="foo",file="recursive2.c", 15508 fullname="/home/foo/recursive2.c",line="11",times="0"}]} 15509 (gdb) 15510 -break-insert -r foo.* 15511 ~int foo(int, int); 15512 ^done,bkpt={number="3",addr="0x00010774",file="recursive2.c, 15513 "fullname="/home/foo/recursive2.c",line="11",times="0"} 15514 (gdb) 15515 15516 The `-break-list' Command 15517 ------------------------- 15518 15519 Synopsis 15520 ........ 15521 15522 -break-list 15523 15524 Displays the list of inserted breakpoints, showing the following 15525 fields: 15526 15527 `Number' 15528 number of the breakpoint 15529 15530 `Type' 15531 type of the breakpoint: `breakpoint' or `watchpoint' 15532 15533 `Disposition' 15534 should the breakpoint be deleted or disabled when it is hit: `keep' 15535 or `nokeep' 15536 15537 `Enabled' 15538 is the breakpoint enabled or no: `y' or `n' 15539 15540 `Address' 15541 memory location at which the breakpoint is set 15542 15543 `What' 15544 logical location of the breakpoint, expressed by function name, 15545 file name, line number 15546 15547 `Times' 15548 number of times the breakpoint has been hit 15549 15550 If there are no breakpoints or watchpoints, the `BreakpointTable' 15551 `body' field is an empty list. 15552 15553 GDB Command 15554 ........... 15555 15556 The corresponding GDB command is `info break'. 15557 15558 Example 15559 ....... 15560 15561 (gdb) 15562 -break-list 15563 ^done,BreakpointTable={nr_rows="2",nr_cols="6", 15564 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15565 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15566 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15567 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15568 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15569 {width="40",alignment="2",col_name="what",colhdr="What"}], 15570 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", 15571 addr="0x000100d0",func="main",file="hello.c",line="5",times="0"}, 15572 bkpt={number="2",type="breakpoint",disp="keep",enabled="y", 15573 addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c", 15574 line="13",times="0"}]} 15575 (gdb) 15576 15577 Here's an example of the result when there are no breakpoints: 15578 15579 (gdb) 15580 -break-list 15581 ^done,BreakpointTable={nr_rows="0",nr_cols="6", 15582 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15583 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15584 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15585 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15586 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15587 {width="40",alignment="2",col_name="what",colhdr="What"}], 15588 body=[]} 15589 (gdb) 15590 15591 The `-break-watch' Command 15592 -------------------------- 15593 15594 Synopsis 15595 ........ 15596 15597 -break-watch [ -a | -r ] 15598 15599 Create a watchpoint. With the `-a' option it will create an 15600 "access" watchpoint, i.e. a watchpoint that triggers either on a read 15601 from or on a write to the memory location. With the `-r' option, the 15602 watchpoint created is a "read" watchpoint, i.e. it will trigger only 15603 when the memory location is accessed for reading. Without either of 15604 the options, the watchpoint created is a regular watchpoint, i.e. it 15605 will trigger when the memory location is accessed for writing. *Note 15606 Setting watchpoints: Set Watchpoints. 15607 15608 Note that `-break-list' will report a single list of watchpoints and 15609 breakpoints inserted. 15610 15611 GDB Command 15612 ........... 15613 15614 The corresponding GDB commands are `watch', `awatch', and `rwatch'. 15615 15616 Example 15617 ....... 15618 15619 Setting a watchpoint on a variable in the `main' function: 15620 15621 (gdb) 15622 -break-watch x 15623 ^done,wpt={number="2",exp="x"} 15624 (gdb) 15625 -exec-continue 15626 ^running 15627 ^done,reason="watchpoint-trigger",wpt={number="2",exp="x"}, 15628 value={old="-268439212",new="55"}, 15629 frame={func="main",args=[],file="recursive2.c", 15630 fullname="/home/foo/bar/recursive2.c",line="5"} 15631 (gdb) 15632 15633 Setting a watchpoint on a variable local to a function. GDB will 15634 stop the program execution twice: first for the variable changing 15635 value, then for the watchpoint going out of scope. 15636 15637 (gdb) 15638 -break-watch C 15639 ^done,wpt={number="5",exp="C"} 15640 (gdb) 15641 -exec-continue 15642 ^running 15643 ^done,reason="watchpoint-trigger", 15644 wpt={number="5",exp="C"},value={old="-276895068",new="3"}, 15645 frame={func="callee4",args=[], 15646 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 15647 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"} 15648 (gdb) 15649 -exec-continue 15650 ^running 15651 ^done,reason="watchpoint-scope",wpnum="5", 15652 frame={func="callee3",args=[{name="strarg", 15653 value="0x11940 \"A string argument.\""}], 15654 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 15655 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"} 15656 (gdb) 15657 15658 Listing breakpoints and watchpoints, at different points in the 15659 program execution. Note that once the watchpoint goes out of scope, it 15660 is deleted. 15661 15662 (gdb) 15663 -break-watch C 15664 ^done,wpt={number="2",exp="C"} 15665 (gdb) 15666 -break-list 15667 ^done,BreakpointTable={nr_rows="2",nr_cols="6", 15668 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15669 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15670 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15671 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15672 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15673 {width="40",alignment="2",col_name="what",colhdr="What"}], 15674 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", 15675 addr="0x00010734",func="callee4", 15676 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 15677 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",times="1"}, 15678 bkpt={number="2",type="watchpoint",disp="keep", 15679 enabled="y",addr="",what="C",times="0"}]} 15680 (gdb) 15681 -exec-continue 15682 ^running 15683 ^done,reason="watchpoint-trigger",wpt={number="2",exp="C"}, 15684 value={old="-276895068",new="3"}, 15685 frame={func="callee4",args=[], 15686 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 15687 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"} 15688 (gdb) 15689 -break-list 15690 ^done,BreakpointTable={nr_rows="2",nr_cols="6", 15691 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15692 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15693 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15694 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15695 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15696 {width="40",alignment="2",col_name="what",colhdr="What"}], 15697 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", 15698 addr="0x00010734",func="callee4", 15699 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 15700 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"}, 15701 bkpt={number="2",type="watchpoint",disp="keep", 15702 enabled="y",addr="",what="C",times="-5"}]} 15703 (gdb) 15704 -exec-continue 15705 ^running 15706 ^done,reason="watchpoint-scope",wpnum="2", 15707 frame={func="callee3",args=[{name="strarg", 15708 value="0x11940 \"A string argument.\""}], 15709 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 15710 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"} 15711 (gdb) 15712 -break-list 15713 ^done,BreakpointTable={nr_rows="1",nr_cols="6", 15714 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, 15715 {width="14",alignment="-1",col_name="type",colhdr="Type"}, 15716 {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, 15717 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, 15718 {width="10",alignment="-1",col_name="addr",colhdr="Address"}, 15719 {width="40",alignment="2",col_name="what",colhdr="What"}], 15720 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", 15721 addr="0x00010734",func="callee4", 15722 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 15723 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8", 15724 times="1"}]} 15725 (gdb) 15726 15727 15728 File: gdb.info, Node: GDB/MI Program Context, Next: GDB/MI Thread Commands, Prev: GDB/MI Breakpoint Commands, Up: GDB/MI 15729 15730 24.8 GDB/MI Program Context 15731 ============================ 15732 15733 The `-exec-arguments' Command 15734 ----------------------------- 15735 15736 Synopsis 15737 ........ 15738 15739 -exec-arguments ARGS 15740 15741 Set the inferior program arguments, to be used in the next 15742 `-exec-run'. 15743 15744 GDB Command 15745 ........... 15746 15747 The corresponding GDB command is `set args'. 15748 15749 Example 15750 ....... 15751 15752 Don't have one around. 15753 15754 The `-exec-show-arguments' Command 15755 ---------------------------------- 15756 15757 Synopsis 15758 ........ 15759 15760 -exec-show-arguments 15761 15762 Print the arguments of the program. 15763 15764 GDB Command 15765 ........... 15766 15767 The corresponding GDB command is `show args'. 15768 15769 Example 15770 ....... 15771 15772 N.A. 15773 15774 The `-environment-cd' Command 15775 ----------------------------- 15776 15777 Synopsis 15778 ........ 15779 15780 -environment-cd PATHDIR 15781 15782 Set GDB's working directory. 15783 15784 GDB Command 15785 ........... 15786 15787 The corresponding GDB command is `cd'. 15788 15789 Example 15790 ....... 15791 15792 (gdb) 15793 -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb 15794 ^done 15795 (gdb) 15796 15797 The `-environment-directory' Command 15798 ------------------------------------ 15799 15800 Synopsis 15801 ........ 15802 15803 -environment-directory [ -r ] [ PATHDIR ]+ 15804 15805 Add directories PATHDIR to beginning of search path for source files. 15806 If the `-r' option is used, the search path is reset to the default 15807 search path. If directories PATHDIR are supplied in addition to the 15808 `-r' option, the search path is first reset and then addition occurs as 15809 normal. Multiple directories may be specified, separated by blanks. 15810 Specifying multiple directories in a single command results in the 15811 directories added to the beginning of the search path in the same order 15812 they were presented in the command. If blanks are needed as part of a 15813 directory name, double-quotes should be used around the name. In the 15814 command output, the path will show up separated by the system 15815 directory-separator character. The directory-seperator character must 15816 not be used in any directory name. If no directories are specified, 15817 the current search path is displayed. 15818 15819 GDB Command 15820 ........... 15821 15822 The corresponding GDB command is `dir'. 15823 15824 Example 15825 ....... 15826 15827 (gdb) 15828 -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb 15829 ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" 15830 (gdb) 15831 -environment-directory "" 15832 ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" 15833 (gdb) 15834 -environment-directory -r /home/jjohnstn/src/gdb /usr/src 15835 ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd" 15836 (gdb) 15837 -environment-directory -r 15838 ^done,source-path="$cdir:$cwd" 15839 (gdb) 15840 15841 The `-environment-path' Command 15842 ------------------------------- 15843 15844 Synopsis 15845 ........ 15846 15847 -environment-path [ -r ] [ PATHDIR ]+ 15848 15849 Add directories PATHDIR to beginning of search path for object files. 15850 If the `-r' option is used, the search path is reset to the original 15851 search path that existed at gdb start-up. If directories PATHDIR are 15852 supplied in addition to the `-r' option, the search path is first reset 15853 and then addition occurs as normal. Multiple directories may be 15854 specified, separated by blanks. Specifying multiple directories in a 15855 single command results in the directories added to the beginning of the 15856 search path in the same order they were presented in the command. If 15857 blanks are needed as part of a directory name, double-quotes should be 15858 used around the name. In the command output, the path will show up 15859 separated by the system directory-separator character. The 15860 directory-seperator character must not be used in any directory name. 15861 If no directories are specified, the current path is displayed. 15862 15863 GDB Command 15864 ........... 15865 15866 The corresponding GDB command is `path'. 15867 15868 Example 15869 ....... 15870 15871 (gdb) 15872 -environment-path 15873 ^done,path="/usr/bin" 15874 (gdb) 15875 -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin 15876 ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin" 15877 (gdb) 15878 -environment-path -r /usr/local/bin 15879 ^done,path="/usr/local/bin:/usr/bin" 15880 (gdb) 15881 15882 The `-environment-pwd' Command 15883 ------------------------------ 15884 15885 Synopsis 15886 ........ 15887 15888 -environment-pwd 15889 15890 Show the current working directory. 15891 15892 GDB command 15893 ........... 15894 15895 The corresponding GDB command is `pwd'. 15896 15897 Example 15898 ....... 15899 15900 (gdb) 15901 -environment-pwd 15902 ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb" 15903 (gdb) 15904 15905 15906 File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Program Execution, Prev: GDB/MI Program Context, Up: GDB/MI 15907 15908 24.9 GDB/MI Thread Commands 15909 =========================== 15910 15911 The `-thread-info' Command 15912 -------------------------- 15913 15914 Synopsis 15915 ........ 15916 15917 -thread-info 15918 15919 GDB command 15920 ........... 15921 15922 No equivalent. 15923 15924 Example 15925 ....... 15926 15927 N.A. 15928 15929 The `-thread-list-all-threads' Command 15930 -------------------------------------- 15931 15932 Synopsis 15933 ........ 15934 15935 -thread-list-all-threads 15936 15937 GDB Command 15938 ........... 15939 15940 The equivalent GDB command is `info threads'. 15941 15942 Example 15943 ....... 15944 15945 N.A. 15946 15947 The `-thread-list-ids' Command 15948 ------------------------------ 15949 15950 Synopsis 15951 ........ 15952 15953 -thread-list-ids 15954 15955 Produces a list of the currently known GDB thread ids. At the end 15956 of the list it also prints the total number of such threads. 15957 15958 GDB Command 15959 ........... 15960 15961 Part of `info threads' supplies the same information. 15962 15963 Example 15964 ....... 15965 15966 No threads present, besides the main process: 15967 15968 (gdb) 15969 -thread-list-ids 15970 ^done,thread-ids={},number-of-threads="0" 15971 (gdb) 15972 15973 Several threads: 15974 15975 (gdb) 15976 -thread-list-ids 15977 ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"}, 15978 number-of-threads="3" 15979 (gdb) 15980 15981 The `-thread-select' Command 15982 ---------------------------- 15983 15984 Synopsis 15985 ........ 15986 15987 -thread-select THREADNUM 15988 15989 Make THREADNUM the current thread. It prints the number of the new 15990 current thread, and the topmost frame for that thread. 15991 15992 GDB Command 15993 ........... 15994 15995 The corresponding GDB command is `thread'. 15996 15997 Example 15998 ....... 15999 16000 (gdb) 16001 -exec-next 16002 ^running 16003 (gdb) 16004 *stopped,reason="end-stepping-range",thread-id="2",line="187", 16005 file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c" 16006 (gdb) 16007 -thread-list-ids 16008 ^done, 16009 thread-ids={thread-id="3",thread-id="2",thread-id="1"}, 16010 number-of-threads="3" 16011 (gdb) 16012 -thread-select 3 16013 ^done,new-thread-id="3", 16014 frame={level="0",func="vprintf", 16015 args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""}, 16016 {name="arg",value="0x2"}],file="vprintf.c",line="31"} 16017 (gdb) 16018 16019 16020 File: gdb.info, Node: GDB/MI Program Execution, Next: GDB/MI Stack Manipulation, Prev: GDB/MI Thread Commands, Up: GDB/MI 16021 16022 24.10 GDB/MI Program Execution 16023 ============================== 16024 16025 These are the asynchronous commands which generate the out-of-band 16026 record `*stopped'. Currently GDB only really executes asynchronously 16027 with remote targets and this interaction is mimicked in other cases. 16028 16029 The `-exec-continue' Command 16030 ---------------------------- 16031 16032 Synopsis 16033 ........ 16034 16035 -exec-continue 16036 16037 Resumes the execution of the inferior program until a breakpoint is 16038 encountered, or until the inferior exits. 16039 16040 GDB Command 16041 ........... 16042 16043 The corresponding GDB corresponding is `continue'. 16044 16045 Example 16046 ....... 16047 16048 -exec-continue 16049 ^running 16050 (gdb) 16051 @Hello world 16052 *stopped,reason="breakpoint-hit",bkptno="2",frame={func="foo",args=[], 16053 file="hello.c",fullname="/home/foo/bar/hello.c",line="13"} 16054 (gdb) 16055 16056 The `-exec-finish' Command 16057 -------------------------- 16058 16059 Synopsis 16060 ........ 16061 16062 -exec-finish 16063 16064 Resumes the execution of the inferior program until the current 16065 function is exited. Displays the results returned by the function. 16066 16067 GDB Command 16068 ........... 16069 16070 The corresponding GDB command is `finish'. 16071 16072 Example 16073 ....... 16074 16075 Function returning `void'. 16076 16077 -exec-finish 16078 ^running 16079 (gdb) 16080 @hello from foo 16081 *stopped,reason="function-finished",frame={func="main",args=[], 16082 file="hello.c",fullname="/home/foo/bar/hello.c",line="7"} 16083 (gdb) 16084 16085 Function returning other than `void'. The name of the internal GDB 16086 variable storing the result is printed, together with the value itself. 16087 16088 -exec-finish 16089 ^running 16090 (gdb) 16091 *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo", 16092 args=[{name="a",value="1"],{name="b",value="9"}}, 16093 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16094 gdb-result-var="$1",return-value="0" 16095 (gdb) 16096 16097 The `-exec-interrupt' Command 16098 ----------------------------- 16099 16100 Synopsis 16101 ........ 16102 16103 -exec-interrupt 16104 16105 Interrupts the background execution of the target. Note how the 16106 token associated with the stop message is the one for the execution 16107 command that has been interrupted. The token for the interrupt itself 16108 only appears in the `^done' output. If the user is trying to interrupt 16109 a non-running program, an error message will be printed. 16110 16111 GDB Command 16112 ........... 16113 16114 The corresponding GDB command is `interrupt'. 16115 16116 Example 16117 ....... 16118 16119 (gdb) 16120 111-exec-continue 16121 111^running 16122 16123 (gdb) 16124 222-exec-interrupt 16125 222^done 16126 (gdb) 16127 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt", 16128 frame={addr="0x00010140",func="foo",args=[],file="try.c", 16129 fullname="/home/foo/bar/try.c",line="13"} 16130 (gdb) 16131 16132 (gdb) 16133 -exec-interrupt 16134 ^error,msg="mi_cmd_exec_interrupt: Inferior not executing." 16135 (gdb) 16136 16137 The `-exec-next' Command 16138 ------------------------ 16139 16140 Synopsis 16141 ........ 16142 16143 -exec-next 16144 16145 Resumes execution of the inferior program, stopping when the 16146 beginning of the next source line is reached. 16147 16148 GDB Command 16149 ........... 16150 16151 The corresponding GDB command is `next'. 16152 16153 Example 16154 ....... 16155 16156 -exec-next 16157 ^running 16158 (gdb) 16159 *stopped,reason="end-stepping-range",line="8",file="hello.c" 16160 (gdb) 16161 16162 The `-exec-next-instruction' Command 16163 ------------------------------------ 16164 16165 Synopsis 16166 ........ 16167 16168 -exec-next-instruction 16169 16170 Executes one machine instruction. If the instruction is a function 16171 call, continues until the function returns. If the program stops at an 16172 instruction in the middle of a source line, the address will be printed 16173 as well. 16174 16175 GDB Command 16176 ........... 16177 16178 The corresponding GDB command is `nexti'. 16179 16180 Example 16181 ....... 16182 16183 (gdb) 16184 -exec-next-instruction 16185 ^running 16186 16187 (gdb) 16188 *stopped,reason="end-stepping-range", 16189 addr="0x000100d4",line="5",file="hello.c" 16190 (gdb) 16191 16192 The `-exec-return' Command 16193 -------------------------- 16194 16195 Synopsis 16196 ........ 16197 16198 -exec-return 16199 16200 Makes current function return immediately. Doesn't execute the 16201 inferior. Displays the new current frame. 16202 16203 GDB Command 16204 ........... 16205 16206 The corresponding GDB command is `return'. 16207 16208 Example 16209 ....... 16210 16211 (gdb) 16212 200-break-insert callee4 16213 200^done,bkpt={number="1",addr="0x00010734", 16214 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"} 16215 (gdb) 16216 000-exec-run 16217 000^running 16218 (gdb) 16219 000*stopped,reason="breakpoint-hit",bkptno="1", 16220 frame={func="callee4",args=[], 16221 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16222 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"} 16223 (gdb) 16224 205-break-delete 16225 205^done 16226 (gdb) 16227 111-exec-return 16228 111^done,frame={level="0",func="callee3", 16229 args=[{name="strarg", 16230 value="0x11940 \"A string argument.\""}], 16231 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16232 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"} 16233 (gdb) 16234 16235 The `-exec-run' Command 16236 ----------------------- 16237 16238 Synopsis 16239 ........ 16240 16241 -exec-run 16242 16243 Starts execution of the inferior from the beginning. The inferior 16244 executes until either a breakpoint is encountered or the program exits. 16245 In the latter case the output will include an exit code, if the 16246 program has exited exceptionally. 16247 16248 GDB Command 16249 ........... 16250 16251 The corresponding GDB command is `run'. 16252 16253 Examples 16254 ........ 16255 16256 (gdb) 16257 -break-insert main 16258 ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"} 16259 (gdb) 16260 -exec-run 16261 ^running 16262 (gdb) 16263 *stopped,reason="breakpoint-hit",bkptno="1", 16264 frame={func="main",args=[],file="recursive2.c", 16265 fullname="/home/foo/bar/recursive2.c",line="4"} 16266 (gdb) 16267 16268 Program exited normally: 16269 16270 (gdb) 16271 -exec-run 16272 ^running 16273 (gdb) 16274 x = 55 16275 *stopped,reason="exited-normally" 16276 (gdb) 16277 16278 Program exited exceptionally: 16279 16280 (gdb) 16281 -exec-run 16282 ^running 16283 (gdb) 16284 x = 55 16285 *stopped,reason="exited",exit-code="01" 16286 (gdb) 16287 16288 Another way the program can terminate is if it receives a signal 16289 such as `SIGINT'. In this case, GDB/MI displays this: 16290 16291 (gdb) 16292 *stopped,reason="exited-signalled",signal-name="SIGINT", 16293 signal-meaning="Interrupt" 16294 16295 The `-exec-step' Command 16296 ------------------------ 16297 16298 Synopsis 16299 ........ 16300 16301 -exec-step 16302 16303 Resumes execution of the inferior program, stopping when the 16304 beginning of the next source line is reached, if the next source line 16305 is not a function call. If it is, stop at the first instruction of the 16306 called function. 16307 16308 GDB Command 16309 ........... 16310 16311 The corresponding GDB command is `step'. 16312 16313 Example 16314 ....... 16315 16316 Stepping into a function: 16317 16318 -exec-step 16319 ^running 16320 (gdb) 16321 *stopped,reason="end-stepping-range", 16322 frame={func="foo",args=[{name="a",value="10"}, 16323 {name="b",value="0"}],file="recursive2.c", 16324 fullname="/home/foo/bar/recursive2.c",line="11"} 16325 (gdb) 16326 16327 Regular stepping: 16328 16329 -exec-step 16330 ^running 16331 (gdb) 16332 *stopped,reason="end-stepping-range",line="14",file="recursive2.c" 16333 (gdb) 16334 16335 The `-exec-step-instruction' Command 16336 ------------------------------------ 16337 16338 Synopsis 16339 ........ 16340 16341 -exec-step-instruction 16342 16343 Resumes the inferior which executes one machine instruction. The 16344 output, once GDB has stopped, will vary depending on whether we have 16345 stopped in the middle of a source line or not. In the former case, the 16346 address at which the program stopped will be printed as well. 16347 16348 GDB Command 16349 ........... 16350 16351 The corresponding GDB command is `stepi'. 16352 16353 Example 16354 ....... 16355 16356 (gdb) 16357 -exec-step-instruction 16358 ^running 16359 16360 (gdb) 16361 *stopped,reason="end-stepping-range", 16362 frame={func="foo",args=[],file="try.c", 16363 fullname="/home/foo/bar/try.c",line="10"} 16364 (gdb) 16365 -exec-step-instruction 16366 ^running 16367 16368 (gdb) 16369 *stopped,reason="end-stepping-range", 16370 frame={addr="0x000100f4",func="foo",args=[],file="try.c", 16371 fullname="/home/foo/bar/try.c",line="10"} 16372 (gdb) 16373 16374 The `-exec-until' Command 16375 ------------------------- 16376 16377 Synopsis 16378 ........ 16379 16380 -exec-until [ LOCATION ] 16381 16382 Executes the inferior until the LOCATION specified in the argument 16383 is reached. If there is no argument, the inferior executes until a 16384 source line greater than the current one is reached. The reason for 16385 stopping in this case will be `location-reached'. 16386 16387 GDB Command 16388 ........... 16389 16390 The corresponding GDB command is `until'. 16391 16392 Example 16393 ....... 16394 16395 (gdb) 16396 -exec-until recursive2.c:6 16397 ^running 16398 (gdb) 16399 x = 55 16400 *stopped,reason="location-reached",frame={func="main",args=[], 16401 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"} 16402 (gdb) 16403 16404 16405 File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Variable Objects, Prev: GDB/MI Program Execution, Up: GDB/MI 16406 16407 24.11 GDB/MI Stack Manipulation Commands 16408 ======================================== 16409 16410 The `-stack-info-frame' Command 16411 ------------------------------- 16412 16413 Synopsis 16414 ........ 16415 16416 -stack-info-frame 16417 16418 Get info on the selected frame. 16419 16420 GDB Command 16421 ........... 16422 16423 The corresponding GDB command is `info frame' or `frame' (without 16424 arguments). 16425 16426 Example 16427 ....... 16428 16429 (gdb) 16430 -stack-info-frame 16431 ^done,frame={level="1",addr="0x0001076c",func="callee3", 16432 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16433 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"} 16434 (gdb) 16435 16436 The `-stack-info-depth' Command 16437 ------------------------------- 16438 16439 Synopsis 16440 ........ 16441 16442 -stack-info-depth [ MAX-DEPTH ] 16443 16444 Return the depth of the stack. If the integer argument MAX-DEPTH is 16445 specified, do not count beyond MAX-DEPTH frames. 16446 16447 GDB Command 16448 ........... 16449 16450 There's no equivalent GDB command. 16451 16452 Example 16453 ....... 16454 16455 For a stack with frame levels 0 through 11: 16456 16457 (gdb) 16458 -stack-info-depth 16459 ^done,depth="12" 16460 (gdb) 16461 -stack-info-depth 4 16462 ^done,depth="4" 16463 (gdb) 16464 -stack-info-depth 12 16465 ^done,depth="12" 16466 (gdb) 16467 -stack-info-depth 11 16468 ^done,depth="11" 16469 (gdb) 16470 -stack-info-depth 13 16471 ^done,depth="12" 16472 (gdb) 16473 16474 The `-stack-list-arguments' Command 16475 ----------------------------------- 16476 16477 Synopsis 16478 ........ 16479 16480 -stack-list-arguments SHOW-VALUES 16481 [ LOW-FRAME HIGH-FRAME ] 16482 16483 Display a list of the arguments for the frames between LOW-FRAME and 16484 HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided, 16485 list the arguments for the whole call stack. If the two arguments are 16486 equal, show the single frame at the corresponding level. It is an 16487 error if LOW-FRAME is larger than the actual number of frames. On the 16488 other hand, HIGH-FRAME may be larger than the actual number of frames, 16489 in which case only existing frames will be returned. 16490 16491 The SHOW-VALUES argument must have a value of 0 or 1. A value of 0 16492 means that only the names of the arguments are listed, a value of 1 16493 means that both names and values of the arguments are printed. 16494 16495 GDB Command 16496 ........... 16497 16498 GDB does not have an equivalent command. `gdbtk' has a `gdb_get_args' 16499 command which partially overlaps with the functionality of 16500 `-stack-list-arguments'. 16501 16502 Example 16503 ....... 16504 16505 (gdb) 16506 -stack-list-frames 16507 ^done, 16508 stack=[ 16509 frame={level="0",addr="0x00010734",func="callee4", 16510 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16511 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"}, 16512 frame={level="1",addr="0x0001076c",func="callee3", 16513 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16514 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"}, 16515 frame={level="2",addr="0x0001078c",func="callee2", 16516 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16517 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"}, 16518 frame={level="3",addr="0x000107b4",func="callee1", 16519 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16520 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"}, 16521 frame={level="4",addr="0x000107e0",func="main", 16522 file="../../../devo/gdb/testsuite/gdb.mi/basics.c", 16523 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"}] 16524 (gdb) 16525 -stack-list-arguments 0 16526 ^done, 16527 stack-args=[ 16528 frame={level="0",args=[]}, 16529 frame={level="1",args=[name="strarg"]}, 16530 frame={level="2",args=[name="intarg",name="strarg"]}, 16531 frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]}, 16532 frame={level="4",args=[]}] 16533 (gdb) 16534 -stack-list-arguments 1 16535 ^done, 16536 stack-args=[ 16537 frame={level="0",args=[]}, 16538 frame={level="1", 16539 args=[{name="strarg",value="0x11940 \"A string argument.\""}]}, 16540 frame={level="2",args=[ 16541 {name="intarg",value="2"}, 16542 {name="strarg",value="0x11940 \"A string argument.\""}]}, 16543 {frame={level="3",args=[ 16544 {name="intarg",value="2"}, 16545 {name="strarg",value="0x11940 \"A string argument.\""}, 16546 {name="fltarg",value="3.5"}]}, 16547 frame={level="4",args=[]}] 16548 (gdb) 16549 -stack-list-arguments 0 2 2 16550 ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}] 16551 (gdb) 16552 -stack-list-arguments 1 2 2 16553 ^done,stack-args=[frame={level="2", 16554 args=[{name="intarg",value="2"}, 16555 {name="strarg",value="0x11940 \"A string argument.\""}]}] 16556 (gdb) 16557 16558 The `-stack-list-frames' Command 16559 -------------------------------- 16560 16561 Synopsis 16562 ........ 16563 16564 -stack-list-frames [ LOW-FRAME HIGH-FRAME ] 16565 16566 List the frames currently on the stack. For each frame it displays 16567 the following info: 16568 16569 `LEVEL' 16570 The frame number, 0 being the topmost frame, i.e. the innermost 16571 function. 16572 16573 `ADDR' 16574 The `$pc' value for that frame. 16575 16576 `FUNC' 16577 Function name. 16578 16579 `FILE' 16580 File name of the source file where the function lives. 16581 16582 `LINE' 16583 Line number corresponding to the `$pc'. 16584 16585 If invoked without arguments, this command prints a backtrace for the 16586 whole stack. If given two integer arguments, it shows the frames whose 16587 levels are between the two arguments (inclusive). If the two arguments 16588 are equal, it shows the single frame at the corresponding level. It is 16589 an error if LOW-FRAME is larger than the actual number of frames. On 16590 the other hand, HIGH-FRAME may be larger than the actual number of 16591 frames, in which case only existing frames will be returned. 16592 16593 GDB Command 16594 ........... 16595 16596 The corresponding GDB commands are `backtrace' and `where'. 16597 16598 Example 16599 ....... 16600 16601 Full stack backtrace: 16602 16603 (gdb) 16604 -stack-list-frames 16605 ^done,stack= 16606 [frame={level="0",addr="0x0001076c",func="foo", 16607 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"}, 16608 frame={level="1",addr="0x000107a4",func="foo", 16609 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16610 frame={level="2",addr="0x000107a4",func="foo", 16611 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16612 frame={level="3",addr="0x000107a4",func="foo", 16613 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16614 frame={level="4",addr="0x000107a4",func="foo", 16615 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16616 frame={level="5",addr="0x000107a4",func="foo", 16617 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16618 frame={level="6",addr="0x000107a4",func="foo", 16619 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16620 frame={level="7",addr="0x000107a4",func="foo", 16621 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16622 frame={level="8",addr="0x000107a4",func="foo", 16623 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16624 frame={level="9",addr="0x000107a4",func="foo", 16625 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16626 frame={level="10",addr="0x000107a4",func="foo", 16627 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16628 frame={level="11",addr="0x00010738",func="main", 16629 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"}] 16630 (gdb) 16631 16632 Show frames between LOW_FRAME and HIGH_FRAME: 16633 16634 (gdb) 16635 -stack-list-frames 3 5 16636 ^done,stack= 16637 [frame={level="3",addr="0x000107a4",func="foo", 16638 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16639 frame={level="4",addr="0x000107a4",func="foo", 16640 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, 16641 frame={level="5",addr="0x000107a4",func="foo", 16642 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}] 16643 (gdb) 16644 16645 Show a single frame: 16646 16647 (gdb) 16648 -stack-list-frames 3 3 16649 ^done,stack= 16650 [frame={level="3",addr="0x000107a4",func="foo", 16651 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}] 16652 (gdb) 16653 16654 The `-stack-list-locals' Command 16655 -------------------------------- 16656 16657 Synopsis 16658 ........ 16659 16660 -stack-list-locals PRINT-VALUES 16661 16662 Display the local variable names for the selected frame. If 16663 PRINT-VALUES is 0 or `--no-values', print only the names of the 16664 variables; if it is 1 or `--all-values', print also their values; and 16665 if it is 2 or `--simple-values', print the name, type and value for 16666 simple data types and the name and type for arrays, structures and 16667 unions. In this last case, a frontend can immediately display the 16668 value of simple data types and create variable objects for other data 16669 types when the the user wishes to explore their values in more detail. 16670 16671 GDB Command 16672 ........... 16673 16674 `info locals' in GDB, `gdb_get_locals' in `gdbtk'. 16675 16676 Example 16677 ....... 16678 16679 (gdb) 16680 -stack-list-locals 0 16681 ^done,locals=[name="A",name="B",name="C"] 16682 (gdb) 16683 -stack-list-locals --all-values 16684 ^done,locals=[{name="A",value="1"},{name="B",value="2"}, 16685 {name="C",value="{1, 2, 3}"}] 16686 -stack-list-locals --simple-values 16687 ^done,locals=[{name="A",type="int",value="1"}, 16688 {name="B",type="int",value="2"},{name="C",type="int [3]"}] 16689 (gdb) 16690 16691 The `-stack-select-frame' Command 16692 --------------------------------- 16693 16694 Synopsis 16695 ........ 16696 16697 -stack-select-frame FRAMENUM 16698 16699 Change the selected frame. Select a different frame FRAMENUM on the 16700 stack. 16701 16702 GDB Command 16703 ........... 16704 16705 The corresponding GDB commands are `frame', `up', `down', 16706 `select-frame', `up-silent', and `down-silent'. 16707 16708 Example 16709 ....... 16710 16711 (gdb) 16712 -stack-select-frame 2 16713 ^done 16714 (gdb) 16715 16716 16717 File: gdb.info, Node: GDB/MI Variable Objects, Next: GDB/MI Data Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI 16718 16719 24.12 GDB/MI Variable Objects 16720 ============================= 16721 16722 Motivation for Variable Objects in GDB/MI 16723 ----------------------------------------- 16724 16725 For the implementation of a variable debugger window (locals, watched 16726 expressions, etc.), we are proposing the adaptation of the existing code 16727 used by `Insight'. 16728 16729 The two main reasons for that are: 16730 16731 1. It has been proven in practice (it is already on its second 16732 generation). 16733 16734 2. It will shorten development time (needless to say how important it 16735 is now). 16736 16737 The original interface was designed to be used by Tcl code, so it was 16738 slightly changed so it could be used through GDB/MI. This section 16739 describes the GDB/MI operations that will be available and gives some 16740 hints about their use. 16741 16742 _Note_: In addition to the set of operations described here, we 16743 expect the GUI implementation of a variable window to require, at 16744 least, the following operations: 16745 16746 * `-gdb-show' `output-radix' 16747 16748 * `-stack-list-arguments' 16749 16750 * `-stack-list-locals' 16751 16752 * `-stack-select-frame' 16753 16754 Introduction to Variable Objects in GDB/MI 16755 ------------------------------------------ 16756 16757 The basic idea behind variable objects is the creation of a named object 16758 to represent a variable, an expression, a memory location or even a CPU 16759 register. For each object created, a set of operations is available for 16760 examining or changing its properties. 16761 16762 Furthermore, complex data types, such as C structures, are 16763 represented in a tree format. For instance, the `struct' type variable 16764 is the root and the children will represent the struct members. If a 16765 child is itself of a complex type, it will also have children of its 16766 own. Appropriate language differences are handled for C, C++ and Java. 16767 16768 When returning the actual values of the objects, this facility allows 16769 for the individual selection of the display format used in the result 16770 creation. It can be chosen among: binary, decimal, hexadecimal, octal 16771 and natural. Natural refers to a default format automatically chosen 16772 based on the variable type (like decimal for an `int', hex for 16773 pointers, etc.). 16774 16775 The following is the complete set of GDB/MI operations defined to 16776 access this functionality: 16777 16778 *Operation* *Description* 16779 `-var-create' create a variable object 16780 `-var-delete' delete the variable object and its children 16781 `-var-set-format' set the display format of this variable 16782 `-var-show-format' show the display format of this variable 16783 `-var-info-num-children' tells how many children this object has 16784 `-var-list-children' return a list of the object's children 16785 `-var-info-type' show the type of this variable object 16786 `-var-info-expression' print what this variable object represents 16787 `-var-show-attributes' is this variable editable? does it exist 16788 here? 16789 `-var-evaluate-expression' get the value of this variable 16790 `-var-assign' set the value of this variable 16791 `-var-update' update the variable and its children 16792 16793 In the next subsection we describe each operation in detail and 16794 suggest how it can be used. 16795 16796 Description And Use of Operations on Variable Objects 16797 ----------------------------------------------------- 16798 16799 The `-var-create' Command 16800 ------------------------- 16801 16802 Synopsis 16803 ........ 16804 16805 -var-create {NAME | "-"} 16806 {FRAME-ADDR | "*"} EXPRESSION 16807 16808 This operation creates a variable object, which allows the 16809 monitoring of a variable, the result of an expression, a memory cell or 16810 a CPU register. 16811 16812 The NAME parameter is the string by which the object can be 16813 referenced. It must be unique. If `-' is specified, the varobj system 16814 will generate a string "varNNNNNN" automatically. It will be unique 16815 provided that one does not specify NAME on that format. The command 16816 fails if a duplicate name is found. 16817 16818 The frame under which the expression should be evaluated can be 16819 specified by FRAME-ADDR. A `*' indicates that the current frame should 16820 be used. 16821 16822 EXPRESSION is any expression valid on the current language set (must 16823 not begin with a `*'), or one of the following: 16824 16825 * `*ADDR', where ADDR is the address of a memory cell 16826 16827 * `*ADDR-ADDR' -- a memory address range (TBD) 16828 16829 * `$REGNAME' -- a CPU register name 16830 16831 Result 16832 ...... 16833 16834 This operation returns the name, number of children and the type of the 16835 object created. Type is returned as a string as the ones generated by 16836 the GDB CLI: 16837 16838 name="NAME",numchild="N",type="TYPE" 16839 16840 The `-var-delete' Command 16841 ------------------------- 16842 16843 Synopsis 16844 ........ 16845 16846 -var-delete NAME 16847 16848 Deletes a previously created variable object and all of its children. 16849 16850 Returns an error if the object NAME is not found. 16851 16852 The `-var-set-format' Command 16853 ----------------------------- 16854 16855 Synopsis 16856 ........ 16857 16858 -var-set-format NAME FORMAT-SPEC 16859 16860 Sets the output format for the value of the object NAME to be 16861 FORMAT-SPEC. 16862 16863 The syntax for the FORMAT-SPEC is as follows: 16864 16865 FORMAT-SPEC ==> 16866 {binary | decimal | hexadecimal | octal | natural} 16867 16868 The `-var-show-format' Command 16869 ------------------------------ 16870 16871 Synopsis 16872 ........ 16873 16874 -var-show-format NAME 16875 16876 Returns the format used to display the value of the object NAME. 16877 16878 FORMAT ==> 16879 FORMAT-SPEC 16880 16881 The `-var-info-num-children' Command 16882 ------------------------------------ 16883 16884 Synopsis 16885 ........ 16886 16887 -var-info-num-children NAME 16888 16889 Returns the number of children of a variable object NAME: 16890 16891 numchild=N 16892 16893 The `-var-list-children' Command 16894 -------------------------------- 16895 16896 Synopsis 16897 ........ 16898 16899 -var-list-children [PRINT-VALUES] NAME 16900 16901 Return a list of the children of the specified variable object and 16902 create variable objects for them, if they do not already exist. With a 16903 single argument or if PRINT-VALUES has a value for of 0 or 16904 `--no-values', print only the names of the variables; if PRINT-VALUES 16905 is 1 or `--all-values', also print their values; and if it is 2 or 16906 `--simple-values' print the name and value for simple data types and 16907 just the name for arrays, structures and unions. 16908 16909 Example 16910 ....... 16911 16912 (gdb) 16913 -var-list-children n 16914 ^done,numchild=N,children=[{name=NAME, 16915 numchild=N,type=TYPE},(repeats N times)] 16916 (gdb) 16917 -var-list-children --all-values n 16918 ^done,numchild=N,children=[{name=NAME, 16919 numchild=N,value=VALUE,type=TYPE},(repeats N times)] 16920 16921 The `-var-info-type' Command 16922 ---------------------------- 16923 16924 Synopsis 16925 ........ 16926 16927 -var-info-type NAME 16928 16929 Returns the type of the specified variable NAME. The type is 16930 returned as a string in the same format as it is output by the GDB CLI: 16931 16932 type=TYPENAME 16933 16934 The `-var-info-expression' Command 16935 ---------------------------------- 16936 16937 Synopsis 16938 ........ 16939 16940 -var-info-expression NAME 16941 16942 Returns what is represented by the variable object NAME: 16943 16944 lang=LANG-SPEC,exp=EXPRESSION 16945 16946 where LANG-SPEC is `{"C" | "C++" | "Java"}'. 16947 16948 The `-var-show-attributes' Command 16949 ---------------------------------- 16950 16951 Synopsis 16952 ........ 16953 16954 -var-show-attributes NAME 16955 16956 List attributes of the specified variable object NAME: 16957 16958 status=ATTR [ ( ,ATTR )* ] 16959 16960 where ATTR is `{ { editable | noneditable } | TBD }'. 16961 16962 The `-var-evaluate-expression' Command 16963 -------------------------------------- 16964 16965 Synopsis 16966 ........ 16967 16968 -var-evaluate-expression NAME 16969 16970 Evaluates the expression that is represented by the specified 16971 variable object and returns its value as a string in the current format 16972 specified for the object: 16973 16974 value=VALUE 16975 16976 Note that one must invoke `-var-list-children' for a variable before 16977 the value of a child variable can be evaluated. 16978 16979 The `-var-assign' Command 16980 ------------------------- 16981 16982 Synopsis 16983 ........ 16984 16985 -var-assign NAME EXPRESSION 16986 16987 Assigns the value of EXPRESSION to the variable object specified by 16988 NAME. The object must be `editable'. If the variable's value is 16989 altered by the assign, the variable will show up in any subsequent 16990 `-var-update' list. 16991 16992 Example 16993 ....... 16994 16995 (gdb) 16996 -var-assign var1 3 16997 ^done,value="3" 16998 (gdb) 16999 -var-update * 17000 ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}] 17001 (gdb) 17002 17003 The `-var-update' Command 17004 ------------------------- 17005 17006 Synopsis 17007 ........ 17008 17009 -var-update [PRINT-VALUES] {NAME | "*"} 17010 17011 Update the value of the variable object NAME by evaluating its 17012 expression after fetching all the new values from memory or registers. 17013 A `*' causes all existing variable objects to be updated. The option 17014 PRINT-VALUES determines whether names both and values, or just names 17015 are printed in the manner described for `-var-list-children' (*note 17016 -var-list-children::). 17017 17018 Example 17019 ....... 17020 17021 (gdb) 17022 -var-assign var1 3 17023 ^done,value="3" 17024 (gdb) 17025 -var-update --all-values var1 17026 ^done,changelist=[{name="var1",value="3",in_scope="true", 17027 type_changed="false"}] 17028 (gdb) 17029 17030 17031 File: gdb.info, Node: GDB/MI Data Manipulation, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Variable Objects, Up: GDB/MI 17032 17033 24.13 GDB/MI Data Manipulation 17034 ============================== 17035 17036 This section describes the GDB/MI commands that manipulate data: 17037 examine memory and registers, evaluate expressions, etc. 17038 17039 The `-data-disassemble' Command 17040 ------------------------------- 17041 17042 Synopsis 17043 ........ 17044 17045 -data-disassemble 17046 [ -s START-ADDR -e END-ADDR ] 17047 | [ -f FILENAME -l LINENUM [ -n LINES ] ] 17048 -- MODE 17049 17050 Where: 17051 17052 `START-ADDR' 17053 is the beginning address (or `$pc') 17054 17055 `END-ADDR' 17056 is the end address 17057 17058 `FILENAME' 17059 is the name of the file to disassemble 17060 17061 `LINENUM' 17062 is the line number to disassemble around 17063 17064 `LINES' 17065 is the the number of disassembly lines to be produced. If it is 17066 -1, the whole function will be disassembled, in case no END-ADDR is 17067 specified. If END-ADDR is specified as a non-zero value, and 17068 LINES is lower than the number of disassembly lines between 17069 START-ADDR and END-ADDR, only LINES lines are displayed; if LINES 17070 is higher than the number of lines between START-ADDR and 17071 END-ADDR, only the lines up to END-ADDR are displayed. 17072 17073 `MODE' 17074 is either 0 (meaning only disassembly) or 1 (meaning mixed source 17075 and disassembly). 17076 17077 Result 17078 ...... 17079 17080 The output for each instruction is composed of four fields: 17081 17082 * Address 17083 17084 * Func-name 17085 17086 * Offset 17087 17088 * Instruction 17089 17090 Note that whatever included in the instruction field, is not 17091 manipulated directely by GDB/MI, i.e. it is not possible to adjust its 17092 format. 17093 17094 GDB Command 17095 ........... 17096 17097 There's no direct mapping from this command to the CLI. 17098 17099 Example 17100 ....... 17101 17102 Disassemble from the current value of `$pc' to `$pc + 20': 17103 17104 (gdb) 17105 -data-disassemble -s $pc -e "$pc + 20" -- 0 17106 ^done, 17107 asm_insns=[ 17108 {address="0x000107c0",func-name="main",offset="4", 17109 inst="mov 2, %o0"}, 17110 {address="0x000107c4",func-name="main",offset="8", 17111 inst="sethi %hi(0x11800), %o2"}, 17112 {address="0x000107c8",func-name="main",offset="12", 17113 inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"}, 17114 {address="0x000107cc",func-name="main",offset="16", 17115 inst="sethi %hi(0x11800), %o2"}, 17116 {address="0x000107d0",func-name="main",offset="20", 17117 inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}] 17118 (gdb) 17119 17120 Disassemble the whole `main' function. Line 32 is part of `main'. 17121 17122 -data-disassemble -f basics.c -l 32 -- 0 17123 ^done,asm_insns=[ 17124 {address="0x000107bc",func-name="main",offset="0", 17125 inst="save %sp, -112, %sp"}, 17126 {address="0x000107c0",func-name="main",offset="4", 17127 inst="mov 2, %o0"}, 17128 {address="0x000107c4",func-name="main",offset="8", 17129 inst="sethi %hi(0x11800), %o2"}, 17130 [...] 17131 {address="0x0001081c",func-name="main",offset="96",inst="ret "}, 17132 {address="0x00010820",func-name="main",offset="100",inst="restore "}] 17133 (gdb) 17134 17135 Disassemble 3 instructions from the start of `main': 17136 17137 (gdb) 17138 -data-disassemble -f basics.c -l 32 -n 3 -- 0 17139 ^done,asm_insns=[ 17140 {address="0x000107bc",func-name="main",offset="0", 17141 inst="save %sp, -112, %sp"}, 17142 {address="0x000107c0",func-name="main",offset="4", 17143 inst="mov 2, %o0"}, 17144 {address="0x000107c4",func-name="main",offset="8", 17145 inst="sethi %hi(0x11800), %o2"}] 17146 (gdb) 17147 17148 Disassemble 3 instructions from the start of `main' in mixed mode: 17149 17150 (gdb) 17151 -data-disassemble -f basics.c -l 32 -n 3 -- 1 17152 ^done,asm_insns=[ 17153 src_and_asm_line={line="31", 17154 file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ 17155 testsuite/gdb.mi/basics.c",line_asm_insn=[ 17156 {address="0x000107bc",func-name="main",offset="0", 17157 inst="save %sp, -112, %sp"}]}, 17158 src_and_asm_line={line="32", 17159 file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ 17160 testsuite/gdb.mi/basics.c",line_asm_insn=[ 17161 {address="0x000107c0",func-name="main",offset="4", 17162 inst="mov 2, %o0"}, 17163 {address="0x000107c4",func-name="main",offset="8", 17164 inst="sethi %hi(0x11800), %o2"}]}] 17165 (gdb) 17166 17167 The `-data-evaluate-expression' Command 17168 --------------------------------------- 17169 17170 Synopsis 17171 ........ 17172 17173 -data-evaluate-expression EXPR 17174 17175 Evaluate EXPR as an expression. The expression could contain an 17176 inferior function call. The function call will execute synchronously. 17177 If the expression contains spaces, it must be enclosed in double quotes. 17178 17179 GDB Command 17180 ........... 17181 17182 The corresponding GDB commands are `print', `output', and `call'. In 17183 `gdbtk' only, there's a corresponding `gdb_eval' command. 17184 17185 Example 17186 ....... 17187 17188 In the following example, the numbers that precede the commands are the 17189 "tokens" described in *Note GDB/MI Command Syntax: GDB/MI Command 17190 Syntax. Notice how GDB/MI returns the same tokens in its output. 17191 17192 211-data-evaluate-expression A 17193 211^done,value="1" 17194 (gdb) 17195 311-data-evaluate-expression &A 17196 311^done,value="0xefffeb7c" 17197 (gdb) 17198 411-data-evaluate-expression A+3 17199 411^done,value="4" 17200 (gdb) 17201 511-data-evaluate-expression "A + 3" 17202 511^done,value="4" 17203 (gdb) 17204 17205 The `-data-list-changed-registers' Command 17206 ------------------------------------------ 17207 17208 Synopsis 17209 ........ 17210 17211 -data-list-changed-registers 17212 17213 Display a list of the registers that have changed. 17214 17215 GDB Command 17216 ........... 17217 17218 GDB doesn't have a direct analog for this command; `gdbtk' has the 17219 corresponding command `gdb_changed_register_list'. 17220 17221 Example 17222 ....... 17223 17224 On a PPC MBX board: 17225 17226 (gdb) 17227 -exec-continue 17228 ^running 17229 17230 (gdb) 17231 *stopped,reason="breakpoint-hit",bkptno="1",frame={func="main", 17232 args=[],file="try.c",fullname="/home/foo/bar/try.c",line="5"} 17233 (gdb) 17234 -data-list-changed-registers 17235 ^done,changed-registers=["0","1","2","4","5","6","7","8","9", 17236 "10","11","13","14","15","16","17","18","19","20","21","22","23", 17237 "24","25","26","27","28","30","31","64","65","66","67","69"] 17238 (gdb) 17239 17240 The `-data-list-register-names' Command 17241 --------------------------------------- 17242 17243 Synopsis 17244 ........ 17245 17246 -data-list-register-names [ ( REGNO )+ ] 17247 17248 Show a list of register names for the current target. If no 17249 arguments are given, it shows a list of the names of all the registers. 17250 If integer numbers are given as arguments, it will print a list of the 17251 names of the registers corresponding to the arguments. To ensure 17252 consistency between a register name and its number, the output list may 17253 include empty register names. 17254 17255 GDB Command 17256 ........... 17257 17258 GDB does not have a command which corresponds to 17259 `-data-list-register-names'. In `gdbtk' there is a corresponding 17260 command `gdb_regnames'. 17261 17262 Example 17263 ....... 17264 17265 For the PPC MBX board: 17266 (gdb) 17267 -data-list-register-names 17268 ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7", 17269 "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18", 17270 "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29", 17271 "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9", 17272 "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20", 17273 "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31", 17274 "", "pc","ps","cr","lr","ctr","xer"] 17275 (gdb) 17276 -data-list-register-names 1 2 3 17277 ^done,register-names=["r1","r2","r3"] 17278 (gdb) 17279 17280 The `-data-list-register-values' Command 17281 ---------------------------------------- 17282 17283 Synopsis 17284 ........ 17285 17286 -data-list-register-values FMT [ ( REGNO )*] 17287 17288 Display the registers' contents. FMT is the format according to 17289 which the registers' contents are to be returned, followed by an 17290 optional list of numbers specifying the registers to display. A 17291 missing list of numbers indicates that the contents of all the 17292 registers must be returned. 17293 17294 Allowed formats for FMT are: 17295 17296 `x' 17297 Hexadecimal 17298 17299 `o' 17300 Octal 17301 17302 `t' 17303 Binary 17304 17305 `d' 17306 Decimal 17307 17308 `r' 17309 Raw 17310 17311 `N' 17312 Natural 17313 17314 GDB Command 17315 ........... 17316 17317 The corresponding GDB commands are `info reg', `info all-reg', and (in 17318 `gdbtk') `gdb_fetch_registers'. 17319 17320 Example 17321 ....... 17322 17323 For a PPC MBX board (note: line breaks are for readability only, they 17324 don't appear in the actual output): 17325 17326 (gdb) 17327 -data-list-register-values r 64 65 17328 ^done,register-values=[{number="64",value="0xfe00a300"}, 17329 {number="65",value="0x00029002"}] 17330 (gdb) 17331 -data-list-register-values x 17332 ^done,register-values=[{number="0",value="0xfe0043c8"}, 17333 {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"}, 17334 {number="3",value="0x0"},{number="4",value="0xa"}, 17335 {number="5",value="0x3fff68"},{number="6",value="0x3fff58"}, 17336 {number="7",value="0xfe011e98"},{number="8",value="0x2"}, 17337 {number="9",value="0xfa202820"},{number="10",value="0xfa202808"}, 17338 {number="11",value="0x1"},{number="12",value="0x0"}, 17339 {number="13",value="0x4544"},{number="14",value="0xffdfffff"}, 17340 {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"}, 17341 {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"}, 17342 {number="19",value="0xffffffff"},{number="20",value="0xffffffff"}, 17343 {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"}, 17344 {number="23",value="0xffffffff"},{number="24",value="0xffffffff"}, 17345 {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"}, 17346 {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"}, 17347 {number="29",value="0x0"},{number="30",value="0xfe010000"}, 17348 {number="31",value="0x0"},{number="32",value="0x0"}, 17349 {number="33",value="0x0"},{number="34",value="0x0"}, 17350 {number="35",value="0x0"},{number="36",value="0x0"}, 17351 {number="37",value="0x0"},{number="38",value="0x0"}, 17352 {number="39",value="0x0"},{number="40",value="0x0"}, 17353 {number="41",value="0x0"},{number="42",value="0x0"}, 17354 {number="43",value="0x0"},{number="44",value="0x0"}, 17355 {number="45",value="0x0"},{number="46",value="0x0"}, 17356 {number="47",value="0x0"},{number="48",value="0x0"}, 17357 {number="49",value="0x0"},{number="50",value="0x0"}, 17358 {number="51",value="0x0"},{number="52",value="0x0"}, 17359 {number="53",value="0x0"},{number="54",value="0x0"}, 17360 {number="55",value="0x0"},{number="56",value="0x0"}, 17361 {number="57",value="0x0"},{number="58",value="0x0"}, 17362 {number="59",value="0x0"},{number="60",value="0x0"}, 17363 {number="61",value="0x0"},{number="62",value="0x0"}, 17364 {number="63",value="0x0"},{number="64",value="0xfe00a300"}, 17365 {number="65",value="0x29002"},{number="66",value="0x202f04b5"}, 17366 {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"}, 17367 {number="69",value="0x20002b03"}] 17368 (gdb) 17369 17370 The `-data-read-memory' Command 17371 ------------------------------- 17372 17373 Synopsis 17374 ........ 17375 17376 -data-read-memory [ -o BYTE-OFFSET ] 17377 ADDRESS WORD-FORMAT WORD-SIZE 17378 NR-ROWS NR-COLS [ ASCHAR ] 17379 17380 where: 17381 17382 `ADDRESS' 17383 An expression specifying the address of the first memory word to be 17384 read. Complex expressions containing embedded white space should 17385 be quoted using the C convention. 17386 17387 `WORD-FORMAT' 17388 The format to be used to print the memory words. The notation is 17389 the same as for GDB's `print' command (*note Output formats: 17390 Output Formats.). 17391 17392 `WORD-SIZE' 17393 The size of each memory word in bytes. 17394 17395 `NR-ROWS' 17396 The number of rows in the output table. 17397 17398 `NR-COLS' 17399 The number of columns in the output table. 17400 17401 `ASCHAR' 17402 If present, indicates that each row should include an ASCII dump. 17403 The value of ASCHAR is used as a padding character when a byte is 17404 not a member of the printable ASCII character set (printable ASCII 17405 characters are those whose code is between 32 and 126, 17406 inclusively). 17407 17408 `BYTE-OFFSET' 17409 An offset to add to the ADDRESS before fetching memory. 17410 17411 This command displays memory contents as a table of NR-ROWS by 17412 NR-COLS words, each word being WORD-SIZE bytes. In total, `NR-ROWS * 17413 NR-COLS * WORD-SIZE' bytes are read (returned as `total-bytes'). 17414 Should less than the requested number of bytes be returned by the 17415 target, the missing words are identified using `N/A'. The number of 17416 bytes read from the target is returned in `nr-bytes' and the starting 17417 address used to read memory in `addr'. 17418 17419 The address of the next/previous row or page is available in 17420 `next-row' and `prev-row', `next-page' and `prev-page'. 17421 17422 GDB Command 17423 ........... 17424 17425 The corresponding GDB command is `x'. `gdbtk' has `gdb_get_mem' memory 17426 read command. 17427 17428 Example 17429 ....... 17430 17431 Read six bytes of memory starting at `bytes+6' but then offset by `-6' 17432 bytes. Format as three rows of two columns. One byte per word. 17433 Display each word in hex. 17434 17435 (gdb) 17436 9-data-read-memory -o -6 -- bytes+6 x 1 3 2 17437 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6", 17438 next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396", 17439 prev-page="0x0000138a",memory=[ 17440 {addr="0x00001390",data=["0x00","0x01"]}, 17441 {addr="0x00001392",data=["0x02","0x03"]}, 17442 {addr="0x00001394",data=["0x04","0x05"]}] 17443 (gdb) 17444 17445 Read two bytes of memory starting at address `shorts + 64' and 17446 display as a single word formatted in decimal. 17447 17448 (gdb) 17449 5-data-read-memory shorts+64 d 2 1 1 17450 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2", 17451 next-row="0x00001512",prev-row="0x0000150e", 17452 next-page="0x00001512",prev-page="0x0000150e",memory=[ 17453 {addr="0x00001510",data=["128"]}] 17454 (gdb) 17455 17456 Read thirty two bytes of memory starting at `bytes+16' and format as 17457 eight rows of four columns. Include a string encoding with `x' used as 17458 the non-printable character. 17459 17460 (gdb) 17461 4-data-read-memory bytes+16 x 1 8 4 x 17462 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32", 17463 next-row="0x000013c0",prev-row="0x0000139c", 17464 next-page="0x000013c0",prev-page="0x00001380",memory=[ 17465 {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"}, 17466 {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"}, 17467 {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"}, 17468 {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"}, 17469 {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"}, 17470 {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"}, 17471 {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"}, 17472 {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}] 17473 (gdb) 17474 17475 17476 File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Symbol Query, Prev: GDB/MI Data Manipulation, Up: GDB/MI 17477 17478 24.14 GDB/MI Tracepoint Commands 17479 ================================ 17480 17481 The tracepoint commands are not yet implemented. 17482 17483 17484 File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI File Commands, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI 17485 17486 24.15 GDB/MI Symbol Query Commands 17487 ================================== 17488 17489 The `-symbol-info-address' Command 17490 ---------------------------------- 17491 17492 Synopsis 17493 ........ 17494 17495 -symbol-info-address SYMBOL 17496 17497 Describe where SYMBOL is stored. 17498 17499 GDB Command 17500 ........... 17501 17502 The corresponding GDB command is `info address'. 17503 17504 Example 17505 ....... 17506 17507 N.A. 17508 17509 The `-symbol-info-file' Command 17510 ------------------------------- 17511 17512 Synopsis 17513 ........ 17514 17515 -symbol-info-file 17516 17517 Show the file for the symbol. 17518 17519 GDB Command 17520 ........... 17521 17522 There's no equivalent GDB command. `gdbtk' has `gdb_find_file'. 17523 17524 Example 17525 ....... 17526 17527 N.A. 17528 17529 The `-symbol-info-function' Command 17530 ----------------------------------- 17531 17532 Synopsis 17533 ........ 17534 17535 -symbol-info-function 17536 17537 Show which function the symbol lives in. 17538 17539 GDB Command 17540 ........... 17541 17542 `gdb_get_function' in `gdbtk'. 17543 17544 Example 17545 ....... 17546 17547 N.A. 17548 17549 The `-symbol-info-line' Command 17550 ------------------------------- 17551 17552 Synopsis 17553 ........ 17554 17555 -symbol-info-line 17556 17557 Show the core addresses of the code for a source line. 17558 17559 GDB Command 17560 ........... 17561 17562 The corresponding GDB command is `info line'. `gdbtk' has the 17563 `gdb_get_line' and `gdb_get_file' commands. 17564 17565 Example 17566 ....... 17567 17568 N.A. 17569 17570 The `-symbol-info-symbol' Command 17571 --------------------------------- 17572 17573 Synopsis 17574 ........ 17575 17576 -symbol-info-symbol ADDR 17577 17578 Describe what symbol is at location ADDR. 17579 17580 GDB Command 17581 ........... 17582 17583 The corresponding GDB command is `info symbol'. 17584 17585 Example 17586 ....... 17587 17588 N.A. 17589 17590 The `-symbol-list-functions' Command 17591 ------------------------------------ 17592 17593 Synopsis 17594 ........ 17595 17596 -symbol-list-functions 17597 17598 List the functions in the executable. 17599 17600 GDB Command 17601 ........... 17602 17603 `info functions' in GDB, `gdb_listfunc' and `gdb_search' in `gdbtk'. 17604 17605 Example 17606 ....... 17607 17608 N.A. 17609 17610 The `-symbol-list-lines' Command 17611 -------------------------------- 17612 17613 Synopsis 17614 ........ 17615 17616 -symbol-list-lines FILENAME 17617 17618 Print the list of lines that contain code and their associated 17619 program addresses for the given source filename. The entries are 17620 sorted in ascending PC order. 17621 17622 GDB Command 17623 ........... 17624 17625 There is no corresponding GDB command. 17626 17627 Example 17628 ....... 17629 17630 (gdb) 17631 -symbol-list-lines basics.c 17632 ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}] 17633 (gdb) 17634 17635 The `-symbol-list-types' Command 17636 -------------------------------- 17637 17638 Synopsis 17639 ........ 17640 17641 -symbol-list-types 17642 17643 List all the type names. 17644 17645 GDB Command 17646 ........... 17647 17648 The corresponding commands are `info types' in GDB, `gdb_search' in 17649 `gdbtk'. 17650 17651 Example 17652 ....... 17653 17654 N.A. 17655 17656 The `-symbol-list-variables' Command 17657 ------------------------------------ 17658 17659 Synopsis 17660 ........ 17661 17662 -symbol-list-variables 17663 17664 List all the global and static variable names. 17665 17666 GDB Command 17667 ........... 17668 17669 `info variables' in GDB, `gdb_search' in `gdbtk'. 17670 17671 Example 17672 ....... 17673 17674 N.A. 17675 17676 The `-symbol-locate' Command 17677 ---------------------------- 17678 17679 Synopsis 17680 ........ 17681 17682 -symbol-locate 17683 17684 GDB Command 17685 ........... 17686 17687 `gdb_loc' in `gdbtk'. 17688 17689 Example 17690 ....... 17691 17692 N.A. 17693 17694 The `-symbol-type' Command 17695 -------------------------- 17696 17697 Synopsis 17698 ........ 17699 17700 -symbol-type VARIABLE 17701 17702 Show type of VARIABLE. 17703 17704 GDB Command 17705 ........... 17706 17707 The corresponding GDB command is `ptype', `gdbtk' has 17708 `gdb_obj_variable'. 17709 17710 Example 17711 ....... 17712 17713 N.A. 17714 17715 17716 File: gdb.info, Node: GDB/MI File Commands, Next: GDB/MI Target Manipulation, Prev: GDB/MI Symbol Query, Up: GDB/MI 17717 17718 24.16 GDB/MI File Commands 17719 ========================== 17720 17721 This section describes the GDB/MI commands to specify executable file 17722 names and to read in and obtain symbol table information. 17723 17724 The `-file-exec-and-symbols' Command 17725 ------------------------------------ 17726 17727 Synopsis 17728 ........ 17729 17730 -file-exec-and-symbols FILE 17731 17732 Specify the executable file to be debugged. This file is the one 17733 from which the symbol table is also read. If no file is specified, the 17734 command clears the executable and symbol information. If breakpoints 17735 are set when using this command with no arguments, GDB will produce 17736 error messages. Otherwise, no output is produced, except a completion 17737 notification. 17738 17739 GDB Command 17740 ........... 17741 17742 The corresponding GDB command is `file'. 17743 17744 Example 17745 ....... 17746 17747 (gdb) 17748 -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx 17749 ^done 17750 (gdb) 17751 17752 The `-file-exec-file' Command 17753 ----------------------------- 17754 17755 Synopsis 17756 ........ 17757 17758 -file-exec-file FILE 17759 17760 Specify the executable file to be debugged. Unlike 17761 `-file-exec-and-symbols', the symbol table is _not_ read from this 17762 file. If used without argument, GDB clears the information about the 17763 executable file. No output is produced, except a completion 17764 notification. 17765 17766 GDB Command 17767 ........... 17768 17769 The corresponding GDB command is `exec-file'. 17770 17771 Example 17772 ....... 17773 17774 (gdb) 17775 -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx 17776 ^done 17777 (gdb) 17778 17779 The `-file-list-exec-sections' Command 17780 -------------------------------------- 17781 17782 Synopsis 17783 ........ 17784 17785 -file-list-exec-sections 17786 17787 List the sections of the current executable file. 17788 17789 GDB Command 17790 ........... 17791 17792 The GDB command `info file' shows, among the rest, the same information 17793 as this command. `gdbtk' has a corresponding command `gdb_load_info'. 17794 17795 Example 17796 ....... 17797 17798 N.A. 17799 17800 The `-file-list-exec-source-file' Command 17801 ----------------------------------------- 17802 17803 Synopsis 17804 ........ 17805 17806 -file-list-exec-source-file 17807 17808 List the line number, the current source file, and the absolute path 17809 to the current source file for the current executable. 17810 17811 GDB Command 17812 ........... 17813 17814 The GDB equivalent is `info source' 17815 17816 Example 17817 ....... 17818 17819 (gdb) 17820 123-file-list-exec-source-file 17821 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c" 17822 (gdb) 17823 17824 The `-file-list-exec-source-files' Command 17825 ------------------------------------------ 17826 17827 Synopsis 17828 ........ 17829 17830 -file-list-exec-source-files 17831 17832 List the source files for the current executable. 17833 17834 It will always output the filename, but only when GDB can find the 17835 absolute file name of a source file, will it output the fullname. 17836 17837 GDB Command 17838 ........... 17839 17840 The GDB equivalent is `info sources'. `gdbtk' has an analogous command 17841 `gdb_listfiles'. 17842 17843 Example 17844 ....... 17845 17846 (gdb) 17847 -file-list-exec-source-files 17848 ^done,files=[ 17849 {file=foo.c,fullname=/home/foo.c}, 17850 {file=/home/bar.c,fullname=/home/bar.c}, 17851 {file=gdb_could_not_find_fullpath.c}] 17852 (gdb) 17853 17854 The `-file-list-shared-libraries' Command 17855 ----------------------------------------- 17856 17857 Synopsis 17858 ........ 17859 17860 -file-list-shared-libraries 17861 17862 List the shared libraries in the program. 17863 17864 GDB Command 17865 ........... 17866 17867 The corresponding GDB command is `info shared'. 17868 17869 Example 17870 ....... 17871 17872 N.A. 17873 17874 The `-file-list-symbol-files' Command 17875 ------------------------------------- 17876 17877 Synopsis 17878 ........ 17879 17880 -file-list-symbol-files 17881 17882 List symbol files. 17883 17884 GDB Command 17885 ........... 17886 17887 The corresponding GDB command is `info file' (part of it). 17888 17889 Example 17890 ....... 17891 17892 N.A. 17893 17894 The `-file-symbol-file' Command 17895 ------------------------------- 17896 17897 Synopsis 17898 ........ 17899 17900 -file-symbol-file FILE 17901 17902 Read symbol table info from the specified FILE argument. When used 17903 without arguments, clears GDB's symbol table info. No output is 17904 produced, except for a completion notification. 17905 17906 GDB Command 17907 ........... 17908 17909 The corresponding GDB command is `symbol-file'. 17910 17911 Example 17912 ....... 17913 17914 (gdb) 17915 -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx 17916 ^done 17917 (gdb) 17918 17919 17920 File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI Miscellaneous Commands, Prev: GDB/MI File Commands, Up: GDB/MI 17921 17922 24.17 GDB/MI Target Manipulation Commands 17923 ========================================= 17924 17925 The `-target-attach' Command 17926 ---------------------------- 17927 17928 Synopsis 17929 ........ 17930 17931 -target-attach PID | FILE 17932 17933 Attach to a process PID or a file FILE outside of GDB. 17934 17935 GDB command 17936 ........... 17937 17938 The corresponding GDB command is `attach'. 17939 17940 Example 17941 ....... 17942 17943 N.A. 17944 17945 The `-target-compare-sections' Command 17946 -------------------------------------- 17947 17948 Synopsis 17949 ........ 17950 17951 -target-compare-sections [ SECTION ] 17952 17953 Compare data of section SECTION on target to the exec file. Without 17954 the argument, all sections are compared. 17955 17956 GDB Command 17957 ........... 17958 17959 The GDB equivalent is `compare-sections'. 17960 17961 Example 17962 ....... 17963 17964 N.A. 17965 17966 The `-target-detach' Command 17967 ---------------------------- 17968 17969 Synopsis 17970 ........ 17971 17972 -target-detach 17973 17974 Detach from the remote target which normally resumes its execution. 17975 There's no output. 17976 17977 GDB command 17978 ........... 17979 17980 The corresponding GDB command is `detach'. 17981 17982 Example 17983 ....... 17984 17985 (gdb) 17986 -target-detach 17987 ^done 17988 (gdb) 17989 17990 The `-target-disconnect' Command 17991 -------------------------------- 17992 17993 Synopsis 17994 ........ 17995 17996 -target-disconnect 17997 17998 Disconnect from the remote target. There's no output and the target 17999 is generally not resumed. 18000 18001 GDB command 18002 ........... 18003 18004 The corresponding GDB command is `disconnect'. 18005 18006 Example 18007 ....... 18008 18009 (gdb) 18010 -target-disconnect 18011 ^done 18012 (gdb) 18013 18014 The `-target-download' Command 18015 ------------------------------ 18016 18017 Synopsis 18018 ........ 18019 18020 -target-download 18021 18022 Loads the executable onto the remote target. It prints out an 18023 update message every half second, which includes the fields: 18024 18025 `section' 18026 The name of the section. 18027 18028 `section-sent' 18029 The size of what has been sent so far for that section. 18030 18031 `section-size' 18032 The size of the section. 18033 18034 `total-sent' 18035 The total size of what was sent so far (the current and the 18036 previous sections). 18037 18038 `total-size' 18039 The size of the overall executable to download. 18040 18041 Each message is sent as status record (*note GDB/MI Output Syntax: 18042 GDB/MI Output Syntax.). 18043 18044 In addition, it prints the name and size of the sections, as they are 18045 downloaded. These messages include the following fields: 18046 18047 `section' 18048 The name of the section. 18049 18050 `section-size' 18051 The size of the section. 18052 18053 `total-size' 18054 The size of the overall executable to download. 18055 18056 At the end, a summary is printed. 18057 18058 GDB Command 18059 ........... 18060 18061 The corresponding GDB command is `load'. 18062 18063 Example 18064 ....... 18065 18066 Note: each status message appears on a single line. Here the messages 18067 have been broken down so that they can fit onto a page. 18068 18069 (gdb) 18070 -target-download 18071 +download,{section=".text",section-size="6668",total-size="9880"} 18072 +download,{section=".text",section-sent="512",section-size="6668", 18073 total-sent="512",total-size="9880"} 18074 +download,{section=".text",section-sent="1024",section-size="6668", 18075 total-sent="1024",total-size="9880"} 18076 +download,{section=".text",section-sent="1536",section-size="6668", 18077 total-sent="1536",total-size="9880"} 18078 +download,{section=".text",section-sent="2048",section-size="6668", 18079 total-sent="2048",total-size="9880"} 18080 +download,{section=".text",section-sent="2560",section-size="6668", 18081 total-sent="2560",total-size="9880"} 18082 +download,{section=".text",section-sent="3072",section-size="6668", 18083 total-sent="3072",total-size="9880"} 18084 +download,{section=".text",section-sent="3584",section-size="6668", 18085 total-sent="3584",total-size="9880"} 18086 +download,{section=".text",section-sent="4096",section-size="6668", 18087 total-sent="4096",total-size="9880"} 18088 +download,{section=".text",section-sent="4608",section-size="6668", 18089 total-sent="4608",total-size="9880"} 18090 +download,{section=".text",section-sent="5120",section-size="6668", 18091 total-sent="5120",total-size="9880"} 18092 +download,{section=".text",section-sent="5632",section-size="6668", 18093 total-sent="5632",total-size="9880"} 18094 +download,{section=".text",section-sent="6144",section-size="6668", 18095 total-sent="6144",total-size="9880"} 18096 +download,{section=".text",section-sent="6656",section-size="6668", 18097 total-sent="6656",total-size="9880"} 18098 +download,{section=".init",section-size="28",total-size="9880"} 18099 +download,{section=".fini",section-size="28",total-size="9880"} 18100 +download,{section=".data",section-size="3156",total-size="9880"} 18101 +download,{section=".data",section-sent="512",section-size="3156", 18102 total-sent="7236",total-size="9880"} 18103 +download,{section=".data",section-sent="1024",section-size="3156", 18104 total-sent="7748",total-size="9880"} 18105 +download,{section=".data",section-sent="1536",section-size="3156", 18106 total-sent="8260",total-size="9880"} 18107 +download,{section=".data",section-sent="2048",section-size="3156", 18108 total-sent="8772",total-size="9880"} 18109 +download,{section=".data",section-sent="2560",section-size="3156", 18110 total-sent="9284",total-size="9880"} 18111 +download,{section=".data",section-sent="3072",section-size="3156", 18112 total-sent="9796",total-size="9880"} 18113 ^done,address="0x10004",load-size="9880",transfer-rate="6586", 18114 write-rate="429" 18115 (gdb) 18116 18117 The `-target-exec-status' Command 18118 --------------------------------- 18119 18120 Synopsis 18121 ........ 18122 18123 -target-exec-status 18124 18125 Provide information on the state of the target (whether it is 18126 running or not, for instance). 18127 18128 GDB Command 18129 ........... 18130 18131 There's no equivalent GDB command. 18132 18133 Example 18134 ....... 18135 18136 N.A. 18137 18138 The `-target-list-available-targets' Command 18139 -------------------------------------------- 18140 18141 Synopsis 18142 ........ 18143 18144 -target-list-available-targets 18145 18146 List the possible targets to connect to. 18147 18148 GDB Command 18149 ........... 18150 18151 The corresponding GDB command is `help target'. 18152 18153 Example 18154 ....... 18155 18156 N.A. 18157 18158 The `-target-list-current-targets' Command 18159 ------------------------------------------ 18160 18161 Synopsis 18162 ........ 18163 18164 -target-list-current-targets 18165 18166 Describe the current target. 18167 18168 GDB Command 18169 ........... 18170 18171 The corresponding information is printed by `info file' (among other 18172 things). 18173 18174 Example 18175 ....... 18176 18177 N.A. 18178 18179 The `-target-list-parameters' Command 18180 ------------------------------------- 18181 18182 Synopsis 18183 ........ 18184 18185 -target-list-parameters 18186 18187 GDB Command 18188 ........... 18189 18190 No equivalent. 18191 18192 Example 18193 ....... 18194 18195 N.A. 18196 18197 The `-target-select' Command 18198 ---------------------------- 18199 18200 Synopsis 18201 ........ 18202 18203 -target-select TYPE PARAMETERS ... 18204 18205 Connect GDB to the remote target. This command takes two args: 18206 18207 `TYPE' 18208 The type of target, for instance `async', `remote', etc. 18209 18210 `PARAMETERS' 18211 Device names, host names and the like. *Note Commands for 18212 managing targets: Target Commands, for more details. 18213 18214 The output is a connection notification, followed by the address at 18215 which the target program is, in the following form: 18216 18217 ^connected,addr="ADDRESS",func="FUNCTION NAME", 18218 args=[ARG LIST] 18219 18220 GDB Command 18221 ........... 18222 18223 The corresponding GDB command is `target'. 18224 18225 Example 18226 ....... 18227 18228 (gdb) 18229 -target-select async /dev/ttya 18230 ^connected,addr="0xfe00a300",func="??",args=[] 18231 (gdb) 18232 18233 18234 File: gdb.info, Node: GDB/MI Miscellaneous Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI 18235 18236 24.18 Miscellaneous GDB/MI Commands 18237 =================================== 18238 18239 The `-gdb-exit' Command 18240 ----------------------- 18241 18242 Synopsis 18243 ........ 18244 18245 -gdb-exit 18246 18247 Exit GDB immediately. 18248 18249 GDB Command 18250 ........... 18251 18252 Approximately corresponds to `quit'. 18253 18254 Example 18255 ....... 18256 18257 (gdb) 18258 -gdb-exit 18259 ^exit 18260 18261 The `-exec-abort' Command 18262 ------------------------- 18263 18264 Synopsis 18265 ........ 18266 18267 -exec-abort 18268 18269 Kill the inferior running program. 18270 18271 GDB Command 18272 ........... 18273 18274 The corresponding GDB command is `kill'. 18275 18276 Example 18277 ....... 18278 18279 N.A. 18280 18281 The `-gdb-set' Command 18282 ---------------------- 18283 18284 Synopsis 18285 ........ 18286 18287 -gdb-set 18288 18289 Set an internal GDB variable. 18290 18291 GDB Command 18292 ........... 18293 18294 The corresponding GDB command is `set'. 18295 18296 Example 18297 ....... 18298 18299 (gdb) 18300 -gdb-set $foo=3 18301 ^done 18302 (gdb) 18303 18304 The `-gdb-show' Command 18305 ----------------------- 18306 18307 Synopsis 18308 ........ 18309 18310 -gdb-show 18311 18312 Show the current value of a GDB variable. 18313 18314 GDB command 18315 ........... 18316 18317 The corresponding GDB command is `show'. 18318 18319 Example 18320 ....... 18321 18322 (gdb) 18323 -gdb-show annotate 18324 ^done,value="0" 18325 (gdb) 18326 18327 The `-gdb-version' Command 18328 -------------------------- 18329 18330 Synopsis 18331 ........ 18332 18333 -gdb-version 18334 18335 Show version information for GDB. Used mostly in testing. 18336 18337 GDB Command 18338 ........... 18339 18340 The GDB equivalent is `show version'. GDB by default shows this 18341 information when you start an interactive session. 18342 18343 Example 18344 ....... 18345 18346 (gdb) 18347 -gdb-version 18348 ~GNU gdb 5.2.1 18349 ~Copyright 2000 Free Software Foundation, Inc. 18350 ~GDB is free software, covered by the GNU General Public License, and 18351 ~you are welcome to change it and/or distribute copies of it under 18352 ~ certain conditions. 18353 ~Type "show copying" to see the conditions. 18354 ~There is absolutely no warranty for GDB. Type "show warranty" for 18355 ~ details. 18356 ~This GDB was configured as 18357 "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi". 18358 ^done 18359 (gdb) 18360 18361 The `-interpreter-exec' Command 18362 ------------------------------- 18363 18364 Synopsis 18365 -------- 18366 18367 -interpreter-exec INTERPRETER COMMAND 18368 18369 Execute the specified COMMAND in the given INTERPRETER. 18370 18371 GDB Command 18372 ----------- 18373 18374 The corresponding GDB command is `interpreter-exec'. 18375 18376 Example 18377 ------- 18378 18379 (gdb) 18380 -interpreter-exec console "break main" 18381 &"During symbol reading, couldn't parse type; debugger out of date?.\n" 18382 &"During symbol reading, bad structure-type format.\n" 18383 ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n" 18384 ^done 18385 (gdb) 18386 18387 The `-inferior-tty-set' Command 18388 ------------------------------- 18389 18390 Synopsis 18391 -------- 18392 18393 -inferior-tty-set /dev/pts/1 18394 18395 Set terminal for future runs of the program being debugged. 18396 18397 GDB Command 18398 ----------- 18399 18400 The corresponding GDB command is `set inferior-tty' /dev/pts/1. 18401 18402 Example 18403 ------- 18404 18405 (gdb) 18406 -inferior-tty-set /dev/pts/1 18407 ^done 18408 (gdb) 18409 18410 The `-inferior-tty-show' Command 18411 -------------------------------- 18412 18413 Synopsis 18414 -------- 18415 18416 -inferior-tty-show 18417 18418 Show terminal for future runs of program being debugged. 18419 18420 GDB Command 18421 ----------- 18422 18423 The corresponding GDB command is `show inferior-tty'. 18424 18425 Example 18426 ------- 18427 18428 (gdb) 18429 -inferior-tty-set /dev/pts/1 18430 ^done 18431 (gdb) 18432 -inferior-tty-show 18433 ^done,inferior_tty_terminal="/dev/pts/1" 18434 (gdb) 18435 18436 18437 File: gdb.info, Node: Annotations, Next: GDB/MI, Prev: Emacs, Up: Top 18438 18439 25 GDB Annotations 18440 ****************** 18441 18442 This chapter describes annotations in GDB. Annotations were designed 18443 to interface GDB to graphical user interfaces or other similar programs 18444 which want to interact with GDB at a relatively high level. 18445 18446 The annotation mechanism has largely been superseeded by GDB/MI 18447 (*note GDB/MI::). 18448 18449 * Menu: 18450 18451 * Annotations Overview:: What annotations are; the general syntax. 18452 * Prompting:: Annotations marking GDB's need for input. 18453 * Errors:: Annotations for error messages. 18454 * Invalidation:: Some annotations describe things now invalid. 18455 * Annotations for Running:: 18456 Whether the program is running, how it stopped, etc. 18457 * Source Annotations:: Annotations describing source code. 18458 18459 18460 File: gdb.info, Node: Annotations Overview, Next: Prompting, Up: Annotations 18461 18462 25.1 What is an Annotation? 18463 =========================== 18464 18465 Annotations start with a newline character, two `control-z' characters, 18466 and the name of the annotation. If there is no additional information 18467 associated with this annotation, the name of the annotation is followed 18468 immediately by a newline. If there is additional information, the name 18469 of the annotation is followed by a space, the additional information, 18470 and a newline. The additional information cannot contain newline 18471 characters. 18472 18473 Any output not beginning with a newline and two `control-z' 18474 characters denotes literal output from GDB. Currently there is no need 18475 for GDB to output a newline followed by two `control-z' characters, but 18476 if there was such a need, the annotations could be extended with an 18477 `escape' annotation which means those three characters as output. 18478 18479 The annotation LEVEL, which is specified using the `--annotate' 18480 command line option (*note Mode Options::), controls how much 18481 information GDB prints together with its prompt, values of expressions, 18482 source lines, and other types of output. Level 0 is for no anntations, 18483 level 1 is for use when GDB is run as a subprocess of GNU Emacs, level 18484 3 is the maximum annotation suitable for programs that control GDB, and 18485 level 2 annotations have been made obsolete (*note Limitations of the 18486 Annotation Interface: (annotate)Limitations.). 18487 18488 `set annotate LEVEL' 18489 The GDB command `set annotate' sets the level of annotations to 18490 the specified LEVEL. 18491 18492 `show annotate' 18493 Show the current annotation level. 18494 18495 This chapter describes level 3 annotations. 18496 18497 A simple example of starting up GDB with annotations is: 18498 18499 $ gdb --annotate=3 18500 GNU gdb 6.0 18501 Copyright 2003 Free Software Foundation, Inc. 18502 GDB is free software, covered by the GNU General Public License, 18503 and you are welcome to change it and/or distribute copies of it 18504 under certain conditions. 18505 Type "show copying" to see the conditions. 18506 There is absolutely no warranty for GDB. Type "show warranty" 18507 for details. 18508 This GDB was configured as "i386-pc-linux-gnu" 18509 18510 ^Z^Zpre-prompt 18511 (gdb) 18512 ^Z^Zprompt 18513 quit 18514 18515 ^Z^Zpost-prompt 18516 $ 18517 18518 Here `quit' is input to GDB; the rest is output from GDB. The three 18519 lines beginning `^Z^Z' (where `^Z' denotes a `control-z' character) are 18520 annotations; the rest is output from GDB. 18521 18522 18523 File: gdb.info, Node: Prompting, Next: Errors, Prev: Annotations Overview, Up: Annotations 18524 18525 25.2 Annotation for GDB Input 18526 ============================= 18527 18528 When GDB prompts for input, it annotates this fact so it is possible to 18529 know when to send output, when the output from a given command is over, 18530 etc. 18531 18532 Different kinds of input each have a different "input type". Each 18533 input type has three annotations: a `pre-' annotation, which denotes 18534 the beginning of any prompt which is being output, a plain annotation, 18535 which denotes the end of the prompt, and then a `post-' annotation 18536 which denotes the end of any echo which may (or may not) be associated 18537 with the input. For example, the `prompt' input type features the 18538 following annotations: 18539 18540 ^Z^Zpre-prompt 18541 ^Z^Zprompt 18542 ^Z^Zpost-prompt 18543 18544 The input types are 18545 18546 `prompt' 18547 When GDB is prompting for a command (the main GDB prompt). 18548 18549 `commands' 18550 When GDB prompts for a set of commands, like in the `commands' 18551 command. The annotations are repeated for each command which is 18552 input. 18553 18554 `overload-choice' 18555 When GDB wants the user to select between various overloaded 18556 functions. 18557 18558 `query' 18559 When GDB wants the user to confirm a potentially dangerous 18560 operation. 18561 18562 `prompt-for-continue' 18563 When GDB is asking the user to press return to continue. Note: 18564 Don't expect this to work well; instead use `set height 0' to 18565 disable prompting. This is because the counting of lines is buggy 18566 in the presence of annotations. 18567 18568 18569 File: gdb.info, Node: Errors, Next: Invalidation, Prev: Prompting, Up: Annotations 18570 18571 25.3 Errors 18572 =========== 18573 18574 ^Z^Zquit 18575 18576 This annotation occurs right before GDB responds to an interrupt. 18577 18578 ^Z^Zerror 18579 18580 This annotation occurs right before GDB responds to an error. 18581 18582 Quit and error annotations indicate that any annotations which GDB 18583 was in the middle of may end abruptly. For example, if a 18584 `value-history-begin' annotation is followed by a `error', one cannot 18585 expect to receive the matching `value-history-end'. One cannot expect 18586 not to receive it either, however; an error annotation does not 18587 necessarily mean that GDB is immediately returning all the way to the 18588 top level. 18589 18590 A quit or error annotation may be preceded by 18591 18592 ^Z^Zerror-begin 18593 18594 Any output between that and the quit or error annotation is the error 18595 message. 18596 18597 Warning messages are not yet annotated. 18598 18599 18600 File: gdb.info, Node: Invalidation, Next: Annotations for Running, Prev: Errors, Up: Annotations 18601 18602 25.4 Invalidation Notices 18603 ========================= 18604 18605 The following annotations say that certain pieces of state may have 18606 changed. 18607 18608 `^Z^Zframes-invalid' 18609 The frames (for example, output from the `backtrace' command) may 18610 have changed. 18611 18612 `^Z^Zbreakpoints-invalid' 18613 The breakpoints may have changed. For example, the user just 18614 added or deleted a breakpoint. 18615 18616 18617 File: gdb.info, Node: Annotations for Running, Next: Source Annotations, Prev: Invalidation, Up: Annotations 18618 18619 25.5 Running the Program 18620 ======================== 18621 18622 When the program starts executing due to a GDB command such as `step' 18623 or `continue', 18624 18625 ^Z^Zstarting 18626 18627 is output. When the program stops, 18628 18629 ^Z^Zstopped 18630 18631 is output. Before the `stopped' annotation, a variety of 18632 annotations describe how the program stopped. 18633 18634 `^Z^Zexited EXIT-STATUS' 18635 The program exited, and EXIT-STATUS is the exit status (zero for 18636 successful exit, otherwise nonzero). 18637 18638 `^Z^Zsignalled' 18639 The program exited with a signal. After the `^Z^Zsignalled', the 18640 annotation continues: 18641 18642 INTRO-TEXT 18643 ^Z^Zsignal-name 18644 NAME 18645 ^Z^Zsignal-name-end 18646 MIDDLE-TEXT 18647 ^Z^Zsignal-string 18648 STRING 18649 ^Z^Zsignal-string-end 18650 END-TEXT 18651 18652 where NAME is the name of the signal, such as `SIGILL' or 18653 `SIGSEGV', and STRING is the explanation of the signal, such as 18654 `Illegal Instruction' or `Segmentation fault'. INTRO-TEXT, 18655 MIDDLE-TEXT, and END-TEXT are for the user's benefit and have no 18656 particular format. 18657 18658 `^Z^Zsignal' 18659 The syntax of this annotation is just like `signalled', but GDB is 18660 just saying that the program received the signal, not that it was 18661 terminated with it. 18662 18663 `^Z^Zbreakpoint NUMBER' 18664 The program hit breakpoint number NUMBER. 18665 18666 `^Z^Zwatchpoint NUMBER' 18667 The program hit watchpoint number NUMBER. 18668 18669 18670 File: gdb.info, Node: Source Annotations, Prev: Annotations for Running, Up: Annotations 18671 18672 25.6 Displaying Source 18673 ====================== 18674 18675 The following annotation is used instead of displaying source code: 18676 18677 ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR 18678 18679 where FILENAME is an absolute file name indicating which source 18680 file, LINE is the line number within that file (where 1 is the first 18681 line in the file), CHARACTER is the character position within the file 18682 (where 0 is the first character in the file) (for most debug formats 18683 this will necessarily point to the beginning of a line), MIDDLE is 18684 `middle' if ADDR is in the middle of the line, or `beg' if ADDR is at 18685 the beginning of the line, and ADDR is the address in the target 18686 program associated with the source which is being displayed. ADDR is 18687 in the form `0x' followed by one or more lowercase hex digits (note 18688 that this does not depend on the language). 18689 18690 18691 File: gdb.info, Node: GDB Bugs, Next: Formatting Documentation, Prev: GDB/MI, Up: Top 18692 18693 26 Reporting Bugs in GDB 18694 ************************ 18695 18696 Your bug reports play an essential role in making GDB reliable. 18697 18698 Reporting a bug may help you by bringing a solution to your problem, 18699 or it may not. But in any case the principal function of a bug report 18700 is to help the entire community by making the next version of GDB work 18701 better. Bug reports are your contribution to the maintenance of GDB. 18702 18703 In order for a bug report to serve its purpose, you must include the 18704 information that enables us to fix the bug. 18705 18706 * Menu: 18707 18708 * Bug Criteria:: Have you found a bug? 18709 * Bug Reporting:: How to report bugs 18710 18711 18712 File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs 18713 18714 26.1 Have you found a bug? 18715 ========================== 18716 18717 If you are not sure whether you have found a bug, here are some 18718 guidelines: 18719 18720 * If the debugger gets a fatal signal, for any input whatever, that 18721 is a GDB bug. Reliable debuggers never crash. 18722 18723 * If GDB produces an error message for valid input, that is a bug. 18724 (Note that if you're cross debugging, the problem may also be 18725 somewhere in the connection to the target.) 18726 18727 * If GDB does not produce an error message for invalid input, that 18728 is a bug. However, you should note that your idea of "invalid 18729 input" might be our idea of "an extension" or "support for 18730 traditional practice". 18731 18732 * If you are an experienced user of debugging tools, your suggestions 18733 for improvement of GDB are welcome in any case. 18734 18735 18736 File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs 18737 18738 26.2 How to report bugs 18739 ======================= 18740 18741 A number of companies and individuals offer support for GNU products. 18742 If you obtained GDB from a support organization, we recommend you 18743 contact that organization first. 18744 18745 You can find contact information for many support companies and 18746 individuals in the file `etc/SERVICE' in the GNU Emacs distribution. 18747 18748 In any event, we also recommend that you submit bug reports for GDB. 18749 The prefered method is to submit them directly using GDB's Bugs web 18750 page (http://www.gnu.org/software/gdb/bugs/). Alternatively, the 18751 e-mail gateway <bug-gdb (a] gnu.org> can be used. 18752 18753 *Do not send bug reports to `info-gdb', or to `help-gdb', or to any 18754 newsgroups.* Most users of GDB do not want to receive bug reports. 18755 Those that do have arranged to receive `bug-gdb'. 18756 18757 The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which 18758 serves as a repeater. The mailing list and the newsgroup carry exactly 18759 the same messages. Often people think of posting bug reports to the 18760 newsgroup instead of mailing them. This appears to work, but it has one 18761 problem which can be crucial: a newsgroup posting often lacks a mail 18762 path back to the sender. Thus, if we need to ask for more information, 18763 we may be unable to reach you. For this reason, it is better to send 18764 bug reports to the mailing list. 18765 18766 The fundamental principle of reporting bugs usefully is this: 18767 *report all the facts*. If you are not sure whether to state a fact or 18768 leave it out, state it! 18769 18770 Often people omit facts because they think they know what causes the 18771 problem and assume that some details do not matter. Thus, you might 18772 assume that the name of the variable you use in an example does not 18773 matter. Well, probably it does not, but one cannot be sure. Perhaps 18774 the bug is a stray memory reference which happens to fetch from the 18775 location where that name is stored in memory; perhaps, if the name were 18776 different, the contents of that location would fool the debugger into 18777 doing the right thing despite the bug. Play it safe and give a 18778 specific, complete example. That is the easiest thing for you to do, 18779 and the most helpful. 18780 18781 Keep in mind that the purpose of a bug report is to enable us to fix 18782 the bug. It may be that the bug has been reported previously, but 18783 neither you nor we can know that unless your bug report is complete and 18784 self-contained. 18785 18786 Sometimes people give a few sketchy facts and ask, "Does this ring a 18787 bell?" Those bug reports are useless, and we urge everyone to _refuse 18788 to respond to them_ except to chide the sender to report bugs properly. 18789 18790 To enable us to fix the bug, you should include all these things: 18791 18792 * The version of GDB. GDB announces it if you start with no 18793 arguments; you can also print it at any time using `show version'. 18794 18795 Without this, we will not know whether there is any point in 18796 looking for the bug in the current version of GDB. 18797 18798 * The type of machine you are using, and the operating system name 18799 and version number. 18800 18801 * What compiler (and its version) was used to compile GDB--e.g. 18802 "gcc-2.8.1". 18803 18804 * What compiler (and its version) was used to compile the program 18805 you are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP 18806 C Compiler". For GCC, you can say `gcc --version' to get this 18807 information; for other compilers, see the documentation for those 18808 compilers. 18809 18810 * The command arguments you gave the compiler to compile your 18811 example and observe the bug. For example, did you use `-O'? To 18812 guarantee you will not omit something important, list them all. A 18813 copy of the Makefile (or the output from make) is sufficient. 18814 18815 If we were to try to guess the arguments, we would probably guess 18816 wrong and then we might not encounter the bug. 18817 18818 * A complete input script, and all necessary source files, that will 18819 reproduce the bug. 18820 18821 * A description of what behavior you observe that you believe is 18822 incorrect. For example, "It gets a fatal signal." 18823 18824 Of course, if the bug is that GDB gets a fatal signal, then we 18825 will certainly notice it. But if the bug is incorrect output, we 18826 might not notice unless it is glaringly wrong. You might as well 18827 not give us a chance to make a mistake. 18828 18829 Even if the problem you experience is a fatal signal, you should 18830 still say so explicitly. Suppose something strange is going on, 18831 such as, your copy of GDB is out of synch, or you have encountered 18832 a bug in the C library on your system. (This has happened!) Your 18833 copy might crash and ours would not. If you told us to expect a 18834 crash, then when ours fails to crash, we would know that the bug 18835 was not happening for us. If you had not told us to expect a 18836 crash, then we would not be able to draw any conclusion from our 18837 observations. 18838 18839 To collect all this information, you can use a session recording 18840 program such as `script', which is available on many Unix systems. 18841 Just run your GDB session inside `script' and then include the 18842 `typescript' file with your bug report. 18843 18844 Another way to record a GDB session is to run GDB inside Emacs and 18845 then save the entire buffer to a file. 18846 18847 * If you wish to suggest changes to the GDB source, send us context 18848 diffs. If you even discuss something in the GDB source, refer to 18849 it by context, not by line number. 18850 18851 The line numbers in our development sources will not match those 18852 in your sources. Your line numbers would convey no useful 18853 information to us. 18854 18855 18856 Here are some things that are not necessary: 18857 18858 * A description of the envelope of the bug. 18859 18860 Often people who encounter a bug spend a lot of time investigating 18861 which changes to the input file will make the bug go away and which 18862 changes will not affect it. 18863 18864 This is often time consuming and not very useful, because the way 18865 we will find the bug is by running a single example under the 18866 debugger with breakpoints, not by pure deduction from a series of 18867 examples. We recommend that you save your time for something else. 18868 18869 Of course, if you can find a simpler example to report _instead_ 18870 of the original one, that is a convenience for us. Errors in the 18871 output will be easier to spot, running under the debugger will take 18872 less time, and so on. 18873 18874 However, simplification is not vital; if you do not want to do 18875 this, report the bug anyway and send us the entire test case you 18876 used. 18877 18878 * A patch for the bug. 18879 18880 A patch for the bug does help us if it is a good one. But do not 18881 omit the necessary information, such as the test case, on the 18882 assumption that a patch is all we need. We might see problems 18883 with your patch and decide to fix the problem another way, or we 18884 might not understand it at all. 18885 18886 Sometimes with a program as complicated as GDB it is very hard to 18887 construct an example that will make the program follow a certain 18888 path through the code. If you do not send us the example, we will 18889 not be able to construct one, so we will not be able to verify 18890 that the bug is fixed. 18891 18892 And if we cannot understand what bug you are trying to fix, or why 18893 your patch should be an improvement, we will not install it. A 18894 test case will help us to understand. 18895 18896 * A guess about what the bug is or what it depends on. 18897 18898 Such guesses are usually wrong. Even we cannot guess right about 18899 such things without first using the debugger to find the facts. 18900 18901 18902 File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Formatting Documentation, Up: Top 18903 18904 27 Command Line Editing 18905 *********************** 18906 18907 This chapter describes the basic features of the GNU command line 18908 editing interface. 18909 18910 * Menu: 18911 18912 * Introduction and Notation:: Notation used in this text. 18913 * Readline Interaction:: The minimum set of commands for editing a line. 18914 * Readline Init File:: Customizing Readline from a user's view. 18915 * Bindable Readline Commands:: A description of most of the Readline commands 18916 available for binding 18917 * Readline vi Mode:: A short description of how to make Readline 18918 behave like the vi editor. 18919 18920 18921 File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing 18922 18923 27.1 Introduction to Line Editing 18924 ================================= 18925 18926 The following paragraphs describe the notation used to represent 18927 keystrokes. 18928 18929 The text `C-k' is read as `Control-K' and describes the character 18930 produced when the <k> key is pressed while the Control key is depressed. 18931 18932 The text `M-k' is read as `Meta-K' and describes the character 18933 produced when the Meta key (if you have one) is depressed, and the <k> 18934 key is pressed. The Meta key is labeled <ALT> on many keyboards. On 18935 keyboards with two keys labeled <ALT> (usually to either side of the 18936 space bar), the <ALT> on the left side is generally set to work as a 18937 Meta key. The <ALT> key on the right may also be configured to work as 18938 a Meta key or may be configured as some other modifier, such as a 18939 Compose key for typing accented characters. 18940 18941 If you do not have a Meta or <ALT> key, or another key working as a 18942 Meta key, the identical keystroke can be generated by typing <ESC> 18943 _first_, and then typing <k>. Either process is known as "metafying" 18944 the <k> key. 18945 18946 The text `M-C-k' is read as `Meta-Control-k' and describes the 18947 character produced by "metafying" `C-k'. 18948 18949 In addition, several keys have their own names. Specifically, 18950 <DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves 18951 when seen in this text, or in an init file (*note Readline Init File::). 18952 If your keyboard lacks a <LFD> key, typing <C-j> will produce the 18953 desired character. The <RET> key may be labeled <Return> or <Enter> on 18954 some keyboards. 18955 18956 18957 File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing 18958 18959 27.2 Readline Interaction 18960 ========================= 18961 18962 Often during an interactive session you type in a long line of text, 18963 only to notice that the first word on the line is misspelled. The 18964 Readline library gives you a set of commands for manipulating the text 18965 as you type it in, allowing you to just fix your typo, and not forcing 18966 you to retype the majority of the line. Using these editing commands, 18967 you move the cursor to the place that needs correction, and delete or 18968 insert the text of the corrections. Then, when you are satisfied with 18969 the line, you simply press <RET>. You do not have to be at the end of 18970 the line to press <RET>; the entire line is accepted regardless of the 18971 location of the cursor within the line. 18972 18973 * Menu: 18974 18975 * Readline Bare Essentials:: The least you need to know about Readline. 18976 * Readline Movement Commands:: Moving about the input line. 18977 * Readline Killing Commands:: How to delete text, and how to get it back! 18978 * Readline Arguments:: Giving numeric arguments to commands. 18979 * Searching:: Searching through previous lines. 18980 18981 18982 File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction 18983 18984 27.2.1 Readline Bare Essentials 18985 ------------------------------- 18986 18987 In order to enter characters into the line, simply type them. The typed 18988 character appears where the cursor was, and then the cursor moves one 18989 space to the right. If you mistype a character, you can use your erase 18990 character to back up and delete the mistyped character. 18991 18992 Sometimes you may mistype a character, and not notice the error 18993 until you have typed several other characters. In that case, you can 18994 type `C-b' to move the cursor to the left, and then correct your 18995 mistake. Afterwards, you can move the cursor to the right with `C-f'. 18996 18997 When you add text in the middle of a line, you will notice that 18998 characters to the right of the cursor are `pushed over' to make room 18999 for the text that you have inserted. Likewise, when you delete text 19000 behind the cursor, characters to the right of the cursor are `pulled 19001 back' to fill in the blank space created by the removal of the text. A 19002 list of the bare essentials for editing the text of an input line 19003 follows. 19004 19005 `C-b' 19006 Move back one character. 19007 19008 `C-f' 19009 Move forward one character. 19010 19011 <DEL> or <Backspace> 19012 Delete the character to the left of the cursor. 19013 19014 `C-d' 19015 Delete the character underneath the cursor. 19016 19017 Printing characters 19018 Insert the character into the line at the cursor. 19019 19020 `C-_' or `C-x C-u' 19021 Undo the last editing command. You can undo all the way back to an 19022 empty line. 19023 19024 (Depending on your configuration, the <Backspace> key be set to delete 19025 the character to the left of the cursor and the <DEL> key set to delete 19026 the character underneath the cursor, like `C-d', rather than the 19027 character to the left of the cursor.) 19028 19029 19030 File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction 19031 19032 27.2.2 Readline Movement Commands 19033 --------------------------------- 19034 19035 The above table describes the most basic keystrokes that you need in 19036 order to do editing of the input line. For your convenience, many 19037 other commands have been added in addition to `C-b', `C-f', `C-d', and 19038 <DEL>. Here are some commands for moving more rapidly about the line. 19039 19040 `C-a' 19041 Move to the start of the line. 19042 19043 `C-e' 19044 Move to the end of the line. 19045 19046 `M-f' 19047 Move forward a word, where a word is composed of letters and 19048 digits. 19049 19050 `M-b' 19051 Move backward a word. 19052 19053 `C-l' 19054 Clear the screen, reprinting the current line at the top. 19055 19056 Notice how `C-f' moves forward a character, while `M-f' moves 19057 forward a word. It is a loose convention that control keystrokes 19058 operate on characters while meta keystrokes operate on words. 19059 19060 19061 File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction 19062 19063 27.2.3 Readline Killing Commands 19064 -------------------------------- 19065 19066 "Killing" text means to delete the text from the line, but to save it 19067 away for later use, usually by "yanking" (re-inserting) it back into 19068 the line. (`Cut' and `paste' are more recent jargon for `kill' and 19069 `yank'.) 19070 19071 If the description for a command says that it `kills' text, then you 19072 can be sure that you can get the text back in a different (or the same) 19073 place later. 19074 19075 When you use a kill command, the text is saved in a "kill-ring". 19076 Any number of consecutive kills save all of the killed text together, so 19077 that when you yank it back, you get it all. The kill ring is not line 19078 specific; the text that you killed on a previously typed line is 19079 available to be yanked back later, when you are typing another line. 19080 19081 Here is the list of commands for killing text. 19082 19083 `C-k' 19084 Kill the text from the current cursor position to the end of the 19085 line. 19086 19087 `M-d' 19088 Kill from the cursor to the end of the current word, or, if between 19089 words, to the end of the next word. Word boundaries are the same 19090 as those used by `M-f'. 19091 19092 `M-<DEL>' 19093 Kill from the cursor the start of the current word, or, if between 19094 words, to the start of the previous word. Word boundaries are the 19095 same as those used by `M-b'. 19096 19097 `C-w' 19098 Kill from the cursor to the previous whitespace. This is 19099 different than `M-<DEL>' because the word boundaries differ. 19100 19101 19102 Here is how to "yank" the text back into the line. Yanking means to 19103 copy the most-recently-killed text from the kill buffer. 19104 19105 `C-y' 19106 Yank the most recently killed text back into the buffer at the 19107 cursor. 19108 19109 `M-y' 19110 Rotate the kill-ring, and yank the new top. You can only do this 19111 if the prior command is `C-y' or `M-y'. 19112 19113 19114 File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction 19115 19116 27.2.4 Readline Arguments 19117 ------------------------- 19118 19119 You can pass numeric arguments to Readline commands. Sometimes the 19120 argument acts as a repeat count, other times it is the sign of the 19121 argument that is significant. If you pass a negative argument to a 19122 command which normally acts in a forward direction, that command will 19123 act in a backward direction. For example, to kill text back to the 19124 start of the line, you might type `M-- C-k'. 19125 19126 The general way to pass numeric arguments to a command is to type 19127 meta digits before the command. If the first `digit' typed is a minus 19128 sign (`-'), then the sign of the argument will be negative. Once you 19129 have typed one meta digit to get the argument started, you can type the 19130 remainder of the digits, and then the command. For example, to give 19131 the `C-d' command an argument of 10, you could type `M-1 0 C-d', which 19132 will delete the next ten characters on the input line. 19133 19134 19135 File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction 19136 19137 27.2.5 Searching for Commands in the History 19138 -------------------------------------------- 19139 19140 Readline provides commands for searching through the command history 19141 for lines containing a specified string. There are two search modes: 19142 "incremental" and "non-incremental". 19143 19144 Incremental searches begin before the user has finished typing the 19145 search string. As each character of the search string is typed, 19146 Readline displays the next entry from the history matching the string 19147 typed so far. An incremental search requires only as many characters 19148 as needed to find the desired history entry. To search backward in the 19149 history for a particular string, type `C-r'. Typing `C-s' searches 19150 forward through the history. The characters present in the value of 19151 the `isearch-terminators' variable are used to terminate an incremental 19152 search. If that variable has not been assigned a value, the <ESC> and 19153 `C-J' characters will terminate an incremental search. `C-g' will 19154 abort an incremental search and restore the original line. When the 19155 search is terminated, the history entry containing the search string 19156 becomes the current line. 19157 19158 To find other matching entries in the history list, type `C-r' or 19159 `C-s' as appropriate. This will search backward or forward in the 19160 history for the next entry matching the search string typed so far. 19161 Any other key sequence bound to a Readline command will terminate the 19162 search and execute that command. For instance, a <RET> will terminate 19163 the search and accept the line, thereby executing the command from the 19164 history list. A movement command will terminate the search, make the 19165 last line found the current line, and begin editing. 19166 19167 Readline remembers the last incremental search string. If two 19168 `C-r's are typed without any intervening characters defining a new 19169 search string, any remembered search string is used. 19170 19171 Non-incremental searches read the entire search string before 19172 starting to search for matching history lines. The search string may be 19173 typed by the user or be part of the contents of the current line. 19174 19175 19176 File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing 19177 19178 27.3 Readline Init File 19179 ======================= 19180 19181 Although the Readline library comes with a set of Emacs-like 19182 keybindings installed by default, it is possible to use a different set 19183 of keybindings. Any user can customize programs that use Readline by 19184 putting commands in an "inputrc" file, conventionally in his home 19185 directory. The name of this file is taken from the value of the 19186 environment variable `INPUTRC'. If that variable is unset, the default 19187 is `~/.inputrc'. 19188 19189 When a program which uses the Readline library starts up, the init 19190 file is read, and the key bindings are set. 19191 19192 In addition, the `C-x C-r' command re-reads this init file, thus 19193 incorporating any changes that you might have made to it. 19194 19195 * Menu: 19196 19197 * Readline Init File Syntax:: Syntax for the commands in the inputrc file. 19198 19199 * Conditional Init Constructs:: Conditional key bindings in the inputrc file. 19200 19201 * Sample Init File:: An example inputrc file. 19202 19203 19204 File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File 19205 19206 27.3.1 Readline Init File Syntax 19207 -------------------------------- 19208 19209 There are only a few basic constructs allowed in the Readline init 19210 file. Blank lines are ignored. Lines beginning with a `#' are 19211 comments. Lines beginning with a `$' indicate conditional constructs 19212 (*note Conditional Init Constructs::). Other lines denote variable 19213 settings and key bindings. 19214 19215 Variable Settings 19216 You can modify the run-time behavior of Readline by altering the 19217 values of variables in Readline using the `set' command within the 19218 init file. The syntax is simple: 19219 19220 set VARIABLE VALUE 19221 19222 Here, for example, is how to change from the default Emacs-like 19223 key binding to use `vi' line editing commands: 19224 19225 set editing-mode vi 19226 19227 Variable names and values, where appropriate, are recognized 19228 without regard to case. Unrecognized variable names are ignored. 19229 19230 Boolean variables (those that can be set to on or off) are set to 19231 on if the value is null or empty, ON (case-insensitive), or 1. 19232 Any other value results in the variable being set to off. 19233 19234 A great deal of run-time behavior is changeable with the following 19235 variables. 19236 19237 `bell-style' 19238 Controls what happens when Readline wants to ring the 19239 terminal bell. If set to `none', Readline never rings the 19240 bell. If set to `visible', Readline uses a visible bell if 19241 one is available. If set to `audible' (the default), 19242 Readline attempts to ring the terminal's bell. 19243 19244 `bind-tty-special-chars' 19245 If set to `on', Readline attempts to bind the control 19246 characters treated specially by the kernel's terminal driver 19247 to their Readline equivalents. 19248 19249 `comment-begin' 19250 The string to insert at the beginning of the line when the 19251 `insert-comment' command is executed. The default value is 19252 `"#"'. 19253 19254 `completion-ignore-case' 19255 If set to `on', Readline performs filename matching and 19256 completion in a case-insensitive fashion. The default value 19257 is `off'. 19258 19259 `completion-query-items' 19260 The number of possible completions that determines when the 19261 user is asked whether the list of possibilities should be 19262 displayed. If the number of possible completions is greater 19263 than this value, Readline will ask the user whether or not he 19264 wishes to view them; otherwise, they are simply listed. This 19265 variable must be set to an integer value greater than or 19266 equal to 0. A negative value means Readline should never ask. 19267 The default limit is `100'. 19268 19269 `convert-meta' 19270 If set to `on', Readline will convert characters with the 19271 eighth bit set to an ASCII key sequence by stripping the 19272 eighth bit and prefixing an <ESC> character, converting them 19273 to a meta-prefixed key sequence. The default value is `on'. 19274 19275 `disable-completion' 19276 If set to `On', Readline will inhibit word completion. 19277 Completion characters will be inserted into the line as if 19278 they had been mapped to `self-insert'. The default is `off'. 19279 19280 `editing-mode' 19281 The `editing-mode' variable controls which default set of key 19282 bindings is used. By default, Readline starts up in Emacs 19283 editing mode, where the keystrokes are most similar to Emacs. 19284 This variable can be set to either `emacs' or `vi'. 19285 19286 `enable-keypad' 19287 When set to `on', Readline will try to enable the application 19288 keypad when it is called. Some systems need this to enable 19289 the arrow keys. The default is `off'. 19290 19291 `expand-tilde' 19292 If set to `on', tilde expansion is performed when Readline 19293 attempts word completion. The default is `off'. 19294 19295 `history-preserve-point' 19296 If set to `on', the history code attempts to place point at 19297 the same location on each history line retrieved with 19298 `previous-history' or `next-history'. The default is `off'. 19299 19300 `horizontal-scroll-mode' 19301 This variable can be set to either `on' or `off'. Setting it 19302 to `on' means that the text of the lines being edited will 19303 scroll horizontally on a single screen line when they are 19304 longer than the width of the screen, instead of wrapping onto 19305 a new screen line. By default, this variable is set to `off'. 19306 19307 `input-meta' 19308 If set to `on', Readline will enable eight-bit input (it will 19309 not clear the eighth bit in the characters it reads), 19310 regardless of what the terminal claims it can support. The 19311 default value is `off'. The name `meta-flag' is a synonym 19312 for this variable. 19313 19314 `isearch-terminators' 19315 The string of characters that should terminate an incremental 19316 search without subsequently executing the character as a 19317 command (*note Searching::). If this variable has not been 19318 given a value, the characters <ESC> and `C-J' will terminate 19319 an incremental search. 19320 19321 `keymap' 19322 Sets Readline's idea of the current keymap for key binding 19323 commands. Acceptable `keymap' names are `emacs', 19324 `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move', 19325 `vi-command', and `vi-insert'. `vi' is equivalent to 19326 `vi-command'; `emacs' is equivalent to `emacs-standard'. The 19327 default value is `emacs'. The value of the `editing-mode' 19328 variable also affects the default keymap. 19329 19330 `mark-directories' 19331 If set to `on', completed directory names have a slash 19332 appended. The default is `on'. 19333 19334 `mark-modified-lines' 19335 This variable, when set to `on', causes Readline to display an 19336 asterisk (`*') at the start of history lines which have been 19337 modified. This variable is `off' by default. 19338 19339 `mark-symlinked-directories' 19340 If set to `on', completed names which are symbolic links to 19341 directories have a slash appended (subject to the value of 19342 `mark-directories'). The default is `off'. 19343 19344 `match-hidden-files' 19345 This variable, when set to `on', causes Readline to match 19346 files whose names begin with a `.' (hidden files) when 19347 performing filename completion, unless the leading `.' is 19348 supplied by the user in the filename to be completed. This 19349 variable is `on' by default. 19350 19351 `output-meta' 19352 If set to `on', Readline will display characters with the 19353 eighth bit set directly rather than as a meta-prefixed escape 19354 sequence. The default is `off'. 19355 19356 `page-completions' 19357 If set to `on', Readline uses an internal `more'-like pager 19358 to display a screenful of possible completions at a time. 19359 This variable is `on' by default. 19360 19361 `print-completions-horizontally' 19362 If set to `on', Readline will display completions with matches 19363 sorted horizontally in alphabetical order, rather than down 19364 the screen. The default is `off'. 19365 19366 `show-all-if-ambiguous' 19367 This alters the default behavior of the completion functions. 19368 If set to `on', words which have more than one possible 19369 completion cause the matches to be listed immediately instead 19370 of ringing the bell. The default value is `off'. 19371 19372 `show-all-if-unmodified' 19373 This alters the default behavior of the completion functions 19374 in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to 19375 `on', words which have more than one possible completion 19376 without any possible partial completion (the possible 19377 completions don't share a common prefix) cause the matches to 19378 be listed immediately instead of ringing the bell. The 19379 default value is `off'. 19380 19381 `visible-stats' 19382 If set to `on', a character denoting a file's type is 19383 appended to the filename when listing possible completions. 19384 The default is `off'. 19385 19386 19387 Key Bindings 19388 The syntax for controlling key bindings in the init file is 19389 simple. First you need to find the name of the command that you 19390 want to change. The following sections contain tables of the 19391 command name, the default keybinding, if any, and a short 19392 description of what the command does. 19393 19394 Once you know the name of the command, simply place on a line in 19395 the init file the name of the key you wish to bind the command to, 19396 a colon, and then the name of the command. The name of the key 19397 can be expressed in different ways, depending on what you find most 19398 comfortable. 19399 19400 In addition to command names, readline allows keys to be bound to 19401 a string that is inserted when the key is pressed (a MACRO). 19402 19403 KEYNAME: FUNCTION-NAME or MACRO 19404 KEYNAME is the name of a key spelled out in English. For 19405 example: 19406 Control-u: universal-argument 19407 Meta-Rubout: backward-kill-word 19408 Control-o: "> output" 19409 19410 In the above example, `C-u' is bound to the function 19411 `universal-argument', `M-DEL' is bound to the function 19412 `backward-kill-word', and `C-o' is bound to run the macro 19413 expressed on the right hand side (that is, to insert the text 19414 `> output' into the line). 19415 19416 A number of symbolic character names are recognized while 19417 processing this key binding syntax: DEL, ESC, ESCAPE, LFD, 19418 NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB. 19419 19420 "KEYSEQ": FUNCTION-NAME or MACRO 19421 KEYSEQ differs from KEYNAME above in that strings denoting an 19422 entire key sequence can be specified, by placing the key 19423 sequence in double quotes. Some GNU Emacs style key escapes 19424 can be used, as in the following example, but the special 19425 character names are not recognized. 19426 19427 "\C-u": universal-argument 19428 "\C-x\C-r": re-read-init-file 19429 "\e[11~": "Function Key 1" 19430 19431 In the above example, `C-u' is again bound to the function 19432 `universal-argument' (just as it was in the first example), 19433 `C-x C-r' is bound to the function `re-read-init-file', and 19434 `<ESC> <[> <1> <1> <~>' is bound to insert the text `Function 19435 Key 1'. 19436 19437 19438 The following GNU Emacs style escape sequences are available when 19439 specifying key sequences: 19440 19441 `\C-' 19442 control prefix 19443 19444 `\M-' 19445 meta prefix 19446 19447 `\e' 19448 an escape character 19449 19450 `\\' 19451 backslash 19452 19453 `\"' 19454 <">, a double quotation mark 19455 19456 `\'' 19457 <'>, a single quote or apostrophe 19458 19459 In addition to the GNU Emacs style escape sequences, a second set 19460 of backslash escapes is available: 19461 19462 `\a' 19463 alert (bell) 19464 19465 `\b' 19466 backspace 19467 19468 `\d' 19469 delete 19470 19471 `\f' 19472 form feed 19473 19474 `\n' 19475 newline 19476 19477 `\r' 19478 carriage return 19479 19480 `\t' 19481 horizontal tab 19482 19483 `\v' 19484 vertical tab 19485 19486 `\NNN' 19487 the eight-bit character whose value is the octal value NNN 19488 (one to three digits) 19489 19490 `\xHH' 19491 the eight-bit character whose value is the hexadecimal value 19492 HH (one or two hex digits) 19493 19494 When entering the text of a macro, single or double quotes must be 19495 used to indicate a macro definition. Unquoted text is assumed to 19496 be a function name. In the macro body, the backslash escapes 19497 described above are expanded. Backslash will quote any other 19498 character in the macro text, including `"' and `''. For example, 19499 the following binding will make `C-x \' insert a single `\' into 19500 the line: 19501 "\C-x\\": "\\" 19502 19503 19504 19505 File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File 19506 19507 27.3.2 Conditional Init Constructs 19508 ---------------------------------- 19509 19510 Readline implements a facility similar in spirit to the conditional 19511 compilation features of the C preprocessor which allows key bindings 19512 and variable settings to be performed as the result of tests. There 19513 are four parser directives used. 19514 19515 `$if' 19516 The `$if' construct allows bindings to be made based on the 19517 editing mode, the terminal being used, or the application using 19518 Readline. The text of the test extends to the end of the line; no 19519 characters are required to isolate it. 19520 19521 `mode' 19522 The `mode=' form of the `$if' directive is used to test 19523 whether Readline is in `emacs' or `vi' mode. This may be 19524 used in conjunction with the `set keymap' command, for 19525 instance, to set bindings in the `emacs-standard' and 19526 `emacs-ctlx' keymaps only if Readline is starting out in 19527 `emacs' mode. 19528 19529 `term' 19530 The `term=' form may be used to include terminal-specific key 19531 bindings, perhaps to bind the key sequences output by the 19532 terminal's function keys. The word on the right side of the 19533 `=' is tested against both the full name of the terminal and 19534 the portion of the terminal name before the first `-'. This 19535 allows `sun' to match both `sun' and `sun-cmd', for instance. 19536 19537 `application' 19538 The APPLICATION construct is used to include 19539 application-specific settings. Each program using the 19540 Readline library sets the APPLICATION NAME, and you can test 19541 for a particular value. This could be used to bind key 19542 sequences to functions useful for a specific program. For 19543 instance, the following command adds a key sequence that 19544 quotes the current or previous word in Bash: 19545 $if Bash 19546 # Quote the current or previous word 19547 "\C-xq": "\eb\"\ef\"" 19548 $endif 19549 19550 `$endif' 19551 This command, as seen in the previous example, terminates an `$if' 19552 command. 19553 19554 `$else' 19555 Commands in this branch of the `$if' directive are executed if the 19556 test fails. 19557 19558 `$include' 19559 This directive takes a single filename as an argument and reads 19560 commands and bindings from that file. For example, the following 19561 directive reads from `/etc/inputrc': 19562 $include /etc/inputrc 19563 19564 19565 File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File 19566 19567 27.3.3 Sample Init File 19568 ----------------------- 19569 19570 Here is an example of an INPUTRC file. This illustrates key binding, 19571 variable assignment, and conditional syntax. 19572 19573 19574 # This file controls the behaviour of line input editing for 19575 # programs that use the GNU Readline library. Existing 19576 # programs include FTP, Bash, and GDB. 19577 # 19578 # You can re-read the inputrc file with C-x C-r. 19579 # Lines beginning with '#' are comments. 19580 # 19581 # First, include any systemwide bindings and variable 19582 # assignments from /etc/Inputrc 19583 $include /etc/Inputrc 19584 19585 # 19586 # Set various bindings for emacs mode. 19587 19588 set editing-mode emacs 19589 19590 $if mode=emacs 19591 19592 Meta-Control-h: backward-kill-word Text after the function name is ignored 19593 19594 # 19595 # Arrow keys in keypad mode 19596 # 19597 #"\M-OD": backward-char 19598 #"\M-OC": forward-char 19599 #"\M-OA": previous-history 19600 #"\M-OB": next-history 19601 # 19602 # Arrow keys in ANSI mode 19603 # 19604 "\M-[D": backward-char 19605 "\M-[C": forward-char 19606 "\M-[A": previous-history 19607 "\M-[B": next-history 19608 # 19609 # Arrow keys in 8 bit keypad mode 19610 # 19611 #"\M-\C-OD": backward-char 19612 #"\M-\C-OC": forward-char 19613 #"\M-\C-OA": previous-history 19614 #"\M-\C-OB": next-history 19615 # 19616 # Arrow keys in 8 bit ANSI mode 19617 # 19618 #"\M-\C-[D": backward-char 19619 #"\M-\C-[C": forward-char 19620 #"\M-\C-[A": previous-history 19621 #"\M-\C-[B": next-history 19622 19623 C-q: quoted-insert 19624 19625 $endif 19626 19627 # An old-style binding. This happens to be the default. 19628 TAB: complete 19629 19630 # Macros that are convenient for shell interaction 19631 $if Bash 19632 # edit the path 19633 "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f" 19634 # prepare to type a quoted word -- 19635 # insert open and close double quotes 19636 # and move to just after the open quote 19637 "\C-x\"": "\"\"\C-b" 19638 # insert a backslash (testing backslash escapes 19639 # in sequences and macros) 19640 "\C-x\\": "\\" 19641 # Quote the current or previous word 19642 "\C-xq": "\eb\"\ef\"" 19643 # Add a binding to refresh the line, which is unbound 19644 "\C-xr": redraw-current-line 19645 # Edit variable on current line. 19646 "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y=" 19647 $endif 19648 19649 # use a visible bell if one is available 19650 set bell-style visible 19651 19652 # don't strip characters to 7 bits when reading 19653 set input-meta on 19654 19655 # allow iso-latin1 characters to be inserted rather 19656 # than converted to prefix-meta sequences 19657 set convert-meta off 19658 19659 # display characters with the eighth bit set directly 19660 # rather than as meta-prefixed characters 19661 set output-meta on 19662 19663 # if there are more than 150 possible completions for 19664 # a word, ask the user if he wants to see all of them 19665 set completion-query-items 150 19666 19667 # For FTP 19668 $if Ftp 19669 "\C-xg": "get \M-?" 19670 "\C-xt": "put \M-?" 19671 "\M-.": yank-last-arg 19672 $endif 19673 19674 19675 File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing 19676 19677 27.4 Bindable Readline Commands 19678 =============================== 19679 19680 * Menu: 19681 19682 * Commands For Moving:: Moving about the line. 19683 * Commands For History:: Getting at previous lines. 19684 * Commands For Text:: Commands for changing text. 19685 * Commands For Killing:: Commands for killing and yanking. 19686 * Numeric Arguments:: Specifying numeric arguments, repeat counts. 19687 * Commands For Completion:: Getting Readline to do the typing for you. 19688 * Keyboard Macros:: Saving and re-executing typed characters 19689 * Miscellaneous Commands:: Other miscellaneous commands. 19690 19691 This section describes Readline commands that may be bound to key 19692 sequences. Command names without an accompanying key sequence are 19693 unbound by default. 19694 19695 In the following descriptions, "point" refers to the current cursor 19696 position, and "mark" refers to a cursor position saved by the 19697 `set-mark' command. The text between the point and mark is referred to 19698 as the "region". 19699 19700 19701 File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands 19702 19703 27.4.1 Commands For Moving 19704 -------------------------- 19705 19706 `beginning-of-line (C-a)' 19707 Move to the start of the current line. 19708 19709 `end-of-line (C-e)' 19710 Move to the end of the line. 19711 19712 `forward-char (C-f)' 19713 Move forward a character. 19714 19715 `backward-char (C-b)' 19716 Move back a character. 19717 19718 `forward-word (M-f)' 19719 Move forward to the end of the next word. Words are composed of 19720 letters and digits. 19721 19722 `backward-word (M-b)' 19723 Move back to the start of the current or previous word. Words are 19724 composed of letters and digits. 19725 19726 `clear-screen (C-l)' 19727 Clear the screen and redraw the current line, leaving the current 19728 line at the top of the screen. 19729 19730 `redraw-current-line ()' 19731 Refresh the current line. By default, this is unbound. 19732 19733 19734 19735 File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands 19736 19737 27.4.2 Commands For Manipulating The History 19738 -------------------------------------------- 19739 19740 `accept-line (Newline or Return)' 19741 Accept the line regardless of where the cursor is. If this line is 19742 non-empty, it may be added to the history list for future recall 19743 with `add_history()'. If this line is a modified history line, 19744 the history line is restored to its original state. 19745 19746 `previous-history (C-p)' 19747 Move `back' through the history list, fetching the previous 19748 command. 19749 19750 `next-history (C-n)' 19751 Move `forward' through the history list, fetching the next command. 19752 19753 `beginning-of-history (M-<)' 19754 Move to the first line in the history. 19755 19756 `end-of-history (M->)' 19757 Move to the end of the input history, i.e., the line currently 19758 being entered. 19759 19760 `reverse-search-history (C-r)' 19761 Search backward starting at the current line and moving `up' 19762 through the history as necessary. This is an incremental search. 19763 19764 `forward-search-history (C-s)' 19765 Search forward starting at the current line and moving `down' 19766 through the the history as necessary. This is an incremental 19767 search. 19768 19769 `non-incremental-reverse-search-history (M-p)' 19770 Search backward starting at the current line and moving `up' 19771 through the history as necessary using a non-incremental search 19772 for a string supplied by the user. 19773 19774 `non-incremental-forward-search-history (M-n)' 19775 Search forward starting at the current line and moving `down' 19776 through the the history as necessary using a non-incremental search 19777 for a string supplied by the user. 19778 19779 `history-search-forward ()' 19780 Search forward through the history for the string of characters 19781 between the start of the current line and the point. This is a 19782 non-incremental search. By default, this command is unbound. 19783 19784 `history-search-backward ()' 19785 Search backward through the history for the string of characters 19786 between the start of the current line and the point. This is a 19787 non-incremental search. By default, this command is unbound. 19788 19789 `yank-nth-arg (M-C-y)' 19790 Insert the first argument to the previous command (usually the 19791 second word on the previous line) at point. With an argument N, 19792 insert the Nth word from the previous command (the words in the 19793 previous command begin with word 0). A negative argument inserts 19794 the Nth word from the end of the previous command. Once the 19795 argument N is computed, the argument is extracted as if the `!N' 19796 history expansion had been specified. 19797 19798 `yank-last-arg (M-. or M-_)' 19799 Insert last argument to the previous command (the last word of the 19800 previous history entry). With an argument, behave exactly like 19801 `yank-nth-arg'. Successive calls to `yank-last-arg' move back 19802 through the history list, inserting the last argument of each line 19803 in turn. The history expansion facilities are used to extract the 19804 last argument, as if the `!$' history expansion had been specified. 19805 19806 19807 19808 File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands 19809 19810 27.4.3 Commands For Changing Text 19811 --------------------------------- 19812 19813 `delete-char (C-d)' 19814 Delete the character at point. If point is at the beginning of 19815 the line, there are no characters in the line, and the last 19816 character typed was not bound to `delete-char', then return EOF. 19817 19818 `backward-delete-char (Rubout)' 19819 Delete the character behind the cursor. A numeric argument means 19820 to kill the characters instead of deleting them. 19821 19822 `forward-backward-delete-char ()' 19823 Delete the character under the cursor, unless the cursor is at the 19824 end of the line, in which case the character behind the cursor is 19825 deleted. By default, this is not bound to a key. 19826 19827 `quoted-insert (C-q or C-v)' 19828 Add the next character typed to the line verbatim. This is how to 19829 insert key sequences like `C-q', for example. 19830 19831 `tab-insert (M-<TAB>)' 19832 Insert a tab character. 19833 19834 `self-insert (a, b, A, 1, !, ...)' 19835 Insert yourself. 19836 19837 `transpose-chars (C-t)' 19838 Drag the character before the cursor forward over the character at 19839 the cursor, moving the cursor forward as well. If the insertion 19840 point is at the end of the line, then this transposes the last two 19841 characters of the line. Negative arguments have no effect. 19842 19843 `transpose-words (M-t)' 19844 Drag the word before point past the word after point, moving point 19845 past that word as well. If the insertion point is at the end of 19846 the line, this transposes the last two words on the line. 19847 19848 `upcase-word (M-u)' 19849 Uppercase the current (or following) word. With a negative 19850 argument, uppercase the previous word, but do not move the cursor. 19851 19852 `downcase-word (M-l)' 19853 Lowercase the current (or following) word. With a negative 19854 argument, lowercase the previous word, but do not move the cursor. 19855 19856 `capitalize-word (M-c)' 19857 Capitalize the current (or following) word. With a negative 19858 argument, capitalize the previous word, but do not move the cursor. 19859 19860 `overwrite-mode ()' 19861 Toggle overwrite mode. With an explicit positive numeric argument, 19862 switches to overwrite mode. With an explicit non-positive numeric 19863 argument, switches to insert mode. This command affects only 19864 `emacs' mode; `vi' mode does overwrite differently. Each call to 19865 `readline()' starts in insert mode. 19866 19867 In overwrite mode, characters bound to `self-insert' replace the 19868 text at point rather than pushing the text to the right. 19869 Characters bound to `backward-delete-char' replace the character 19870 before point with a space. 19871 19872 By default, this command is unbound. 19873 19874 19875 19876 File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands 19877 19878 27.4.4 Killing And Yanking 19879 -------------------------- 19880 19881 `kill-line (C-k)' 19882 Kill the text from point to the end of the line. 19883 19884 `backward-kill-line (C-x Rubout)' 19885 Kill backward to the beginning of the line. 19886 19887 `unix-line-discard (C-u)' 19888 Kill backward from the cursor to the beginning of the current line. 19889 19890 `kill-whole-line ()' 19891 Kill all characters on the current line, no matter where point is. 19892 By default, this is unbound. 19893 19894 `kill-word (M-d)' 19895 Kill from point to the end of the current word, or if between 19896 words, to the end of the next word. Word boundaries are the same 19897 as `forward-word'. 19898 19899 `backward-kill-word (M-<DEL>)' 19900 Kill the word behind point. Word boundaries are the same as 19901 `backward-word'. 19902 19903 `unix-word-rubout (C-w)' 19904 Kill the word behind point, using white space as a word boundary. 19905 The killed text is saved on the kill-ring. 19906 19907 `unix-filename-rubout ()' 19908 Kill the word behind point, using white space and the slash 19909 character as the word boundaries. The killed text is saved on the 19910 kill-ring. 19911 19912 `delete-horizontal-space ()' 19913 Delete all spaces and tabs around point. By default, this is 19914 unbound. 19915 19916 `kill-region ()' 19917 Kill the text in the current region. By default, this command is 19918 unbound. 19919 19920 `copy-region-as-kill ()' 19921 Copy the text in the region to the kill buffer, so it can be yanked 19922 right away. By default, this command is unbound. 19923 19924 `copy-backward-word ()' 19925 Copy the word before point to the kill buffer. The word 19926 boundaries are the same as `backward-word'. By default, this 19927 command is unbound. 19928 19929 `copy-forward-word ()' 19930 Copy the word following point to the kill buffer. The word 19931 boundaries are the same as `forward-word'. By default, this 19932 command is unbound. 19933 19934 `yank (C-y)' 19935 Yank the top of the kill ring into the buffer at point. 19936 19937 `yank-pop (M-y)' 19938 Rotate the kill-ring, and yank the new top. You can only do this 19939 if the prior command is `yank' or `yank-pop'. 19940 19941 19942 File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands 19943 19944 27.4.5 Specifying Numeric Arguments 19945 ----------------------------------- 19946 19947 `digit-argument (M-0, M-1, ... M--)' 19948 Add this digit to the argument already accumulating, or start a new 19949 argument. `M--' starts a negative argument. 19950 19951 `universal-argument ()' 19952 This is another way to specify an argument. If this command is 19953 followed by one or more digits, optionally with a leading minus 19954 sign, those digits define the argument. If the command is 19955 followed by digits, executing `universal-argument' again ends the 19956 numeric argument, but is otherwise ignored. As a special case, if 19957 this command is immediately followed by a character that is 19958 neither a digit or minus sign, the argument count for the next 19959 command is multiplied by four. The argument count is initially 19960 one, so executing this function the first time makes the argument 19961 count four, a second time makes the argument count sixteen, and so 19962 on. By default, this is not bound to a key. 19963 19964 19965 File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands 19966 19967 27.4.6 Letting Readline Type For You 19968 ------------------------------------ 19969 19970 `complete (<TAB>)' 19971 Attempt to perform completion on the text before point. The 19972 actual completion performed is application-specific. The default 19973 is filename completion. 19974 19975 `possible-completions (M-?)' 19976 List the possible completions of the text before point. 19977 19978 `insert-completions (M-*)' 19979 Insert all completions of the text before point that would have 19980 been generated by `possible-completions'. 19981 19982 `menu-complete ()' 19983 Similar to `complete', but replaces the word to be completed with 19984 a single match from the list of possible completions. Repeated 19985 execution of `menu-complete' steps through the list of possible 19986 completions, inserting each match in turn. At the end of the list 19987 of completions, the bell is rung (subject to the setting of 19988 `bell-style') and the original text is restored. An argument of N 19989 moves N positions forward in the list of matches; a negative 19990 argument may be used to move backward through the list. This 19991 command is intended to be bound to <TAB>, but is unbound by 19992 default. 19993 19994 `delete-char-or-list ()' 19995 Deletes the character under the cursor if not at the beginning or 19996 end of the line (like `delete-char'). If at the end of the line, 19997 behaves identically to `possible-completions'. This command is 19998 unbound by default. 19999 20000 20001 20002 File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands 20003 20004 27.4.7 Keyboard Macros 20005 ---------------------- 20006 20007 `start-kbd-macro (C-x ()' 20008 Begin saving the characters typed into the current keyboard macro. 20009 20010 `end-kbd-macro (C-x ))' 20011 Stop saving the characters typed into the current keyboard macro 20012 and save the definition. 20013 20014 `call-last-kbd-macro (C-x e)' 20015 Re-execute the last keyboard macro defined, by making the 20016 characters in the macro appear as if typed at the keyboard. 20017 20018 20019 20020 File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands 20021 20022 27.4.8 Some Miscellaneous Commands 20023 ---------------------------------- 20024 20025 `re-read-init-file (C-x C-r)' 20026 Read in the contents of the INPUTRC file, and incorporate any 20027 bindings or variable assignments found there. 20028 20029 `abort (C-g)' 20030 Abort the current editing command and ring the terminal's bell 20031 (subject to the setting of `bell-style'). 20032 20033 `do-uppercase-version (M-a, M-b, M-X, ...)' 20034 If the metafied character X is lowercase, run the command that is 20035 bound to the corresponding uppercase character. 20036 20037 `prefix-meta (<ESC>)' 20038 Metafy the next character typed. This is for keyboards without a 20039 meta key. Typing `<ESC> f' is equivalent to typing `M-f'. 20040 20041 `undo (C-_ or C-x C-u)' 20042 Incremental undo, separately remembered for each line. 20043 20044 `revert-line (M-r)' 20045 Undo all changes made to this line. This is like executing the 20046 `undo' command enough times to get back to the beginning. 20047 20048 `tilde-expand (M-~)' 20049 Perform tilde expansion on the current word. 20050 20051 `set-mark (C-@)' 20052 Set the mark to the point. If a numeric argument is supplied, the 20053 mark is set to that position. 20054 20055 `exchange-point-and-mark (C-x C-x)' 20056 Swap the point with the mark. The current cursor position is set 20057 to the saved position, and the old cursor position is saved as the 20058 mark. 20059 20060 `character-search (C-])' 20061 A character is read and point is moved to the next occurrence of 20062 that character. A negative count searches for previous 20063 occurrences. 20064 20065 `character-search-backward (M-C-])' 20066 A character is read and point is moved to the previous occurrence 20067 of that character. A negative count searches for subsequent 20068 occurrences. 20069 20070 `insert-comment (M-#)' 20071 Without a numeric argument, the value of the `comment-begin' 20072 variable is inserted at the beginning of the current line. If a 20073 numeric argument is supplied, this command acts as a toggle: if 20074 the characters at the beginning of the line do not match the value 20075 of `comment-begin', the value is inserted, otherwise the 20076 characters in `comment-begin' are deleted from the beginning of 20077 the line. In either case, the line is accepted as if a newline 20078 had been typed. 20079 20080 `dump-functions ()' 20081 Print all of the functions and their key bindings to the Readline 20082 output stream. If a numeric argument is supplied, the output is 20083 formatted in such a way that it can be made part of an INPUTRC 20084 file. This command is unbound by default. 20085 20086 `dump-variables ()' 20087 Print all of the settable variables and their values to the 20088 Readline output stream. If a numeric argument is supplied, the 20089 output is formatted in such a way that it can be made part of an 20090 INPUTRC file. This command is unbound by default. 20091 20092 `dump-macros ()' 20093 Print all of the Readline key sequences bound to macros and the 20094 strings they output. If a numeric argument is supplied, the 20095 output is formatted in such a way that it can be made part of an 20096 INPUTRC file. This command is unbound by default. 20097 20098 `emacs-editing-mode (C-e)' 20099 When in `vi' command mode, this causes a switch to `emacs' editing 20100 mode. 20101 20102 `vi-editing-mode (M-C-j)' 20103 When in `emacs' editing mode, this causes a switch to `vi' editing 20104 mode. 20105 20106 20107 20108 File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing 20109 20110 27.5 Readline vi Mode 20111 ===================== 20112 20113 While the Readline library does not have a full set of `vi' editing 20114 functions, it does contain enough to allow simple editing of the line. 20115 The Readline `vi' mode behaves as specified in the POSIX 1003.2 20116 standard. 20117 20118 In order to switch interactively between `emacs' and `vi' editing 20119 modes, use the command `M-C-j' (bound to emacs-editing-mode when in 20120 `vi' mode and to vi-editing-mode in `emacs' mode). The Readline 20121 default is `emacs' mode. 20122 20123 When you enter a line in `vi' mode, you are already placed in 20124 `insertion' mode, as if you had typed an `i'. Pressing <ESC> switches 20125 you into `command' mode, where you can edit the text of the line with 20126 the standard `vi' movement keys, move to previous history lines with 20127 `k' and subsequent lines with `j', and so forth. 20128 20129 20130 File: gdb.info, Node: Using History Interactively, Next: Installing GDB, Prev: Command Line Editing, Up: Top 20131 20132 28 Using History Interactively 20133 ****************************** 20134 20135 This chapter describes how to use the GNU History Library interactively, 20136 from a user's standpoint. It should be considered a user's guide. For 20137 information on using the GNU History Library in other programs, see the 20138 GNU Readline Library Manual. 20139 20140 * Menu: 20141 20142 * History Interaction:: What it feels like using History as a user. 20143 20144 20145 File: gdb.info, Node: History Interaction, Up: Using History Interactively 20146 20147 28.1 History Expansion 20148 ====================== 20149 20150 The History library provides a history expansion feature that is similar 20151 to the history expansion provided by `csh'. This section describes the 20152 syntax used to manipulate the history information. 20153 20154 History expansions introduce words from the history list into the 20155 input stream, making it easy to repeat commands, insert the arguments 20156 to a previous command into the current input line, or fix errors in 20157 previous commands quickly. 20158 20159 History expansion takes place in two parts. The first is to 20160 determine which line from the history list should be used during 20161 substitution. The second is to select portions of that line for 20162 inclusion into the current one. The line selected from the history is 20163 called the "event", and the portions of that line that are acted upon 20164 are called "words". Various "modifiers" are available to manipulate 20165 the selected words. The line is broken into words in the same fashion 20166 that Bash does, so that several words surrounded by quotes are 20167 considered one word. History expansions are introduced by the 20168 appearance of the history expansion character, which is `!' by default. 20169 20170 * Menu: 20171 20172 * Event Designators:: How to specify which history line to use. 20173 * Word Designators:: Specifying which words are of interest. 20174 * Modifiers:: Modifying the results of substitution. 20175 20176 20177 File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction 20178 20179 28.1.1 Event Designators 20180 ------------------------ 20181 20182 An event designator is a reference to a command line entry in the 20183 history list. 20184 20185 `!' 20186 Start a history substitution, except when followed by a space, tab, 20187 the end of the line, or `='. 20188 20189 `!N' 20190 Refer to command line N. 20191 20192 `!-N' 20193 Refer to the command N lines back. 20194 20195 `!!' 20196 Refer to the previous command. This is a synonym for `!-1'. 20197 20198 `!STRING' 20199 Refer to the most recent command starting with STRING. 20200 20201 `!?STRING[?]' 20202 Refer to the most recent command containing STRING. The trailing 20203 `?' may be omitted if the STRING is followed immediately by a 20204 newline. 20205 20206 `^STRING1^STRING2^' 20207 Quick Substitution. Repeat the last command, replacing STRING1 20208 with STRING2. Equivalent to `!!:s/STRING1/STRING2/'. 20209 20210 `!#' 20211 The entire command line typed so far. 20212 20213 20214 20215 File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction 20216 20217 28.1.2 Word Designators 20218 ----------------------- 20219 20220 Word designators are used to select desired words from the event. A 20221 `:' separates the event specification from the word designator. It may 20222 be omitted if the word designator begins with a `^', `$', `*', `-', or 20223 `%'. Words are numbered from the beginning of the line, with the first 20224 word being denoted by 0 (zero). Words are inserted into the current 20225 line separated by single spaces. 20226 20227 For example, 20228 20229 `!!' 20230 designates the preceding command. When you type this, the 20231 preceding command is repeated in toto. 20232 20233 `!!:$' 20234 designates the last argument of the preceding command. This may be 20235 shortened to `!$'. 20236 20237 `!fi:2' 20238 designates the second argument of the most recent command starting 20239 with the letters `fi'. 20240 20241 Here are the word designators: 20242 20243 `0 (zero)' 20244 The `0'th word. For many applications, this is the command word. 20245 20246 `N' 20247 The Nth word. 20248 20249 `^' 20250 The first argument; that is, word 1. 20251 20252 `$' 20253 The last argument. 20254 20255 `%' 20256 The word matched by the most recent `?STRING?' search. 20257 20258 `X-Y' 20259 A range of words; `-Y' abbreviates `0-Y'. 20260 20261 `*' 20262 All of the words, except the `0'th. This is a synonym for `1-$'. 20263 It is not an error to use `*' if there is just one word in the 20264 event; the empty string is returned in that case. 20265 20266 `X*' 20267 Abbreviates `X-$' 20268 20269 `X-' 20270 Abbreviates `X-$' like `X*', but omits the last word. 20271 20272 20273 If a word designator is supplied without an event specification, the 20274 previous command is used as the event. 20275 20276 20277 File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction 20278 20279 28.1.3 Modifiers 20280 ---------------- 20281 20282 After the optional word designator, you can add a sequence of one or 20283 more of the following modifiers, each preceded by a `:'. 20284 20285 `h' 20286 Remove a trailing pathname component, leaving only the head. 20287 20288 `t' 20289 Remove all leading pathname components, leaving the tail. 20290 20291 `r' 20292 Remove a trailing suffix of the form `.SUFFIX', leaving the 20293 basename. 20294 20295 `e' 20296 Remove all but the trailing suffix. 20297 20298 `p' 20299 Print the new command but do not execute it. 20300 20301 `s/OLD/NEW/' 20302 Substitute NEW for the first occurrence of OLD in the event line. 20303 Any delimiter may be used in place of `/'. The delimiter may be 20304 quoted in OLD and NEW with a single backslash. If `&' appears in 20305 NEW, it is replaced by OLD. A single backslash will quote the 20306 `&'. The final delimiter is optional if it is the last character 20307 on the input line. 20308 20309 `&' 20310 Repeat the previous substitution. 20311 20312 `g' 20313 `a' 20314 Cause changes to be applied over the entire event line. Used in 20315 conjunction with `s', as in `gs/OLD/NEW/', or with `&'. 20316 20317 `G' 20318 Apply the following `s' modifier once to each word in the event. 20319 20320 20321 20322 File: gdb.info, Node: Formatting Documentation, Next: Command Line Editing, Prev: GDB Bugs, Up: Top 20323 20324 Appendix A Formatting Documentation 20325 *********************************** 20326 20327 The GDB 4 release includes an already-formatted reference card, ready 20328 for printing with PostScript or Ghostscript, in the `gdb' subdirectory 20329 of the main source directory(1). If you can use PostScript or 20330 Ghostscript with your printer, you can print the reference card 20331 immediately with `refcard.ps'. 20332 20333 The release also includes the source for the reference card. You 20334 can format it, using TeX, by typing: 20335 20336 make refcard.dvi 20337 20338 The GDB reference card is designed to print in "landscape" mode on 20339 US "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches 20340 high. You will need to specify this form of printing as an option to 20341 your DVI output program. 20342 20343 All the documentation for GDB comes as part of the machine-readable 20344 distribution. The documentation is written in Texinfo format, which is 20345 a documentation system that uses a single source file to produce both 20346 on-line information and a printed manual. You can use one of the Info 20347 formatting commands to create the on-line version of the documentation 20348 and TeX (or `texi2roff') to typeset the printed version. 20349 20350 GDB includes an already formatted copy of the on-line Info version 20351 of this manual in the `gdb' subdirectory. The main Info file is 20352 `gdb-6.6/gdb/gdb.info', and it refers to subordinate files matching 20353 `gdb.info*' in the same directory. If necessary, you can print out 20354 these files, or read them with any editor; but they are easier to read 20355 using the `info' subsystem in GNU Emacs or the standalone `info' 20356 program, available as part of the GNU Texinfo distribution. 20357 20358 If you want to format these Info files yourself, you need one of the 20359 Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'. 20360 20361 If you have `makeinfo' installed, and are in the top level GDB 20362 source directory (`gdb-6.6', in the case of version 6.6), you can make 20363 the Info file by typing: 20364 20365 cd gdb 20366 make gdb.info 20367 20368 If you want to typeset and print copies of this manual, you need TeX, 20369 a program to print its DVI output files, and `texinfo.tex', the Texinfo 20370 definitions file. 20371 20372 TeX is a typesetting program; it does not print files directly, but 20373 produces output files called DVI files. To print a typeset document, 20374 you need a program to print DVI files. If your system has TeX 20375 installed, chances are it has such a program. The precise command to 20376 use depends on your system; `lpr -d' is common; another (for PostScript 20377 devices) is `dvips'. The DVI print command may require a file name 20378 without any extension or a `.dvi' extension. 20379 20380 TeX also requires a macro definitions file called `texinfo.tex'. 20381 This file tells TeX how to typeset a document written in Texinfo 20382 format. On its own, TeX cannot either read or typeset a Texinfo file. 20383 `texinfo.tex' is distributed with GDB and is located in the 20384 `gdb-VERSION-NUMBER/texinfo' directory. 20385 20386 If you have TeX and a DVI printer program installed, you can typeset 20387 and print this manual. First switch to the the `gdb' subdirectory of 20388 the main source directory (for example, to `gdb-6.6/gdb') and type: 20389 20390 make gdb.dvi 20391 20392 Then give `gdb.dvi' to your DVI printing program. 20393 20394 ---------- Footnotes ---------- 20395 20396 (1) In `gdb-6.6/gdb/refcard.ps' of the version 6.6 release. 20397 20398 20399 File: gdb.info, Node: Installing GDB, Next: Maintenance Commands, Prev: Using History Interactively, Up: Top 20400 20401 Appendix B Installing GDB 20402 ************************* 20403 20404 * Menu: 20405 20406 * Requirements:: Requirements for building GDB 20407 * Running Configure:: Invoking the GDB `configure' script 20408 * Separate Objdir:: Compiling GDB in another directory 20409 * Config Names:: Specifying names for hosts and targets 20410 * Configure Options:: Summary of options for configure 20411 20412 20413 File: gdb.info, Node: Requirements, Next: Running Configure, Up: Installing GDB 20414 20415 B.1 Requirements for building GDB 20416 ================================= 20417 20418 Building GDB requires various tools and packages to be available. 20419 Other packages will be used only if they are found. 20420 20421 Tools/packages necessary for building GDB 20422 ========================================= 20423 20424 ISO C90 compiler 20425 GDB is written in ISO C90. It should be buildable with any 20426 working C90 compiler, e.g. GCC. 20427 20428 20429 Tools/packages optional for building GDB 20430 ======================================== 20431 20432 Expat 20433 GDB can use the Expat XML parsing library. This library may be 20434 included with your operating system distribution; if it is not, you 20435 can get the latest version from `http://expat.sourceforge.net'. 20436 The `configure' script will search for this library in several 20437 standard locations; if it is installed in an unusual path, you can 20438 use the `--with-libexpat-prefix' option to specify its location. 20439 20440 Expat is used currently only used to implement some remote-specific 20441 features. 20442 20443 20444 20445 File: gdb.info, Node: Running Configure, Next: Separate Objdir, Prev: Requirements, Up: Installing GDB 20446 20447 B.2 Invoking the GDB `configure' script 20448 ======================================= 20449 20450 GDB comes with a `configure' script that automates the process of 20451 preparing GDB for installation; you can then use `make' to build the 20452 `gdb' program. 20453 20454 The GDB distribution includes all the source code you need for GDB 20455 in a single directory, whose name is usually composed by appending the 20456 version number to `gdb'. 20457 20458 For example, the GDB version 6.6 distribution is in the `gdb-6.6' 20459 directory. That directory contains: 20460 20461 `gdb-6.6/configure (and supporting files)' 20462 script for configuring GDB and all its supporting libraries 20463 20464 `gdb-6.6/gdb' 20465 the source specific to GDB itself 20466 20467 `gdb-6.6/bfd' 20468 source for the Binary File Descriptor library 20469 20470 `gdb-6.6/include' 20471 GNU include files 20472 20473 `gdb-6.6/libiberty' 20474 source for the `-liberty' free software library 20475 20476 `gdb-6.6/opcodes' 20477 source for the library of opcode tables and disassemblers 20478 20479 `gdb-6.6/readline' 20480 source for the GNU command-line interface 20481 20482 `gdb-6.6/glob' 20483 source for the GNU filename pattern-matching subroutine 20484 20485 `gdb-6.6/mmalloc' 20486 source for the GNU memory-mapped malloc package 20487 20488 The simplest way to configure and build GDB is to run `configure' 20489 from the `gdb-VERSION-NUMBER' source directory, which in this example 20490 is the `gdb-6.6' directory. 20491 20492 First switch to the `gdb-VERSION-NUMBER' source directory if you are 20493 not already in it; then run `configure'. Pass the identifier for the 20494 platform on which GDB will run as an argument. 20495 20496 For example: 20497 20498 cd gdb-6.6 20499 ./configure HOST 20500 make 20501 20502 where HOST is an identifier such as `sun4' or `decstation', that 20503 identifies the platform where GDB will run. (You can often leave off 20504 HOST; `configure' tries to guess the correct value by examining your 20505 system.) 20506 20507 Running `configure HOST' and then running `make' builds the `bfd', 20508 `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself. 20509 The configured source files, and the binaries, are left in the 20510 corresponding source directories. 20511 20512 `configure' is a Bourne-shell (`/bin/sh') script; if your system 20513 does not recognize this automatically when you run a different shell, 20514 you may need to run `sh' on it explicitly: 20515 20516 sh configure HOST 20517 20518 If you run `configure' from a directory that contains source 20519 directories for multiple libraries or programs, such as the `gdb-6.6' 20520 source directory for version 6.6, `configure' creates configuration 20521 files for every directory level underneath (unless you tell it not to, 20522 with the `--norecursion' option). 20523 20524 You should run the `configure' script from the top directory in the 20525 source tree, the `gdb-VERSION-NUMBER' directory. If you run 20526 `configure' from one of the subdirectories, you will configure only 20527 that subdirectory. That is usually not what you want. In particular, 20528 if you run the first `configure' from the `gdb' subdirectory of the 20529 `gdb-VERSION-NUMBER' directory, you will omit the configuration of 20530 `bfd', `readline', and other sibling directories of the `gdb' 20531 subdirectory. This leads to build errors about missing include files 20532 such as `bfd/bfd.h'. 20533 20534 You can install `gdb' anywhere; it has no hardwired paths. However, 20535 you should make sure that the shell on your path (named by the `SHELL' 20536 environment variable) is publicly readable. Remember that GDB uses the 20537 shell to start your program--some systems refuse to let GDB debug child 20538 processes whose programs are not readable. 20539 20540 20541 File: gdb.info, Node: Separate Objdir, Next: Config Names, Prev: Running Configure, Up: Installing GDB 20542 20543 B.3 Compiling GDB in another directory 20544 ====================================== 20545 20546 If you want to run GDB versions for several host or target machines, 20547 you need a different `gdb' compiled for each combination of host and 20548 target. `configure' is designed to make this easy by allowing you to 20549 generate each configuration in a separate subdirectory, rather than in 20550 the source directory. If your `make' program handles the `VPATH' 20551 feature (GNU `make' does), running `make' in each of these directories 20552 builds the `gdb' program specified there. 20553 20554 To build `gdb' in a separate directory, run `configure' with the 20555 `--srcdir' option to specify where to find the source. (You also need 20556 to specify a path to find `configure' itself from your working 20557 directory. If the path to `configure' would be the same as the 20558 argument to `--srcdir', you can leave out the `--srcdir' option; it is 20559 assumed.) 20560 20561 For example, with version 6.6, you can build GDB in a separate 20562 directory for a Sun 4 like this: 20563 20564 cd gdb-6.6 20565 mkdir ../gdb-sun4 20566 cd ../gdb-sun4 20567 ../gdb-6.6/configure sun4 20568 make 20569 20570 When `configure' builds a configuration using a remote source 20571 directory, it creates a tree for the binaries with the same structure 20572 (and using the same names) as the tree under the source directory. In 20573 the example, you'd find the Sun 4 library `libiberty.a' in the 20574 directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'. 20575 20576 Make sure that your path to the `configure' script has just one 20577 instance of `gdb' in it. If your path to `configure' looks like 20578 `../gdb-6.6/gdb/configure', you are configuring only one subdirectory 20579 of GDB, not the whole package. This leads to build errors about 20580 missing include files such as `bfd/bfd.h'. 20581 20582 One popular reason to build several GDB configurations in separate 20583 directories is to configure GDB for cross-compiling (where GDB runs on 20584 one machine--the "host"--while debugging programs that run on another 20585 machine--the "target"). You specify a cross-debugging target by giving 20586 the `--target=TARGET' option to `configure'. 20587 20588 When you run `make' to build a program or library, you must run it 20589 in a configured directory--whatever directory you were in when you 20590 called `configure' (or one of its subdirectories). 20591 20592 The `Makefile' that `configure' generates in each source directory 20593 also runs recursively. If you type `make' in a source directory such 20594 as `gdb-6.6' (or in a separate configured directory configured with 20595 `--srcdir=DIRNAME/gdb-6.6'), you will build all the required libraries, 20596 and then build GDB. 20597 20598 When you have multiple hosts or targets configured in separate 20599 directories, you can run `make' on them in parallel (for example, if 20600 they are NFS-mounted on each of the hosts); they will not interfere 20601 with each other. 20602 20603 20604 File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB 20605 20606 B.4 Specifying names for hosts and targets 20607 ========================================== 20608 20609 The specifications used for hosts and targets in the `configure' script 20610 are based on a three-part naming scheme, but some short predefined 20611 aliases are also supported. The full naming scheme encodes three pieces 20612 of information in the following pattern: 20613 20614 ARCHITECTURE-VENDOR-OS 20615 20616 For example, you can use the alias `sun4' as a HOST argument, or as 20617 the value for TARGET in a `--target=TARGET' option. The equivalent 20618 full name is `sparc-sun-sunos4'. 20619 20620 The `configure' script accompanying GDB does not provide any query 20621 facility to list all supported host and target names or aliases. 20622 `configure' calls the Bourne shell script `config.sub' to map 20623 abbreviations to full names; you can read the script, if you wish, or 20624 you can use it to test your guesses on abbreviations--for example: 20625 20626 % sh config.sub i386-linux 20627 i386-pc-linux-gnu 20628 % sh config.sub alpha-linux 20629 alpha-unknown-linux-gnu 20630 % sh config.sub hp9k700 20631 hppa1.1-hp-hpux 20632 % sh config.sub sun4 20633 sparc-sun-sunos4.1.1 20634 % sh config.sub sun3 20635 m68k-sun-sunos4.1.1 20636 % sh config.sub i986v 20637 Invalid configuration `i986v': machine `i986v' not recognized 20638 20639 `config.sub' is also distributed in the GDB source directory 20640 (`gdb-6.6', for version 6.6). 20641 20642 20643 File: gdb.info, Node: Configure Options, Prev: Config Names, Up: Installing GDB 20644 20645 B.5 `configure' options 20646 ======================= 20647 20648 Here is a summary of the `configure' options and arguments that are 20649 most often useful for building GDB. `configure' also has several other 20650 options not listed here. *note (configure.info)What Configure Does::, 20651 for a full explanation of `configure'. 20652 20653 configure [--help] 20654 [--prefix=DIR] 20655 [--exec-prefix=DIR] 20656 [--srcdir=DIRNAME] 20657 [--norecursion] [--rm] 20658 [--target=TARGET] 20659 HOST 20660 20661 You may introduce options with a single `-' rather than `--' if you 20662 prefer; but you may abbreviate option names if you use `--'. 20663 20664 `--help' 20665 Display a quick summary of how to invoke `configure'. 20666 20667 `--prefix=DIR' 20668 Configure the source to install programs and files under directory 20669 `DIR'. 20670 20671 `--exec-prefix=DIR' 20672 Configure the source to install programs under directory `DIR'. 20673 20674 `--srcdir=DIRNAME' 20675 *Warning: using this option requires GNU `make', or another `make' 20676 that implements the `VPATH' feature.* 20677 Use this option to make configurations in directories separate 20678 from the GDB source directories. Among other things, you can use 20679 this to build (or maintain) several configurations simultaneously, 20680 in separate directories. `configure' writes configuration 20681 specific files in the current directory, but arranges for them to 20682 use the source in the directory DIRNAME. `configure' creates 20683 directories under the working directory in parallel to the source 20684 directories below DIRNAME. 20685 20686 `--norecursion' 20687 Configure only the directory level where `configure' is executed; 20688 do not propagate configuration to subdirectories. 20689 20690 `--target=TARGET' 20691 Configure GDB for cross-debugging programs running on the specified 20692 TARGET. Without this option, GDB is configured to debug programs 20693 that run on the same machine (HOST) as GDB itself. 20694 20695 There is no convenient way to generate a list of all available 20696 targets. 20697 20698 `HOST ...' 20699 Configure GDB to run on the specified HOST. 20700 20701 There is no convenient way to generate a list of all available 20702 hosts. 20703 20704 There are many other options available as well, but they are 20705 generally needed for special purposes only. 20706 20707 20708 File: gdb.info, Node: Maintenance Commands, Next: Remote Protocol, Prev: Installing GDB, Up: Top 20709 20710 Appendix C Maintenance Commands 20711 ******************************* 20712 20713 In addition to commands intended for GDB users, GDB includes a number 20714 of commands intended for GDB developers, that are not documented 20715 elsewhere in this manual. These commands are provided here for 20716 reference. (For commands that turn on debugging messages, see *Note 20717 Debugging Output::.) 20718 20719 `maint agent EXPRESSION' 20720 Translate the given EXPRESSION into remote agent bytecodes. This 20721 command is useful for debugging the Agent Expression mechanism 20722 (*note Agent Expressions::). 20723 20724 `maint info breakpoints' 20725 Using the same format as `info breakpoints', display both the 20726 breakpoints you've set explicitly, and those GDB is using for 20727 internal purposes. Internal breakpoints are shown with negative 20728 breakpoint numbers. The type column identifies what kind of 20729 breakpoint is shown: 20730 20731 `breakpoint' 20732 Normal, explicitly set breakpoint. 20733 20734 `watchpoint' 20735 Normal, explicitly set watchpoint. 20736 20737 `longjmp' 20738 Internal breakpoint, used to handle correctly stepping through 20739 `longjmp' calls. 20740 20741 `longjmp resume' 20742 Internal breakpoint at the target of a `longjmp'. 20743 20744 `until' 20745 Temporary internal breakpoint used by the GDB `until' command. 20746 20747 `finish' 20748 Temporary internal breakpoint used by the GDB `finish' 20749 command. 20750 20751 `shlib events' 20752 Shared library events. 20753 20754 20755 `maint check-symtabs' 20756 Check the consistency of psymtabs and symtabs. 20757 20758 `maint cplus first_component NAME' 20759 Print the first C++ class/namespace component of NAME. 20760 20761 `maint cplus namespace' 20762 Print the list of possible C++ namespaces. 20763 20764 `maint demangle NAME' 20765 Demangle a C++ or Objective-C manled NAME. 20766 20767 `maint deprecate COMMAND [REPLACEMENT]' 20768 `maint undeprecate COMMAND' 20769 Deprecate or undeprecate the named COMMAND. Deprecated commands 20770 cause GDB to issue a warning when you use them. The optional 20771 argument REPLACEMENT says which newer command should be used in 20772 favor of the deprecated one; if it is given, GDB will mention the 20773 replacement as part of the warning. 20774 20775 `maint dump-me' 20776 Cause a fatal signal in the debugger and force it to dump its core. 20777 This is supported only on systems which support aborting a program 20778 with the `SIGQUIT' signal. 20779 20780 `maint internal-error [MESSAGE-TEXT]' 20781 `maint internal-warning [MESSAGE-TEXT]' 20782 Cause GDB to call the internal function `internal_error' or 20783 `internal_warning' and hence behave as though an internal error or 20784 internal warning has been detected. In addition to reporting the 20785 internal problem, these functions give the user the opportunity to 20786 either quit GDB or create a core file of the current GDB session. 20787 20788 These commands take an optional parameter MESSAGE-TEXT that is 20789 used as the text of the error or warning message. 20790 20791 Here's an example of using `indernal-error': 20792 20793 (gdb) maint internal-error testing, 1, 2 20794 .../maint.c:121: internal-error: testing, 1, 2 20795 A problem internal to GDB has been detected. Further 20796 debugging may prove unreliable. 20797 Quit this debugging session? (y or n) n 20798 Create a core file? (y or n) n 20799 (gdb) 20800 20801 `maint packet TEXT' 20802 If GDB is talking to an inferior via the serial protocol, then 20803 this command sends the string TEXT to the inferior, and displays 20804 the response packet. GDB supplies the initial `$' character, the 20805 terminating `#' character, and the checksum. 20806 20807 `maint print architecture [FILE]' 20808 Print the entire architecture configuration. The optional argument 20809 FILE names the file where the output goes. 20810 20811 `maint print dummy-frames' 20812 Prints the contents of GDB's internal dummy-frame stack. 20813 20814 (gdb) b add 20815 ... 20816 (gdb) print add(2,3) 20817 Breakpoint 2, add (a=2, b=3) at ... 20818 58 return (a + b); 20819 The program being debugged stopped while in a function called from GDB. 20820 ... 20821 (gdb) maint print dummy-frames 20822 0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6 20823 top=0x0200bdd4 id={stack=0x200bddc,code=0x101405c} 20824 call_lo=0x01014000 call_hi=0x01014001 20825 (gdb) 20826 20827 Takes an optional file parameter. 20828 20829 `maint print registers [FILE]' 20830 `maint print raw-registers [FILE]' 20831 `maint print cooked-registers [FILE]' 20832 `maint print register-groups [FILE]' 20833 Print GDB's internal register data structures. 20834 20835 The command `maint print raw-registers' includes the contents of 20836 the raw register cache; the command `maint print cooked-registers' 20837 includes the (cooked) value of all registers; and the command 20838 `maint print register-groups' includes the groups that each 20839 register is a member of. *Note Registers: (gdbint)Registers. 20840 20841 These commands take an optional parameter, a file name to which to 20842 write the information. 20843 20844 `maint print reggroups [FILE]' 20845 Print GDB's internal register group data structures. The optional 20846 argument FILE tells to what file to write the information. 20847 20848 The register groups info looks like this: 20849 20850 (gdb) maint print reggroups 20851 Group Type 20852 general user 20853 float user 20854 all user 20855 vector user 20856 system user 20857 save internal 20858 restore internal 20859 20860 `flushregs' 20861 This command forces GDB to flush its internal register cache. 20862 20863 `maint print objfiles' 20864 Print a dump of all known object files. For each object file, this 20865 command prints its name, address in memory, and all of its psymtabs 20866 and symtabs. 20867 20868 `maint print statistics' 20869 This command prints, for each object file in the program, various 20870 data about that object file followed by the byte cache ("bcache") 20871 statistics for the object file. The objfile data includes the 20872 number of minimal, partical, full, and stabs symbols, the number 20873 of types defined by the objfile, the number of as yet unexpanded 20874 psym tables, the number of line tables and string tables, and the 20875 amount of memory used by the various tables. The bcache 20876 statistics include the counts, sizes, and counts of duplicates of 20877 all and unique objects, max, average, and median entry size, total 20878 memory used and its overhead and savings, and various measures of 20879 the hash table size and chain lengths. 20880 20881 `maint print type EXPR' 20882 Print the type chain for a type specified by EXPR. The argument 20883 can be either a type name or a symbol. If it is a symbol, the 20884 type of that symbol is described. The type chain produced by this 20885 command is a recursive definition of the data type as stored in 20886 GDB's data structures, including its flags and contained types. 20887 20888 `maint set dwarf2 max-cache-age' 20889 `maint show dwarf2 max-cache-age' 20890 Control the DWARF 2 compilation unit cache. 20891 20892 In object files with inter-compilation-unit references, such as 20893 those produced by the GCC option `-feliminate-dwarf2-dups', the 20894 DWARF 2 reader needs to frequently refer to previously read 20895 compilation units. This setting controls how long a compilation 20896 unit will remain in the cache if it is not referenced. A higher 20897 limit means that cached compilation units will be stored in memory 20898 longer, and more total memory will be used. Setting it to zero 20899 disables caching, which will slow down GDB startup, but reduce 20900 memory consumption. 20901 20902 `maint set profile' 20903 `maint show profile' 20904 Control profiling of GDB. 20905 20906 Profiling will be disabled until you use the `maint set profile' 20907 command to enable it. When you enable profiling, the system will 20908 begin collecting timing and execution count data; when you disable 20909 profiling or exit GDB, the results will be written to a log file. 20910 Remember that if you use profiling, GDB will overwrite the 20911 profiling log file (often called `gmon.out'). If you have a 20912 record of important profiling data in a `gmon.out' file, be sure 20913 to move it to a safe location. 20914 20915 Configuring with `--enable-profiling' arranges for GDB to be 20916 compiled with the `-pg' compiler option. 20917 20918 `maint show-debug-regs' 20919 Control whether to show variables that mirror the x86 hardware 20920 debug registers. Use `ON' to enable, `OFF' to disable. If 20921 enabled, the debug registers values are shown when GDB inserts or 20922 removes a hardware breakpoint or watchpoint, and when the inferior 20923 triggers a hardware-assisted breakpoint or watchpoint. 20924 20925 `maint space' 20926 Control whether to display memory usage for each command. If set 20927 to a nonzero value, GDB will display how much memory each command 20928 took, following the command's own output. This can also be 20929 requested by invoking GDB with the `--statistics' command-line 20930 switch (*note Mode Options::). 20931 20932 `maint time' 20933 Control whether to display the execution time for each command. If 20934 set to a nonzero value, GDB will display how much time it took to 20935 execute each command, following the command's own output. This 20936 can also be requested by invoking GDB with the `--statistics' 20937 command-line switch (*note Mode Options::). 20938 20939 `maint translate-address [SECTION] ADDR' 20940 Find the symbol stored at the location specified by the address 20941 ADDR and an optional section name SECTION. If found, GDB prints 20942 the name of the closest symbol and an offset from the symbol's 20943 location to the specified address. This is similar to the `info 20944 address' command (*note Symbols::), except that this command also 20945 allows to find symbols in other sections. 20946 20947 20948 The following command is useful for non-interactive invocations of 20949 GDB, such as in the test suite. 20950 20951 `set watchdog NSEC' 20952 Set the maximum number of seconds GDB will wait for the target 20953 operation to finish. If this time expires, GDB reports and error 20954 and the command is aborted. 20955 20956 `show watchdog' 20957 Show the current setting of the target wait timeout. 20958 20959 20960 File: gdb.info, Node: Remote Protocol, Next: Agent Expressions, Prev: Maintenance Commands, Up: Top 20961 20962 Appendix D GDB Remote Serial Protocol 20963 ************************************* 20964 20965 * Menu: 20966 20967 * Overview:: 20968 * Packets:: 20969 * Stop Reply Packets:: 20970 * General Query Packets:: 20971 * Register Packet Format:: 20972 * Tracepoint Packets:: 20973 * Interrupts:: 20974 * Examples:: 20975 * File-I/O remote protocol extension:: 20976 * Memory map format:: 20977 20978 20979 File: gdb.info, Node: Overview, Next: Packets, Up: Remote Protocol 20980 20981 D.1 Overview 20982 ============ 20983 20984 There may be occasions when you need to know something about the 20985 protocol--for example, if there is only one serial port to your target 20986 machine, you might want your program to do something special if it 20987 recognizes a packet meant for GDB. 20988 20989 In the examples below, `->' and `<-' are used to indicate 20990 transmitted and received data respectfully. 20991 20992 All GDB commands and responses (other than acknowledgments) are sent 20993 as a PACKET. A PACKET is introduced with the character `$', the actual 20994 PACKET-DATA, and the terminating character `#' followed by a two-digit 20995 CHECKSUM: 20996 20997 `$'PACKET-DATA`#'CHECKSUM 20998 The two-digit CHECKSUM is computed as the modulo 256 sum of all 20999 characters between the leading `$' and the trailing `#' (an eight bit 21000 unsigned checksum). 21001 21002 Implementors should note that prior to GDB 5.0 the protocol 21003 specification also included an optional two-digit SEQUENCE-ID: 21004 21005 `$'SEQUENCE-ID`:'PACKET-DATA`#'CHECKSUM 21006 21007 That SEQUENCE-ID was appended to the acknowledgment. GDB has never 21008 output SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0 21009 must not accept SEQUENCE-ID. 21010 21011 When either the host or the target machine receives a packet, the 21012 first response expected is an acknowledgment: either `+' (to indicate 21013 the package was received correctly) or `-' (to request retransmission): 21014 21015 -> `$'PACKET-DATA`#'CHECKSUM 21016 <- `+' 21017 The host (GDB) sends COMMANDs, and the target (the debugging stub 21018 incorporated in your program) sends a RESPONSE. In the case of step 21019 and continue COMMANDs, the response is only sent when the operation has 21020 completed (the target has again stopped). 21021 21022 PACKET-DATA consists of a sequence of characters with the exception 21023 of `#' and `$' (see `X' packet for additional exceptions). 21024 21025 Fields within the packet should be separated using `,' `;' or `:'. 21026 Except where otherwise noted all numbers are represented in HEX with 21027 leading zeros suppressed. 21028 21029 Implementors should note that prior to GDB 5.0, the character `:' 21030 could not appear as the third character in a packet (as it would 21031 potentially conflict with the SEQUENCE-ID). 21032 21033 Binary data in most packets is encoded either as two hexadecimal 21034 digits per byte of binary data. This allowed the traditional remote 21035 protocol to work over connections which were only seven-bit clean. 21036 Some packets designed more recently assume an eight-bit clean 21037 connection, and use a more efficient encoding to send and receive 21038 binary data. 21039 21040 The binary data representation uses `7d' (ASCII `}') as an escape 21041 character. Any escaped byte is transmitted as the escape character 21042 followed by the original character XORed with `0x20'. For example, the 21043 byte `0x7d' would be transmitted as the two bytes `0x7d 0x5d'. The 21044 bytes `0x23' (ASCII `#'), `0x24' (ASCII `$'), and `0x7d' (ASCII `}') 21045 must always be escaped. Responses sent by the stub must also escape 21046 `0x2a' (ASCII `*'), so that it is not interpreted as the start of a 21047 run-length encoded sequence (described next). 21048 21049 Response DATA can be run-length encoded to save space. A `*' means 21050 that the next character is an ASCII encoding giving a repeat count 21051 which stands for that many repetitions of the character preceding the 21052 `*'. The encoding is `n+29', yielding a printable character where `n 21053 >=3' (which is where rle starts to win). The printable characters `$', 21054 `#', `+' and `-' or with a numeric value greater than 126 should not be 21055 used. 21056 21057 So: 21058 "`0* '" 21059 means the same as "0000". 21060 21061 The error response returned for some packets includes a two character 21062 error number. That number is not well defined. 21063 21064 For any COMMAND not supported by the stub, an empty response 21065 (`$#00') should be returned. That way it is possible to extend the 21066 protocol. A newer GDB can tell if a packet is supported based on that 21067 response. 21068 21069 A stub is required to support the `g', `G', `m', `M', `c', and `s' 21070 COMMANDs. All other COMMANDs are optional. 21071 21072 21073 File: gdb.info, Node: Packets, Next: Stop Reply Packets, Prev: Overview, Up: Remote Protocol 21074 21075 D.2 Packets 21076 =========== 21077 21078 The following table provides a complete list of all currently defined 21079 COMMANDs and their corresponding response DATA. *Note File-I/O remote 21080 protocol extension::, for details about the File I/O extension of the 21081 remote protocol. 21082 21083 Each packet's description has a template showing the packet's overall 21084 syntax, followed by an explanation of the packet's meaning. We include 21085 spaces in some of the templates for clarity; these are not part of the 21086 packet's syntax. No GDB packet uses spaces to separate its components. 21087 For example, a template like `foo BAR BAZ' describes a packet 21088 beginning with the three ASCII bytes `foo', followed by a BAR, followed 21089 directly by a BAZ. GDB does not transmit a space character between the 21090 `foo' and the BAR, or between the BAR and the BAZ. 21091 21092 Note that all packet forms beginning with an upper- or lower-case 21093 letter, other than those described here, are reserved for future use. 21094 21095 Here are the packet descriptions. 21096 21097 `!' 21098 Enable extended mode. In extended mode, the remote server is made 21099 persistent. The `R' packet is used to restart the program being 21100 debugged. 21101 21102 Reply: 21103 `OK' 21104 The remote target both supports and has enabled extended mode. 21105 21106 `?' 21107 Indicate the reason the target halted. The reply is the same as 21108 for step and continue. 21109 21110 Reply: *Note Stop Reply Packets::, for the reply specifications. 21111 21112 `A ARGLEN,ARGNUM,ARG,...' 21113 Initialized `argv[]' array passed into program. ARGLEN specifies 21114 the number of bytes in the hex encoded byte stream ARG. See 21115 `gdbserver' for more details. 21116 21117 Reply: 21118 `OK' 21119 The arguments were set. 21120 21121 `E NN' 21122 An error occurred. 21123 21124 `b BAUD' 21125 (Don't use this packet; its behavior is not well-defined.) Change 21126 the serial line speed to BAUD. 21127 21128 JTC: _When does the transport layer state change? When it's 21129 received, or after the ACK is transmitted. In either case, there 21130 are problems if the command or the acknowledgment packet is 21131 dropped._ 21132 21133 Stan: _If people really wanted to add something like this, and get 21134 it working for the first time, they ought to modify ser-unix.c to 21135 send some kind of out-of-band message to a specially-setup stub 21136 and have the switch happen "in between" packets, so that from 21137 remote protocol's point of view, nothing actually happened._ 21138 21139 `B ADDR,MODE' 21140 Set (MODE is `S') or clear (MODE is `C') a breakpoint at ADDR. 21141 21142 Don't use this packet. Use the `Z' and `z' packets instead (*note 21143 insert breakpoint or watchpoint packet::). 21144 21145 `c [ADDR]' 21146 Continue. ADDR is address to resume. If ADDR is omitted, resume 21147 at current address. 21148 21149 Reply: *Note Stop Reply Packets::, for the reply specifications. 21150 21151 `C SIG[;ADDR]' 21152 Continue with signal SIG (hex signal number). If `;ADDR' is 21153 omitted, resume at same address. 21154 21155 Reply: *Note Stop Reply Packets::, for the reply specifications. 21156 21157 `d' 21158 Toggle debug flag. 21159 21160 Don't use this packet; instead, define a general set packet (*note 21161 General Query Packets::). 21162 21163 `D' 21164 Detach GDB from the remote system. Sent to the remote target 21165 before GDB disconnects via the `detach' command. 21166 21167 Reply: 21168 `OK' 21169 for success 21170 21171 `E NN' 21172 for an error 21173 21174 `F RC,EE,CF;XX' 21175 A reply from GDB to an `F' packet sent by the target. This is 21176 part of the File-I/O protocol extension. *Note File-I/O remote 21177 protocol extension::, for the specification. 21178 21179 `g' 21180 Read general registers. 21181 21182 Reply: 21183 `XX...' 21184 Each byte of register data is described by two hex digits. 21185 The bytes with the register are transmitted in target byte 21186 order. The size of each register and their position within 21187 the `g' packet are determined by the GDB internal macros 21188 `DEPRECATED_REGISTER_RAW_SIZE' and `REGISTER_NAME' macros. 21189 The specification of several standard `g' packets is 21190 specified below. 21191 21192 `E NN' 21193 for an error. 21194 21195 `G XX...' 21196 Write general registers. *Note read registers packet::, for a 21197 description of the XX... data. 21198 21199 Reply: 21200 `OK' 21201 for success 21202 21203 `E NN' 21204 for an error 21205 21206 `H C T' 21207 Set thread for subsequent operations (`m', `M', `g', `G', et.al.). 21208 C depends on the operation to be performed: it should be `c' for 21209 step and continue operations, `g' for other operations. The 21210 thread designator T may be `-1', meaning all the threads, a thread 21211 number, or `0' which means pick any thread. 21212 21213 Reply: 21214 `OK' 21215 for success 21216 21217 `E NN' 21218 for an error 21219 21220 `i [ADDR[,NNN]]' 21221 Step the remote target by a single clock cycle. If `,NNN' is 21222 present, cycle step NNN cycles. If ADDR is present, cycle step 21223 starting at that address. 21224 21225 `I' 21226 Signal, then cycle step. *Note step with signal packet::. *Note 21227 cycle step packet::. 21228 21229 `k' 21230 Kill request. 21231 21232 FIXME: _There is no description of how to operate when a specific 21233 thread context has been selected (i.e. does 'k' kill only that 21234 thread?)_. 21235 21236 `m ADDR,LENGTH' 21237 Read LENGTH bytes of memory starting at address ADDR. Note that 21238 ADDR may not be aligned to any particular boundary. 21239 21240 The stub need not use any particular size or alignment when 21241 gathering data from memory for the response; even if ADDR is 21242 word-aligned and LENGTH is a multiple of the word size, the stub 21243 is free to use byte accesses, or not. For this reason, this 21244 packet may not be suitable for accessing memory-mapped I/O devices. 21245 21246 Reply: 21247 `XX...' 21248 Memory contents; each byte is transmitted as a two-digit 21249 hexadecimal number. The reply may contain fewer bytes than 21250 requested if the server was able to read only part of the 21251 region of memory. 21252 21253 `E NN' 21254 NN is errno 21255 21256 `M ADDR,LENGTH:XX...' 21257 Write LENGTH bytes of memory starting at address ADDR. XX... is 21258 the data; each byte is transmitted as a two-digit hexadecimal 21259 number. 21260 21261 Reply: 21262 `OK' 21263 for success 21264 21265 `E NN' 21266 for an error (this includes the case where only part of the 21267 data was written). 21268 21269 `p N' 21270 Read the value of register N; N is in hex. *Note read registers 21271 packet::, for a description of how the returned register value is 21272 encoded. 21273 21274 Reply: 21275 `XX...' 21276 the register's value 21277 21278 `E NN' 21279 for an error 21280 21281 `' 21282 Indicating an unrecognized QUERY. 21283 21284 `P N...=R...' 21285 Write register N... with value R.... The register number N is in 21286 hexadecimal, and R... contains two hex digits for each byte in the 21287 register (target byte order). 21288 21289 Reply: 21290 `OK' 21291 for success 21292 21293 `E NN' 21294 for an error 21295 21296 `q NAME PARAMS...' 21297 `Q NAME PARAMS...' 21298 General query (`q') and set (`Q'). These packets are described 21299 fully in *Note General Query Packets::. 21300 21301 `r' 21302 Reset the entire system. 21303 21304 Don't use this packet; use the `R' packet instead. 21305 21306 `R XX' 21307 Restart the program being debugged. XX, while needed, is ignored. 21308 This packet is only available in extended mode. 21309 21310 The `R' packet has no reply. 21311 21312 `s [ADDR]' 21313 Single step. ADDR is the address at which to resume. If ADDR is 21314 omitted, resume at same address. 21315 21316 Reply: *Note Stop Reply Packets::, for the reply specifications. 21317 21318 `S SIG[;ADDR]' 21319 Step with signal. This is analogous to the `C' packet, but 21320 requests a single-step, rather than a normal resumption of 21321 execution. 21322 21323 Reply: *Note Stop Reply Packets::, for the reply specifications. 21324 21325 `t ADDR:PP,MM' 21326 Search backwards starting at address ADDR for a match with pattern 21327 PP and mask MM. PP and MM are 4 bytes. ADDR must be at least 3 21328 digits. 21329 21330 `T XX' 21331 Find out if the thread XX is alive. 21332 21333 Reply: 21334 `OK' 21335 thread is still alive 21336 21337 `E NN' 21338 thread is dead 21339 21340 `v' 21341 Packets starting with `v' are identified by a multi-letter name, 21342 up to the first `;' or `?' (or the end of the packet). 21343 21344 `vCont[;ACTION[:TID]]...' 21345 Resume the inferior, specifying different actions for each thread. 21346 If an action is specified with no TID, then it is applied to any 21347 threads that don't have a specific action specified; if no default 21348 action is specified then other threads should remain stopped. 21349 Specifying multiple default actions is an error; specifying no 21350 actions is also an error. Thread IDs are specified in 21351 hexadecimal. Currently supported actions are: 21352 21353 `c' 21354 Continue. 21355 21356 `C SIG' 21357 Continue with signal SIG. SIG should be two hex digits. 21358 21359 `s' 21360 Step. 21361 21362 `S SIG' 21363 Step with signal SIG. SIG should be two hex digits. 21364 21365 The optional ADDR argument normally associated with these packets 21366 is not supported in `vCont'. 21367 21368 Reply: *Note Stop Reply Packets::, for the reply specifications. 21369 21370 `vCont?' 21371 Request a list of actions supporetd by the `vCont' packet. 21372 21373 Reply: 21374 `vCont[;ACTION...]' 21375 The `vCont' packet is supported. Each ACTION is a supported 21376 command in the `vCont' packet. 21377 21378 `' 21379 The `vCont' packet is not supported. 21380 21381 `vFlashErase:ADDR,LENGTH' 21382 Direct the stub to erase LENGTH bytes of flash starting at ADDR. 21383 The region may enclose any number of flash blocks, but its start 21384 and end must fall on block boundaries, as indicated by the flash 21385 block size appearing in the memory map (*note Memory map 21386 format::). GDB groups flash memory programming operations 21387 together, and sends a `vFlashDone' request after each group; the 21388 stub is allowed to delay erase operation until the `vFlashDone' 21389 packet is received. 21390 21391 Reply: 21392 `OK' 21393 for success 21394 21395 `E NN' 21396 for an error 21397 21398 `vFlashWrite:ADDR:XX...' 21399 Direct the stub to write data to flash address ADDR. The data is 21400 passed in binary form using the same encoding as for the `X' 21401 packet (*note Binary Data::). The memory ranges specified by 21402 `vFlashWrite' packets preceding a `vFlashDone' packet must not 21403 overlap, and must appear in order of increasing addresses 21404 (although `vFlashErase' packets for higher addresses may already 21405 have been received; the ordering is guaranteed only between 21406 `vFlashWrite' packets). If a packet writes to an address that was 21407 neither erased by a preceding `vFlashErase' packet nor by some 21408 other target-specific method, the results are unpredictable. 21409 21410 Reply: 21411 `OK' 21412 for success 21413 21414 `E.memtype' 21415 for vFlashWrite addressing non-flash memory 21416 21417 `E NN' 21418 for an error 21419 21420 `vFlashDone' 21421 Indicate to the stub that flash programming operation is finished. 21422 The stub is permitted to delay or batch the effects of a group of 21423 `vFlashErase' and `vFlashWrite' packets until a `vFlashDone' 21424 packet is received. The contents of the affected regions of flash 21425 memory are unpredictable until the `vFlashDone' request is 21426 completed. 21427 21428 `X ADDR,LENGTH:XX...' 21429 Write data to memory, where the data is transmitted in binary. 21430 ADDR is address, LENGTH is number of bytes, `XX...' is binary data 21431 (*note Binary Data::). 21432 21433 Reply: 21434 `OK' 21435 for success 21436 21437 `E NN' 21438 for an error 21439 21440 `z TYPE,ADDR,LENGTH' 21441 `Z TYPE,ADDR,LENGTH' 21442 Insert (`Z') or remove (`z') a TYPE breakpoint or watchpoint 21443 starting at address ADDRESS and covering the next LENGTH bytes. 21444 21445 Each breakpoint and watchpoint packet TYPE is documented 21446 separately. 21447 21448 _Implementation notes: A remote target shall return an empty string 21449 for an unrecognized breakpoint or watchpoint packet TYPE. A 21450 remote target shall support either both or neither of a given 21451 `ZTYPE...' and `zTYPE...' packet pair. To avoid potential 21452 problems with duplicate packets, the operations should be 21453 implemented in an idempotent way._ 21454 21455 `z0,ADDR,LENGTH' 21456 `Z0,ADDR,LENGTH' 21457 Insert (`Z0') or remove (`z0') a memory breakpoint at address ADDR 21458 of size LENGTH. 21459 21460 A memory breakpoint is implemented by replacing the instruction at 21461 ADDR with a software breakpoint or trap instruction. The LENGTH 21462 is used by targets that indicates the size of the breakpoint (in 21463 bytes) that should be inserted (e.g., the ARM and MIPS can insert 21464 either a 2 or 4 byte breakpoint). 21465 21466 _Implementation note: It is possible for a target to copy or move 21467 code that contains memory breakpoints (e.g., when implementing 21468 overlays). The behavior of this packet, in the presence of such a 21469 target, is not defined._ 21470 21471 Reply: 21472 `OK' 21473 success 21474 21475 `' 21476 not supported 21477 21478 `E NN' 21479 for an error 21480 21481 `z1,ADDR,LENGTH' 21482 `Z1,ADDR,LENGTH' 21483 Insert (`Z1') or remove (`z1') a hardware breakpoint at address 21484 ADDR of size LENGTH. 21485 21486 A hardware breakpoint is implemented using a mechanism that is not 21487 dependant on being able to modify the target's memory. 21488 21489 _Implementation note: A hardware breakpoint is not affected by code 21490 movement._ 21491 21492 Reply: 21493 `OK' 21494 success 21495 21496 `' 21497 not supported 21498 21499 `E NN' 21500 for an error 21501 21502 `z2,ADDR,LENGTH' 21503 `Z2,ADDR,LENGTH' 21504 Insert (`Z2') or remove (`z2') a write watchpoint. 21505 21506 Reply: 21507 `OK' 21508 success 21509 21510 `' 21511 not supported 21512 21513 `E NN' 21514 for an error 21515 21516 `z3,ADDR,LENGTH' 21517 `Z3,ADDR,LENGTH' 21518 Insert (`Z3') or remove (`z3') a read watchpoint. 21519 21520 Reply: 21521 `OK' 21522 success 21523 21524 `' 21525 not supported 21526 21527 `E NN' 21528 for an error 21529 21530 `z4,ADDR,LENGTH' 21531 `Z4,ADDR,LENGTH' 21532 Insert (`Z4') or remove (`z4') an access watchpoint. 21533 21534 Reply: 21535 `OK' 21536 success 21537 21538 `' 21539 not supported 21540 21541 `E NN' 21542 for an error 21543 21544 21545 21546 File: gdb.info, Node: Stop Reply Packets, Next: General Query Packets, Prev: Packets, Up: Remote Protocol 21547 21548 D.3 Stop Reply Packets 21549 ====================== 21550 21551 The `C', `c', `S', `s' and `?' packets can receive any of the below as 21552 a reply. In the case of the `C', `c', `S' and `s' packets, that reply 21553 is only returned when the target halts. In the below the exact meaning 21554 of "signal number" is poorly defined. In general one of the UNIX signal 21555 numbering conventions is used. 21556 21557 As in the description of request packets, we include spaces in the 21558 reply templates for clarity; these are not part of the reply packet's 21559 syntax. No GDB stop reply packet uses spaces to separate its 21560 components. 21561 21562 `S AA' 21563 The program received signal number AA (a two-digit hexadecimal 21564 number). This is equivalent to a `T' response with no N:R pairs. 21565 21566 `T AA N1:R1;N2:R2;...' 21567 The program received signal number AA (a two-digit hexadecimal 21568 number). This is equivalent to an `S' response, except that the 21569 `N:R' pairs can carry values of important registers and other 21570 information directly in the stop reply packet, reducing round-trip 21571 latency. Single-step and breakpoint traps are reported this way. 21572 Each `N:R' pair is interpreted as follows: 21573 1. If N is a hexadecimal number, it is a register number, and the 21574 corresponding R gives that register's value. R is a series 21575 of bytes in target byte order, with each byte given by a 21576 two-digit hex number. 21577 21578 2. If N is `thread', then R is the thread process ID, in hex. 21579 21580 3. If N is `watch', `rwatch', or `awatch', then the packet 21581 indicates a watchpoint hit, and R is the data address, in hex. 21582 21583 4. Otherwise, GDB should ignore this `N:R' pair and go on to the 21584 next; this allows us to extend the protocol in the future. 21585 21586 `W AA' 21587 The process exited, and AA is the exit status. This is only 21588 applicable to certain targets. 21589 21590 `X AA' 21591 The process terminated with signal AA. 21592 21593 `O XX...' 21594 `XX...' is hex encoding of ASCII data, to be written as the 21595 program's console output. This can happen at any time while the 21596 program is running and the debugger should continue to wait for 21597 `W', `T', etc. 21598 21599 `F CALL-ID,PARAMETER...' 21600 CALL-ID is the identifier which says which host system call should 21601 be called. This is just the name of the function. Translation 21602 into the correct system call is only applicable as it's defined in 21603 GDB. *Note File-I/O remote protocol extension::, for a list of 21604 implemented system calls. 21605 21606 `PARAMETER...' is a list of parameters as defined for this very 21607 system call. 21608 21609 The target replies with this packet when it expects GDB to call a 21610 host system call on behalf of the target. GDB replies with an 21611 appropriate `F' packet and keeps up waiting for the next reply 21612 packet from the target. The latest `C', `c', `S' or `s' action is 21613 expected to be continued. *Note File-I/O remote protocol 21614 extension::, for more details. 21615 21616 21617 21618 File: gdb.info, Node: General Query Packets, Next: Register Packet Format, Prev: Stop Reply Packets, Up: Remote Protocol 21619 21620 D.4 General Query Packets 21621 ========================= 21622 21623 Packets starting with `q' are "general query packets"; packets starting 21624 with `Q' are "general set packets". General query and set packets are 21625 a semi-unified form for retrieving and sending information to and from 21626 the stub. 21627 21628 The initial letter of a query or set packet is followed by a name 21629 indicating what sort of thing the packet applies to. For example, GDB 21630 may use a `qSymbol' packet to exchange symbol definitions with the 21631 stub. These packet names follow some conventions: 21632 21633 * The name must not contain commas, colons or semicolons. 21634 21635 * Most GDB query and set packets have a leading upper case letter. 21636 21637 * The names of custom vendor packets should use a company prefix, in 21638 lower case, followed by a period. For example, packets designed at 21639 the Acme Corporation might begin with `qacme.foo' (for querying 21640 foos) or `Qacme.bar' (for setting bars). 21641 21642 The name of a query or set packet should be separated from any 21643 parameters by a `:'; the parameters themselves should be separated by 21644 `,' or `;'. Stubs must be careful to match the full packet name, and 21645 check for a separator or the end of the packet, in case two packet 21646 names share a common prefix. New packets should not begin with `qC', 21647 `qP', or `qL'(1). 21648 21649 Like the descriptions of the other packets, each description here 21650 has a template showing the packet's overall syntax, followed by an 21651 explanation of the packet's meaning. We include spaces in some of the 21652 templates for clarity; these are not part of the packet's syntax. No 21653 GDB packet uses spaces to separate its components. 21654 21655 Here are the currently defined query and set packets: 21656 21657 `qC' 21658 Return the current thread id. 21659 21660 Reply: 21661 `QC PID' 21662 Where PID is an unsigned hexadecimal process id. 21663 21664 `(anything else)' 21665 Any other reply implies the old pid. 21666 21667 `qCRC:ADDR,LENGTH' 21668 Compute the CRC checksum of a block of memory. Reply: 21669 `E NN' 21670 An error (such as memory fault) 21671 21672 `C CRC32' 21673 The specified memory region's checksum is CRC32. 21674 21675 `qfThreadInfo' 21676 `qsThreadInfo' 21677 Obtain a list of all active thread ids from the target (OS). 21678 Since there may be too many active threads to fit into one reply 21679 packet, this query works iteratively: it may require more than one 21680 query/reply sequence to obtain the entire list of threads. The 21681 first query of the sequence will be the `qfThreadInfo' query; 21682 subsequent queries in the sequence will be the `qsThreadInfo' 21683 query. 21684 21685 NOTE: This packet replaces the `qL' query (see below). 21686 21687 Reply: 21688 `m ID' 21689 A single thread id 21690 21691 `m ID,ID...' 21692 a comma-separated list of thread ids 21693 21694 `l' 21695 (lower case letter `L') denotes end of list. 21696 21697 In response to each query, the target will reply with a list of 21698 one or more thread ids, in big-endian unsigned hex, separated by 21699 commas. GDB will respond to each reply with a request for more 21700 thread ids (using the `qs' form of the query), until the target 21701 responds with `l' (lower-case el, for "last"). 21702 21703 `qGetTLSAddr:THREAD-ID,OFFSET,LM' 21704 Fetch the address associated with thread local storage specified 21705 by THREAD-ID, OFFSET, and LM. 21706 21707 THREAD-ID is the (big endian, hex encoded) thread id associated 21708 with the thread for which to fetch the TLS address. 21709 21710 OFFSET is the (big endian, hex encoded) offset associated with the 21711 thread local variable. (This offset is obtained from the debug 21712 information associated with the variable.) 21713 21714 LM is the (big endian, hex encoded) OS/ABI specific encoding of the 21715 the load module associated with the thread local storage. For 21716 example, a GNU/Linux system will pass the link map address of the 21717 shared object associated with the thread local storage under 21718 consideration. Other operating environments may choose to 21719 represent the load module differently, so the precise meaning of 21720 this parameter will vary. 21721 21722 Reply: 21723 `XX...' 21724 Hex encoded (big endian) bytes representing the address of 21725 the thread local storage requested. 21726 21727 `E NN' 21728 An error occurred. NN are hex digits. 21729 21730 `' 21731 An empty reply indicates that `qGetTLSAddr' is not supported 21732 by the stub. 21733 21734 `qL STARTFLAG THREADCOUNT NEXTTHREAD' 21735 Obtain thread information from RTOS. Where: STARTFLAG (one hex 21736 digit) is one to indicate the first query and zero to indicate a 21737 subsequent query; THREADCOUNT (two hex digits) is the maximum 21738 number of threads the response packet can contain; and NEXTTHREAD 21739 (eight hex digits), for subsequent queries (STARTFLAG is zero), is 21740 returned in the response as ARGTHREAD. 21741 21742 Don't use this packet; use the `qfThreadInfo' query instead (see 21743 above). 21744 21745 Reply: 21746 `qM COUNT DONE ARGTHREAD THREAD...' 21747 Where: COUNT (two hex digits) is the number of threads being 21748 returned; DONE (one hex digit) is zero to indicate more 21749 threads and one indicates no further threads; ARGTHREADID 21750 (eight hex digits) is NEXTTHREAD from the request packet; 21751 THREAD... is a sequence of thread IDs from the target. 21752 THREADID (eight hex digits). See 21753 `remote.c:parse_threadlist_response()'. 21754 21755 `qOffsets' 21756 Get section offsets that the target used when re-locating the 21757 downloaded image. _Note: while a `Bss' offset is included in the 21758 response, GDB ignores this and instead applies the `Data' offset 21759 to the `Bss' section._ 21760 21761 Reply: 21762 `Text=XXX;Data=YYY;Bss=ZZZ' 21763 21764 `qP MODE THREADID' 21765 Returns information on THREADID. Where: MODE is a hex encoded 32 21766 bit mode; THREADID is a hex encoded 64 bit thread ID. 21767 21768 Don't use this packet; use the `qThreadExtraInfo' query instead 21769 (see below). 21770 21771 Reply: see `remote.c:remote_unpack_thread_info_response()'. 21772 21773 `qRcmd,COMMAND' 21774 COMMAND (hex encoded) is passed to the local interpreter for 21775 execution. Invalid commands should be reported using the output 21776 string. Before the final result packet, the target may also 21777 respond with a number of intermediate `OOUTPUT' console output 21778 packets. _Implementors should note that providing access to a 21779 stubs's interpreter may have security implications_. 21780 21781 Reply: 21782 `OK' 21783 A command response with no output. 21784 21785 `OUTPUT' 21786 A command response with the hex encoded output string OUTPUT. 21787 21788 `E NN' 21789 Indicate a badly formed request. 21790 21791 `' 21792 An empty reply indicates that `qRcmd' is not recognized. 21793 21794 (Note that the `qRcmd' packet's name is separated from the command 21795 by a `,', not a `:', contrary to the naming conventions above. 21796 Please don't use this packet as a model for new packets.) 21797 21798 `qSupported [:GDBFEATURE [;GDBFEATURE]... ]' 21799 Tell the remote stub about features supported by GDB, and query 21800 the stub for features it supports. This packet allows GDB and the 21801 remote stub to take advantage of each others' features. 21802 `qSupported' also consolidates multiple feature probes at startup, 21803 to improve GDB performance--a single larger packet performs better 21804 than multiple smaller probe packets on high-latency links. Some 21805 features may enable behavior which must not be on by default, e.g. 21806 because it would confuse older clients or stubs. Other features 21807 may describe packets which could be automatically probed for, but 21808 are not. These features must be reported before GDB will use 21809 them. This "default unsupported" behavior is not appropriate for 21810 all packets, but it helps to keep the initial connection time 21811 under control with new versions of GDB which support increasing 21812 numbers of packets. 21813 21814 Reply: 21815 `STUBFEATURE [;STUBFEATURE]...' 21816 The stub supports or does not support each returned 21817 STUBFEATURE, depending on the form of each STUBFEATURE (see 21818 below for the possible forms). 21819 21820 `' 21821 An empty reply indicates that `qSupported' is not recognized, 21822 or that no features needed to be reported to GDB. 21823 21824 The allowed forms for each feature (either a GDBFEATURE in the 21825 `qSupported' packet, or a STUBFEATURE in the response) are: 21826 21827 `NAME=VALUE' 21828 The remote protocol feature NAME is supported, and associated 21829 with the specified VALUE. The format of VALUE depends on the 21830 feature, but it must not include a semicolon. 21831 21832 `NAME+' 21833 The remote protocol feature NAME is supported, and does not 21834 need an associated value. 21835 21836 `NAME-' 21837 The remote protocol feature NAME is not supported. 21838 21839 `NAME?' 21840 The remote protocol feature NAME may be supported, and GDB 21841 should auto-detect support in some other way when it is 21842 needed. This form will not be used for GDBFEATURE 21843 notifications, but may be used for STUBFEATURE responses. 21844 21845 Whenever the stub receives a `qSupported' request, the supplied 21846 set of GDB features should override any previous request. This 21847 allows GDB to put the stub in a known state, even if the stub had 21848 previously been communicating with a different version of GDB. 21849 21850 No values of GDBFEATURE (for the packet sent by GDB) are defined 21851 yet. Stubs should ignore any unknown values for GDBFEATURE. Any 21852 GDB which sends a `qSupported' packet supports receiving packets 21853 of unlimited length (earlier versions of GDB may reject overly 21854 long responses). Values for GDBFEATURE may be defined in the 21855 future to let the stub take advantage of new features in GDB, e.g. 21856 incompatible improvements in the remote protocol--support for 21857 unlimited length responses would be a GDBFEATURE example, if it 21858 were not implied by the `qSupported' query. The stub's reply 21859 should be independent of the GDBFEATURE entries sent by GDB; first 21860 GDB describes all the features it supports, and then the stub 21861 replies with all the features it supports. 21862 21863 Similarly, GDB will silently ignore unrecognized stub feature 21864 responses, as long as each response uses one of the standard forms. 21865 21866 Some features are flags. A stub which supports a flag feature 21867 should respond with a `+' form response. Other features require 21868 values, and the stub should respond with an `=' form response. 21869 21870 Each feature has a default value, which GDB will use if 21871 `qSupported' is not available or if the feature is not mentioned 21872 in the `qSupported' response. The default values are fixed; a 21873 stub is free to omit any feature responses that match the defaults. 21874 21875 Not all features can be probed, but for those which can, the 21876 probing mechanism is useful: in some cases, a stub's internal 21877 architecture may not allow the protocol layer to know some 21878 information about the underlying target in advance. This is 21879 especially common in stubs which may be configured for multiple 21880 targets. 21881 21882 These are the currently defined stub features and their properties: 21883 21884 Feature Name Value Default Probe Allowed 21885 Required 21886 `PacketSize' Yes `-' No 21887 `qXfer:auxv:read' No `-' Yes 21888 `qXfer:memory-map:read'No `-' Yes 21889 21890 These are the currently defined stub features, in more detail: 21891 21892 `PacketSize=BYTES' 21893 The remote stub can accept packets up to at least BYTES in 21894 length. GDB will send packets up to this size for bulk 21895 transfers, and will never send larger packets. This is a 21896 limit on the data characters in the packet, including the 21897 frame and checksum. There is no trailing NUL byte in a 21898 remote protocol packet; if the stub stores packets in a 21899 NUL-terminated format, it should allow an extra byte in its 21900 buffer for the NUL. If this stub feature is not supported, 21901 GDB guesses based on the size of the `g' packet response. 21902 21903 `qXfer:auxv:read' 21904 The remote stub understands the `qXfer:auxv:read' packet 21905 (*note qXfer auxiliary vector read::). 21906 21907 21908 `qSymbol::' 21909 Notify the target that GDB is prepared to serve symbol lookup 21910 requests. Accept requests from the target for the values of 21911 symbols. 21912 21913 Reply: 21914 `OK' 21915 The target does not need to look up any (more) symbols. 21916 21917 `qSymbol:SYM_NAME' 21918 The target requests the value of symbol SYM_NAME (hex 21919 encoded). GDB may provide the value by using the 21920 `qSymbol:SYM_VALUE:SYM_NAME' message, described below. 21921 21922 `qSymbol:SYM_VALUE:SYM_NAME' 21923 Set the value of SYM_NAME to SYM_VALUE. 21924 21925 SYM_NAME (hex encoded) is the name of a symbol whose value the 21926 target has previously requested. 21927 21928 SYM_VALUE (hex) is the value for symbol SYM_NAME. If GDB cannot 21929 supply a value for SYM_NAME, then this field will be empty. 21930 21931 Reply: 21932 `OK' 21933 The target does not need to look up any (more) symbols. 21934 21935 `qSymbol:SYM_NAME' 21936 The target requests the value of a new symbol SYM_NAME (hex 21937 encoded). GDB will continue to supply the values of symbols 21938 (if available), until the target ceases to request them. 21939 21940 `QTDP' 21941 `QTFrame' 21942 *Note Tracepoint Packets::. 21943 21944 `qThreadExtraInfo,ID' 21945 Obtain a printable string description of a thread's attributes from 21946 the target OS. ID is a thread-id in big-endian hex. This string 21947 may contain anything that the target OS thinks is interesting for 21948 GDB to tell the user about the thread. The string is displayed in 21949 GDB's `info threads' display. Some examples of possible thread 21950 extra info strings are `Runnable', or `Blocked on Mutex'. 21951 21952 Reply: 21953 `XX...' 21954 Where `XX...' is a hex encoding of ASCII data, comprising the 21955 printable string containing the extra information about the 21956 thread's attributes. 21957 21958 (Note that the `qThreadExtraInfo' packet's name is separated from 21959 the command by a `,', not a `:', contrary to the naming 21960 conventions above. Please don't use this packet as a model for new 21961 packets.) 21962 21963 `QTStart' 21964 `QTStop' 21965 `QTinit' 21966 `QTro' 21967 `qTStatus' 21968 *Note Tracepoint Packets::. 21969 21970 `qXfer:OBJECT:read:ANNEX:OFFSET,LENGTH' 21971 Read uninterpreted bytes from the target's special data area 21972 identified by the keyword OBJECT. Request LENGTH bytes starting 21973 at OFFSET bytes into the data. The content and encoding of ANNEX 21974 is specific to the object; it can supply additional details about 21975 what data to access. 21976 21977 Here are the specific requests of this form defined so far. All 21978 `qXfer:OBJECT:read:...' requests use the same reply formats, 21979 listed below. 21980 21981 `qXfer:auxv:read::OFFSET,LENGTH' 21982 Access the target's "auxiliary vector". *Note auxiliary 21983 vector: OS Information. Note ANNEX must be empty. 21984 21985 This packet is not probed by default; the remote stub must 21986 request it, by suppling an appropriate `qSupported' response 21987 (*note qSupported::). 21988 21989 `qXfer:memory-map:read::OFFSET,LENGTH' 21990 Access the target's "memory-map". *Note Memory map format::. 21991 The annex part of the generic `qXfer' packet must be empty 21992 (*note qXfer read::). 21993 21994 This packet is not probed by default; the remote stub must 21995 request it, by supplying an appropriate `qSupported' response 21996 (*note qSupported::). 21997 21998 Reply: 21999 `m DATA' 22000 Data DATA (*note Binary Data::) has been read from the 22001 target. There may be more data at a higher address (although 22002 it is permitted to return `m' even for the last valid block 22003 of data, as long as at least one byte of data was read). 22004 DATA may have fewer bytes than the LENGTH in the request. 22005 22006 `l DATA' 22007 Data DATA (*note Binary Data::) has been read from the target. 22008 There is no more data to be read. DATA may have fewer bytes 22009 than the LENGTH in the request. 22010 22011 `l' 22012 The OFFSET in the request is at the end of the data. There 22013 is no more data to be read. 22014 22015 `E00' 22016 The request was malformed, or ANNEX was invalid. 22017 22018 `E NN' 22019 The offset was invalid, or there was an error encountered 22020 reading the data. NN is a hex-encoded `errno' value. 22021 22022 `' 22023 An empty reply indicates the OBJECT string was not recognized 22024 by the stub, or that the object does not support reading. 22025 22026 `qXfer:OBJECT:write:ANNEX:OFFSET:DATA...' 22027 Write uninterpreted bytes into the target's special data area 22028 identified by the keyword OBJECT, starting at OFFSET bytes into 22029 the data. `DATA...' is the binary-encoded data (*note Binary 22030 Data::) to be written. The content and encoding of ANNEX is 22031 specific to the object; it can supply additional details about 22032 what data to access. 22033 22034 No requests of this form are presently in use. This specification 22035 serves as a placeholder to document the common format that new 22036 specific request specifications ought to use. 22037 22038 Reply: 22039 `NN' 22040 NN (hex encoded) is the number of bytes written. This may be 22041 fewer bytes than supplied in the request. 22042 22043 `E00' 22044 The request was malformed, or ANNEX was invalid. 22045 22046 `E NN' 22047 The offset was invalid, or there was an error encountered 22048 writing the data. NN is a hex-encoded `errno' value. 22049 22050 `' 22051 An empty reply indicates the OBJECT string was not recognized 22052 by the stub, or that the object does not support writing. 22053 22054 `qXfer:OBJECT:OPERATION:...' 22055 Requests of this form may be added in the future. When a stub does 22056 not recognize the OBJECT keyword, or its support for OBJECT does 22057 not recognize the OPERATION keyword, the stub must respond with an 22058 empty packet. 22059 22060 22061 ---------- Footnotes ---------- 22062 22063 (1) The `qP' and `qL' packets predate these conventions, and have 22064 arguments without any terminator for the packet name; we suspect they 22065 are in widespread use in places that are difficult to upgrade. The 22066 `qC' packet has no arguments, but some existing stubs (e.g. RedBoot) 22067 are known to not check for the end of the packet. 22068 22069 22070 File: gdb.info, Node: Register Packet Format, Next: Tracepoint Packets, Prev: General Query Packets, Up: Remote Protocol 22071 22072 D.5 Register Packet Format 22073 ========================== 22074 22075 The following `g'/`G' packets have previously been defined. In the 22076 below, some thirty-two bit registers are transferred as sixty-four 22077 bits. Those registers should be zero/sign extended (which?) to fill 22078 the space allocated. Register bytes are transferred in target byte 22079 order. The two nibbles within a register byte are transferred 22080 most-significant - least-significant. 22081 22082 MIPS32 22083 All registers are transferred as thirty-two bit quantities in the 22084 order: 32 general-purpose; sr; lo; hi; bad; cause; pc; 32 22085 floating-point registers; fsr; fir; fp. 22086 22087 MIPS64 22088 All registers are transferred as sixty-four bit quantities 22089 (including thirty-two bit registers such as `sr'). The ordering 22090 is the same as `MIPS32'. 22091 22092 22093 22094 File: gdb.info, Node: Tracepoint Packets, Next: Interrupts, Prev: Register Packet Format, Up: Remote Protocol 22095 22096 D.6 Tracepoint Packets 22097 ====================== 22098 22099 Here we describe the packets GDB uses to implement tracepoints (*note 22100 Tracepoints::). 22101 22102 `QTDP:N:ADDR:ENA:STEP:PASS[-]' 22103 Create a new tracepoint, number N, at ADDR. If ENA is `E', then 22104 the tracepoint is enabled; if it is `D', then the tracepoint is 22105 disabled. STEP is the tracepoint's step count, and PASS is its 22106 pass count. If the trailing `-' is present, further `QTDP' 22107 packets will follow to specify this tracepoint's actions. 22108 22109 Replies: 22110 `OK' 22111 The packet was understood and carried out. 22112 22113 `' 22114 The packet was not recognized. 22115 22116 `QTDP:-N:ADDR:[S]ACTION...[-]' 22117 Define actions to be taken when a tracepoint is hit. N and ADDR 22118 must be the same as in the initial `QTDP' packet for this 22119 tracepoint. This packet may only be sent immediately after 22120 another `QTDP' packet that ended with a `-'. If the trailing `-' 22121 is present, further `QTDP' packets will follow, specifying more 22122 actions for this tracepoint. 22123 22124 In the series of action packets for a given tracepoint, at most one 22125 can have an `S' before its first ACTION. If such a packet is 22126 sent, it and the following packets define "while-stepping" 22127 actions. Any prior packets define ordinary actions -- that is, 22128 those taken when the tracepoint is first hit. If no action packet 22129 has an `S', then all the packets in the series specify ordinary 22130 tracepoint actions. 22131 22132 The `ACTION...' portion of the packet is a series of actions, 22133 concatenated without separators. Each action has one of the 22134 following forms: 22135 22136 `R MASK' 22137 Collect the registers whose bits are set in MASK. MASK is a 22138 hexadecimal number whose I'th bit is set if register number I 22139 should be collected. (The least significant bit is numbered 22140 zero.) Note that MASK may be any number of digits long; it 22141 may not fit in a 32-bit word. 22142 22143 `M BASEREG,OFFSET,LEN' 22144 Collect LEN bytes of memory starting at the address in 22145 register number BASEREG, plus OFFSET. If BASEREG is `-1', 22146 then the range has a fixed address: OFFSET is the address of 22147 the lowest byte to collect. The BASEREG, OFFSET, and LEN 22148 parameters are all unsigned hexadecimal values (the `-1' 22149 value for BASEREG is a special case). 22150 22151 `X LEN,EXPR' 22152 Evaluate EXPR, whose length is LEN, and collect memory as it 22153 directs. EXPR is an agent expression, as described in *Note 22154 Agent Expressions::. Each byte of the expression is encoded 22155 as a two-digit hex number in the packet; LEN is the number of 22156 bytes in the expression (and thus one-half the number of hex 22157 digits in the packet). 22158 22159 22160 Any number of actions may be packed together in a single `QTDP' 22161 packet, as long as the packet does not exceed the maximum packet 22162 length (400 bytes, for many stubs). There may be only one `R' 22163 action per tracepoint, and it must precede any `M' or `X' actions. 22164 Any registers referred to by `M' and `X' actions must be 22165 collected by a preceding `R' action. (The "while-stepping" 22166 actions are treated as if they were attached to a separate 22167 tracepoint, as far as these restrictions are concerned.) 22168 22169 Replies: 22170 `OK' 22171 The packet was understood and carried out. 22172 22173 `' 22174 The packet was not recognized. 22175 22176 `QTFrame:N' 22177 Select the N'th tracepoint frame from the buffer, and use the 22178 register and memory contents recorded there to answer subsequent 22179 request packets from GDB. 22180 22181 A successful reply from the stub indicates that the stub has found 22182 the requested frame. The response is a series of parts, 22183 concatenated without separators, describing the frame we selected. 22184 Each part has one of the following forms: 22185 22186 `F F' 22187 The selected frame is number N in the trace frame buffer; F 22188 is a hexadecimal number. If F is `-1', then there was no 22189 frame matching the criteria in the request packet. 22190 22191 `T T' 22192 The selected trace frame records a hit of tracepoint number T; 22193 T is a hexadecimal number. 22194 22195 22196 `QTFrame:pc:ADDR' 22197 Like `QTFrame:N', but select the first tracepoint frame after the 22198 currently selected frame whose PC is ADDR; ADDR is a hexadecimal 22199 number. 22200 22201 `QTFrame:tdp:T' 22202 Like `QTFrame:N', but select the first tracepoint frame after the 22203 currently selected frame that is a hit of tracepoint T; T is a 22204 hexadecimal number. 22205 22206 `QTFrame:range:START:END' 22207 Like `QTFrame:N', but select the first tracepoint frame after the 22208 currently selected frame whose PC is between START (inclusive) and 22209 END (exclusive); START and END are hexadecimal numbers. 22210 22211 `QTFrame:outside:START:END' 22212 Like `QTFrame:range:START:END', but select the first frame 22213 _outside_ the given range of addresses. 22214 22215 `QTStart' 22216 Begin the tracepoint experiment. Begin collecting data from 22217 tracepoint hits in the trace frame buffer. 22218 22219 `QTStop' 22220 End the tracepoint experiment. Stop collecting trace frames. 22221 22222 `QTinit' 22223 Clear the table of tracepoints, and empty the trace frame buffer. 22224 22225 `QTro:START1,END1:START2,END2:...' 22226 Establish the given ranges of memory as "transparent". The stub 22227 will answer requests for these ranges from memory's current 22228 contents, if they were not collected as part of the tracepoint hit. 22229 22230 GDB uses this to mark read-only regions of memory, like those 22231 containing program code. Since these areas never change, they 22232 should still have the same contents they did when the tracepoint 22233 was hit, so there's no reason for the stub to refuse to provide 22234 their contents. 22235 22236 `qTStatus' 22237 Ask the stub if there is a trace experiment running right now. 22238 22239 Replies: 22240 `T0' 22241 There is no trace experiment running. 22242 22243 `T1' 22244 There is a trace experiment running. 22245 22246 22247 22248 File: gdb.info, Node: Interrupts, Next: Examples, Prev: Tracepoint Packets, Up: Remote Protocol 22249 22250 D.7 Interrupts 22251 ============== 22252 22253 When a program on the remote target is running, GDB may attempt to 22254 interrupt it by sending a `Ctrl-C' or a `BREAK', control of which is 22255 specified via GDB's `remotebreak' setting (*note set remotebreak::). 22256 22257 The precise meaning of `BREAK' is defined by the transport mechanism 22258 and may, in fact, be undefined. GDB does not currently define a 22259 `BREAK' mechanism for any of the network interfaces. 22260 22261 `Ctrl-C', on the other hand, is defined and implemented for all 22262 transport mechanisms. It is represented by sending the single byte 22263 `0x03' without any of the usual packet overhead described in the 22264 Overview section (*note Overview::). When a `0x03' byte is transmitted 22265 as part of a packet, it is considered to be packet data and does _not_ 22266 represent an interrupt. E.g., an `X' packet (*note X packet::), used 22267 for binary downloads, may include an unescaped `0x03' as part of its 22268 packet. 22269 22270 Stubs are not required to recognize these interrupt mechanisms and 22271 the precise meaning associated with receipt of the interrupt is 22272 implementation defined. If the stub is successful at interrupting the 22273 running program, it is expected that it will send one of the Stop Reply 22274 Packets (*note Stop Reply Packets::) to GDB as a result of successfully 22275 stopping the program. Interrupts received while the program is stopped 22276 will be discarded. 22277 22278 22279 File: gdb.info, Node: Examples, Next: File-I/O remote protocol extension, Prev: Interrupts, Up: Remote Protocol 22280 22281 D.8 Examples 22282 ============ 22283 22284 Example sequence of a target being re-started. Notice how the restart 22285 does not get any direct output: 22286 22287 -> `R00' 22288 <- `+' 22289 _target restarts_ 22290 -> `?' 22291 <- `+' 22292 <- `T001:1234123412341234' 22293 -> `+' 22294 22295 Example sequence of a target being stepped by a single instruction: 22296 22297 -> `G1445...' 22298 <- `+' 22299 -> `s' 22300 <- `+' 22301 _time passes_ 22302 <- `T001:1234123412341234' 22303 -> `+' 22304 -> `g' 22305 <- `+' 22306 <- `1455...' 22307 -> `+' 22308 22309 22310 File: gdb.info, Node: File-I/O remote protocol extension, Next: Memory map format, Prev: Examples, Up: Remote Protocol 22311 22312 D.9 File-I/O remote protocol extension 22313 ====================================== 22314 22315 * Menu: 22316 22317 * File-I/O Overview:: 22318 * Protocol basics:: 22319 * The F request packet:: 22320 * The F reply packet:: 22321 * The Ctrl-C message:: 22322 * Console I/O:: 22323 * List of supported calls:: 22324 * Protocol specific representation of datatypes:: 22325 * Constants:: 22326 * File-I/O Examples:: 22327 22328 22329 File: gdb.info, Node: File-I/O Overview, Next: Protocol basics, Up: File-I/O remote protocol extension 22330 22331 D.9.1 File-I/O Overview 22332 ----------------------- 22333 22334 The "File I/O remote protocol extension" (short: File-I/O) allows the 22335 target to use the host's file system and console I/O to perform various 22336 system calls. System calls on the target system are translated into a 22337 remote protocol packet to the host system, which then performs the 22338 needed actions and returns a response packet to the target system. 22339 This simulates file system operations even on targets that lack file 22340 systems. 22341 22342 The protocol is defined to be independent of both the host and 22343 target systems. It uses its own internal representation of datatypes 22344 and values. Both GDB and the target's GDB stub are responsible for 22345 translating the system-dependent value representations into the internal 22346 protocol representations when data is transmitted. 22347 22348 The communication is synchronous. A system call is possible only 22349 when GDB is waiting for a response from the `C', `c', `S' or `s' 22350 packets. While GDB handles the request for a system call, the target 22351 is stopped to allow deterministic access to the target's memory. 22352 Therefore File-I/O is not interruptible by target signals. On the 22353 other hand, it is possible to interrupt File-I/O by a user interrupt 22354 (`Ctrl-C') within GDB. 22355 22356 The target's request to perform a host system call does not finish 22357 the latest `C', `c', `S' or `s' action. That means, after finishing 22358 the system call, the target returns to continuing the previous activity 22359 (continue, step). No additional continue or step request from GDB is 22360 required. 22361 22362 (gdb) continue 22363 <- target requests 'system call X' 22364 target is stopped, GDB executes system call 22365 -> GDB returns result 22366 ... target continues, GDB returns to wait for the target 22367 <- target hits breakpoint and sends a Txx packet 22368 22369 The protocol only supports I/O on the console and to regular files on 22370 the host file system. Character or block special devices, pipes, named 22371 pipes, sockets or any other communication method on the host system are 22372 not supported by this protocol. 22373 22374 22375 File: gdb.info, Node: Protocol basics, Next: The F request packet, Prev: File-I/O Overview, Up: File-I/O remote protocol extension 22376 22377 D.9.2 Protocol basics 22378 --------------------- 22379 22380 The File-I/O protocol uses the `F' packet as the request as well as 22381 reply packet. Since a File-I/O system call can only occur when GDB is 22382 waiting for a response from the continuing or stepping target, the 22383 File-I/O request is a reply that GDB has to expect as a result of a 22384 previous `C', `c', `S' or `s' packet. This `F' packet contains all 22385 information needed to allow GDB to call the appropriate host system 22386 call: 22387 22388 * A unique identifier for the requested system call. 22389 22390 * All parameters to the system call. Pointers are given as addresses 22391 in the target memory address space. Pointers to strings are given 22392 as pointer/length pair. Numerical values are given as they are. 22393 Numerical control flags are given in a protocol specific 22394 representation. 22395 22396 22397 At this point, GDB has to perform the following actions. 22398 22399 * If the parameters include pointer values to data needed as input 22400 to a system call, GDB requests this data from the target with a 22401 standard `m' packet request. This additional communication has to 22402 be expected by the target implementation and is handled as any 22403 other `m' packet. 22404 22405 * GDB translates all value from protocol representation to host 22406 representation as needed. Datatypes are coerced into the host 22407 types. 22408 22409 * GDB calls the system call. 22410 22411 * It then coerces datatypes back to protocol representation. 22412 22413 * If the system call is expected to return data in buffer space 22414 specified by pointer parameters to the call, the data is 22415 transmitted to the target using a `M' or `X' packet. This packet 22416 has to be expected by the target implementation and is handled as 22417 any other `M' or `X' packet. 22418 22419 22420 Eventually GDB replies with another `F' packet which contains all 22421 necessary information for the target to continue. This at least 22422 contains 22423 22424 * Return value. 22425 22426 * `errno', if has been changed by the system call. 22427 22428 * "Ctrl-C" flag. 22429 22430 22431 After having done the needed type and value coercion, the target 22432 continues the latest continue or step action. 22433 22434 22435 File: gdb.info, Node: The F request packet, Next: The F reply packet, Prev: Protocol basics, Up: File-I/O remote protocol extension 22436 22437 D.9.3 The `F' request packet 22438 ---------------------------- 22439 22440 The `F' request packet has the following format: 22441 22442 `FCALL-ID,PARAMETER...' 22443 CALL-ID is the identifier to indicate the host system call to be 22444 called. This is just the name of the function. 22445 22446 PARAMETER... are the parameters to the system call. Parameters 22447 are hexadecimal integer values, either the actual values in case 22448 of scalar datatypes, pointers to target buffer space in case of 22449 compound datatypes and unspecified memory areas, or pointer/length 22450 pairs in case of string parameters. These are appended to the 22451 CALL-ID as a comma-delimited list. All values are transmitted in 22452 ASCII string representation, pointer/length pairs separated by a 22453 slash. 22454 22455 22456 22457 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 22458 22459 D.9.4 The `F' reply packet 22460 -------------------------- 22461 22462 The `F' reply packet has the following format: 22463 22464 `FRETCODE,ERRNO,CTRL-C FLAG;CALL SPECIFIC ATTACHMENT' 22465 RETCODE is the return code of the system call as hexadecimal value. 22466 22467 ERRNO is the `errno' set by the call, in protocol specific 22468 representation. This parameter can be omitted if the call was 22469 successful. 22470 22471 CTRL-C FLAG is only sent if the user requested a break. In this 22472 case, ERRNO must be sent as well, even if the call was successful. 22473 The CTRL-C FLAG itself consists of the character `C': 22474 22475 F0,0,C 22476 22477 or, if the call was interrupted before the host call has been 22478 performed: 22479 22480 F-1,4,C 22481 22482 assuming 4 is the protocol specific representation of `EINTR'. 22483 22484 22485 22486 File: gdb.info, Node: The Ctrl-C message, Next: Console I/O, Prev: The F reply packet, Up: File-I/O remote protocol extension 22487 22488 D.9.5 The `Ctrl-C' message 22489 -------------------------- 22490 22491 If the `Ctrl-C' flag is set in the GDB reply packet (*note The F reply 22492 packet::), the target should behave as if it had gotten a break 22493 message. The meaning for the target is "system call interrupted by 22494 `SIGINT'". Consequentially, the target should actually stop (as with a 22495 break message) and return to GDB with a `T02' packet. 22496 22497 It's important for the target to know in which state the system call 22498 was interrupted. There are two possible cases: 22499 22500 * The system call hasn't been performed on the host yet. 22501 22502 * The system call on the host has been finished. 22503 22504 22505 These two states can be distinguished by the target by the value of 22506 the returned `errno'. If it's the protocol representation of `EINTR', 22507 the system call hasn't been performed. This is equivalent to the 22508 `EINTR' handling on POSIX systems. In any other case, the target may 22509 presume that the system call has been finished -- successfully or not 22510 -- and should behave as if the break message arrived right after the 22511 system call. 22512 22513 GDB must behave reliably. If the system call has not been called 22514 yet, GDB may send the `F' reply immediately, setting `EINTR' as `errno' 22515 in the packet. If the system call on the host has been finished before 22516 the user requests a break, the full action must be finished by GDB. 22517 This requires sending `M' or `X' packets as necessary. The `F' packet 22518 may only be sent when either nothing has happened or the full action 22519 has been completed. 22520 22521 22522 File: gdb.info, Node: Console I/O, Next: List of supported calls, Prev: The Ctrl-C message, Up: File-I/O remote protocol extension 22523 22524 D.9.6 Console I/O 22525 ----------------- 22526 22527 By default and if not explicitely closed by the target system, the file 22528 descriptors 0, 1 and 2 are connected to the GDB console. Output on the 22529 GDB console is handled as any other file output operation (`write(1, 22530 ...)' or `write(2, ...)'). Console input is handled by GDB so that 22531 after the target read request from file descriptor 0 all following 22532 typing is buffered until either one of the following conditions is met: 22533 22534 * The user types `Ctrl-c'. The behaviour is as explained above, and 22535 the `read' system call is treated as finished. 22536 22537 * The user presses <RET>. This is treated as end of input with a 22538 trailing newline. 22539 22540 * The user types `Ctrl-d'. This is treated as end of input. No 22541 trailing character (neither newline nor `Ctrl-D') is appended to 22542 the input. 22543 22544 22545 If the user has typed more characters than fit in the buffer given to 22546 the `read' call, the trailing characters are buffered in GDB until 22547 either another `read(0, ...)' is requested by the target, or debugging 22548 is stopped at the user's request. 22549 22550 22551 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 22552 22553 D.9.7 List of supported calls 22554 ----------------------------- 22555 22556 * Menu: 22557 22558 * open:: 22559 * close:: 22560 * read:: 22561 * write:: 22562 * lseek:: 22563 * rename:: 22564 * unlink:: 22565 * stat/fstat:: 22566 * gettimeofday:: 22567 * isatty:: 22568 * system:: 22569 22570 22571 File: gdb.info, Node: open, Next: close, Up: List of supported calls 22572 22573 open 22574 .... 22575 22576 Synopsis: 22577 int open(const char *pathname, int flags); 22578 int open(const char *pathname, int flags, mode_t mode); 22579 22580 Request: 22581 `Fopen,PATHPTR/LEN,FLAGS,MODE' 22582 22583 FLAGS is the bitwise `OR' of the following values: 22584 22585 `O_CREAT' 22586 If the file does not exist it will be created. The host 22587 rules apply as far as file ownership and time stamps are 22588 concerned. 22589 22590 `O_EXCL' 22591 When used with `O_CREAT', if the file already exists it is an 22592 error and open() fails. 22593 22594 `O_TRUNC' 22595 If the file already exists and the open mode allows writing 22596 (`O_RDWR' or `O_WRONLY' is given) it will be truncated to 22597 zero length. 22598 22599 `O_APPEND' 22600 The file is opened in append mode. 22601 22602 `O_RDONLY' 22603 The file is opened for reading only. 22604 22605 `O_WRONLY' 22606 The file is opened for writing only. 22607 22608 `O_RDWR' 22609 The file is opened for reading and writing. 22610 22611 Other bits are silently ignored. 22612 22613 MODE is the bitwise `OR' of the following values: 22614 22615 `S_IRUSR' 22616 User has read permission. 22617 22618 `S_IWUSR' 22619 User has write permission. 22620 22621 `S_IRGRP' 22622 Group has read permission. 22623 22624 `S_IWGRP' 22625 Group has write permission. 22626 22627 `S_IROTH' 22628 Others have read permission. 22629 22630 `S_IWOTH' 22631 Others have write permission. 22632 22633 Other bits are silently ignored. 22634 22635 Return value: 22636 `open' returns the new file descriptor or -1 if an error occurred. 22637 22638 Errors: 22639 22640 `EEXIST' 22641 PATHNAME already exists and `O_CREAT' and `O_EXCL' were used. 22642 22643 `EISDIR' 22644 PATHNAME refers to a directory. 22645 22646 `EACCES' 22647 The requested access is not allowed. 22648 22649 `ENAMETOOLONG' 22650 PATHNAME was too long. 22651 22652 `ENOENT' 22653 A directory component in PATHNAME does not exist. 22654 22655 `ENODEV' 22656 PATHNAME refers to a device, pipe, named pipe or socket. 22657 22658 `EROFS' 22659 PATHNAME refers to a file on a read-only filesystem and write 22660 access was requested. 22661 22662 `EFAULT' 22663 PATHNAME is an invalid pointer value. 22664 22665 `ENOSPC' 22666 No space on device to create the file. 22667 22668 `EMFILE' 22669 The process already has the maximum number of files open. 22670 22671 `ENFILE' 22672 The limit on the total number of files open on the system has 22673 been reached. 22674 22675 `EINTR' 22676 The call was interrupted by the user. 22677 22678 22679 22680 File: gdb.info, Node: close, Next: read, Prev: open, Up: List of supported calls 22681 22682 close 22683 ..... 22684 22685 Synopsis: 22686 int close(int fd); 22687 22688 Request: 22689 `Fclose,FD' 22690 22691 Return value: 22692 `close' returns zero on success, or -1 if an error occurred. 22693 22694 Errors: 22695 22696 `EBADF' 22697 FD isn't a valid open file descriptor. 22698 22699 `EINTR' 22700 The call was interrupted by the user. 22701 22702 22703 22704 File: gdb.info, Node: read, Next: write, Prev: close, Up: List of supported calls 22705 22706 read 22707 .... 22708 22709 Synopsis: 22710 int read(int fd, void *buf, unsigned int count); 22711 22712 Request: 22713 `Fread,FD,BUFPTR,COUNT' 22714 22715 Return value: 22716 On success, the number of bytes read is returned. Zero indicates 22717 end of file. If count is zero, read returns zero as well. On 22718 error, -1 is returned. 22719 22720 Errors: 22721 22722 `EBADF' 22723 FD is not a valid file descriptor or is not open for reading. 22724 22725 `EFAULT' 22726 BUFPTR is an invalid pointer value. 22727 22728 `EINTR' 22729 The call was interrupted by the user. 22730 22731 22732 22733 File: gdb.info, Node: write, Next: lseek, Prev: read, Up: List of supported calls 22734 22735 write 22736 ..... 22737 22738 Synopsis: 22739 int write(int fd, const void *buf, unsigned int count); 22740 22741 Request: 22742 `Fwrite,FD,BUFPTR,COUNT' 22743 22744 Return value: 22745 On success, the number of bytes written are returned. Zero 22746 indicates nothing was written. On error, -1 is returned. 22747 22748 Errors: 22749 22750 `EBADF' 22751 FD is not a valid file descriptor or is not open for writing. 22752 22753 `EFAULT' 22754 BUFPTR is an invalid pointer value. 22755 22756 `EFBIG' 22757 An attempt was made to write a file that exceeds the host 22758 specific maximum file size allowed. 22759 22760 `ENOSPC' 22761 No space on device to write the data. 22762 22763 `EINTR' 22764 The call was interrupted by the user. 22765 22766 22767 22768 File: gdb.info, Node: lseek, Next: rename, Prev: write, Up: List of supported calls 22769 22770 lseek 22771 ..... 22772 22773 Synopsis: 22774 long lseek (int fd, long offset, int flag); 22775 22776 Request: 22777 `Flseek,FD,OFFSET,FLAG' 22778 22779 FLAG is one of: 22780 22781 `SEEK_SET' 22782 The offset is set to OFFSET bytes. 22783 22784 `SEEK_CUR' 22785 The offset is set to its current location plus OFFSET bytes. 22786 22787 `SEEK_END' 22788 The offset is set to the size of the file plus OFFSET bytes. 22789 22790 Return value: 22791 On success, the resulting unsigned offset in bytes from the 22792 beginning of the file is returned. Otherwise, a value of -1 is 22793 returned. 22794 22795 Errors: 22796 22797 `EBADF' 22798 FD is not a valid open file descriptor. 22799 22800 `ESPIPE' 22801 FD is associated with the GDB console. 22802 22803 `EINVAL' 22804 FLAG is not a proper value. 22805 22806 `EINTR' 22807 The call was interrupted by the user. 22808 22809 22810 22811 File: gdb.info, Node: rename, Next: unlink, Prev: lseek, Up: List of supported calls 22812 22813 rename 22814 ...... 22815 22816 Synopsis: 22817 int rename(const char *oldpath, const char *newpath); 22818 22819 Request: 22820 `Frename,OLDPATHPTR/LEN,NEWPATHPTR/LEN' 22821 22822 Return value: 22823 On success, zero is returned. On error, -1 is returned. 22824 22825 Errors: 22826 22827 `EISDIR' 22828 NEWPATH is an existing directory, but OLDPATH is not a 22829 directory. 22830 22831 `EEXIST' 22832 NEWPATH is a non-empty directory. 22833 22834 `EBUSY' 22835 OLDPATH or NEWPATH is a directory that is in use by some 22836 process. 22837 22838 `EINVAL' 22839 An attempt was made to make a directory a subdirectory of 22840 itself. 22841 22842 `ENOTDIR' 22843 A component used as a directory in OLDPATH or new path is 22844 not a directory. Or OLDPATH is a directory and NEWPATH 22845 exists but is not a directory. 22846 22847 `EFAULT' 22848 OLDPATHPTR or NEWPATHPTR are invalid pointer values. 22849 22850 `EACCES' 22851 No access to the file or the path of the file. 22852 22853 `ENAMETOOLONG' 22854 OLDPATH or NEWPATH was too long. 22855 22856 `ENOENT' 22857 A directory component in OLDPATH or NEWPATH does not exist. 22858 22859 `EROFS' 22860 The file is on a read-only filesystem. 22861 22862 `ENOSPC' 22863 The device containing the file has no room for the new 22864 directory entry. 22865 22866 `EINTR' 22867 The call was interrupted by the user. 22868 22869 22870 22871 File: gdb.info, Node: unlink, Next: stat/fstat, Prev: rename, Up: List of supported calls 22872 22873 unlink 22874 ...... 22875 22876 Synopsis: 22877 int unlink(const char *pathname); 22878 22879 Request: 22880 `Funlink,PATHNAMEPTR/LEN' 22881 22882 Return value: 22883 On success, zero is returned. On error, -1 is returned. 22884 22885 Errors: 22886 22887 `EACCES' 22888 No access to the file or the path of the file. 22889 22890 `EPERM' 22891 The system does not allow unlinking of directories. 22892 22893 `EBUSY' 22894 The file PATHNAME cannot be unlinked because it's being used 22895 by another process. 22896 22897 `EFAULT' 22898 PATHNAMEPTR is an invalid pointer value. 22899 22900 `ENAMETOOLONG' 22901 PATHNAME was too long. 22902 22903 `ENOENT' 22904 A directory component in PATHNAME does not exist. 22905 22906 `ENOTDIR' 22907 A component of the path is not a directory. 22908 22909 `EROFS' 22910 The file is on a read-only filesystem. 22911 22912 `EINTR' 22913 The call was interrupted by the user. 22914 22915 22916 22917 File: gdb.info, Node: stat/fstat, Next: gettimeofday, Prev: unlink, Up: List of supported calls 22918 22919 stat/fstat 22920 .......... 22921 22922 Synopsis: 22923 int stat(const char *pathname, struct stat *buf); 22924 int fstat(int fd, struct stat *buf); 22925 22926 Request: 22927 `Fstat,PATHNAMEPTR/LEN,BUFPTR' 22928 `Ffstat,FD,BUFPTR' 22929 22930 Return value: 22931 On success, zero is returned. On error, -1 is returned. 22932 22933 Errors: 22934 22935 `EBADF' 22936 FD is not a valid open file. 22937 22938 `ENOENT' 22939 A directory component in PATHNAME does not exist or the path 22940 is an empty string. 22941 22942 `ENOTDIR' 22943 A component of the path is not a directory. 22944 22945 `EFAULT' 22946 PATHNAMEPTR is an invalid pointer value. 22947 22948 `EACCES' 22949 No access to the file or the path of the file. 22950 22951 `ENAMETOOLONG' 22952 PATHNAME was too long. 22953 22954 `EINTR' 22955 The call was interrupted by the user. 22956 22957 22958 22959 File: gdb.info, Node: gettimeofday, Next: isatty, Prev: stat/fstat, Up: List of supported calls 22960 22961 gettimeofday 22962 ............ 22963 22964 Synopsis: 22965 int gettimeofday(struct timeval *tv, void *tz); 22966 22967 Request: 22968 `Fgettimeofday,TVPTR,TZPTR' 22969 22970 Return value: 22971 On success, 0 is returned, -1 otherwise. 22972 22973 Errors: 22974 22975 `EINVAL' 22976 TZ is a non-NULL pointer. 22977 22978 `EFAULT' 22979 TVPTR and/or TZPTR is an invalid pointer value. 22980 22981 22982 22983 File: gdb.info, Node: isatty, Next: system, Prev: gettimeofday, Up: List of supported calls 22984 22985 isatty 22986 ...... 22987 22988 Synopsis: 22989 int isatty(int fd); 22990 22991 Request: 22992 `Fisatty,FD' 22993 22994 Return value: 22995 Returns 1 if FD refers to the GDB console, 0 otherwise. 22996 22997 Errors: 22998 22999 `EINTR' 23000 The call was interrupted by the user. 23001 23002 23003 Note that the `isatty' call is treated as a special case: it returns 23004 1 to the target if the file descriptor is attached to the GDB console, 23005 0 otherwise. Implementing through system calls would require 23006 implementing `ioctl' and would be more complex than needed. 23007 23008 23009 File: gdb.info, Node: system, Prev: isatty, Up: List of supported calls 23010 23011 system 23012 ...... 23013 23014 Synopsis: 23015 int system(const char *command); 23016 23017 Request: 23018 `Fsystem,COMMANDPTR/LEN' 23019 23020 Return value: 23021 If LEN is zero, the return value indicates whether a shell is 23022 available. A zero return value indicates a shell is not available. 23023 For non-zero LEN, the value returned is -1 on error and the return 23024 status of the command otherwise. Only the exit status of the 23025 command is returned, which is extracted from the host's `system' 23026 return value by calling `WEXITSTATUS(retval)'. In case `/bin/sh' 23027 could not be executed, 127 is returned. 23028 23029 Errors: 23030 23031 `EINTR' 23032 The call was interrupted by the user. 23033 23034 23035 GDB takes over the full task of calling the necessary host calls to 23036 perform the `system' call. The return value of `system' on the host is 23037 simplified before it's returned to the target. Any termination signal 23038 information from the child process is discarded, and the return value 23039 consists entirely of the exit status of the called command. 23040 23041 Due to security concerns, the `system' call is by default refused by 23042 GDB. The user has to allow this call explicitly with the `set remote 23043 system-call-allowed 1' command. 23044 23045 `set remote system-call-allowed' 23046 Control whether to allow the `system' calls in the File I/O 23047 protocol for the remote target. The default is zero (disabled). 23048 23049 `show remote system-call-allowed' 23050 Show whether the `system' calls are allowed in the File I/O 23051 protocol. 23052 23053 23054 File: gdb.info, Node: Protocol specific representation of datatypes, Next: Constants, Prev: List of supported calls, Up: File-I/O remote protocol extension 23055 23056 D.9.8 Protocol specific representation of datatypes 23057 --------------------------------------------------- 23058 23059 * Menu: 23060 23061 * Integral datatypes:: 23062 * Pointer values:: 23063 * Memory transfer:: 23064 * struct stat:: 23065 * struct timeval:: 23066 23067 23068 File: gdb.info, Node: Integral datatypes, Next: Pointer values, Up: Protocol specific representation of datatypes 23069 23070 Integral datatypes 23071 .................. 23072 23073 The integral datatypes used in the system calls are `int', `unsigned 23074 int', `long', `unsigned long', `mode_t', and `time_t'. 23075 23076 `int', `unsigned int', `mode_t' and `time_t' are implemented as 32 23077 bit values in this protocol. 23078 23079 `long' and `unsigned long' are implemented as 64 bit types. 23080 23081 *Note Limits::, for corresponding MIN and MAX values (similar to 23082 those in `limits.h') to allow range checking on host and target. 23083 23084 `time_t' datatypes are defined as seconds since the Epoch. 23085 23086 All integral datatypes transferred as part of a memory read or write 23087 of a structured datatype e.g. a `struct stat' have to be given in big 23088 endian byte order. 23089 23090 23091 File: gdb.info, Node: Pointer values, Next: Memory transfer, Prev: Integral datatypes, Up: Protocol specific representation of datatypes 23092 23093 Pointer values 23094 .............. 23095 23096 Pointers to target data are transmitted as they are. An exception is 23097 made for pointers to buffers for which the length isn't transmitted as 23098 part of the function call, namely strings. Strings are transmitted as 23099 a pointer/length pair, both as hex values, e.g. 23100 23101 `1aaf/12' 23102 23103 which is a pointer to data of length 18 bytes at position 0x1aaf. The 23104 length is defined as the full string length in bytes, including the 23105 trailing null byte. For example, the string `"hello world"' at address 23106 0x123456 is transmitted as 23107 23108 `123456/d' 23109 23110 23111 File: gdb.info, Node: Memory transfer, Next: struct stat, Prev: Pointer values, Up: Protocol specific representation of datatypes 23112 23113 Memory transfer 23114 ............... 23115 23116 Structured data which is transferred using a memory read or write (for 23117 example, a `struct stat') is expected to be in a protocol specific 23118 format with all scalar multibyte datatypes being big endian. 23119 Translation to this representation needs to be done both by the target 23120 before the `F' packet is sent, and by GDB before it transfers memory to 23121 the target. Transferred pointers to structured data should point to 23122 the already-coerced data at any time. 23123 23124 23125 File: gdb.info, Node: struct stat, Next: struct timeval, Prev: Memory transfer, Up: Protocol specific representation of datatypes 23126 23127 struct stat 23128 ........... 23129 23130 The buffer of type `struct stat' used by the target and GDB is defined 23131 as follows: 23132 23133 struct stat { 23134 unsigned int st_dev; /* device */ 23135 unsigned int st_ino; /* inode */ 23136 mode_t st_mode; /* protection */ 23137 unsigned int st_nlink; /* number of hard links */ 23138 unsigned int st_uid; /* user ID of owner */ 23139 unsigned int st_gid; /* group ID of owner */ 23140 unsigned int st_rdev; /* device type (if inode device) */ 23141 unsigned long st_size; /* total size, in bytes */ 23142 unsigned long st_blksize; /* blocksize for filesystem I/O */ 23143 unsigned long st_blocks; /* number of blocks allocated */ 23144 time_t st_atime; /* time of last access */ 23145 time_t st_mtime; /* time of last modification */ 23146 time_t st_ctime; /* time of last change */ 23147 }; 23148 23149 The integral datatypes conform to the definitions given in the 23150 appropriate section (see *Note Integral datatypes::, for details) so 23151 this structure is of size 64 bytes. 23152 23153 The values of several fields have a restricted meaning and/or range 23154 of values. 23155 23156 `st_dev' 23157 A value of 0 represents a file, 1 the console. 23158 23159 `st_ino' 23160 No valid meaning for the target. Transmitted unchanged. 23161 23162 `st_mode' 23163 Valid mode bits are described in *Note Constants::. Any other 23164 bits have currently no meaning for the target. 23165 23166 `st_uid' 23167 `st_gid' 23168 `st_rdev' 23169 No valid meaning for the target. Transmitted unchanged. 23170 23171 `st_atime' 23172 `st_mtime' 23173 `st_ctime' 23174 These values have a host and file system dependent accuracy. 23175 Especially on Windows hosts, the file system may not support exact 23176 timing values. 23177 23178 The target gets a `struct stat' of the above representation and is 23179 responsible for coercing it to the target representation before 23180 continuing. 23181 23182 Note that due to size differences between the host, target, and 23183 protocol representations of `struct stat' members, these members could 23184 eventually get truncated on the target. 23185 23186 23187 File: gdb.info, Node: struct timeval, Prev: struct stat, Up: Protocol specific representation of datatypes 23188 23189 struct timeval 23190 .............. 23191 23192 The buffer of type `struct timeval' used by the File-I/O protocol is 23193 defined as follows: 23194 23195 struct timeval { 23196 time_t tv_sec; /* second */ 23197 long tv_usec; /* microsecond */ 23198 }; 23199 23200 The integral datatypes conform to the definitions given in the 23201 appropriate section (see *Note Integral datatypes::, for details) so 23202 this structure is of size 8 bytes. 23203 23204 23205 File: gdb.info, Node: Constants, Next: File-I/O Examples, Prev: Protocol specific representation of datatypes, Up: File-I/O remote protocol extension 23206 23207 D.9.9 Constants 23208 --------------- 23209 23210 The following values are used for the constants inside of the protocol. 23211 GDB and target are responsible for translating these values before and 23212 after the call as needed. 23213 23214 * Menu: 23215 23216 * Open flags:: 23217 * mode_t values:: 23218 * Errno values:: 23219 * Lseek flags:: 23220 * Limits:: 23221 23222 23223 File: gdb.info, Node: Open flags, Next: mode_t values, Up: Constants 23224 23225 Open flags 23226 .......... 23227 23228 All values are given in hexadecimal representation. 23229 23230 O_RDONLY 0x0 23231 O_WRONLY 0x1 23232 O_RDWR 0x2 23233 O_APPEND 0x8 23234 O_CREAT 0x200 23235 O_TRUNC 0x400 23236 O_EXCL 0x800 23237 23238 23239 File: gdb.info, Node: mode_t values, Next: Errno values, Prev: Open flags, Up: Constants 23240 23241 mode_t values 23242 ............. 23243 23244 All values are given in octal representation. 23245 23246 S_IFREG 0100000 23247 S_IFDIR 040000 23248 S_IRUSR 0400 23249 S_IWUSR 0200 23250 S_IXUSR 0100 23251 S_IRGRP 040 23252 S_IWGRP 020 23253 S_IXGRP 010 23254 S_IROTH 04 23255 S_IWOTH 02 23256 S_IXOTH 01 23257 23258 23259 File: gdb.info, Node: Errno values, Next: Lseek flags, Prev: mode_t values, Up: Constants 23260 23261 Errno values 23262 ............ 23263 23264 All values are given in decimal representation. 23265 23266 EPERM 1 23267 ENOENT 2 23268 EINTR 4 23269 EBADF 9 23270 EACCES 13 23271 EFAULT 14 23272 EBUSY 16 23273 EEXIST 17 23274 ENODEV 19 23275 ENOTDIR 20 23276 EISDIR 21 23277 EINVAL 22 23278 ENFILE 23 23279 EMFILE 24 23280 EFBIG 27 23281 ENOSPC 28 23282 ESPIPE 29 23283 EROFS 30 23284 ENAMETOOLONG 91 23285 EUNKNOWN 9999 23286 23287 `EUNKNOWN' is used as a fallback error value if a host system returns 23288 any error value not in the list of supported error numbers. 23289 23290 23291 File: gdb.info, Node: Lseek flags, Next: Limits, Prev: Errno values, Up: Constants 23292 23293 Lseek flags 23294 ........... 23295 23296 SEEK_SET 0 23297 SEEK_CUR 1 23298 SEEK_END 2 23299 23300 23301 File: gdb.info, Node: Limits, Prev: Lseek flags, Up: Constants 23302 23303 Limits 23304 ...... 23305 23306 All values are given in decimal representation. 23307 23308 INT_MIN -2147483648 23309 INT_MAX 2147483647 23310 UINT_MAX 4294967295 23311 LONG_MIN -9223372036854775808 23312 LONG_MAX 9223372036854775807 23313 ULONG_MAX 18446744073709551615 23314 23315 23316 File: gdb.info, Node: File-I/O Examples, Prev: Constants, Up: File-I/O remote protocol extension 23317 23318 D.9.10 File-I/O Examples 23319 ------------------------ 23320 23321 Example sequence of a write call, file descriptor 3, buffer is at target 23322 address 0x1234, 6 bytes should be written: 23323 23324 <- `Fwrite,3,1234,6' 23325 _request memory read from target_ 23326 -> `m1234,6' 23327 <- XXXXXX 23328 _return "6 bytes written"_ 23329 -> `F6' 23330 23331 Example sequence of a read call, file descriptor 3, buffer is at 23332 target address 0x1234, 6 bytes should be read: 23333 23334 <- `Fread,3,1234,6' 23335 _request memory write to target_ 23336 -> `X1234,6:XXXXXX' 23337 _return "6 bytes read"_ 23338 -> `F6' 23339 23340 Example sequence of a read call, call fails on the host due to 23341 invalid file descriptor (`EBADF'): 23342 23343 <- `Fread,3,1234,6' 23344 -> `F-1,9' 23345 23346 Example sequence of a read call, user presses `Ctrl-c' before 23347 syscall on host is called: 23348 23349 <- `Fread,3,1234,6' 23350 -> `F-1,4,C' 23351 <- `T02' 23352 23353 Example sequence of a read call, user presses `Ctrl-c' after syscall 23354 on host is called: 23355 23356 <- `Fread,3,1234,6' 23357 -> `X1234,6:XXXXXX' 23358 <- `T02' 23359 23360 23361 File: gdb.info, Node: Memory map format, Prev: File-I/O remote protocol extension, Up: Remote Protocol 23362 23363 D.10 Memory map format 23364 ====================== 23365 23366 To be able to write into flash memory, GDB needs to obtain a memory map 23367 from the target. This section describes the format of the memory map. 23368 23369 The memory map is obtained using the `qXfer:memory-map:read' (*note 23370 qXfer memory map read::) packet and is an XML document that lists 23371 memory regions. The top-level structure of the document is shown below: 23372 23373 <?xml version="1.0"?> 23374 <!DOCTYPE memory-map 23375 PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN" 23376 "http://sourceware.org/gdb/gdb-memory-map.dtd"> 23377 <memory-map> 23378 region... 23379 </memory-map> 23380 23381 Each region can be either: 23382 23383 * A region of RAM starting at ADDR and extending for LENGTH bytes 23384 from there: 23385 23386 <memory type="ram" start="ADDR" length="LENGTH"/> 23387 23388 * A region of read-only memory: 23389 23390 <memory type="rom" start="ADDR" length="LENGTH"/> 23391 23392 * A region of flash memory, with erasure blocks BLOCKSIZE bytes in 23393 length: 23394 23395 <memory type="flash" start="ADDR" length="LENGTH"> 23396 <property name="blocksize">BLOCKSIZE</property> 23397 </memory> 23398 23399 23400 Regions must not overlap. GDB assumes that areas of memory not 23401 covered by the memory map are RAM, and uses the ordinary `M' and `X' 23402 packets to write to addresses in such ranges. 23403 23404 The formal DTD for memory map format is given below: 23405 23406 <!-- ................................................... --> 23407 <!-- Memory Map XML DTD ................................ --> 23408 <!-- File: memory-map.dtd .............................. --> 23409 <!-- .................................... .............. --> 23410 <!-- memory-map.dtd --> 23411 <!-- memory-map: Root element with versioning --> 23412 <!ELEMENT memory-map (memory | property)> 23413 <!ATTLIST memory-map version CDATA #FIXED "1.0.0"> 23414 <!ELEMENT memory (property)> 23415 <!-- memory: Specifies a memory region, 23416 and its type, or device. --> 23417 <!ATTLIST memory type CDATA #REQUIRED 23418 start CDATA #REQUIRED 23419 length CDATA #REQUIRED 23420 device CDATA #IMPLIED> 23421 <!-- property: Generic attribute tag --> 23422 <!ELEMENT property (#PCDATA | property)*> 23423 <!ATTLIST property name CDATA #REQUIRED> 23424 23425 23426 File: gdb.info, Node: Agent Expressions, Next: Copying, Prev: Remote Protocol, Up: Top 23427 23428 Appendix E The GDB Agent Expression Mechanism 23429 ********************************************* 23430 23431 In some applications, it is not feasable for the debugger to interrupt 23432 the program's execution long enough for the developer to learn anything 23433 helpful about its behavior. If the program's correctness depends on its 23434 real-time behavior, delays introduced by a debugger might cause the 23435 program to fail, even when the code itself is correct. It is useful to 23436 be able to observe the program's behavior without interrupting it. 23437 23438 Using GDB's `trace' and `collect' commands, the user can specify 23439 locations in the program, and arbitrary expressions to evaluate when 23440 those locations are reached. Later, using the `tfind' command, she can 23441 examine the values those expressions had when the program hit the trace 23442 points. The expressions may also denote objects in memory -- 23443 structures or arrays, for example -- whose values GDB should record; 23444 while visiting a particular tracepoint, the user may inspect those 23445 objects as if they were in memory at that moment. However, because GDB 23446 records these values without interacting with the user, it can do so 23447 quickly and unobtrusively, hopefully not disturbing the program's 23448 behavior. 23449 23450 When GDB is debugging a remote target, the GDB "agent" code running 23451 on the target computes the values of the expressions itself. To avoid 23452 having a full symbolic expression evaluator on the agent, GDB translates 23453 expressions in the source language into a simpler bytecode language, and 23454 then sends the bytecode to the agent; the agent then executes the 23455 bytecode, and records the values for GDB to retrieve later. 23456 23457 The bytecode language is simple; there are forty-odd opcodes, the 23458 bulk of which are the usual vocabulary of C operands (addition, 23459 subtraction, shifts, and so on) and various sizes of literals and 23460 memory reference operations. The bytecode interpreter operates 23461 strictly on machine-level values -- various sizes of integers and 23462 floating point numbers -- and requires no information about types or 23463 symbols; thus, the interpreter's internal data structures are simple, 23464 and each bytecode requires only a few native machine instructions to 23465 implement it. The interpreter is small, and strict limits on the 23466 memory and time required to evaluate an expression are easy to 23467 determine, making it suitable for use by the debugging agent in 23468 real-time applications. 23469 23470 * Menu: 23471 23472 * General Bytecode Design:: Overview of the interpreter. 23473 * Bytecode Descriptions:: What each one does. 23474 * Using Agent Expressions:: How agent expressions fit into the big picture. 23475 * Varying Target Capabilities:: How to discover what the target can do. 23476 * Tracing on Symmetrix:: Special info for implementation on EMC's 23477 boxes. 23478 * Rationale:: Why we did it this way. 23479 23480 23481 File: gdb.info, Node: General Bytecode Design, Next: Bytecode Descriptions, Up: Agent Expressions 23482 23483 E.1 General Bytecode Design 23484 =========================== 23485 23486 The agent represents bytecode expressions as an array of bytes. Each 23487 instruction is one byte long (thus the term "bytecode"). Some 23488 instructions are followed by operand bytes; for example, the `goto' 23489 instruction is followed by a destination for the jump. 23490 23491 The bytecode interpreter is a stack-based machine; most instructions 23492 pop their operands off the stack, perform some operation, and push the 23493 result back on the stack for the next instruction to consume. Each 23494 element of the stack may contain either a integer or a floating point 23495 value; these values are as many bits wide as the largest integer that 23496 can be directly manipulated in the source language. Stack elements 23497 carry no record of their type; bytecode could push a value as an 23498 integer, then pop it as a floating point value. However, GDB will not 23499 generate code which does this. In C, one might define the type of a 23500 stack element as follows: 23501 union agent_val { 23502 LONGEST l; 23503 DOUBLEST d; 23504 }; 23505 where `LONGEST' and `DOUBLEST' are `typedef' names for the largest 23506 integer and floating point types on the machine. 23507 23508 By the time the bytecode interpreter reaches the end of the 23509 expression, the value of the expression should be the only value left 23510 on the stack. For tracing applications, `trace' bytecodes in the 23511 expression will have recorded the necessary data, and the value on the 23512 stack may be discarded. For other applications, like conditional 23513 breakpoints, the value may be useful. 23514 23515 Separate from the stack, the interpreter has two registers: 23516 `pc' 23517 The address of the next bytecode to execute. 23518 23519 `start' 23520 The address of the start of the bytecode expression, necessary for 23521 interpreting the `goto' and `if_goto' instructions. 23522 23523 Neither of these registers is directly visible to the bytecode 23524 language itself, but they are useful for defining the meanings of the 23525 bytecode operations. 23526 23527 There are no instructions to perform side effects on the running 23528 program, or call the program's functions; we assume that these 23529 expressions are only used for unobtrusive debugging, not for patching 23530 the running code. 23531 23532 Most bytecode instructions do not distinguish between the various 23533 sizes of values, and operate on full-width values; the upper bits of the 23534 values are simply ignored, since they do not usually make a difference 23535 to the value computed. The exceptions to this rule are: 23536 memory reference instructions (`ref'N) 23537 There are distinct instructions to fetch different word sizes from 23538 memory. Once on the stack, however, the values are treated as 23539 full-size integers. They may need to be sign-extended; the `ext' 23540 instruction exists for this purpose. 23541 23542 the sign-extension instruction (`ext' N) 23543 These clearly need to know which portion of their operand is to be 23544 extended to occupy the full length of the word. 23545 23546 23547 If the interpreter is unable to evaluate an expression completely for 23548 some reason (a memory location is inaccessible, or a divisor is zero, 23549 for example), we say that interpretation "terminates with an error". 23550 This means that the problem is reported back to the interpreter's caller 23551 in some helpful way. In general, code using agent expressions should 23552 assume that they may attempt to divide by zero, fetch arbitrary memory 23553 locations, and misbehave in other ways. 23554 23555 Even complicated C expressions compile to a few bytecode 23556 instructions; for example, the expression `x + y * z' would typically 23557 produce code like the following, assuming that `x' and `y' live in 23558 registers, and `z' is a global variable holding a 32-bit `int': 23559 reg 1 23560 reg 2 23561 const32 address of z 23562 ref32 23563 ext 32 23564 mul 23565 add 23566 end 23567 23568 In detail, these mean: 23569 `reg 1' 23570 Push the value of register 1 (presumably holding `x') onto the 23571 stack. 23572 23573 `reg 2' 23574 Push the value of register 2 (holding `y'). 23575 23576 `const32 address of z' 23577 Push the address of `z' onto the stack. 23578 23579 `ref32' 23580 Fetch a 32-bit word from the address at the top of the stack; 23581 replace the address on the stack with the value. Thus, we replace 23582 the address of `z' with `z''s value. 23583 23584 `ext 32' 23585 Sign-extend the value on the top of the stack from 32 bits to full 23586 length. This is necessary because `z' is a signed integer. 23587 23588 `mul' 23589 Pop the top two numbers on the stack, multiply them, and push their 23590 product. Now the top of the stack contains the value of the 23591 expression `y * z'. 23592 23593 `add' 23594 Pop the top two numbers, add them, and push the sum. Now the top 23595 of the stack contains the value of `x + y * z'. 23596 23597 `end' 23598 Stop executing; the value left on the stack top is the value to be 23599 recorded. 23600 23601 23602 23603 File: gdb.info, Node: Bytecode Descriptions, Next: Using Agent Expressions, Prev: General Bytecode Design, Up: Agent Expressions 23604 23605 E.2 Bytecode Descriptions 23606 ========================= 23607 23608 Each bytecode description has the following form: 23609 23610 `add' (0x02): A B => A+B 23611 Pop the top two stack items, A and B, as integers; push their sum, 23612 as an integer. 23613 23614 23615 In this example, `add' is the name of the bytecode, and `(0x02)' is 23616 the one-byte value used to encode the bytecode, in hexidecimal. The 23617 phrase "A B => A+B" shows the stack before and after the bytecode 23618 executes. Beforehand, the stack must contain at least two values, A 23619 and B; since the top of the stack is to the right, B is on the top of 23620 the stack, and A is underneath it. After execution, the bytecode will 23621 have popped A and B from the stack, and replaced them with a single 23622 value, A+B. There may be other values on the stack below those shown, 23623 but the bytecode affects only those shown. 23624 23625 Here is another example: 23626 23627 `const8' (0x22) N: => N 23628 Push the 8-bit integer constant N on the stack, without sign 23629 extension. 23630 23631 23632 In this example, the bytecode `const8' takes an operand N directly 23633 from the bytecode stream; the operand follows the `const8' bytecode 23634 itself. We write any such operands immediately after the name of the 23635 bytecode, before the colon, and describe the exact encoding of the 23636 operand in the bytecode stream in the body of the bytecode description. 23637 23638 For the `const8' bytecode, there are no stack items given before the 23639 =>; this simply means that the bytecode consumes no values from the 23640 stack. If a bytecode consumes no values, or produces no values, the 23641 list on either side of the => may be empty. 23642 23643 If a value is written as A, B, or N, then the bytecode treats it as 23644 an integer. If a value is written is ADDR, then the bytecode treats it 23645 as an address. 23646 23647 We do not fully describe the floating point operations here; although 23648 this design can be extended in a clean way to handle floating point 23649 values, they are not of immediate interest to the customer, so we avoid 23650 describing them, to save time. 23651 23652 `float' (0x01): => 23653 Prefix for floating-point bytecodes. Not implemented yet. 23654 23655 `add' (0x02): A B => A+B 23656 Pop two integers from the stack, and push their sum, as an integer. 23657 23658 `sub' (0x03): A B => A-B 23659 Pop two integers from the stack, subtract the top value from the 23660 next-to-top value, and push the difference. 23661 23662 `mul' (0x04): A B => A*B 23663 Pop two integers from the stack, multiply them, and push the 23664 product on the stack. Note that, when one multiplies two N-bit 23665 numbers yielding another N-bit number, it is irrelevant whether the 23666 numbers are signed or not; the results are the same. 23667 23668 `div_signed' (0x05): A B => A/B 23669 Pop two signed integers from the stack; divide the next-to-top 23670 value by the top value, and push the quotient. If the divisor is 23671 zero, terminate with an error. 23672 23673 `div_unsigned' (0x06): A B => A/B 23674 Pop two unsigned integers from the stack; divide the next-to-top 23675 value by the top value, and push the quotient. If the divisor is 23676 zero, terminate with an error. 23677 23678 `rem_signed' (0x07): A B => A MODULO B 23679 Pop two signed integers from the stack; divide the next-to-top 23680 value by the top value, and push the remainder. If the divisor is 23681 zero, terminate with an error. 23682 23683 `rem_unsigned' (0x08): A B => A MODULO B 23684 Pop two unsigned integers from the stack; divide the next-to-top 23685 value by the top value, and push the remainder. If the divisor is 23686 zero, terminate with an error. 23687 23688 `lsh' (0x09): A B => A<<B 23689 Pop two integers from the stack; let A be the next-to-top value, 23690 and B be the top value. Shift A left by B bits, and push the 23691 result. 23692 23693 `rsh_signed' (0x0a): A B => `(signed)'A>>B 23694 Pop two integers from the stack; let A be the next-to-top value, 23695 and B be the top value. Shift A right by B bits, inserting copies 23696 of the top bit at the high end, and push the result. 23697 23698 `rsh_unsigned' (0x0b): A B => A>>B 23699 Pop two integers from the stack; let A be the next-to-top value, 23700 and B be the top value. Shift A right by B bits, inserting zero 23701 bits at the high end, and push the result. 23702 23703 `log_not' (0x0e): A => !A 23704 Pop an integer from the stack; if it is zero, push the value one; 23705 otherwise, push the value zero. 23706 23707 `bit_and' (0x0f): A B => A&B 23708 Pop two integers from the stack, and push their bitwise `and'. 23709 23710 `bit_or' (0x10): A B => A|B 23711 Pop two integers from the stack, and push their bitwise `or'. 23712 23713 `bit_xor' (0x11): A B => A^B 23714 Pop two integers from the stack, and push their bitwise 23715 exclusive-`or'. 23716 23717 `bit_not' (0x12): A => ~A 23718 Pop an integer from the stack, and push its bitwise complement. 23719 23720 `equal' (0x13): A B => A=B 23721 Pop two integers from the stack; if they are equal, push the value 23722 one; otherwise, push the value zero. 23723 23724 `less_signed' (0x14): A B => A<B 23725 Pop two signed integers from the stack; if the next-to-top value 23726 is less than the top value, push the value one; otherwise, push 23727 the value zero. 23728 23729 `less_unsigned' (0x15): A B => A<B 23730 Pop two unsigned integers from the stack; if the next-to-top value 23731 is less than the top value, push the value one; otherwise, push 23732 the value zero. 23733 23734 `ext' (0x16) N: A => A, sign-extended from N bits 23735 Pop an unsigned value from the stack; treating it as an N-bit 23736 twos-complement value, extend it to full length. This means that 23737 all bits to the left of bit N-1 (where the least significant bit 23738 is bit 0) are set to the value of bit N-1. Note that N may be 23739 larger than or equal to the width of the stack elements of the 23740 bytecode engine; in this case, the bytecode should have no effect. 23741 23742 The number of source bits to preserve, N, is encoded as a single 23743 byte unsigned integer following the `ext' bytecode. 23744 23745 `zero_ext' (0x2a) N: A => A, zero-extended from N bits 23746 Pop an unsigned value from the stack; zero all but the bottom N 23747 bits. This means that all bits to the left of bit N-1 (where the 23748 least significant bit is bit 0) are set to the value of bit N-1. 23749 23750 The number of source bits to preserve, N, is encoded as a single 23751 byte unsigned integer following the `zero_ext' bytecode. 23752 23753 `ref8' (0x17): ADDR => A 23754 `ref16' (0x18): ADDR => A 23755 `ref32' (0x19): ADDR => A 23756 `ref64' (0x1a): ADDR => A 23757 Pop an address ADDR from the stack. For bytecode `ref'N, fetch an 23758 N-bit value from ADDR, using the natural target endianness. Push 23759 the fetched value as an unsigned integer. 23760 23761 Note that ADDR may not be aligned in any particular way; the 23762 `refN' bytecodes should operate correctly for any address. 23763 23764 If attempting to access memory at ADDR would cause a processor 23765 exception of some sort, terminate with an error. 23766 23767 `ref_float' (0x1b): ADDR => D 23768 `ref_double' (0x1c): ADDR => D 23769 `ref_long_double' (0x1d): ADDR => D 23770 `l_to_d' (0x1e): A => D 23771 `d_to_l' (0x1f): D => A 23772 Not implemented yet. 23773 23774 `dup' (0x28): A => A A 23775 Push another copy of the stack's top element. 23776 23777 `swap' (0x2b): A B => B A 23778 Exchange the top two items on the stack. 23779 23780 `pop' (0x29): A => 23781 Discard the top value on the stack. 23782 23783 `if_goto' (0x20) OFFSET: A => 23784 Pop an integer off the stack; if it is non-zero, branch to the 23785 given offset in the bytecode string. Otherwise, continue to the 23786 next instruction in the bytecode stream. In other words, if A is 23787 non-zero, set the `pc' register to `start' + OFFSET. Thus, an 23788 offset of zero denotes the beginning of the expression. 23789 23790 The OFFSET is stored as a sixteen-bit unsigned value, stored 23791 immediately following the `if_goto' bytecode. It is always stored 23792 most significant byte first, regardless of the target's normal 23793 endianness. The offset is not guaranteed to fall at any particular 23794 alignment within the bytecode stream; thus, on machines where 23795 fetching a 16-bit on an unaligned address raises an exception, you 23796 should fetch the offset one byte at a time. 23797 23798 `goto' (0x21) OFFSET: => 23799 Branch unconditionally to OFFSET; in other words, set the `pc' 23800 register to `start' + OFFSET. 23801 23802 The offset is stored in the same way as for the `if_goto' bytecode. 23803 23804 `const8' (0x22) N: => N 23805 `const16' (0x23) N: => N 23806 `const32' (0x24) N: => N 23807 `const64' (0x25) N: => N 23808 Push the integer constant N on the stack, without sign extension. 23809 To produce a small negative value, push a small twos-complement 23810 value, and then sign-extend it using the `ext' bytecode. 23811 23812 The constant N is stored in the appropriate number of bytes 23813 following the `const'B bytecode. The constant N is always stored 23814 most significant byte first, regardless of the target's normal 23815 endianness. The constant is not guaranteed to fall at any 23816 particular alignment within the bytecode stream; thus, on machines 23817 where fetching a 16-bit on an unaligned address raises an 23818 exception, you should fetch N one byte at a time. 23819 23820 `reg' (0x26) N: => A 23821 Push the value of register number N, without sign extension. The 23822 registers are numbered following GDB's conventions. 23823 23824 The register number N is encoded as a 16-bit unsigned integer 23825 immediately following the `reg' bytecode. It is always stored most 23826 significant byte first, regardless of the target's normal 23827 endianness. The register number is not guaranteed to fall at any 23828 particular alignment within the bytecode stream; thus, on machines 23829 where fetching a 16-bit on an unaligned address raises an 23830 exception, you should fetch the register number one byte at a time. 23831 23832 `trace' (0x0c): ADDR SIZE => 23833 Record the contents of the SIZE bytes at ADDR in a trace buffer, 23834 for later retrieval by GDB. 23835 23836 `trace_quick' (0x0d) SIZE: ADDR => ADDR 23837 Record the contents of the SIZE bytes at ADDR in a trace buffer, 23838 for later retrieval by GDB. SIZE is a single byte unsigned 23839 integer following the `trace' opcode. 23840 23841 This bytecode is equivalent to the sequence `dup const8 SIZE 23842 trace', but we provide it anyway to save space in bytecode strings. 23843 23844 `trace16' (0x30) SIZE: ADDR => ADDR 23845 Identical to trace_quick, except that SIZE is a 16-bit big-endian 23846 unsigned integer, not a single byte. This should probably have 23847 been named `trace_quick16', for consistency. 23848 23849 `end' (0x27): => 23850 Stop executing bytecode; the result should be the top element of 23851 the stack. If the purpose of the expression was to compute an 23852 lvalue or a range of memory, then the next-to-top of the stack is 23853 the lvalue's address, and the top of the stack is the lvalue's 23854 size, in bytes. 23855 23856 23857 23858 File: gdb.info, Node: Using Agent Expressions, Next: Varying Target Capabilities, Prev: Bytecode Descriptions, Up: Agent Expressions 23859 23860 E.3 Using Agent Expressions 23861 =========================== 23862 23863 Here is a sketch of a full non-stop debugging cycle, showing how agent 23864 expressions fit into the process. 23865 23866 * The user selects trace points in the program's code at which GDB 23867 should collect data. 23868 23869 * The user specifies expressions to evaluate at each trace point. 23870 These expressions may denote objects in memory, in which case 23871 those objects' contents are recorded as the program runs, or 23872 computed values, in which case the values themselves are recorded. 23873 23874 * GDB transmits the tracepoints and their associated expressions to 23875 the GDB agent, running on the debugging target. 23876 23877 * The agent arranges to be notified when a trace point is hit. Note 23878 that, on some systems, the target operating system is completely 23879 responsible for collecting the data; see *Note Tracing on 23880 Symmetrix::. 23881 23882 * When execution on the target reaches a trace point, the agent 23883 evaluates the expressions associated with that trace point, and 23884 records the resulting values and memory ranges. 23885 23886 * Later, when the user selects a given trace event and inspects the 23887 objects and expression values recorded, GDB talks to the agent to 23888 retrieve recorded data as necessary to meet the user's requests. 23889 If the user asks to see an object whose contents have not been 23890 recorded, GDB reports an error. 23891 23892 23893 23894 File: gdb.info, Node: Varying Target Capabilities, Next: Tracing on Symmetrix, Prev: Using Agent Expressions, Up: Agent Expressions 23895 23896 E.4 Varying Target Capabilities 23897 =============================== 23898 23899 Some targets don't support floating-point, and some would rather not 23900 have to deal with `long long' operations. Also, different targets will 23901 have different stack sizes, and different bytecode buffer lengths. 23902 23903 Thus, GDB needs a way to ask the target about itself. We haven't 23904 worked out the details yet, but in general, GDB should be able to send 23905 the target a packet asking it to describe itself. The reply should be a 23906 packet whose length is explicit, so we can add new information to the 23907 packet in future revisions of the agent, without confusing old versions 23908 of GDB, and it should contain a version number. It should contain at 23909 least the following information: 23910 23911 * whether floating point is supported 23912 23913 * whether `long long' is supported 23914 23915 * maximum acceptable size of bytecode stack 23916 23917 * maximum acceptable length of bytecode expressions 23918 23919 * which registers are actually available for collection 23920 23921 * whether the target supports disabled tracepoints 23922 23923 23924 23925 File: gdb.info, Node: Tracing on Symmetrix, Next: Rationale, Prev: Varying Target Capabilities, Up: Agent Expressions 23926 23927 E.5 Tracing on Symmetrix 23928 ======================== 23929 23930 This section documents the API used by the GDB agent to collect data on 23931 Symmetrix systems. 23932 23933 Cygnus originally implemented these tracing features to help EMC 23934 Corporation debug their Symmetrix high-availability disk drives. The 23935 Symmetrix application code already includes substantial tracing 23936 facilities; the GDB agent for the Symmetrix system uses those facilities 23937 for its own data collection, via the API described here. 23938 23939 -- Function: DTC_RESPONSE adbg_find_memory_in_frame (FRAME_DEF *FRAME, 23940 char *ADDRESS, char **BUFFER, unsigned int *SIZE) 23941 Search the trace frame FRAME for memory saved from ADDRESS. If 23942 the memory is available, provide the address of the buffer holding 23943 it; otherwise, provide the address of the next saved area. 23944 23945 * If the memory at ADDRESS was saved in FRAME, set `*BUFFER' to 23946 point to the buffer in which that memory was saved, set 23947 `*SIZE' to the number of bytes from ADDRESS that are saved at 23948 `*BUFFER', and return `OK_TARGET_RESPONSE'. (Clearly, in 23949 this case, the function will always set `*SIZE' to a value 23950 greater than zero.) 23951 23952 * If FRAME does not record any memory at ADDRESS, set `*SIZE' 23953 to the distance from ADDRESS to the start of the saved region 23954 with the lowest address higher than ADDRESS. If there is no 23955 memory saved from any higher address, set `*SIZE' to zero. 23956 Return `NOT_FOUND_TARGET_RESPONSE'. 23957 23958 These two possibilities allow the caller to either retrieve the 23959 data, or walk the address space to the next saved area. 23960 23961 This function allows the GDB agent to map the regions of memory 23962 saved in a particular frame, and retrieve their contents efficiently. 23963 23964 This function also provides a clean interface between the GDB agent 23965 and the Symmetrix tracing structures, making it easier to adapt the GDB 23966 agent to future versions of the Symmetrix system, and vice versa. This 23967 function searches all data saved in FRAME, whether the data is there at 23968 the request of a bytecode expression, or because it falls in one of the 23969 format's memory ranges, or because it was saved from the top of the 23970 stack. EMC can arbitrarily change and enhance the tracing mechanism, 23971 but as long as this function works properly, all collected memory is 23972 visible to GDB. 23973 23974 The function itself is straightforward to implement. A single pass 23975 over the trace frame's stack area, memory ranges, and expression blocks 23976 can yield the address of the buffer (if the requested address was 23977 saved), and also note the address of the next higher range of memory, 23978 to be returned when the search fails. 23979 23980 As an example, suppose the trace frame `f' has saved sixteen bytes 23981 from address `0x8000' in a buffer at `0x1000', and thirty-two bytes 23982 from address `0xc000' in a buffer at `0x1010'. Here are some sample 23983 calls, and the effect each would have: 23984 23985 `adbg_find_memory_in_frame (f, (char*) 0x8000, &buffer, &size)' 23986 This would set `buffer' to `0x1000', set `size' to sixteen, and 23987 return `OK_TARGET_RESPONSE', since `f' saves sixteen bytes from 23988 `0x8000' at `0x1000'. 23989 23990 `adbg_find_memory_in_frame (f, (char *) 0x8004, &buffer, &size)' 23991 This would set `buffer' to `0x1004', set `size' to twelve, and 23992 return `OK_TARGET_RESPONSE', since `f' saves the twelve bytes from 23993 `0x8004' starting four bytes into the buffer at `0x1000'. This 23994 shows that request addresses may fall in the middle of saved 23995 areas; the function should return the address and size of the 23996 remainder of the buffer. 23997 23998 `adbg_find_memory_in_frame (f, (char *) 0x8100, &buffer, &size)' 23999 This would set `size' to `0x3f00' and return 24000 `NOT_FOUND_TARGET_RESPONSE', since there is no memory saved in `f' 24001 from the address `0x8100', and the next memory available is at 24002 `0x8100 + 0x3f00', or `0xc000'. This shows that request addresses 24003 may fall outside of all saved memory ranges; the function should 24004 indicate the next saved area, if any. 24005 24006 `adbg_find_memory_in_frame (f, (char *) 0x7000, &buffer, &size)' 24007 This would set `size' to `0x1000' and return 24008 `NOT_FOUND_TARGET_RESPONSE', since the next saved memory is at 24009 `0x7000 + 0x1000', or `0x8000'. 24010 24011 `adbg_find_memory_in_frame (f, (char *) 0xf000, &buffer, &size)' 24012 This would set `size' to zero, and return 24013 `NOT_FOUND_TARGET_RESPONSE'. This shows how the function tells the 24014 caller that no further memory ranges have been saved. 24015 24016 24017 As another example, here is a function which will print out the 24018 addresses of all memory saved in the trace frame `frame' on the 24019 Symmetrix INLINES console: 24020 void 24021 print_frame_addresses (FRAME_DEF *frame) 24022 { 24023 char *addr; 24024 char *buffer; 24025 unsigned long size; 24026 24027 addr = 0; 24028 for (;;) 24029 { 24030 /* Either find out how much memory we have here, or discover 24031 where the next saved region is. */ 24032 if (adbg_find_memory_in_frame (frame, addr, &buffer, &size) 24033 == OK_TARGET_RESPONSE) 24034 printp ("saved %x to %x\n", addr, addr + size); 24035 if (size == 0) 24036 break; 24037 addr += size; 24038 } 24039 } 24040 24041 Note that there is not necessarily any connection between the order 24042 in which the data is saved in the trace frame, and the order in which 24043 `adbg_find_memory_in_frame' will return those memory ranges. The code 24044 above will always print the saved memory regions in order of increasing 24045 address, while the underlying frame structure might store the data in a 24046 random order. 24047 24048 [[This section should cover the rest of the Symmetrix functions the 24049 stub relies upon, too.]] 24050 24051 24052 File: gdb.info, Node: Rationale, Prev: Tracing on Symmetrix, Up: Agent Expressions 24053 24054 E.6 Rationale 24055 ============= 24056 24057 Some of the design decisions apparent above are arguable. 24058 24059 What about stack overflow/underflow? 24060 GDB should be able to query the target to discover its stack size. 24061 Given that information, GDB can determine at translation time 24062 whether a given expression will overflow the stack. But this spec 24063 isn't about what kinds of error-checking GDB ought to do. 24064 24065 Why are you doing everything in LONGEST? 24066 Speed isn't important, but agent code size is; using LONGEST 24067 brings in a bunch of support code to do things like division, etc. 24068 So this is a serious concern. 24069 24070 First, note that you don't need different bytecodes for different 24071 operand sizes. You can generate code without _knowing_ how big the 24072 stack elements actually are on the target. If the target only 24073 supports 32-bit ints, and you don't send any 64-bit bytecodes, 24074 everything just works. The observation here is that the MIPS and 24075 the Alpha have only fixed-size registers, and you can still get 24076 C's semantics even though most instructions only operate on 24077 full-sized words. You just need to make sure everything is 24078 properly sign-extended at the right times. So there is no need 24079 for 32- and 64-bit variants of the bytecodes. Just implement 24080 everything using the largest size you support. 24081 24082 GDB should certainly check to see what sizes the target supports, 24083 so the user can get an error earlier, rather than later. But this 24084 information is not necessary for correctness. 24085 24086 Why don't you have `>' or `<=' operators? 24087 I want to keep the interpreter small, and we don't need them. We 24088 can combine the `less_' opcodes with `log_not', and swap the order 24089 of the operands, yielding all four asymmetrical comparison 24090 operators. For example, `(x <= y)' is `! (x > y)', which is `! (y 24091 < x)'. 24092 24093 Why do you have `log_not'? 24094 Why do you have `ext'? 24095 Why do you have `zero_ext'? 24096 These are all easily synthesized from other instructions, but I 24097 expect them to be used frequently, and they're simple, so I 24098 include them to keep bytecode strings short. 24099 24100 `log_not' is equivalent to `const8 0 equal'; it's used in half the 24101 relational operators. 24102 24103 `ext N' is equivalent to `const8 S-N lsh const8 S-N rsh_signed', 24104 where S is the size of the stack elements; it follows `refM' and 24105 REG bytecodes when the value should be signed. See the next 24106 bulleted item. 24107 24108 `zero_ext N' is equivalent to `constM MASK log_and'; it's used 24109 whenever we push the value of a register, because we can't assume 24110 the upper bits of the register aren't garbage. 24111 24112 Why not have sign-extending variants of the `ref' operators? 24113 Because that would double the number of `ref' operators, and we 24114 need the `ext' bytecode anyway for accessing bitfields. 24115 24116 Why not have constant-address variants of the `ref' operators? 24117 Because that would double the number of `ref' operators again, and 24118 `const32 ADDRESS ref32' is only one byte longer. 24119 24120 Why do the `refN' operators have to support unaligned fetches? 24121 GDB will generate bytecode that fetches multi-byte values at 24122 unaligned addresses whenever the executable's debugging 24123 information tells it to. Furthermore, GDB does not know the value 24124 the pointer will have when GDB generates the bytecode, so it 24125 cannot determine whether a particular fetch will be aligned or not. 24126 24127 In particular, structure bitfields may be several bytes long, but 24128 follow no alignment rules; members of packed structures are not 24129 necessarily aligned either. 24130 24131 In general, there are many cases where unaligned references occur 24132 in correct C code, either at the programmer's explicit request, or 24133 at the compiler's discretion. Thus, it is simpler to make the GDB 24134 agent bytecodes work correctly in all circumstances than to make 24135 GDB guess in each case whether the compiler did the usual thing. 24136 24137 Why are there no side-effecting operators? 24138 Because our current client doesn't want them? That's a cheap 24139 answer. I think the real answer is that I'm afraid of 24140 implementing function calls. We should re-visit this issue after 24141 the present contract is delivered. 24142 24143 Why aren't the `goto' ops PC-relative? 24144 The interpreter has the base address around anyway for PC bounds 24145 checking, and it seemed simpler. 24146 24147 Why is there only one offset size for the `goto' ops? 24148 Offsets are currently sixteen bits. I'm not happy with this 24149 situation either: 24150 24151 Suppose we have multiple branch ops with different offset sizes. 24152 As I generate code left-to-right, all my jumps are forward jumps 24153 (there are no loops in expressions), so I never know the target 24154 when I emit the jump opcode. Thus, I have to either always assume 24155 the largest offset size, or do jump relaxation on the code after I 24156 generate it, which seems like a big waste of time. 24157 24158 I can imagine a reasonable expression being longer than 256 bytes. 24159 I can't imagine one being longer than 64k. Thus, we need 16-bit 24160 offsets. This kind of reasoning is so bogus, but relaxation is 24161 pathetic. 24162 24163 The other approach would be to generate code right-to-left. Then 24164 I'd always know my offset size. That might be fun. 24165 24166 Where is the function call bytecode? 24167 When we add side-effects, we should add this. 24168 24169 Why does the `reg' bytecode take a 16-bit register number? 24170 Intel's IA-64 architecture has 128 general-purpose registers, and 24171 128 floating-point registers, and I'm sure it has some random 24172 control registers. 24173 24174 Why do we need `trace' and `trace_quick'? 24175 Because GDB needs to record all the memory contents and registers 24176 an expression touches. If the user wants to evaluate an expression 24177 `x->y->z', the agent must record the values of `x' and `x->y' as 24178 well as the value of `x->y->z'. 24179 24180 Don't the `trace' bytecodes make the interpreter less general? 24181 They do mean that the interpreter contains special-purpose code, 24182 but that doesn't mean the interpreter can only be used for that 24183 purpose. If an expression doesn't use the `trace' bytecodes, they 24184 don't get in its way. 24185 24186 Why doesn't `trace_quick' consume its arguments the way everything else does? 24187 In general, you do want your operators to consume their arguments; 24188 it's consistent, and generally reduces the amount of stack 24189 rearrangement necessary. However, `trace_quick' is a kludge to 24190 save space; it only exists so we needn't write `dup const8 SIZE 24191 trace' before every memory reference. Therefore, it's okay for it 24192 not to consume its arguments; it's meant for a specific context in 24193 which we know exactly what it should do with the stack. If we're 24194 going to have a kludge, it should be an effective kludge. 24195 24196 Why does `trace16' exist? 24197 That opcode was added by the customer that contracted Cygnus for 24198 the data tracing work. I personally think it is unnecessary; 24199 objects that large will be quite rare, so it is okay to use `dup 24200 const16 SIZE trace' in those cases. 24201 24202 Whatever we decide to do with `trace16', we should at least leave 24203 opcode 0x30 reserved, to remain compatible with the customer who 24204 added it. 24205 24206 24207 24208 File: gdb.info, Node: Copying, Next: GNU Free Documentation License, Prev: Agent Expressions, Up: Top 24209 24210 Appendix F GNU GENERAL PUBLIC LICENSE 24211 ************************************* 24212 24213 Version 2, June 1991 24214 24215 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 24216 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24217 24218 Everyone is permitted to copy and distribute verbatim copies 24219 of this license document, but changing it is not allowed. 24220 24221 Preamble 24222 ======== 24223 24224 The licenses for most software are designed to take away your freedom 24225 to share and change it. By contrast, the GNU General Public License is 24226 intended to guarantee your freedom to share and change free 24227 software--to make sure the software is free for all its users. This 24228 General Public License applies to most of the Free Software 24229 Foundation's software and to any other program whose authors commit to 24230 using it. (Some other Free Software Foundation software is covered by 24231 the GNU Library General Public License instead.) You can apply it to 24232 your programs, too. 24233 24234 When we speak of free software, we are referring to freedom, not 24235 price. Our General Public Licenses are designed to make sure that you 24236 have the freedom to distribute copies of free software (and charge for 24237 this service if you wish), that you receive source code or can get it 24238 if you want it, that you can change the software or use pieces of it in 24239 new free programs; and that you know you can do these things. 24240 24241 To protect your rights, we need to make restrictions that forbid 24242 anyone to deny you these rights or to ask you to surrender the rights. 24243 These restrictions translate to certain responsibilities for you if you 24244 distribute copies of the software, or if you modify it. 24245 24246 For example, if you distribute copies of such a program, whether 24247 gratis or for a fee, you must give the recipients all the rights that 24248 you have. You must make sure that they, too, receive or can get the 24249 source code. And you must show them these terms so they know their 24250 rights. 24251 24252 We protect your rights with two steps: (1) copyright the software, 24253 and (2) offer you this license which gives you legal permission to copy, 24254 distribute and/or modify the software. 24255 24256 Also, for each author's protection and ours, we want to make certain 24257 that everyone understands that there is no warranty for this free 24258 software. If the software is modified by someone else and passed on, we 24259 want its recipients to know that what they have is not the original, so 24260 that any problems introduced by others will not reflect on the original 24261 authors' reputations. 24262 24263 Finally, any free program is threatened constantly by software 24264 patents. We wish to avoid the danger that redistributors of a free 24265 program will individually obtain patent licenses, in effect making the 24266 program proprietary. To prevent this, we have made it clear that any 24267 patent must be licensed for everyone's free use or not licensed at all. 24268 24269 The precise terms and conditions for copying, distribution and 24270 modification follow. 24271 24272 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 24273 0. This License applies to any program or other work which contains a 24274 notice placed by the copyright holder saying it may be distributed 24275 under the terms of this General Public License. The "Program", 24276 below, refers to any such program or work, and a "work based on 24277 the Program" means either the Program or any derivative work under 24278 copyright law: that is to say, a work containing the Program or a 24279 portion of it, either verbatim or with modifications and/or 24280 translated into another language. (Hereinafter, translation is 24281 included without limitation in the term "modification".) Each 24282 licensee is addressed as "you". 24283 24284 Activities other than copying, distribution and modification are 24285 not covered by this License; they are outside its scope. The act 24286 of running the Program is not restricted, and the output from the 24287 Program is covered only if its contents constitute a work based on 24288 the Program (independent of having been made by running the 24289 Program). Whether that is true depends on what the Program does. 24290 24291 1. You may copy and distribute verbatim copies of the Program's 24292 source code as you receive it, in any medium, provided that you 24293 conspicuously and appropriately publish on each copy an appropriate 24294 copyright notice and disclaimer of warranty; keep intact all the 24295 notices that refer to this License and to the absence of any 24296 warranty; and give any other recipients of the Program a copy of 24297 this License along with the Program. 24298 24299 You may charge a fee for the physical act of transferring a copy, 24300 and you may at your option offer warranty protection in exchange 24301 for a fee. 24302 24303 2. You may modify your copy or copies of the Program or any portion 24304 of it, thus forming a work based on the Program, and copy and 24305 distribute such modifications or work under the terms of Section 1 24306 above, provided that you also meet all of these conditions: 24307 24308 a. You must cause the modified files to carry prominent notices 24309 stating that you changed the files and the date of any change. 24310 24311 b. You must cause any work that you distribute or publish, that 24312 in whole or in part contains or is derived from the Program 24313 or any part thereof, to be licensed as a whole at no charge 24314 to all third parties under the terms of this License. 24315 24316 c. If the modified program normally reads commands interactively 24317 when run, you must cause it, when started running for such 24318 interactive use in the most ordinary way, to print or display 24319 an announcement including an appropriate copyright notice and 24320 a notice that there is no warranty (or else, saying that you 24321 provide a warranty) and that users may redistribute the 24322 program under these conditions, and telling the user how to 24323 view a copy of this License. (Exception: if the Program 24324 itself is interactive but does not normally print such an 24325 announcement, your work based on the Program is not required 24326 to print an announcement.) 24327 24328 These requirements apply to the modified work as a whole. If 24329 identifiable sections of that work are not derived from the 24330 Program, and can be reasonably considered independent and separate 24331 works in themselves, then this License, and its terms, do not 24332 apply to those sections when you distribute them as separate 24333 works. But when you distribute the same sections as part of a 24334 whole which is a work based on the Program, the distribution of 24335 the whole must be on the terms of this License, whose permissions 24336 for other licensees extend to the entire whole, and thus to each 24337 and every part regardless of who wrote it. 24338 24339 Thus, it is not the intent of this section to claim rights or 24340 contest your rights to work written entirely by you; rather, the 24341 intent is to exercise the right to control the distribution of 24342 derivative or collective works based on the Program. 24343 24344 In addition, mere aggregation of another work not based on the 24345 Program with the Program (or with a work based on the Program) on 24346 a volume of a storage or distribution medium does not bring the 24347 other work under the scope of this License. 24348 24349 3. You may copy and distribute the Program (or a work based on it, 24350 under Section 2) in object code or executable form under the terms 24351 of Sections 1 and 2 above provided that you also do one of the 24352 following: 24353 24354 a. Accompany it with the complete corresponding machine-readable 24355 source code, which must be distributed under the terms of 24356 Sections 1 and 2 above on a medium customarily used for 24357 software interchange; or, 24358 24359 b. Accompany it with a written offer, valid for at least three 24360 years, to give any third party, for a charge no more than your 24361 cost of physically performing source distribution, a complete 24362 machine-readable copy of the corresponding source code, to be 24363 distributed under the terms of Sections 1 and 2 above on a 24364 medium customarily used for software interchange; or, 24365 24366 c. Accompany it with the information you received as to the offer 24367 to distribute corresponding source code. (This alternative is 24368 allowed only for noncommercial distribution and only if you 24369 received the program in object code or executable form with 24370 such an offer, in accord with Subsection b above.) 24371 24372 The source code for a work means the preferred form of the work for 24373 making modifications to it. For an executable work, complete 24374 source code means all the source code for all modules it contains, 24375 plus any associated interface definition files, plus the scripts 24376 used to control compilation and installation of the executable. 24377 However, as a special exception, the source code distributed need 24378 not include anything that is normally distributed (in either 24379 source or binary form) with the major components (compiler, 24380 kernel, and so on) of the operating system on which the executable 24381 runs, unless that component itself accompanies the executable. 24382 24383 If distribution of executable or object code is made by offering 24384 access to copy from a designated place, then offering equivalent 24385 access to copy the source code from the same place counts as 24386 distribution of the source code, even though third parties are not 24387 compelled to copy the source along with the object code. 24388 24389 4. You may not copy, modify, sublicense, or distribute the Program 24390 except as expressly provided under this License. Any attempt 24391 otherwise to copy, modify, sublicense or distribute the Program is 24392 void, and will automatically terminate your rights under this 24393 License. However, parties who have received copies, or rights, 24394 from you under this License will not have their licenses 24395 terminated so long as such parties remain in full compliance. 24396 24397 5. You are not required to accept this License, since you have not 24398 signed it. However, nothing else grants you permission to modify 24399 or distribute the Program or its derivative works. These actions 24400 are prohibited by law if you do not accept this License. 24401 Therefore, by modifying or distributing the Program (or any work 24402 based on the Program), you indicate your acceptance of this 24403 License to do so, and all its terms and conditions for copying, 24404 distributing or modifying the Program or works based on it. 24405 24406 6. Each time you redistribute the Program (or any work based on the 24407 Program), the recipient automatically receives a license from the 24408 original licensor to copy, distribute or modify the Program 24409 subject to these terms and conditions. You may not impose any 24410 further restrictions on the recipients' exercise of the rights 24411 granted herein. You are not responsible for enforcing compliance 24412 by third parties to this License. 24413 24414 7. If, as a consequence of a court judgment or allegation of patent 24415 infringement or for any other reason (not limited to patent 24416 issues), conditions are imposed on you (whether by court order, 24417 agreement or otherwise) that contradict the conditions of this 24418 License, they do not excuse you from the conditions of this 24419 License. If you cannot distribute so as to satisfy simultaneously 24420 your obligations under this License and any other pertinent 24421 obligations, then as a consequence you may not distribute the 24422 Program at all. For example, if a patent license would not permit 24423 royalty-free redistribution of the Program by all those who 24424 receive copies directly or indirectly through you, then the only 24425 way you could satisfy both it and this License would be to refrain 24426 entirely from distribution of the Program. 24427 24428 If any portion of this section is held invalid or unenforceable 24429 under any particular circumstance, the balance of the section is 24430 intended to apply and the section as a whole is intended to apply 24431 in other circumstances. 24432 24433 It is not the purpose of this section to induce you to infringe any 24434 patents or other property right claims or to contest validity of 24435 any such claims; this section has the sole purpose of protecting 24436 the integrity of the free software distribution system, which is 24437 implemented by public license practices. Many people have made 24438 generous contributions to the wide range of software distributed 24439 through that system in reliance on consistent application of that 24440 system; it is up to the author/donor to decide if he or she is 24441 willing to distribute software through any other system and a 24442 licensee cannot impose that choice. 24443 24444 This section is intended to make thoroughly clear what is believed 24445 to be a consequence of the rest of this License. 24446 24447 8. If the distribution and/or use of the Program is restricted in 24448 certain countries either by patents or by copyrighted interfaces, 24449 the original copyright holder who places the Program under this 24450 License may add an explicit geographical distribution limitation 24451 excluding those countries, so that distribution is permitted only 24452 in or among countries not thus excluded. In such case, this 24453 License incorporates the limitation as if written in the body of 24454 this License. 24455 24456 9. The Free Software Foundation may publish revised and/or new 24457 versions of the General Public License from time to time. Such 24458 new versions will be similar in spirit to the present version, but 24459 may differ in detail to address new problems or concerns. 24460 24461 Each version is given a distinguishing version number. If the 24462 Program specifies a version number of this License which applies 24463 to it and "any later version", you have the option of following 24464 the terms and conditions either of that version or of any later 24465 version published by the Free Software Foundation. If the Program 24466 does not specify a version number of this License, you may choose 24467 any version ever published by the Free Software Foundation. 24468 24469 10. If you wish to incorporate parts of the Program into other free 24470 programs whose distribution conditions are different, write to the 24471 author to ask for permission. For software which is copyrighted 24472 by the Free Software Foundation, write to the Free Software 24473 Foundation; we sometimes make exceptions for this. Our decision 24474 will be guided by the two goals of preserving the free status of 24475 all derivatives of our free software and of promoting the sharing 24476 and reuse of software generally. 24477 24478 NO WARRANTY 24479 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO 24480 WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE 24481 LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 24482 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT 24483 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT 24484 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 24485 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 24486 QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 24487 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY 24488 SERVICING, REPAIR OR CORRECTION. 24489 24490 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 24491 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY 24492 MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE 24493 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 24494 INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR 24495 INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 24496 DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU 24497 OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY 24498 OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN 24499 ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 24500 24501 END OF TERMS AND CONDITIONS 24502 How to Apply These Terms to Your New Programs 24503 ============================================= 24504 24505 If you develop a new program, and you want it to be of the greatest 24506 possible use to the public, the best way to achieve this is to make it 24507 free software which everyone can redistribute and change under these 24508 terms. 24509 24510 To do so, attach the following notices to the program. It is safest 24511 to attach them to the start of each source file to most effectively 24512 convey the exclusion of warranty; and each file should have at least 24513 the "copyright" line and a pointer to where the full notice is found. 24514 24515 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. 24516 Copyright (C) YEAR NAME OF AUTHOR 24517 24518 This program is free software; you can redistribute it and/or modify 24519 it under the terms of the GNU General Public License as published by 24520 the Free Software Foundation; either version 2 of the License, or 24521 (at your option) any later version. 24522 24523 This program is distributed in the hope that it will be useful, 24524 but WITHOUT ANY WARRANTY; without even the implied warranty of 24525 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24526 GNU General Public License for more details. 24527 24528 You should have received a copy of the GNU General Public License 24529 along with this program; if not, write to the Free Software 24530 Foundation, Inc., 51 Franklin Street, Fifth Floor, 24531 Boston, MA 02110-1301, USA. 24532 24533 Also add information on how to contact you by electronic and paper 24534 mail. 24535 24536 If the program is interactive, make it output a short notice like 24537 this when it starts in an interactive mode: 24538 24539 Gnomovision version 69, Copyright (C) YEAR NAME OF AUTHOR 24540 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details 24541 type `show w'. 24542 This is free software, and you are welcome to redistribute it 24543 under certain conditions; type `show c' for details. 24544 24545 The hypothetical commands `show w' and `show c' should show the 24546 appropriate parts of the General Public License. Of course, the 24547 commands you use may be called something other than `show w' and `show 24548 c'; they could even be mouse-clicks or menu items--whatever suits your 24549 program. 24550 24551 You should also get your employer (if you work as a programmer) or 24552 your school, if any, to sign a "copyright disclaimer" for the program, 24553 if necessary. Here is a sample; alter the names: 24554 24555 Yoyodyne, Inc., hereby disclaims all copyright interest in the program 24556 `Gnomovision' (which makes passes at compilers) written by James Hacker. 24557 24558 SIGNATURE OF TY COON, 1 April 1989 24559 Ty Coon, President of Vice 24560 24561 This General Public License does not permit incorporating your 24562 program into proprietary programs. If your program is a subroutine 24563 library, you may consider it more useful to permit linking proprietary 24564 applications with the library. If this is what you want to do, use the 24565 GNU Library General Public License instead of this License. 24566 24567 24568 File: gdb.info, Node: GNU Free Documentation License, Next: Index, Prev: Copying, Up: Top 24569 24570 Appendix G GNU Free Documentation License 24571 ***************************************** 24572 24573 Version 1.2, November 2002 24574 24575 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. 24576 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24577 24578 Everyone is permitted to copy and distribute verbatim copies 24579 of this license document, but changing it is not allowed. 24580 24581 0. PREAMBLE 24582 24583 The purpose of this License is to make a manual, textbook, or other 24584 functional and useful document "free" in the sense of freedom: to 24585 assure everyone the effective freedom to copy and redistribute it, 24586 with or without modifying it, either commercially or 24587 noncommercially. Secondarily, this License preserves for the 24588 author and publisher a way to get credit for their work, while not 24589 being considered responsible for modifications made by others. 24590 24591 This License is a kind of "copyleft", which means that derivative 24592 works of the document must themselves be free in the same sense. 24593 It complements the GNU General Public License, which is a copyleft 24594 license designed for free software. 24595 24596 We have designed this License in order to use it for manuals for 24597 free software, because free software needs free documentation: a 24598 free program should come with manuals providing the same freedoms 24599 that the software does. But this License is not limited to 24600 software manuals; it can be used for any textual work, regardless 24601 of subject matter or whether it is published as a printed book. 24602 We recommend this License principally for works whose purpose is 24603 instruction or reference. 24604 24605 1. APPLICABILITY AND DEFINITIONS 24606 24607 This License applies to any manual or other work, in any medium, 24608 that contains a notice placed by the copyright holder saying it 24609 can be distributed under the terms of this License. Such a notice 24610 grants a world-wide, royalty-free license, unlimited in duration, 24611 to use that work under the conditions stated herein. The 24612 "Document", below, refers to any such manual or work. Any member 24613 of the public is a licensee, and is addressed as "you". You 24614 accept the license if you copy, modify or distribute the work in a 24615 way requiring permission under copyright law. 24616 24617 A "Modified Version" of the Document means any work containing the 24618 Document or a portion of it, either copied verbatim, or with 24619 modifications and/or translated into another language. 24620 24621 A "Secondary Section" is a named appendix or a front-matter section 24622 of the Document that deals exclusively with the relationship of the 24623 publishers or authors of the Document to the Document's overall 24624 subject (or to related matters) and contains nothing that could 24625 fall directly within that overall subject. (Thus, if the Document 24626 is in part a textbook of mathematics, a Secondary Section may not 24627 explain any mathematics.) The relationship could be a matter of 24628 historical connection with the subject or with related matters, or 24629 of legal, commercial, philosophical, ethical or political position 24630 regarding them. 24631 24632 The "Invariant Sections" are certain Secondary Sections whose 24633 titles are designated, as being those of Invariant Sections, in 24634 the notice that says that the Document is released under this 24635 License. If a section does not fit the above definition of 24636 Secondary then it is not allowed to be designated as Invariant. 24637 The Document may contain zero Invariant Sections. If the Document 24638 does not identify any Invariant Sections then there are none. 24639 24640 The "Cover Texts" are certain short passages of text that are 24641 listed, as Front-Cover Texts or Back-Cover Texts, in the notice 24642 that says that the Document is released under this License. A 24643 Front-Cover Text may be at most 5 words, and a Back-Cover Text may 24644 be at most 25 words. 24645 24646 A "Transparent" copy of the Document means a machine-readable copy, 24647 represented in a format whose specification is available to the 24648 general public, that is suitable for revising the document 24649 straightforwardly with generic text editors or (for images 24650 composed of pixels) generic paint programs or (for drawings) some 24651 widely available drawing editor, and that is suitable for input to 24652 text formatters or for automatic translation to a variety of 24653 formats suitable for input to text formatters. A copy made in an 24654 otherwise Transparent file format whose markup, or absence of 24655 markup, has been arranged to thwart or discourage subsequent 24656 modification by readers is not Transparent. An image format is 24657 not Transparent if used for any substantial amount of text. A 24658 copy that is not "Transparent" is called "Opaque". 24659 24660 Examples of suitable formats for Transparent copies include plain 24661 ASCII without markup, Texinfo input format, LaTeX input format, 24662 SGML or XML using a publicly available DTD, and 24663 standard-conforming simple HTML, PostScript or PDF designed for 24664 human modification. Examples of transparent image formats include 24665 PNG, XCF and JPG. Opaque formats include proprietary formats that 24666 can be read and edited only by proprietary word processors, SGML or 24667 XML for which the DTD and/or processing tools are not generally 24668 available, and the machine-generated HTML, PostScript or PDF 24669 produced by some word processors for output purposes only. 24670 24671 The "Title Page" means, for a printed book, the title page itself, 24672 plus such following pages as are needed to hold, legibly, the 24673 material this License requires to appear in the title page. For 24674 works in formats which do not have any title page as such, "Title 24675 Page" means the text near the most prominent appearance of the 24676 work's title, preceding the beginning of the body of the text. 24677 24678 A section "Entitled XYZ" means a named subunit of the Document 24679 whose title either is precisely XYZ or contains XYZ in parentheses 24680 following text that translates XYZ in another language. (Here XYZ 24681 stands for a specific section name mentioned below, such as 24682 "Acknowledgements", "Dedications", "Endorsements", or "History".) 24683 To "Preserve the Title" of such a section when you modify the 24684 Document means that it remains a section "Entitled XYZ" according 24685 to this definition. 24686 24687 The Document may include Warranty Disclaimers next to the notice 24688 which states that this License applies to the Document. These 24689 Warranty Disclaimers are considered to be included by reference in 24690 this License, but only as regards disclaiming warranties: any other 24691 implication that these Warranty Disclaimers may have is void and 24692 has no effect on the meaning of this License. 24693 24694 2. VERBATIM COPYING 24695 24696 You may copy and distribute the Document in any medium, either 24697 commercially or noncommercially, provided that this License, the 24698 copyright notices, and the license notice saying this License 24699 applies to the Document are reproduced in all copies, and that you 24700 add no other conditions whatsoever to those of this License. You 24701 may not use technical measures to obstruct or control the reading 24702 or further copying of the copies you make or distribute. However, 24703 you may accept compensation in exchange for copies. If you 24704 distribute a large enough number of copies you must also follow 24705 the conditions in section 3. 24706 24707 You may also lend copies, under the same conditions stated above, 24708 and you may publicly display copies. 24709 24710 3. COPYING IN QUANTITY 24711 24712 If you publish printed copies (or copies in media that commonly 24713 have printed covers) of the Document, numbering more than 100, and 24714 the Document's license notice requires Cover Texts, you must 24715 enclose the copies in covers that carry, clearly and legibly, all 24716 these Cover Texts: Front-Cover Texts on the front cover, and 24717 Back-Cover Texts on the back cover. Both covers must also clearly 24718 and legibly identify you as the publisher of these copies. The 24719 front cover must present the full title with all words of the 24720 title equally prominent and visible. You may add other material 24721 on the covers in addition. Copying with changes limited to the 24722 covers, as long as they preserve the title of the Document and 24723 satisfy these conditions, can be treated as verbatim copying in 24724 other respects. 24725 24726 If the required texts for either cover are too voluminous to fit 24727 legibly, you should put the first ones listed (as many as fit 24728 reasonably) on the actual cover, and continue the rest onto 24729 adjacent pages. 24730 24731 If you publish or distribute Opaque copies of the Document 24732 numbering more than 100, you must either include a 24733 machine-readable Transparent copy along with each Opaque copy, or 24734 state in or with each Opaque copy a computer-network location from 24735 which the general network-using public has access to download 24736 using public-standard network protocols a complete Transparent 24737 copy of the Document, free of added material. If you use the 24738 latter option, you must take reasonably prudent steps, when you 24739 begin distribution of Opaque copies in quantity, to ensure that 24740 this Transparent copy will remain thus accessible at the stated 24741 location until at least one year after the last time you 24742 distribute an Opaque copy (directly or through your agents or 24743 retailers) of that edition to the public. 24744 24745 It is requested, but not required, that you contact the authors of 24746 the Document well before redistributing any large number of 24747 copies, to give them a chance to provide you with an updated 24748 version of the Document. 24749 24750 4. MODIFICATIONS 24751 24752 You may copy and distribute a Modified Version of the Document 24753 under the conditions of sections 2 and 3 above, provided that you 24754 release the Modified Version under precisely this License, with 24755 the Modified Version filling the role of the Document, thus 24756 licensing distribution and modification of the Modified Version to 24757 whoever possesses a copy of it. In addition, you must do these 24758 things in the Modified Version: 24759 24760 A. Use in the Title Page (and on the covers, if any) a title 24761 distinct from that of the Document, and from those of 24762 previous versions (which should, if there were any, be listed 24763 in the History section of the Document). You may use the 24764 same title as a previous version if the original publisher of 24765 that version gives permission. 24766 24767 B. List on the Title Page, as authors, one or more persons or 24768 entities responsible for authorship of the modifications in 24769 the Modified Version, together with at least five of the 24770 principal authors of the Document (all of its principal 24771 authors, if it has fewer than five), unless they release you 24772 from this requirement. 24773 24774 C. State on the Title page the name of the publisher of the 24775 Modified Version, as the publisher. 24776 24777 D. Preserve all the copyright notices of the Document. 24778 24779 E. Add an appropriate copyright notice for your modifications 24780 adjacent to the other copyright notices. 24781 24782 F. Include, immediately after the copyright notices, a license 24783 notice giving the public permission to use the Modified 24784 Version under the terms of this License, in the form shown in 24785 the Addendum below. 24786 24787 G. Preserve in that license notice the full lists of Invariant 24788 Sections and required Cover Texts given in the Document's 24789 license notice. 24790 24791 H. Include an unaltered copy of this License. 24792 24793 I. Preserve the section Entitled "History", Preserve its Title, 24794 and add to it an item stating at least the title, year, new 24795 authors, and publisher of the Modified Version as given on 24796 the Title Page. If there is no section Entitled "History" in 24797 the Document, create one stating the title, year, authors, 24798 and publisher of the Document as given on its Title Page, 24799 then add an item describing the Modified Version as stated in 24800 the previous sentence. 24801 24802 J. Preserve the network location, if any, given in the Document 24803 for public access to a Transparent copy of the Document, and 24804 likewise the network locations given in the Document for 24805 previous versions it was based on. These may be placed in 24806 the "History" section. You may omit a network location for a 24807 work that was published at least four years before the 24808 Document itself, or if the original publisher of the version 24809 it refers to gives permission. 24810 24811 K. For any section Entitled "Acknowledgements" or "Dedications", 24812 Preserve the Title of the section, and preserve in the 24813 section all the substance and tone of each of the contributor 24814 acknowledgements and/or dedications given therein. 24815 24816 L. Preserve all the Invariant Sections of the Document, 24817 unaltered in their text and in their titles. Section numbers 24818 or the equivalent are not considered part of the section 24819 titles. 24820 24821 M. Delete any section Entitled "Endorsements". Such a section 24822 may not be included in the Modified Version. 24823 24824 N. Do not retitle any existing section to be Entitled 24825 "Endorsements" or to conflict in title with any Invariant 24826 Section. 24827 24828 O. Preserve any Warranty Disclaimers. 24829 24830 If the Modified Version includes new front-matter sections or 24831 appendices that qualify as Secondary Sections and contain no 24832 material copied from the Document, you may at your option 24833 designate some or all of these sections as invariant. To do this, 24834 add their titles to the list of Invariant Sections in the Modified 24835 Version's license notice. These titles must be distinct from any 24836 other section titles. 24837 24838 You may add a section Entitled "Endorsements", provided it contains 24839 nothing but endorsements of your Modified Version by various 24840 parties--for example, statements of peer review or that the text 24841 has been approved by an organization as the authoritative 24842 definition of a standard. 24843 24844 You may add a passage of up to five words as a Front-Cover Text, 24845 and a passage of up to 25 words as a Back-Cover Text, to the end 24846 of the list of Cover Texts in the Modified Version. Only one 24847 passage of Front-Cover Text and one of Back-Cover Text may be 24848 added by (or through arrangements made by) any one entity. If the 24849 Document already includes a cover text for the same cover, 24850 previously added by you or by arrangement made by the same entity 24851 you are acting on behalf of, you may not add another; but you may 24852 replace the old one, on explicit permission from the previous 24853 publisher that added the old one. 24854 24855 The author(s) and publisher(s) of the Document do not by this 24856 License give permission to use their names for publicity for or to 24857 assert or imply endorsement of any Modified Version. 24858 24859 5. COMBINING DOCUMENTS 24860 24861 You may combine the Document with other documents released under 24862 this License, under the terms defined in section 4 above for 24863 modified versions, provided that you include in the combination 24864 all of the Invariant Sections of all of the original documents, 24865 unmodified, and list them all as Invariant Sections of your 24866 combined work in its license notice, and that you preserve all 24867 their Warranty Disclaimers. 24868 24869 The combined work need only contain one copy of this License, and 24870 multiple identical Invariant Sections may be replaced with a single 24871 copy. If there are multiple Invariant Sections with the same name 24872 but different contents, make the title of each such section unique 24873 by adding at the end of it, in parentheses, the name of the 24874 original author or publisher of that section if known, or else a 24875 unique number. Make the same adjustment to the section titles in 24876 the list of Invariant Sections in the license notice of the 24877 combined work. 24878 24879 In the combination, you must combine any sections Entitled 24880 "History" in the various original documents, forming one section 24881 Entitled "History"; likewise combine any sections Entitled 24882 "Acknowledgements", and any sections Entitled "Dedications". You 24883 must delete all sections Entitled "Endorsements." 24884 24885 6. COLLECTIONS OF DOCUMENTS 24886 24887 You may make a collection consisting of the Document and other 24888 documents released under this License, and replace the individual 24889 copies of this License in the various documents with a single copy 24890 that is included in the collection, provided that you follow the 24891 rules of this License for verbatim copying of each of the 24892 documents in all other respects. 24893 24894 You may extract a single document from such a collection, and 24895 distribute it individually under this License, provided you insert 24896 a copy of this License into the extracted document, and follow 24897 this License in all other respects regarding verbatim copying of 24898 that document. 24899 24900 7. AGGREGATION WITH INDEPENDENT WORKS 24901 24902 A compilation of the Document or its derivatives with other 24903 separate and independent documents or works, in or on a volume of 24904 a storage or distribution medium, is called an "aggregate" if the 24905 copyright resulting from the compilation is not used to limit the 24906 legal rights of the compilation's users beyond what the individual 24907 works permit. When the Document is included in an aggregate, this 24908 License does not apply to the other works in the aggregate which 24909 are not themselves derivative works of the Document. 24910 24911 If the Cover Text requirement of section 3 is applicable to these 24912 copies of the Document, then if the Document is less than one half 24913 of the entire aggregate, the Document's Cover Texts may be placed 24914 on covers that bracket the Document within the aggregate, or the 24915 electronic equivalent of covers if the Document is in electronic 24916 form. Otherwise they must appear on printed covers that bracket 24917 the whole aggregate. 24918 24919 8. TRANSLATION 24920 24921 Translation is considered a kind of modification, so you may 24922 distribute translations of the Document under the terms of section 24923 4. Replacing Invariant Sections with translations requires special 24924 permission from their copyright holders, but you may include 24925 translations of some or all Invariant Sections in addition to the 24926 original versions of these Invariant Sections. You may include a 24927 translation of this License, and all the license notices in the 24928 Document, and any Warranty Disclaimers, provided that you also 24929 include the original English version of this License and the 24930 original versions of those notices and disclaimers. In case of a 24931 disagreement between the translation and the original version of 24932 this License or a notice or disclaimer, the original version will 24933 prevail. 24934 24935 If a section in the Document is Entitled "Acknowledgements", 24936 "Dedications", or "History", the requirement (section 4) to 24937 Preserve its Title (section 1) will typically require changing the 24938 actual title. 24939 24940 9. TERMINATION 24941 24942 You may not copy, modify, sublicense, or distribute the Document 24943 except as expressly provided for under this License. Any other 24944 attempt to copy, modify, sublicense or distribute the Document is 24945 void, and will automatically terminate your rights under this 24946 License. However, parties who have received copies, or rights, 24947 from you under this License will not have their licenses 24948 terminated so long as such parties remain in full compliance. 24949 24950 10. FUTURE REVISIONS OF THIS LICENSE 24951 24952 The Free Software Foundation may publish new, revised versions of 24953 the GNU Free Documentation License from time to time. Such new 24954 versions will be similar in spirit to the present version, but may 24955 differ in detail to address new problems or concerns. See 24956 `http://www.gnu.org/copyleft/'. 24957 24958 Each version of the License is given a distinguishing version 24959 number. If the Document specifies that a particular numbered 24960 version of this License "or any later version" applies to it, you 24961 have the option of following the terms and conditions either of 24962 that specified version or of any later version that has been 24963 published (not as a draft) by the Free Software Foundation. If 24964 the Document does not specify a version number of this License, 24965 you may choose any version ever published (not as a draft) by the 24966 Free Software Foundation. 24967 24968 G.1 ADDENDUM: How to use this License for your documents 24969 ======================================================== 24970 24971 To use this License in a document you have written, include a copy of 24972 the License in the document and put the following copyright and license 24973 notices just after the title page: 24974 24975 Copyright (C) YEAR YOUR NAME. 24976 Permission is granted to copy, distribute and/or modify this document 24977 under the terms of the GNU Free Documentation License, Version 1.2 24978 or any later version published by the Free Software Foundation; 24979 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 24980 Texts. A copy of the license is included in the section entitled ``GNU 24981 Free Documentation License''. 24982 24983 If you have Invariant Sections, Front-Cover Texts and Back-Cover 24984 Texts, replace the "with...Texts." line with this: 24985 24986 with the Invariant Sections being LIST THEIR TITLES, with 24987 the Front-Cover Texts being LIST, and with the Back-Cover Texts 24988 being LIST. 24989 24990 If you have Invariant Sections without Cover Texts, or some other 24991 combination of the three, merge those two alternatives to suit the 24992 situation. 24993 24994 If your document contains nontrivial examples of program code, we 24995 recommend releasing these examples in parallel under your choice of 24996 free software license, such as the GNU General Public License, to 24997 permit their use in free software. 24998 24999 25000 File: gdb.info, Node: Index, Prev: GNU Free Documentation License, Up: Top 25001 25002 Index 25003 ***** 25004 25005 [index] 25006 * Menu: 25007 25008 * ! packet: Packets. (line 26) 25009 * "No symbol "foo" in current context": Variables. (line 74) 25010 * # (a comment): Command Syntax. (line 38) 25011 * # in Modula-2: GDB/M2. (line 18) 25012 * $: Value History. (line 13) 25013 * $$: Value History. (line 13) 25014 * $_ and info breakpoints: Set Breaks. (line 136) 25015 * $_ and info line: Machine Code. (line 30) 25016 * $_, $__, and value history: Memory. (line 87) 25017 * $_, convenience variable: Convenience Vars. (line 64) 25018 * $__, convenience variable: Convenience Vars. (line 73) 25019 * $_exitcode, convenience variable: Convenience Vars. (line 79) 25020 * $bpnum, convenience variable: Set Breaks. (line 6) 25021 * $cdir, convenience variable: Source Path. (line 99) 25022 * $cwdr, convenience variable: Source Path. (line 99) 25023 * $tpnum: Create and Delete Tracepoints. 25024 (line 31) 25025 * $trace_file: Tracepoint Variables. 25026 (line 16) 25027 * $trace_frame: Tracepoint Variables. 25028 (line 6) 25029 * $trace_func: Tracepoint Variables. 25030 (line 19) 25031 * $trace_line: Tracepoint Variables. 25032 (line 13) 25033 * $tracepoint: Tracepoint Variables. 25034 (line 10) 25035 * --annotate: Mode Options. (line 101) 25036 * --args: Mode Options. (line 114) 25037 * --batch: Mode Options. (line 23) 25038 * --batch-silent: Mode Options. (line 39) 25039 * --baud: Mode Options. (line 120) 25040 * --cd: Mode Options. (line 80) 25041 * --command: File Options. (line 55) 25042 * --core: File Options. (line 43) 25043 * --directory: File Options. (line 70) 25044 * --epoch: Mode Options. (line 96) 25045 * --eval-command: File Options. (line 60) 25046 * --exec: File Options. (line 35) 25047 * --fullname: Mode Options. (line 85) 25048 * --interpreter: Mode Options. (line 141) 25049 * --nowindows: Mode Options. (line 70) 25050 * --nx: Mode Options. (line 11) 25051 * --pid: File Options. (line 49) 25052 * --quiet: Mode Options. (line 19) 25053 * --readnow: File Options. (line 74) 25054 * --return-child-result: Mode Options. (line 51) 25055 * --se: File Options. (line 39) 25056 * --silent: Mode Options. (line 19) 25057 * --statistics: Mode Options. (line 158) 25058 * --symbols: File Options. (line 31) 25059 * --tty: Mode Options. (line 129) 25060 * --tui: Mode Options. (line 132) 25061 * --version: Mode Options. (line 162) 25062 * --windows: Mode Options. (line 76) 25063 * --with-sysroot: Files. (line 374) 25064 * --write: Mode Options. (line 153) 25065 * -b: Mode Options. (line 120) 25066 * -break-after: GDB/MI Breakpoint Commands. 25067 (line 11) 25068 * -break-condition: GDB/MI Breakpoint Commands. 25069 (line 54) 25070 * -break-delete: GDB/MI Breakpoint Commands. 25071 (line 91) 25072 * -break-disable: GDB/MI Breakpoint Commands. 25073 (line 125) 25074 * -break-enable: GDB/MI Breakpoint Commands. 25075 (line 161) 25076 * -break-info: GDB/MI Breakpoint Commands. 25077 (line 196) 25078 * -break-insert: GDB/MI Breakpoint Commands. 25079 (line 216) 25080 * -break-list: GDB/MI Breakpoint Commands. 25081 (line 313) 25082 * -break-watch: GDB/MI Breakpoint Commands. 25083 (line 388) 25084 * -c: File Options. (line 43) 25085 * -d: File Options. (line 70) 25086 * -data-disassemble: GDB/MI Data Manipulation. 25087 (line 12) 25088 * -data-evaluate-expression: GDB/MI Data Manipulation. 25089 (line 140) 25090 * -data-list-changed-registers: GDB/MI Data Manipulation. 25091 (line 178) 25092 * -data-list-register-names: GDB/MI Data Manipulation. 25093 (line 213) 25094 * -data-list-register-values: GDB/MI Data Manipulation. 25095 (line 253) 25096 * -data-read-memory: GDB/MI Data Manipulation. 25097 (line 343) 25098 * -e: File Options. (line 35) 25099 * -environment-cd: GDB/MI Program Context. 25100 (line 50) 25101 * -environment-directory: GDB/MI Program Context. 25102 (line 73) 25103 * -environment-path: GDB/MI Program Context. 25104 (line 117) 25105 * -environment-pwd: GDB/MI Program Context. 25106 (line 158) 25107 * -ex: File Options. (line 60) 25108 * -exec-abort: GDB/MI Miscellaneous Commands. 25109 (line 31) 25110 * -exec-arguments: GDB/MI Program Context. 25111 (line 9) 25112 * -exec-continue: GDB/MI Program Execution. 25113 (line 13) 25114 * -exec-finish: GDB/MI Program Execution. 25115 (line 40) 25116 * -exec-interrupt: GDB/MI Program Execution. 25117 (line 81) 25118 * -exec-next: GDB/MI Program Execution. 25119 (line 121) 25120 * -exec-next-instruction: GDB/MI Program Execution. 25121 (line 146) 25122 * -exec-return: GDB/MI Program Execution. 25123 (line 176) 25124 * -exec-run: GDB/MI Program Execution. 25125 (line 219) 25126 * -exec-show-arguments: GDB/MI Program Context. 25127 (line 30) 25128 * -exec-step: GDB/MI Program Execution. 25129 (line 279) 25130 * -exec-step-instruction: GDB/MI Program Execution. 25131 (line 319) 25132 * -exec-until: GDB/MI Program Execution. 25133 (line 358) 25134 * -f: Mode Options. (line 85) 25135 * -file-exec-and-symbols: GDB/MI File Commands. 25136 (line 12) 25137 * -file-exec-file: GDB/MI File Commands. 25138 (line 40) 25139 * -file-list-exec-sections: GDB/MI File Commands. 25140 (line 67) 25141 * -file-list-exec-source-file: GDB/MI File Commands. 25142 (line 88) 25143 * -file-list-exec-source-files: GDB/MI File Commands. 25144 (line 112) 25145 * -file-list-shared-libraries: GDB/MI File Commands. 25146 (line 142) 25147 * -file-list-symbol-files: GDB/MI File Commands. 25148 (line 162) 25149 * -file-symbol-file: GDB/MI File Commands. 25150 (line 182) 25151 * -gdb-exit: GDB/MI Miscellaneous Commands. 25152 (line 9) 25153 * -gdb-set: GDB/MI Miscellaneous Commands. 25154 (line 51) 25155 * -gdb-show: GDB/MI Miscellaneous Commands. 25156 (line 74) 25157 * -gdb-version: GDB/MI Miscellaneous Commands. 25158 (line 97) 25159 * -inferior-tty-set: GDB/MI Miscellaneous Commands. 25160 (line 157) 25161 * -inferior-tty-show: GDB/MI Miscellaneous Commands. 25162 (line 180) 25163 * -interpreter-exec: GDB/MI Miscellaneous Commands. 25164 (line 131) 25165 * -l: Mode Options. (line 124) 25166 * -n: Mode Options. (line 11) 25167 * -nw: Mode Options. (line 70) 25168 * -p: File Options. (line 49) 25169 * -q: Mode Options. (line 19) 25170 * -r: File Options. (line 74) 25171 * -s: File Options. (line 31) 25172 * -stack-info-depth: GDB/MI Stack Manipulation. 25173 (line 35) 25174 * -stack-info-frame: GDB/MI Stack Manipulation. 25175 (line 9) 25176 * -stack-list-arguments: GDB/MI Stack Manipulation. 25177 (line 73) 25178 * -stack-list-frames: GDB/MI Stack Manipulation. 25179 (line 157) 25180 * -stack-list-locals: GDB/MI Stack Manipulation. 25181 (line 253) 25182 * -stack-select-frame: GDB/MI Stack Manipulation. 25183 (line 290) 25184 * -symbol-info-address: GDB/MI Symbol Query. (line 9) 25185 * -symbol-info-file: GDB/MI Symbol Query. (line 29) 25186 * -symbol-info-function: GDB/MI Symbol Query. (line 49) 25187 * -symbol-info-line: GDB/MI Symbol Query. (line 69) 25188 * -symbol-info-symbol: GDB/MI Symbol Query. (line 90) 25189 * -symbol-list-functions: GDB/MI Symbol Query. (line 110) 25190 * -symbol-list-lines: GDB/MI Symbol Query. (line 130) 25191 * -symbol-list-types: GDB/MI Symbol Query. (line 155) 25192 * -symbol-list-variables: GDB/MI Symbol Query. (line 176) 25193 * -symbol-locate: GDB/MI Symbol Query. (line 196) 25194 * -symbol-type: GDB/MI Symbol Query. (line 214) 25195 * -t: Mode Options. (line 129) 25196 * -target-attach: GDB/MI Target Manipulation. 25197 (line 9) 25198 * -target-compare-sections: GDB/MI Target Manipulation. 25199 (line 29) 25200 * -target-detach: GDB/MI Target Manipulation. 25201 (line 50) 25202 * -target-disconnect: GDB/MI Target Manipulation. 25203 (line 74) 25204 * -target-download: GDB/MI Target Manipulation. 25205 (line 98) 25206 * -target-exec-status: GDB/MI Target Manipulation. 25207 (line 201) 25208 * -target-list-available-targets: GDB/MI Target Manipulation. 25209 (line 222) 25210 * -target-list-current-targets: GDB/MI Target Manipulation. 25211 (line 242) 25212 * -target-list-parameters: GDB/MI Target Manipulation. 25213 (line 263) 25214 * -target-select: GDB/MI Target Manipulation. 25215 (line 281) 25216 * -thread-info: GDB/MI Thread Commands. 25217 (line 9) 25218 * -thread-list-all-threads: GDB/MI Thread Commands. 25219 (line 27) 25220 * -thread-list-ids: GDB/MI Thread Commands. 25221 (line 45) 25222 * -thread-select: GDB/MI Thread Commands. 25223 (line 79) 25224 * -var-assign: GDB/MI Variable Objects. 25225 (line 266) 25226 * -var-create: GDB/MI Variable Objects. 25227 (line 86) 25228 * -var-delete: GDB/MI Variable Objects. 25229 (line 127) 25230 * -var-evaluate-expression: GDB/MI Variable Objects. 25231 (line 249) 25232 * -var-info-expression: GDB/MI Variable Objects. 25233 (line 221) 25234 * -var-info-num-children: GDB/MI Variable Objects. 25235 (line 168) 25236 * -var-info-type: GDB/MI Variable Objects. 25237 (line 208) 25238 * -var-list-children: GDB/MI Variable Objects. 25239 (line 180) 25240 * -var-set-format: GDB/MI Variable Objects. 25241 (line 139) 25242 * -var-show-attributes: GDB/MI Variable Objects. 25243 (line 235) 25244 * -var-show-format: GDB/MI Variable Objects. 25245 (line 155) 25246 * -var-update: GDB/MI Variable Objects. 25247 (line 290) 25248 * -w: Mode Options. (line 76) 25249 * -x: File Options. (line 55) 25250 * ., Modula-2 scope operator: M2 Scope. (line 6) 25251 * .debug subdirectories: Separate Debug Files. 25252 (line 6) 25253 * .esgdbinit: Startup. (line 54) 25254 * .gdbinit: Startup. (line 37) 25255 * .gnu_debuglink sections: Separate Debug Files. 25256 (line 56) 25257 * .o files, reading symbols from: Files. (line 132) 25258 * .os68gdbinit: Startup. (line 52) 25259 * .vxgdbinit: Startup. (line 50) 25260 * /proc: SVR4 Process Information. 25261 (line 6) 25262 * ? packet: Packets. (line 35) 25263 * @, referencing memory as an array: Arrays. (line 6) 25264 * ^connected: GDB/MI Result Records. 25265 (line 18) 25266 * ^done: GDB/MI Result Records. 25267 (line 9) 25268 * ^error: GDB/MI Result Records. 25269 (line 21) 25270 * ^exit: GDB/MI Result Records. 25271 (line 25) 25272 * ^running: GDB/MI Result Records. 25273 (line 14) 25274 * _NSPrintForDebugger, and printing Objective-C objects: The Print Command with Objective-C. 25275 (line 11) 25276 * A packet: Packets. (line 41) 25277 * abbreviation: Command Syntax. (line 13) 25278 * abort (C-g): Miscellaneous Commands. 25279 (line 10) 25280 * accept-line (Newline or Return): Commands For History. 25281 (line 6) 25282 * acknowledgment, for GDB remote: Overview. (line 33) 25283 * actions: Tracepoint Actions. (line 6) 25284 * active targets: Active Targets. (line 6) 25285 * Ada: Ada. (line 6) 25286 * Ada mode, general: Ada Mode Intro. (line 6) 25287 * Ada, deviations from: Additions to Ada. (line 6) 25288 * Ada, omissions from: Omissions from Ada. (line 6) 25289 * Ada, problems: Ada Glitches. (line 6) 25290 * adbg_find_memory_in_frame: Tracing on Symmetrix. 25291 (line 17) 25292 * add new commands for external monitor: Connecting. (line 104) 25293 * add-shared-symbol-files: Files. (line 172) 25294 * add-symbol-file: Files. (line 113) 25295 * add-symbol-file-from-memory: Files. (line 162) 25296 * address of a symbol: Symbols. (line 44) 25297 * ADP (Angel Debugger Protocol) logging: ARM. (line 70) 25298 * adress size for remote targets: Remote configuration. 25299 (line 12) 25300 * advance LOCATION: Continuing and Stepping. 25301 (line 181) 25302 * aggregates (Ada): Omissions from Ada. (line 44) 25303 * AIX threads: Debugging Output. (line 28) 25304 * alignment of remote memory accesses: Packets. (line 172) 25305 * Alpha stack: MIPS. (line 6) 25306 * AMD 29K register stack: A29K. (line 6) 25307 * annotations: Annotations Overview. 25308 (line 6) 25309 * annotations for errors, warnings and interrupts: Errors. (line 6) 25310 * annotations for invalidation messages: Invalidation. (line 6) 25311 * annotations for prompts: Prompting. (line 6) 25312 * annotations for running programs: Annotations for Running. 25313 (line 6) 25314 * annotations for source display: Source Annotations. (line 6) 25315 * append: Dump/Restore Files. (line 35) 25316 * append data to a file: Dump/Restore Files. (line 6) 25317 * apply command to several threads: Threads. (line 143) 25318 * apropos: Help. (line 63) 25319 * architecture debugging info: Debugging Output. (line 18) 25320 * argument count in user-defined commands: Define. (line 25) 25321 * arguments (to your program): Arguments. (line 6) 25322 * arguments, to user-defined commands: Define. (line 6) 25323 * ARM 32-bit mode: ARM. (line 25) 25324 * ARM RDI: ARM. (line 6) 25325 * array aggregates (Ada): Omissions from Ada. (line 44) 25326 * arrays: Arrays. (line 6) 25327 * arrays in expressions: Expressions. (line 14) 25328 * artificial array: Arrays. (line 6) 25329 * ASCII character set: Character Sets. (line 65) 25330 * assembly instructions: Machine Code. (line 36) 25331 * assf: Files. (line 172) 25332 * assignment: Assignment. (line 6) 25333 * async output in GDB/MI: GDB/MI Output Syntax. 25334 (line 96) 25335 * AT&T disassembly flavor: Machine Code. (line 68) 25336 * attach: Attach. (line 6) 25337 * attach to a program by name: Server. (line 70) 25338 * automatic display: Auto Display. (line 6) 25339 * automatic overlay debugging: Automatic Overlay Debugging. 25340 (line 6) 25341 * automatic thread selection: Threads. (line 152) 25342 * auxiliary vector: OS Information. (line 21) 25343 * AVR: AVR. (line 6) 25344 * awatch: Set Watchpoints. (line 45) 25345 * b (break): Set Breaks. (line 6) 25346 * B packet: Packets. (line 68) 25347 * b packet: Packets. (line 53) 25348 * backtrace: Backtrace. (line 11) 25349 * backtrace beyond main function: Backtrace. (line 87) 25350 * backtrace limit: Backtrace. (line 123) 25351 * backward-char (C-b): Commands For Moving. (line 15) 25352 * backward-delete-char (Rubout): Commands For Text. (line 11) 25353 * backward-kill-line (C-x Rubout): Commands For Killing. 25354 (line 9) 25355 * backward-kill-word (M-<DEL>): Commands For Killing. 25356 (line 24) 25357 * backward-word (M-b): Commands For Moving. (line 22) 25358 * baud rate for remote targets: Remote configuration. 25359 (line 21) 25360 * bcache statistics: Maintenance Commands. 25361 (line 161) 25362 * beginning-of-history (M-<): Commands For History. 25363 (line 19) 25364 * beginning-of-line (C-a): Commands For Moving. (line 6) 25365 * bell-style: Readline Init File Syntax. 25366 (line 35) 25367 * bind-tty-special-chars: Readline Init File Syntax. 25368 (line 42) 25369 * bits in remote address: Remote configuration. 25370 (line 12) 25371 * bookmark: Checkpoint/Restart. (line 6) 25372 * break: Set Breaks. (line 6) 25373 * break ... thread THREADNO: Thread Stops. (line 10) 25374 * break in overloaded functions: Debugging C plus plus. 25375 (line 9) 25376 * break on fork/exec: Set Catchpoints. (line 19) 25377 * break on load/unload of shared library: Set Catchpoints. (line 30) 25378 * BREAK signal instead of Ctrl-C: Remote configuration. 25379 (line 29) 25380 * break, and Objective-C: Method Names in Commands. 25381 (line 9) 25382 * breakpoint address adjusted: Breakpoint related warnings. 25383 (line 6) 25384 * breakpoint annotation: Annotations for Running. 25385 (line 47) 25386 * breakpoint commands: Break Commands. (line 6) 25387 * breakpoint commands for GDB/MI: GDB/MI Breakpoint Commands. 25388 (line 6) 25389 * breakpoint conditions: Conditions. (line 6) 25390 * breakpoint numbers: Breakpoints. (line 41) 25391 * breakpoint on events: Breakpoints. (line 33) 25392 * breakpoint on memory address: Breakpoints. (line 20) 25393 * breakpoint on variable modification: Breakpoints. (line 20) 25394 * breakpoint ranges: Breakpoints. (line 48) 25395 * breakpoint subroutine, remote: Stub Contents. (line 31) 25396 * breakpointing Ada elaboration code: Stopping Before Main Program. 25397 (line 6) 25398 * breakpoints: Breakpoints. (line 6) 25399 * breakpoints and threads: Thread Stops. (line 10) 25400 * breakpoints in functions matching a regexp: Set Breaks. (line 111) 25401 * breakpoints in overlays: Overlay Commands. (line 93) 25402 * breakpoints-invalid annotation: Invalidation. (line 13) 25403 * bt (backtrace): Backtrace. (line 11) 25404 * bug criteria: Bug Criteria. (line 6) 25405 * bug reports: Bug Reporting. (line 6) 25406 * bugs in GDB: GDB Bugs. (line 6) 25407 * building GDB, requirements for: Requirements. (line 6) 25408 * built-in simulator target: Target Commands. (line 73) 25409 * c (continue): Continuing and Stepping. 25410 (line 15) 25411 * c (SingleKey TUI key): TUI Single Key Mode. (line 10) 25412 * C and C++: C. (line 6) 25413 * C and C++ checks: C Checks. (line 6) 25414 * C and C++ constants: C Constants. (line 6) 25415 * C and C++ defaults: C Defaults. (line 6) 25416 * C and C++ operators: C Operators. (line 6) 25417 * C packet: Packets. (line 80) 25418 * c packet: Packets. (line 74) 25419 * C++: C. (line 10) 25420 * C++ compilers: C plus plus expressions. 25421 (line 8) 25422 * C++ exception handling: Debugging C plus plus. 25423 (line 19) 25424 * C++ overload debugging info: Debugging Output. (line 80) 25425 * C++ scope resolution: Variables. (line 54) 25426 * C++ symbol decoding style: Print Settings. (line 255) 25427 * C++ symbol display: Debugging C plus plus. 25428 (line 28) 25429 * C-L: TUI Keys. (line 69) 25430 * C-x 1: TUI Keys. (line 22) 25431 * C-x 2: TUI Keys. (line 29) 25432 * C-x A: TUI Keys. (line 15) 25433 * C-x a: TUI Keys. (line 14) 25434 * C-x C-a: TUI Keys. (line 13) 25435 * C-x o: TUI Keys. (line 37) 25436 * C-x s: TUI Keys. (line 44) 25437 * caching data of remote targets: Caching Remote Data. (line 6) 25438 * call: Calling. (line 10) 25439 * call dummy stack unwinding: Calling. (line 26) 25440 * call overloaded functions: C plus plus expressions. 25441 (line 27) 25442 * call stack: Stack. (line 9) 25443 * call stack traces: Backtrace. (line 6) 25444 * call-last-kbd-macro (C-x e): Keyboard Macros. (line 13) 25445 * calling functions: Calling. (line 6) 25446 * calling make: Shell Commands. (line 19) 25447 * capitalize-word (M-c): Commands For Text. (line 49) 25448 * case sensitivity in symbol names: Symbols. (line 27) 25449 * case-insensitive symbol names: Symbols. (line 27) 25450 * casts, in expressions: Expressions. (line 27) 25451 * casts, to view memory: Expressions. (line 42) 25452 * catch: Set Catchpoints. (line 10) 25453 * catch exceptions, list active handlers: Frame Info. (line 60) 25454 * catchpoints: Breakpoints. (line 33) 25455 * catchpoints, setting: Set Catchpoints. (line 6) 25456 * cd: Working Directory. (line 16) 25457 * cdir: Source Path. (line 99) 25458 * change working directory: Working Directory. (line 16) 25459 * character sets: Character Sets. (line 6) 25460 * character-search (C-]): Miscellaneous Commands. 25461 (line 41) 25462 * character-search-backward (M-C-]): Miscellaneous Commands. 25463 (line 46) 25464 * charset: Character Sets. (line 6) 25465 * checkpoint: Checkpoint/Restart. (line 6) 25466 * checkpoints and process id: Checkpoint/Restart. (line 80) 25467 * checks, range: Type Checking. (line 65) 25468 * checks, type: Checks. (line 31) 25469 * checksum, for GDB remote: Overview. (line 20) 25470 * choosing target byte order: Byte Order. (line 6) 25471 * clear: Delete Breaks. (line 21) 25472 * clear, and Objective-C: Method Names in Commands. 25473 (line 9) 25474 * clear-screen (C-l): Commands For Moving. (line 26) 25475 * clearing breakpoints, watchpoints, catchpoints: Delete Breaks. 25476 (line 6) 25477 * close, file-i/o system call: close. (line 6) 25478 * closest symbol and offset for an address: Symbols. (line 54) 25479 * code address and its source line: Machine Code. (line 25) 25480 * collect (tracepoints): Tracepoint Actions. (line 45) 25481 * collected data discarded: Starting and Stopping Trace Experiment. 25482 (line 6) 25483 * colon, doubled as scope operator: M2 Scope. (line 6) 25484 * colon-colon, context for variables/functions: Variables. (line 44) 25485 * colon-colon, in Modula-2: M2 Scope. (line 6) 25486 * command editing: Readline Bare Essentials. 25487 (line 6) 25488 * command files: Command Files. (line 6) 25489 * command history: Command History. (line 6) 25490 * command hooks: Hooks. (line 6) 25491 * command interpreters: Interpreters. (line 6) 25492 * command line editing: Editing. (line 6) 25493 * command scripts, debugging: Messages/Warnings. (line 65) 25494 * command tracing: Messages/Warnings. (line 60) 25495 * commands: Break Commands. (line 11) 25496 * commands annotation: Prompting. (line 27) 25497 * commands for C++: Debugging C plus plus. 25498 (line 6) 25499 * commands to STDBUG (ST2000): ST2000. (line 30) 25500 * comment: Command Syntax. (line 38) 25501 * comment-begin: Readline Init File Syntax. 25502 (line 47) 25503 * COMMON blocks, Fortran: Special Fortran commands. 25504 (line 9) 25505 * common targets: Target Commands. (line 46) 25506 * compare-sections: Memory. (line 107) 25507 * compatibility, GDB/MI and CLI: GDB/MI Compatibility with CLI. 25508 (line 6) 25509 * compilation directory: Source Path. (line 99) 25510 * compiling, on Sparclet: Sparclet. (line 16) 25511 * complete: Help. (line 77) 25512 * complete (<TAB>): Commands For Completion. 25513 (line 6) 25514 * completion: Completion. (line 6) 25515 * completion of quoted strings: Completion. (line 57) 25516 * completion-query-items: Readline Init File Syntax. 25517 (line 57) 25518 * condition: Conditions. (line 45) 25519 * conditional breakpoints: Conditions. (line 6) 25520 * configuring GDB: Running Configure. (line 6) 25521 * confirmation: Messages/Warnings. (line 50) 25522 * connect (to STDBUG): ST2000. (line 34) 25523 * console i/o as part of file-i/o: Console I/O. (line 6) 25524 * console interpreter: Interpreters. (line 21) 25525 * console output in GDB/MI: GDB/MI Output Syntax. 25526 (line 104) 25527 * constants, in file-i/o protocol: Constants. (line 6) 25528 * continue: Continuing and Stepping. 25529 (line 15) 25530 * continuing: Continuing and Stepping. 25531 (line 6) 25532 * continuing threads: Thread Stops. (line 69) 25533 * control C, and remote debugging: Bootstrapping. (line 25) 25534 * controlling terminal: Input/Output. (line 23) 25535 * convenience variables: Convenience Vars. (line 6) 25536 * convenience variables for tracepoints: Tracepoint Variables. 25537 (line 6) 25538 * convenience variables, initializing: Convenience Vars. (line 41) 25539 * convert-meta: Readline Init File Syntax. 25540 (line 67) 25541 * copy-backward-word (): Commands For Killing. 25542 (line 49) 25543 * copy-forward-word (): Commands For Killing. 25544 (line 54) 25545 * copy-region-as-kill (): Commands For Killing. 25546 (line 45) 25547 * core dump file: Files. (line 6) 25548 * core dump file target: Target Commands. (line 54) 25549 * core-file: Files. (line 97) 25550 * crash of debugger: Bug Criteria. (line 9) 25551 * CRC of memory block, remote request: General Query Packets. 25552 (line 51) 25553 * CRIS: CRIS. (line 6) 25554 * CRIS mode: CRIS. (line 26) 25555 * CRIS version: CRIS. (line 10) 25556 * ctrl-c message, in file-i/o protocol: The Ctrl-C message. (line 6) 25557 * Ctrl-o (operate-and-get-next): Command Syntax. (line 42) 25558 * current directory: Source Path. (line 99) 25559 * current stack frame: Frames. (line 45) 25560 * current thread: Threads. (line 38) 25561 * current thread, remote request: General Query Packets. 25562 (line 41) 25563 * cwd: Source Path. (line 99) 25564 * Cygwin DLL, debugging: Cygwin Native. (line 30) 25565 * Cygwin-specific commands: Cygwin Native. (line 6) 25566 * d (delete): Delete Breaks. (line 36) 25567 * d (SingleKey TUI key): TUI Single Key Mode. (line 13) 25568 * D packet: Packets. (line 92) 25569 * d packet: Packets. (line 86) 25570 * data breakpoints: Breakpoints. (line 20) 25571 * data manipulation, in GDB/MI: GDB/MI Data Manipulation. 25572 (line 6) 25573 * dead names, GNU Hurd: Hurd Native. (line 85) 25574 * debug formats and C++: C plus plus expressions. 25575 (line 8) 25576 * debug links: Separate Debug Files. 25577 (line 56) 25578 * debug remote protocol: Debugging Output. (line 86) 25579 * debug_chaos: M32R/D. (line 50) 25580 * debugger crash: Bug Criteria. (line 9) 25581 * debugging C++ programs: C plus plus expressions. 25582 (line 8) 25583 * debugging information directory, global: Separate Debug Files. 25584 (line 6) 25585 * debugging information in separate files: Separate Debug Files. 25586 (line 6) 25587 * debugging multiple processes: Processes. (line 52) 25588 * debugging multithreaded programs (on HP-UX): Threads. (line 82) 25589 * debugging optimized code: Compilation. (line 26) 25590 * debugging stub, example: remote stub. (line 6) 25591 * debugging target: Targets. (line 6) 25592 * debugging the Cygwin DLL: Cygwin Native. (line 30) 25593 * default value of solib-absolute-prefix: Files. (line 374) 25594 * define: Define. (line 37) 25595 * defining macros interactively: Macros. (line 54) 25596 * definition, showing a macro's: Macros. (line 50) 25597 * delete: Delete Breaks. (line 36) 25598 * delete breakpoints: Delete Breaks. (line 36) 25599 * delete checkpoint CHECKPOINT-ID: Checkpoint/Restart. (line 56) 25600 * delete display: Auto Display. (line 46) 25601 * delete fork FORK-ID: Processes. (line 100) 25602 * delete mem: Memory Region Attributes. 25603 (line 34) 25604 * delete tracepoint: Create and Delete Tracepoints. 25605 (line 34) 25606 * delete-char (C-d): Commands For Text. (line 6) 25607 * delete-char-or-list (): Commands For Completion. 25608 (line 30) 25609 * delete-horizontal-space (): Commands For Killing. 25610 (line 37) 25611 * deleting breakpoints, watchpoints, catchpoints: Delete Breaks. 25612 (line 6) 25613 * deliver a signal to a program: Signaling. (line 6) 25614 * demangling C++ names: Print Settings. (line 236) 25615 * deprecated commands: Maintenance Commands. 25616 (line 60) 25617 * derived type of an object, printing: Print Settings. (line 288) 25618 * descriptor tables display: DJGPP Native. (line 24) 25619 * detach: Attach. (line 36) 25620 * detach (remote): Connecting. (line 90) 25621 * detach fork FORK-ID: Processes. (line 95) 25622 * detach from task, GNU Hurd: Hurd Native. (line 60) 25623 * detach from thread, GNU Hurd: Hurd Native. (line 110) 25624 * device: Renesas Boards. (line 6) 25625 * digit-argument (M-0, M-1, ... M--): Numeric Arguments. (line 6) 25626 * dir: Source Path. (line 39) 25627 * direct memory access (DMA) on MS-DOS: DJGPP Native. (line 75) 25628 * directories for source files: Source Path. (line 6) 25629 * directory: Source Path. (line 39) 25630 * directory, compilation: Source Path. (line 99) 25631 * directory, current: Source Path. (line 99) 25632 * dis (disable): Disabling. (line 35) 25633 * disable: Disabling. (line 35) 25634 * disable display: Auto Display. (line 53) 25635 * disable mem: Memory Region Attributes. 25636 (line 38) 25637 * disable tracepoint: Enable and Disable Tracepoints. 25638 (line 6) 25639 * disable-completion: Readline Init File Syntax. 25640 (line 73) 25641 * disassemble: Machine Code. (line 36) 25642 * disconnect: Connecting. (line 97) 25643 * display: Auto Display. (line 24) 25644 * display command history: Command History. (line 78) 25645 * display derived types: Print Settings. (line 288) 25646 * display disabled out of scope: Auto Display. (line 75) 25647 * display GDB copyright: Help. (line 137) 25648 * display of expressions: Auto Display. (line 6) 25649 * display remote monitor communications: Target Commands. (line 108) 25650 * display remote packets: Debugging Output. (line 86) 25651 * DJGPP debugging: DJGPP Native. (line 6) 25652 * dll-symbols: Cygwin Native. (line 26) 25653 * DLLs with no debugging symbols: Non-debug DLL symbols. 25654 (line 6) 25655 * do (down): Selection. (line 40) 25656 * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands. 25657 (line 14) 25658 * document: Define. (line 46) 25659 * documentation: Formatting Documentation. 25660 (line 22) 25661 * don't repeat command: Define. (line 58) 25662 * dont-repeat: Define. (line 58) 25663 * DOS serial data link, remote debugging: DJGPP Native. (line 121) 25664 * DOS serial port status: DJGPP Native. (line 142) 25665 * Down: TUI Keys. (line 60) 25666 * down: Selection. (line 40) 25667 * down-silently: Selection. (line 64) 25668 * downcase-word (M-l): Commands For Text. (line 45) 25669 * download server address (M32R): M32R/D. (line 27) 25670 * download to H8/300 or H8/500: H8/300. (line 19) 25671 * download to Renesas SH: H8/300. (line 19) 25672 * download to Sparclet: Sparclet Download. (line 6) 25673 * download to VxWorks: VxWorks Download. (line 6) 25674 * DPMI: DJGPP Native. (line 6) 25675 * drain, E7000: Renesas ICE. (line 37) 25676 * dump: Dump/Restore Files. (line 13) 25677 * dump all data collected at tracepoint: tdump. (line 6) 25678 * dump core from inferior: Core File Generation. 25679 (line 6) 25680 * dump data to a file: Dump/Restore Files. (line 6) 25681 * dump-functions (): Miscellaneous Commands. 25682 (line 61) 25683 * dump-macros (): Miscellaneous Commands. 25684 (line 73) 25685 * dump-variables (): Miscellaneous Commands. 25686 (line 67) 25687 * dump/restore files: Dump/Restore Files. (line 6) 25688 * DWARF 2 compilation units cache: Maintenance Commands. 25689 (line 185) 25690 * DWARF-2 CFI and CRIS: CRIS. (line 18) 25691 * dynamic linking: Files. (line 113) 25692 * e (edit): Edit. (line 6) 25693 * e7000: Renesas ICE. (line 24) 25694 * EBCDIC character set: Character Sets. (line 74) 25695 * echo: Output. (line 12) 25696 * edit: Edit. (line 6) 25697 * editing: Editing. (line 15) 25698 * editing command lines: Readline Bare Essentials. 25699 (line 6) 25700 * editing source files: Edit. (line 6) 25701 * editing-mode: Readline Init File Syntax. 25702 (line 78) 25703 * eight-bit characters in strings: Print Settings. (line 181) 25704 * elaboration phase: Starting. (line 82) 25705 * else: Command Files. (line 56) 25706 * Emacs: Emacs. (line 6) 25707 * empty response, for unsupported packets: Overview. (line 86) 25708 * enable: Disabling. (line 42) 25709 * enable display: Auto Display. (line 58) 25710 * enable mem: Memory Region Attributes. 25711 (line 42) 25712 * enable tracepoint: Enable and Disable Tracepoints. 25713 (line 12) 25714 * enable-keypad: Readline Init File Syntax. 25715 (line 84) 25716 * enable/disable a breakpoint: Disabling. (line 6) 25717 * end (breakpoint commands): Break Commands. (line 11) 25718 * end (if/else/while commands): Command Files. (line 85) 25719 * end (user-defined commands): Define. (line 46) 25720 * end-kbd-macro (C-x )): Keyboard Macros. (line 9) 25721 * end-of-history (M->): Commands For History. 25722 (line 22) 25723 * end-of-line (C-e): Commands For Moving. (line 9) 25724 * entering numbers: Numbers. (line 6) 25725 * environment (of your program): Environment. (line 6) 25726 * errno values, in file-i/o protocol: Errno values. (line 6) 25727 * error annotation: Errors. (line 10) 25728 * error on valid input: Bug Criteria. (line 12) 25729 * error-begin annotation: Errors. (line 22) 25730 * event debugging info: Debugging Output. (line 35) 25731 * event designators: Event Designators. (line 6) 25732 * event handling: Set Catchpoints. (line 6) 25733 * examine process image: SVR4 Process Information. 25734 (line 6) 25735 * examining data: Data. (line 6) 25736 * examining memory: Memory. (line 9) 25737 * exception handlers: Set Catchpoints. (line 6) 25738 * exception handlers, how to list: Frame Info. (line 60) 25739 * exceptionHandler: Bootstrapping. (line 38) 25740 * exchange-point-and-mark (C-x C-x): Miscellaneous Commands. 25741 (line 36) 25742 * exec-file: Files. (line 39) 25743 * executable file: Files. (line 16) 25744 * executable file target: Target Commands. (line 50) 25745 * execute commands from a file: Command Files. (line 14) 25746 * execute remote command, remote request: General Query Packets. 25747 (line 157) 25748 * exited annotation: Annotations for Running. 25749 (line 18) 25750 * exiting GDB: Quitting GDB. (line 6) 25751 * expand macro once: Macros. (line 41) 25752 * expand-tilde: Readline Init File Syntax. 25753 (line 89) 25754 * expanding preprocessor macros: Macros. (line 32) 25755 * expression debugging info: Debugging Output. (line 42) 25756 * expressions: Expressions. (line 6) 25757 * expressions in Ada: Ada. (line 11) 25758 * expressions in C or C++: C. (line 6) 25759 * expressions in C++: C plus plus expressions. 25760 (line 6) 25761 * expressions in Modula-2: Modula-2. (line 12) 25762 * extend GDB for remote targets: Connecting. (line 104) 25763 * f (frame): Selection. (line 11) 25764 * f (SingleKey TUI key): TUI Single Key Mode. (line 16) 25765 * F packet: Packets. (line 103) 25766 * F reply packet: The F reply packet. (line 6) 25767 * F request packet: The F request packet. 25768 (line 6) 25769 * fatal signal: Bug Criteria. (line 9) 25770 * fatal signals: Signals. (line 15) 25771 * FDL, GNU Free Documentation License: GNU Free Documentation License. 25772 (line 6) 25773 * features of the remote protocol: General Query Packets. 25774 (line 182) 25775 * fg (resume foreground execution): Continuing and Stepping. 25776 (line 15) 25777 * file: Files. (line 16) 25778 * file-i/o examples: File-I/O Examples. (line 6) 25779 * file-i/o overview: File-I/O Overview. (line 6) 25780 * File-I/O remote protocol extension: File-I/O remote protocol extension. 25781 (line 6) 25782 * file-i/o reply packet: The F reply packet. (line 6) 25783 * file-i/o request packet: The F request packet. 25784 (line 6) 25785 * find downloadable SREC files (M32R): M32R/D. (line 15) 25786 * find trace snapshot: tfind. (line 6) 25787 * finish: Continuing and Stepping. 25788 (line 110) 25789 * flinching: Messages/Warnings. (line 50) 25790 * float promotion: ABI. (line 29) 25791 * floating point: Floating Point Hardware. 25792 (line 6) 25793 * floating point registers: Registers. (line 15) 25794 * floating point, MIPS remote: MIPS Embedded. (line 60) 25795 * flush_i_cache: Bootstrapping. (line 60) 25796 * flushregs: Maintenance Commands. 25797 (line 153) 25798 * focus: TUI Commands. (line 34) 25799 * focus of debugging: Threads. (line 38) 25800 * foo: Symbol Errors. (line 50) 25801 * fork FORK-ID: Processes. (line 85) 25802 * fork, debugging programs which call: Processes. (line 6) 25803 * format options: Print Settings. (line 6) 25804 * formatted output: Output Formats. (line 6) 25805 * Fortran: Summary. (line 35) 25806 * Fortran Defaults: Fortran Defaults. (line 6) 25807 * Fortran operators and expressions: Fortran Operators. (line 6) 25808 * Fortran-specific support in GDB: Fortran. (line 6) 25809 * forward-backward-delete-char (): Commands For Text. (line 15) 25810 * forward-char (C-f): Commands For Moving. (line 12) 25811 * forward-search: Search. (line 9) 25812 * forward-search-history (C-s): Commands For History. 25813 (line 30) 25814 * forward-word (M-f): Commands For Moving. (line 18) 25815 * FR-V shared-library debugging: Debugging Output. (line 104) 25816 * frame debugging info: Debugging Output. (line 50) 25817 * frame number: Frames. (line 28) 25818 * frame pointer: Frames. (line 21) 25819 * frame pointer register: Registers. (line 26) 25820 * frame, command: Frames. (line 45) 25821 * frame, definition: Frames. (line 6) 25822 * frame, selecting: Selection. (line 11) 25823 * frameless execution: Frames. (line 34) 25824 * frames-invalid annotation: Invalidation. (line 9) 25825 * free memory information (MS-DOS): DJGPP Native. (line 19) 25826 * fstat, file-i/o system call: stat/fstat. (line 6) 25827 * ftpload, E7000: Renesas ICE. (line 33) 25828 * ftplogin, E7000: Renesas ICE. (line 27) 25829 * Fujitsu: remote stub. (line 69) 25830 * full symbol tables, listing GDB's internal: Symbols. (line 269) 25831 * function call arguments, optimized out: Backtrace. (line 65) 25832 * function entry/exit, wrong values of variables: Variables. (line 58) 25833 * functions without line info, and stepping: Continuing and Stepping. 25834 (line 93) 25835 * G packet: Packets. (line 124) 25836 * g packet: Packets. (line 108) 25837 * g++, GNU C++ compiler: C. (line 10) 25838 * garbled pointers: DJGPP Native. (line 42) 25839 * GCC and C++: C plus plus expressions. 25840 (line 8) 25841 * gcore: Core File Generation. 25842 (line 18) 25843 * GDB bugs, reporting: Bug Reporting. (line 6) 25844 * GDB reference card: Formatting Documentation. 25845 (line 6) 25846 * GDB startup: Startup. (line 6) 25847 * GDB version number: Help. (line 127) 25848 * gdb.ini: Startup. (line 44) 25849 * GDB/MI development: GDB/MI Development and Front Ends. 25850 (line 6) 25851 * GDB/MI, breakpoint commands: GDB/MI Breakpoint Commands. 25852 (line 6) 25853 * GDB/MI, compatibility with CLI: GDB/MI Compatibility with CLI. 25854 (line 6) 25855 * GDB/MI, data manipulation: GDB/MI Data Manipulation. 25856 (line 6) 25857 * GDB/MI, input syntax: GDB/MI Input Syntax. (line 6) 25858 * GDB/MI, its purpose: GDB/MI. (line 9) 25859 * GDB/MI, out-of-band records: GDB/MI Out-of-band Records. 25860 (line 6) 25861 * GDB/MI, output syntax: GDB/MI Output Syntax. 25862 (line 6) 25863 * GDB/MI, result records: GDB/MI Result Records. 25864 (line 6) 25865 * GDB/MI, simple examples: GDB/MI Simple Examples. 25866 (line 6) 25867 * GDB/MI, stream records: GDB/MI Stream Records. 25868 (line 6) 25869 * gdbarch debugging info: Debugging Output. (line 18) 25870 * GDBHISTFILE, environment variable: Command History. (line 26) 25871 * gdbserver: Server. (line 6) 25872 * GDT: DJGPP Native. (line 24) 25873 * generate-core-file: Core File Generation. 25874 (line 18) 25875 * get thread-local storage address, remote request: General Query Packets. 25876 (line 87) 25877 * getDebugChar: Bootstrapping. (line 14) 25878 * gettimeofday, file-i/o system call: gettimeofday. (line 6) 25879 * global debugging information directory: Separate Debug Files. 25880 (line 6) 25881 * GNU C++: C. (line 10) 25882 * GNU Emacs: Emacs. (line 6) 25883 * GNU Hurd debugging: Hurd Native. (line 6) 25884 * GNU/Linux LWP debug messages: Debugging Output. (line 66) 25885 * gnu_debuglink_crc32: Separate Debug Files. 25886 (line 94) 25887 * h (help): Help. (line 9) 25888 * H packet: Packets. (line 135) 25889 * H8/300 or H8/500 download: H8/300. (line 19) 25890 * handle: Signals. (line 45) 25891 * handle_exception: Stub Contents. (line 15) 25892 * handling signals: Signals. (line 27) 25893 * hardware breakpoints: Set Breaks. (line 81) 25894 * hardware breakpoints, and E7000: Renesas ICE. (line 41) 25895 * hardware watchpoints: Set Watchpoints. (line 22) 25896 * hash mark while downloading: Target Commands. (line 99) 25897 * hbreak: Set Breaks. (line 81) 25898 * help: Help. (line 6) 25899 * help target: Target Commands. (line 19) 25900 * help user-defined: Define. (line 63) 25901 * heuristic-fence-post (Alpha, MIPS): MIPS. (line 14) 25902 * history events: Event Designators. (line 7) 25903 * history expansion: History Interaction. (line 6) 25904 * history expansion, turn on/off: Command History. (line 53) 25905 * history file: Command History. (line 26) 25906 * history number: Value History. (line 13) 25907 * history of values printed by GDB: Value History. (line 6) 25908 * history size: Command History. (line 45) 25909 * history substitution: Command History. (line 26) 25910 * history-preserve-point: Readline Init File Syntax. 25911 (line 93) 25912 * history-search-backward (): Commands For History. 25913 (line 50) 25914 * history-search-forward (): Commands For History. 25915 (line 45) 25916 * HISTSIZE, environment variable: Command History. (line 45) 25917 * hook: Hooks. (line 6) 25918 * hookpost: Hooks. (line 11) 25919 * hooks, for commands: Hooks. (line 6) 25920 * hooks, post-command: Hooks. (line 11) 25921 * hooks, pre-command: Hooks. (line 6) 25922 * horizontal-scroll-mode: Readline Init File Syntax. 25923 (line 98) 25924 * host character set: Character Sets. (line 6) 25925 * how many arguments (user-defined commands): Define. (line 25) 25926 * HPPA support: HPPA. (line 6) 25927 * htrace: OpenRISC 1000. (line 69) 25928 * hwatch: OpenRISC 1000. (line 59) 25929 * i (info): Help. (line 100) 25930 * I packet: Packets. (line 154) 25931 * i packet: Packets. (line 149) 25932 * i/o: Input/Output. (line 6) 25933 * I/O registers (Atmel AVR): AVR. (line 10) 25934 * i386: remote stub. (line 57) 25935 * i386-stub.c: remote stub. (line 57) 25936 * IBM1047 character set: Character Sets. (line 74) 25937 * IDT: DJGPP Native. (line 24) 25938 * if: Command Files. (line 56) 25939 * ignore: Conditions. (line 77) 25940 * ignore count (of breakpoint): Conditions. (line 66) 25941 * INCLUDE_RDB: VxWorks. (line 33) 25942 * incomplete type: Symbols. (line 99) 25943 * indentation in structure display: Print Settings. (line 157) 25944 * inferior debugging info: Debugging Output. (line 57) 25945 * inferior functions, calling: Calling. (line 6) 25946 * inferior tty: Input/Output. (line 44) 25947 * infinite recursion in user-defined commands: Define. (line 73) 25948 * info: Help. (line 100) 25949 * info address: Symbols. (line 44) 25950 * info all-registers: Registers. (line 15) 25951 * info args: Frame Info. (line 51) 25952 * info auxv: OS Information. (line 33) 25953 * info breakpoints: Set Breaks. (line 136) 25954 * info catch: Frame Info. (line 60) 25955 * info checkpoints: Checkpoint/Restart. (line 31) 25956 * info classes: Symbols. (line 196) 25957 * info common: Special Fortran commands. 25958 (line 9) 25959 * info copying: Help. (line 137) 25960 * info dcache: Caching Remote Data. (line 21) 25961 * info display: Auto Display. (line 67) 25962 * info dll: Cygwin Native. (line 23) 25963 * info dos: DJGPP Native. (line 15) 25964 * info extensions: Show. (line 34) 25965 * info f (info frame): Frame Info. (line 17) 25966 * info files: Files. (line 191) 25967 * info float: Floating Point Hardware. 25968 (line 9) 25969 * info for known object files: Maintenance Commands. 25970 (line 156) 25971 * info forks: Processes. (line 80) 25972 * info frame: Frame Info. (line 17) 25973 * info frame, show the source language: Show. (line 15) 25974 * info functions: Symbols. (line 175) 25975 * info handle: Signals. (line 33) 25976 * info io_registers, AVR: AVR. (line 10) 25977 * info line: Machine Code. (line 13) 25978 * info line, and Objective-C: Method Names in Commands. 25979 (line 9) 25980 * info locals: Frame Info. (line 55) 25981 * info macro: Macros. (line 50) 25982 * info mem: Memory Region Attributes. 25983 (line 45) 25984 * info meminfo: SVR4 Process Information. 25985 (line 78) 25986 * info or1k spr: OpenRISC 1000. (line 20) 25987 * info pidlist: SVR4 Process Information. 25988 (line 74) 25989 * info proc: SVR4 Process Information. 25990 (line 16) 25991 * info program: Stopping. (line 18) 25992 * info registers: Registers. (line 11) 25993 * info scope: Symbols. (line 130) 25994 * info selectors: Symbols. (line 202) 25995 * info serial: DJGPP Native. (line 142) 25996 * info set: Help. (line 120) 25997 * info share: Files. (line 323) 25998 * info sharedlibrary: Files. (line 323) 25999 * info signals: Signals. (line 33) 26000 * info source: Symbols. (line 150) 26001 * info source, show the source language: Show. (line 21) 26002 * info sources: Symbols. (line 169) 26003 * info stack: Backtrace. (line 34) 26004 * info symbol: Symbols. (line 54) 26005 * info target: Files. (line 191) 26006 * info terminal: Input/Output. (line 12) 26007 * info threads: Threads. (line 59) 26008 * info threads (HP-UX): Threads. (line 96) 26009 * info tp: Listing Tracepoints. (line 6) 26010 * info tracepoints: Listing Tracepoints. (line 6) 26011 * info types: Symbols. (line 116) 26012 * info udot: OS Information. (line 16) 26013 * info variables: Symbols. (line 187) 26014 * info vector: Vector Unit. (line 9) 26015 * info w32: Cygwin Native. (line 12) 26016 * info warranty: Help. (line 141) 26017 * info watchpoints [N]: Set Watchpoints. (line 49) 26018 * info win: TUI Commands. (line 12) 26019 * information about tracepoints: Listing Tracepoints. (line 6) 26020 * inheritance: Debugging C plus plus. 26021 (line 24) 26022 * init file: Startup. (line 11) 26023 * init file name: Startup. (line 37) 26024 * init-if-undefined: Convenience Vars. (line 41) 26025 * initial frame: Frames. (line 12) 26026 * initialization file, readline: Readline Init File. (line 6) 26027 * innermost frame: Frames. (line 12) 26028 * input syntax for GDB/MI: GDB/MI Input Syntax. (line 6) 26029 * input-meta: Readline Init File Syntax. 26030 (line 105) 26031 * insert-comment (M-#): Miscellaneous Commands. 26032 (line 51) 26033 * insert-completions (M-*): Commands For Completion. 26034 (line 14) 26035 * inspect: Data. (line 6) 26036 * installation: Installing GDB. (line 6) 26037 * instructions, assembly: Machine Code. (line 36) 26038 * integral datatypes, in file-i/o protocol: Integral datatypes. 26039 (line 6) 26040 * Intel: remote stub. (line 57) 26041 * Intel disassembly flavor: Machine Code. (line 68) 26042 * interaction, readline: Readline Interaction. 26043 (line 6) 26044 * internal commands: Maintenance Commands. 26045 (line 6) 26046 * internal GDB breakpoints: Set Breaks. (line 241) 26047 * interpreter-exec: Interpreters. (line 43) 26048 * interrupt: Quitting GDB. (line 13) 26049 * interrupt remote programs: Remote configuration. 26050 (line 29) 26051 * interrupting remote programs: Connecting. (line 77) 26052 * interrupting remote targets: Bootstrapping. (line 25) 26053 * interrupts (remote protocol): Interrupts. (line 6) 26054 * invalid input: Bug Criteria. (line 16) 26055 * invoke another interpreter: Interpreters. (line 37) 26056 * isatty, file-i/o system call: isatty. (line 6) 26057 * isearch-terminators: Readline Init File Syntax. 26058 (line 112) 26059 * ISO 8859-1 character set: Character Sets. (line 68) 26060 * ISO Latin 1 character set: Character Sets. (line 68) 26061 * jump: Jumping. (line 10) 26062 * jump, and Objective-C: Method Names in Commands. 26063 (line 9) 26064 * k packet: Packets. (line 158) 26065 * kernel crash dump: BSD libkvm Interface. 26066 (line 6) 26067 * kernel memory image: BSD libkvm Interface. 26068 (line 6) 26069 * keymap: Readline Init File Syntax. 26070 (line 119) 26071 * kill: Kill Process. (line 6) 26072 * kill ring: Readline Killing Commands. 26073 (line 19) 26074 * kill-line (C-k): Commands For Killing. 26075 (line 6) 26076 * kill-region (): Commands For Killing. 26077 (line 41) 26078 * kill-whole-line (): Commands For Killing. 26079 (line 15) 26080 * kill-word (M-d): Commands For Killing. 26081 (line 19) 26082 * killing text: Readline Killing Commands. 26083 (line 6) 26084 * kvm: BSD libkvm Interface. 26085 (line 24) 26086 * l (list): List. (line 6) 26087 * languages: Languages. (line 6) 26088 * last tracepoint number: Create and Delete Tracepoints. 26089 (line 31) 26090 * latest breakpoint: Set Breaks. (line 6) 26091 * layout: TUI Commands. (line 15) 26092 * LDT: DJGPP Native. (line 24) 26093 * leaving GDB: Quitting GDB. (line 6) 26094 * Left: TUI Keys. (line 63) 26095 * libkvm: BSD libkvm Interface. 26096 (line 6) 26097 * limit hardware breakpoints and watchpoints: Remote configuration. 26098 (line 75) 26099 * limit on number of printed array elements: Print Settings. (line 123) 26100 * limits, in file-i/o protocol: Limits. (line 6) 26101 * linespec: List. (line 45) 26102 * Linux lightweight processes: Debugging Output. (line 66) 26103 * list: List. (line 6) 26104 * list active threads, remote request: General Query Packets. 26105 (line 60) 26106 * list of supported file-i/o calls: List of supported calls. 26107 (line 6) 26108 * list output in GDB/MI: GDB/MI Output Syntax. 26109 (line 115) 26110 * list, and Objective-C: Method Names in Commands. 26111 (line 9) 26112 * list, how many lines to display: List. (line 29) 26113 * listing GDB's internal symbol tables: Symbols. (line 269) 26114 * listing machine instructions: Machine Code. (line 36) 26115 * listing mapped overlays: Overlay Commands. (line 60) 26116 * load address, overlay's: How Overlays Work. (line 6) 26117 * load FILENAME: Target Commands. (line 115) 26118 * load shared library: Files. (line 320) 26119 * load symbols from memory: Files. (line 162) 26120 * local variables: Symbols. (line 130) 26121 * locate address: Output Formats. (line 35) 26122 * lock scheduler: Thread Stops. (line 89) 26123 * log output in GDB/MI: GDB/MI Output Syntax. 26124 (line 111) 26125 * logging file name: Logging output. (line 13) 26126 * logging GDB output: Logging output. (line 6) 26127 * loop_break: Command Files. (line 75) 26128 * loop_continue: Command Files. (line 79) 26129 * lseek flags, in file-i/o protocol: Lseek flags. (line 6) 26130 * lseek, file-i/o system call: lseek. (line 6) 26131 * M packet: Packets. (line 185) 26132 * m packet: Packets. (line 165) 26133 * M32-EVA target board address: M32R/D. (line 21) 26134 * M32R/Chaos debugging: M32R/D. (line 50) 26135 * m680x0: remote stub. (line 60) 26136 * m68k-stub.c: remote stub. (line 60) 26137 * machine instructions: Machine Code. (line 36) 26138 * macro define: Macros. (line 54) 26139 * macro definition, showing: Macros. (line 50) 26140 * macro exp1: Macros. (line 39) 26141 * macro expand: Macros. (line 32) 26142 * macro expansion, showing the results of preprocessor: Macros. 26143 (line 32) 26144 * macro list: Macros. (line 76) 26145 * macro undef: Macros. (line 69) 26146 * macros, example of debugging with: Macros. (line 80) 26147 * macros, user-defined: Macros. (line 54) 26148 * mailing lists: GDB/MI Development and Front Ends. 26149 (line 36) 26150 * maint agent: Maintenance Commands. 26151 (line 12) 26152 * maint check-symtabs: Maintenance Commands. 26153 (line 48) 26154 * maint cplus first_component: Maintenance Commands. 26155 (line 51) 26156 * maint cplus namespace: Maintenance Commands. 26157 (line 54) 26158 * maint demangle: Maintenance Commands. 26159 (line 57) 26160 * maint deprecate: Maintenance Commands. 26161 (line 60) 26162 * maint dump-me: Maintenance Commands. 26163 (line 68) 26164 * maint info breakpoints: Maintenance Commands. 26165 (line 17) 26166 * maint info psymtabs: Symbols. (line 269) 26167 * maint info sections: Files. (line 200) 26168 * maint info sol-threads: Threads. (line 126) 26169 * maint info symtabs: Symbols. (line 269) 26170 * maint internal-error: Maintenance Commands. 26171 (line 73) 26172 * maint internal-warning: Maintenance Commands. 26173 (line 73) 26174 * maint packet: Maintenance Commands. 26175 (line 94) 26176 * maint print architecture: Maintenance Commands. 26177 (line 100) 26178 * maint print cooked-registers: Maintenance Commands. 26179 (line 122) 26180 * maint print dummy-frames: Maintenance Commands. 26181 (line 104) 26182 * maint print objfiles: Maintenance Commands. 26183 (line 156) 26184 * maint print psymbols: Symbols. (line 250) 26185 * maint print raw-registers: Maintenance Commands. 26186 (line 122) 26187 * maint print reggroups: Maintenance Commands. 26188 (line 137) 26189 * maint print register-groups: Maintenance Commands. 26190 (line 122) 26191 * maint print registers: Maintenance Commands. 26192 (line 122) 26193 * maint print statistics: Maintenance Commands. 26194 (line 161) 26195 * maint print symbols: Symbols. (line 250) 26196 * maint print type: Maintenance Commands. 26197 (line 174) 26198 * maint print unwind, HPPA: HPPA. (line 17) 26199 * maint set dwarf2 max-cache-age: Maintenance Commands. 26200 (line 181) 26201 * maint set profile: Maintenance Commands. 26202 (line 195) 26203 * maint show dwarf2 max-cache-age: Maintenance Commands. 26204 (line 181) 26205 * maint show profile: Maintenance Commands. 26206 (line 195) 26207 * maint show-debug-regs: Maintenance Commands. 26208 (line 211) 26209 * maint space: Maintenance Commands. 26210 (line 218) 26211 * maint time: Maintenance Commands. 26212 (line 225) 26213 * maint translate-address: Maintenance Commands. 26214 (line 232) 26215 * maint undeprecate: Maintenance Commands. 26216 (line 60) 26217 * maintenance commands: Maintenance Commands. 26218 (line 6) 26219 * make: Shell Commands. (line 19) 26220 * manual overlay debugging: Overlay Commands. (line 23) 26221 * map an overlay: Overlay Commands. (line 30) 26222 * mapinfo list, QNX Neutrino: SVR4 Process Information. 26223 (line 78) 26224 * mapped address: How Overlays Work. (line 6) 26225 * mapped overlays: How Overlays Work. (line 6) 26226 * mark-modified-lines: Readline Init File Syntax. 26227 (line 132) 26228 * mark-symlinked-directories: Readline Init File Syntax. 26229 (line 137) 26230 * match-hidden-files: Readline Init File Syntax. 26231 (line 142) 26232 * maximum value for offset of closest symbol: Print Settings. (line 70) 26233 * mem: Memory Region Attributes. 26234 (line 22) 26235 * member functions: C plus plus expressions. 26236 (line 18) 26237 * memory address space mappings: SVR4 Process Information. 26238 (line 32) 26239 * memory map format: Memory map format. (line 6) 26240 * memory models, H8/500: H8/500. (line 6) 26241 * memory region attributes: Memory Region Attributes. 26242 (line 6) 26243 * memory tracing: Breakpoints. (line 20) 26244 * memory transfer, in file-i/o protocol: Memory transfer. (line 6) 26245 * memory used by commands: Maintenance Commands. 26246 (line 218) 26247 * memory used for symbol tables: Files. (line 308) 26248 * memory, alignment and size of remote accesses: Packets. (line 172) 26249 * memory, viewing as typed object: Expressions. (line 42) 26250 * memset: Bootstrapping. (line 70) 26251 * menu-complete (): Commands For Completion. 26252 (line 18) 26253 * meta-flag: Readline Init File Syntax. 26254 (line 105) 26255 * mi interpreter: Interpreters. (line 26) 26256 * mi1 interpreter: Interpreters. (line 34) 26257 * mi2 interpreter: Interpreters. (line 31) 26258 * minimal language: Unsupported languages. 26259 (line 6) 26260 * Minimal symbols and DLLs: Non-debug DLL symbols. 26261 (line 6) 26262 * MIPS addresses, masking: MIPS. (line 84) 26263 * MIPS boards: MIPS Embedded. (line 6) 26264 * MIPS GP register size on stack: MIPS. (line 32) 26265 * MIPS remote floating point: MIPS Embedded. (line 60) 26266 * MIPS stack: MIPS. (line 6) 26267 * MIPS stack space for arguments: MIPS. (line 50) 26268 * MMX registers (x86): Registers. (line 71) 26269 * mode_t values, in file-i/o protocol: mode_t values. (line 6) 26270 * Modula-2: Summary. (line 27) 26271 * Modula-2 built-ins: Built-In Func/Proc. (line 6) 26272 * Modula-2 checks: M2 Checks. (line 6) 26273 * Modula-2 constants: Built-In Func/Proc. (line 109) 26274 * Modula-2 defaults: M2 Defaults. (line 6) 26275 * Modula-2 operators: M2 Operators. (line 6) 26276 * Modula-2 types: M2 Types. (line 6) 26277 * Modula-2, deviations from: Deviations. (line 6) 26278 * Modula-2, GDB support: Modula-2. (line 6) 26279 * monitor: Connecting. (line 104) 26280 * Motorola 680x0: remote stub. (line 60) 26281 * MS Windows debugging: Cygwin Native. (line 6) 26282 * MS-DOS system info: DJGPP Native. (line 19) 26283 * MS-DOS-specific commands: DJGPP Native. (line 6) 26284 * multiple processes: Processes. (line 6) 26285 * multiple targets: Active Targets. (line 6) 26286 * multiple threads: Threads. (line 6) 26287 * multiple threads, backtrace: Backtrace. (line 37) 26288 * n (next): Continuing and Stepping. 26289 (line 78) 26290 * n (SingleKey TUI key): TUI Single Key Mode. (line 19) 26291 * names of symbols: Symbols. (line 14) 26292 * namespace in C++: C plus plus expressions. 26293 (line 22) 26294 * native Cygwin debugging: Cygwin Native. (line 6) 26295 * native DJGPP debugging: DJGPP Native. (line 6) 26296 * negative breakpoint numbers: Set Breaks. (line 241) 26297 * NetROM ROM emulator target: Target Commands. (line 88) 26298 * New SYSTAG message: Threads. (line 44) 26299 * New SYSTAG message, on HP-UX: Threads. (line 86) 26300 * next: Continuing and Stepping. 26301 (line 78) 26302 * next-history (C-n): Commands For History. 26303 (line 16) 26304 * nexti: Continuing and Stepping. 26305 (line 203) 26306 * ni (nexti): Continuing and Stepping. 26307 (line 203) 26308 * non-incremental-forward-search-history (M-n): Commands For History. 26309 (line 40) 26310 * non-incremental-reverse-search-history (M-p): Commands For History. 26311 (line 35) 26312 * non-member C++ functions, set breakpoint in: Set Breaks. (line 127) 26313 * noninvasive task options: Hurd Native. (line 73) 26314 * nosharedlibrary: Files. (line 336) 26315 * notation, readline: Readline Bare Essentials. 26316 (line 6) 26317 * notational conventions, for GDB/MI: GDB/MI. (line 25) 26318 * notify output in GDB/MI: GDB/MI Output Syntax. 26319 (line 100) 26320 * NULL elements in arrays: Print Settings. (line 148) 26321 * number of array elements to print: Print Settings. (line 123) 26322 * number representation: Numbers. (line 6) 26323 * numbers for breakpoints: Breakpoints. (line 41) 26324 * object files, relocatable, reading symbols from: Files. (line 132) 26325 * Objective-C: Objective-C. (line 6) 26326 * Objective-C, classes and selectors: Symbols. (line 196) 26327 * Objective-C, print objects: The Print Command with Objective-C. 26328 (line 6) 26329 * observer debugging info: Debugging Output. (line 73) 26330 * octal escapes in strings: Print Settings. (line 181) 26331 * online documentation: Help. (line 6) 26332 * opaque data types: Symbols. (line 232) 26333 * open flags, in file-i/o protocol: Open flags. (line 6) 26334 * open, file-i/o system call: open. (line 6) 26335 * OpenRISC 1000: OpenRISC 1000. (line 6) 26336 * OpenRISC 1000 htrace: OpenRISC 1000. (line 58) 26337 * operations allowed on pending breakpoints: Set Breaks. (line 228) 26338 * optimized code, debugging: Compilation. (line 26) 26339 * optimized code, wrong values of variables: Variables. (line 58) 26340 * optional debugging messages: Debugging Output. (line 6) 26341 * optional warnings: Messages/Warnings. (line 6) 26342 * or1k boards: OpenRISC 1000. (line 6) 26343 * or1ksim: OpenRISC 1000. (line 16) 26344 * OS ABI: ABI. (line 11) 26345 * OS information: OS Information. (line 6) 26346 * out-of-band records in GDB/MI: GDB/MI Out-of-band Records. 26347 (line 6) 26348 * outermost frame: Frames. (line 12) 26349 * output: Output. (line 35) 26350 * output formats: Output Formats. (line 6) 26351 * output syntax of GDB/MI: GDB/MI Output Syntax. 26352 (line 6) 26353 * output-meta: Readline Init File Syntax. 26354 (line 149) 26355 * overlay: Overlay Commands. (line 17) 26356 * overlay area: How Overlays Work. (line 6) 26357 * overlay example program: Overlay Sample Program. 26358 (line 6) 26359 * overlays: Overlays. (line 6) 26360 * overlays, setting breakpoints in: Overlay Commands. (line 93) 26361 * overload-choice annotation: Prompting. (line 32) 26362 * overloaded functions, calling: C plus plus expressions. 26363 (line 27) 26364 * overloaded functions, overload resolution: Debugging C plus plus. 26365 (line 47) 26366 * overloading: Breakpoint Menus. (line 6) 26367 * overloading in C++: Debugging C plus plus. 26368 (line 14) 26369 * overwrite-mode (): Commands For Text. (line 53) 26370 * P packet: Packets. (line 213) 26371 * p packet: Packets. (line 198) 26372 * Pacal objects, static members display: Print Settings. (line 312) 26373 * packet size, remote protocol: General Query Packets. 26374 (line 275) 26375 * packets, reporting on stdout: Debugging Output. (line 86) 26376 * packets, tracepoint: Tracepoint Packets. (line 6) 26377 * page tables display (MS-DOS): DJGPP Native. (line 56) 26378 * page-completions: Readline Init File Syntax. 26379 (line 154) 26380 * partial symbol dump: Symbols. (line 250) 26381 * partial symbol tables, listing GDB's internal: Symbols. (line 269) 26382 * Pascal: Summary. (line 30) 26383 * Pascal support in GDB, limitations: Pascal. (line 6) 26384 * passcount: Tracepoint Passcounts. 26385 (line 6) 26386 * patching binaries: Patching. (line 6) 26387 * patching object files: Files. (line 26) 26388 * path: Environment. (line 14) 26389 * pause current task (GNU Hurd): Hurd Native. (line 49) 26390 * pause current thread (GNU Hurd): Hurd Native. (line 91) 26391 * pauses in output: Screen Size. (line 6) 26392 * pending breakpoints: Set Breaks. (line 195) 26393 * PgDn: TUI Keys. (line 54) 26394 * PgUp: TUI Keys. (line 51) 26395 * physical address from linear address: DJGPP Native. (line 81) 26396 * pipe, target remote to: Connecting. (line 60) 26397 * pipes: Starting. (line 54) 26398 * pmon, MIPS remote: MIPS Embedded. (line 132) 26399 * po (print-object): The Print Command with Objective-C. 26400 (line 6) 26401 * pointer values, in file-i/o protocol: Pointer values. (line 6) 26402 * pointer, finding referent: Print Settings. (line 79) 26403 * port rights, GNU Hurd: Hurd Native. (line 85) 26404 * port sets, GNU Hurd: Hurd Native. (line 85) 26405 * possible-completions (M-?): Commands For Completion. 26406 (line 11) 26407 * post-commands annotation: Prompting. (line 27) 26408 * post-overload-choice annotation: Prompting. (line 32) 26409 * post-prompt annotation: Prompting. (line 24) 26410 * post-prompt-for-continue annotation: Prompting. (line 40) 26411 * post-query annotation: Prompting. (line 36) 26412 * pre-commands annotation: Prompting. (line 27) 26413 * pre-overload-choice annotation: Prompting. (line 32) 26414 * pre-prompt annotation: Prompting. (line 24) 26415 * pre-prompt-for-continue annotation: Prompting. (line 40) 26416 * pre-query annotation: Prompting. (line 36) 26417 * prefix for shared library file names: Files. (line 366) 26418 * prefix-meta (<ESC>): Miscellaneous Commands. 26419 (line 18) 26420 * premature return from system calls: Thread Stops. (line 36) 26421 * preprocessor macro expansion, showing the results of: Macros. 26422 (line 32) 26423 * pretty print arrays: Print Settings. (line 98) 26424 * pretty print C++ virtual function tables: Print Settings. (line 323) 26425 * previous-history (C-p): Commands For History. 26426 (line 12) 26427 * print: Data. (line 6) 26428 * print an Objective-C object description: The Print Command with Objective-C. 26429 (line 11) 26430 * print array indexes: Print Settings. (line 108) 26431 * print settings: Print Settings. (line 6) 26432 * print structures in indented form: Print Settings. (line 157) 26433 * print-object: The Print Command with Objective-C. 26434 (line 6) 26435 * print/don't print memory addresses: Print Settings. (line 13) 26436 * printf: Output. (line 46) 26437 * printing data: Data. (line 6) 26438 * proc-trace-entry: SVR4 Process Information. 26439 (line 70) 26440 * proc-trace-exit: SVR4 Process Information. 26441 (line 70) 26442 * proc-untrace-entry: SVR4 Process Information. 26443 (line 70) 26444 * proc-untrace-exit: SVR4 Process Information. 26445 (line 70) 26446 * process detailed status information: SVR4 Process Information. 26447 (line 40) 26448 * process ID: SVR4 Process Information. 26449 (line 16) 26450 * process info via /proc: SVR4 Process Information. 26451 (line 6) 26452 * process list, QNX Neutrino: SVR4 Process Information. 26453 (line 74) 26454 * process status register: Registers. (line 26) 26455 * processes, multiple: Processes. (line 6) 26456 * procfs API calls: SVR4 Process Information. 26457 (line 53) 26458 * profiling GDB: Maintenance Commands. 26459 (line 195) 26460 * program counter register: Registers. (line 26) 26461 * program entry point: Backtrace. (line 87) 26462 * prompt: Prompt. (line 6) 26463 * prompt annotation: Prompting. (line 24) 26464 * prompt-for-continue annotation: Prompting. (line 40) 26465 * protocol basics, file-i/o: Protocol basics. (line 6) 26466 * protocol specific representation of datatypes, in file-i/o protocol: Protocol specific representation of datatypes. 26467 (line 6) 26468 * protocol, GDB remote serial: Overview. (line 14) 26469 * ptrace system call: OS Information. (line 9) 26470 * ptype: Symbols. (line 77) 26471 * putDebugChar: Bootstrapping. (line 20) 26472 * pwd: Working Directory. (line 19) 26473 * q (quit): Quitting GDB. (line 6) 26474 * q (SingleKey TUI key): TUI Single Key Mode. (line 22) 26475 * Q packet: Packets. (line 226) 26476 * q packet: Packets. (line 226) 26477 * qC packet: General Query Packets. 26478 (line 41) 26479 * qCRC packet: General Query Packets. 26480 (line 51) 26481 * qfThreadInfo packet: General Query Packets. 26482 (line 60) 26483 * qGetTLSAddr packet: General Query Packets. 26484 (line 87) 26485 * QNX Neutrino: Neutrino. (line 6) 26486 * qOffsets packet: General Query Packets. 26487 (line 139) 26488 * qP packet: General Query Packets. 26489 (line 148) 26490 * qRcmd packet: General Query Packets. 26491 (line 157) 26492 * qsThreadInfo packet: General Query Packets. 26493 (line 60) 26494 * qSupported packet: General Query Packets. 26495 (line 182) 26496 * qSymbol packet: General Query Packets. 26497 (line 292) 26498 * qThreadExtraInfo packet: General Query Packets. 26499 (line 328) 26500 * query annotation: Prompting. (line 36) 26501 * quit [EXPRESSION]: Quitting GDB. (line 6) 26502 * quit annotation: Errors. (line 6) 26503 * quoted-insert (C-q or C-v): Commands For Text. (line 20) 26504 * quotes in commands: Completion. (line 57) 26505 * quoting Ada internal identifiers: Additions to Ada. (line 76) 26506 * quoting names: Symbols. (line 14) 26507 * qXfer packet: General Query Packets. 26508 (line 354) 26509 * r (run): Starting. (line 6) 26510 * r (SingleKey TUI key): TUI Single Key Mode. (line 25) 26511 * R packet: Packets. (line 235) 26512 * r packet: Packets. (line 230) 26513 * raise exceptions: Set Catchpoints. (line 64) 26514 * range checking: Type Checking. (line 65) 26515 * ranges of breakpoints: Breakpoints. (line 48) 26516 * rbreak: Set Breaks. (line 111) 26517 * RDI heartbeat: ARM. (line 93) 26518 * rdilogenable: ARM. (line 76) 26519 * rdilogfile: ARM. (line 70) 26520 * re-read-init-file (C-x C-r): Miscellaneous Commands. 26521 (line 6) 26522 * read special object, remote request: General Query Packets. 26523 (line 354) 26524 * read, file-i/o system call: read. (line 6) 26525 * read-only sections: Files. (line 258) 26526 * reading symbols from relocatable object files: Files. (line 132) 26527 * reading symbols immediately: Files. (line 90) 26528 * readline: Editing. (line 6) 26529 * readnow: Files. (line 90) 26530 * receive rights, GNU Hurd: Hurd Native. (line 85) 26531 * recent tracepoint number: Create and Delete Tracepoints. 26532 (line 31) 26533 * record aggregates (Ada): Omissions from Ada. (line 44) 26534 * record serial communications on file: Remote configuration. 26535 (line 60) 26536 * recording a session script: Bug Reporting. (line 104) 26537 * redirection: Input/Output. (line 6) 26538 * redraw-current-line (): Commands For Moving. (line 30) 26539 * reference card: Formatting Documentation. 26540 (line 6) 26541 * reference declarations: C plus plus expressions. 26542 (line 51) 26543 * refresh: TUI Commands. (line 39) 26544 * register stack, AMD29K: A29K. (line 6) 26545 * registers: Registers. (line 6) 26546 * regs, Super-H: Super-H. (line 9) 26547 * regular expression: Set Breaks. (line 111) 26548 * reloading symbols: Symbols. (line 208) 26549 * reloading the overlay table: Overlay Commands. (line 52) 26550 * relocatable object files, reading symbols from: Files. (line 132) 26551 * remote connection without stubs: Server. (line 6) 26552 * remote debugging: Remote. (line 6) 26553 * remote memory comparison: Memory. (line 101) 26554 * remote monitor prompt: MIPS Embedded. (line 107) 26555 * remote packets, enabling and disabling: Remote configuration. 26556 (line 80) 26557 * remote programs, interrupting: Connecting. (line 77) 26558 * remote protocol debugging: Debugging Output. (line 86) 26559 * remote protocol, binary data: Overview. (line 55) 26560 * remote protocol, field separator: Overview. (line 47) 26561 * remote query requests: General Query Packets. 26562 (line 6) 26563 * remote serial debugging summary: Debug Session. (line 6) 26564 * remote serial debugging, overview: remote stub. (line 14) 26565 * remote serial protocol: Overview. (line 14) 26566 * remote serial stub: Stub Contents. (line 6) 26567 * remote serial stub list: remote stub. (line 54) 26568 * remote serial stub, initialization: Stub Contents. (line 10) 26569 * remote serial stub, main routine: Stub Contents. (line 15) 26570 * remote stub, example: remote stub. (line 6) 26571 * remote stub, support routines: Bootstrapping. (line 6) 26572 * remote target: Target Commands. (line 58) 26573 * remote target, limit break- and watchpoints: Remote configuration. 26574 (line 75) 26575 * remote timeout: Remote configuration. 26576 (line 68) 26577 * remote, a command: Remote. (line 26) 26578 * remotetimeout: Sparclet. (line 12) 26579 * remove actions from a tracepoint: Tracepoint Actions. (line 17) 26580 * rename, file-i/o system call: rename. (line 6) 26581 * Renesas: remote stub. (line 63) 26582 * Renesas SH download: H8/300. (line 19) 26583 * repeated array elements: Print Settings. (line 135) 26584 * repeating command sequences: Command Syntax. (line 42) 26585 * repeating commands: Command Syntax. (line 21) 26586 * reporting bugs in GDB: GDB Bugs. (line 6) 26587 * reprint the last value: Data. (line 21) 26588 * reset SDI connection, M32R: M32R/D. (line 44) 26589 * response time, MIPS debugging: MIPS. (line 10) 26590 * restart: Checkpoint/Restart. (line 6) 26591 * restart CHECKPOINT-ID: Checkpoint/Restart. (line 44) 26592 * restore: Dump/Restore Files. (line 41) 26593 * restore data from a file: Dump/Restore Files. (line 6) 26594 * result records in GDB/MI: GDB/MI Result Records. 26595 (line 6) 26596 * resuming execution: Continuing and Stepping. 26597 (line 6) 26598 * RET (repeat last command): Command Syntax. (line 21) 26599 * retransmit-timeout, MIPS protocol: MIPS Embedded. (line 83) 26600 * return: Returning. (line 6) 26601 * returning from a function: Returning. (line 6) 26602 * reverse-search: Search. (line 16) 26603 * reverse-search-history (C-r): Commands For History. 26604 (line 26) 26605 * revert-line (M-r): Miscellaneous Commands. 26606 (line 25) 26607 * rewind program state: Checkpoint/Restart. (line 6) 26608 * Right: TUI Keys. (line 66) 26609 * ROM at zero address, RDI: ARM. (line 83) 26610 * run: Starting. (line 6) 26611 * run to main procedure: Starting. (line 71) 26612 * run until specified location: Continuing and Stepping. 26613 (line 117) 26614 * running: Starting. (line 6) 26615 * running and debugging Sparclet programs: Sparclet Execution. 26616 (line 6) 26617 * running VxWorks tasks: VxWorks Attach. (line 6) 26618 * running, on Sparclet: Sparclet. (line 28) 26619 * rwatch: Set Watchpoints. (line 41) 26620 * s (SingleKey TUI key): TUI Single Key Mode. (line 28) 26621 * s (step): Continuing and Stepping. 26622 (line 46) 26623 * S packet: Packets. (line 247) 26624 * s packet: Packets. (line 241) 26625 * save command history: Command History. (line 36) 26626 * save GDB output to a file: Logging output. (line 6) 26627 * save tracepoints for future sessions: save-tracepoints. (line 6) 26628 * save-tracepoints: save-tracepoints. (line 6) 26629 * scheduler locking mode: Thread Stops. (line 89) 26630 * scope: M2 Scope. (line 6) 26631 * scripting commands: Command Files. (line 6) 26632 * sdireset: M32R/D. (line 44) 26633 * sdistatus: M32R/D. (line 47) 26634 * SDS protocol: PowerPC. (line 17) 26635 * sds, a command: PowerPC. (line 28) 26636 * search: Search. (line 9) 26637 * searching source files: Search. (line 6) 26638 * section: Files. (line 182) 26639 * section offsets, remote request: General Query Packets. 26640 (line 139) 26641 * segment descriptor tables: DJGPP Native. (line 24) 26642 * select trace snapshot: tfind. (line 6) 26643 * select-frame: Frames. (line 51) 26644 * selected frame: Stack. (line 19) 26645 * selecting frame silently: Frames. (line 51) 26646 * self-insert (a, b, A, 1, !, ...): Commands For Text. (line 27) 26647 * send command to E7000 monitor: Renesas ICE. (line 24) 26648 * send command to remote monitor <1>: Connecting. (line 104) 26649 * send command to remote monitor: Remote. (line 26) 26650 * send command to simulator: Embedded Processors. (line 9) 26651 * send PMON command: MIPS Embedded. (line 132) 26652 * send rights, GNU Hurd: Hurd Native. (line 85) 26653 * separate debugging information files: Separate Debug Files. 26654 (line 6) 26655 * sequence-id, for GDB remote: Overview. (line 29) 26656 * serial connections, debugging: Debugging Output. (line 86) 26657 * serial device, Renesas micros: Renesas Boards. (line 6) 26658 * serial line speed, Renesas micros: Renesas Boards. (line 11) 26659 * serial line, target remote: Connecting. (line 18) 26660 * serial port name: Remote configuration. 26661 (line 40) 26662 * serial protocol, GDB remote: Overview. (line 14) 26663 * server, command prefix: Command History. (line 20) 26664 * set: Help. (line 108) 26665 * set ABI for MIPS: MIPS. (line 55) 26666 * set annotate: Annotations Overview. 26667 (line 29) 26668 * set architecture: Targets. (line 21) 26669 * set args: Arguments. (line 21) 26670 * set arm: ARM. (line 18) 26671 * set auto-solib-add: Files. (line 300) 26672 * set backtrace: Backtrace. (line 98) 26673 * set board-address: M32R/D. (line 21) 26674 * set breakpoint pending: Set Breaks. (line 211) 26675 * set breakpoints in many functions: Set Breaks. (line 111) 26676 * set breakpoints on all functions: Set Breaks. (line 131) 26677 * set can-use-hw-watchpoints: Set Watchpoints. (line 68) 26678 * set case-sensitive: Symbols. (line 27) 26679 * set charset: Character Sets. (line 47) 26680 * set check range: Range Checking. (line 34) 26681 * set check type: Type Checking. (line 42) 26682 * set coerce-float-to-double: ABI. (line 41) 26683 * set com1base: DJGPP Native. (line 125) 26684 * set com1irq: DJGPP Native. (line 125) 26685 * set com2base: DJGPP Native. (line 125) 26686 * set com2irq: DJGPP Native. (line 125) 26687 * set com3base: DJGPP Native. (line 125) 26688 * set com3irq: DJGPP Native. (line 125) 26689 * set com4base: DJGPP Native. (line 125) 26690 * set com4irq: DJGPP Native. (line 125) 26691 * set complaints: Messages/Warnings. (line 29) 26692 * set confirm: Messages/Warnings. (line 50) 26693 * set cp-abi: ABI. (line 53) 26694 * set cygwin-exceptions: Cygwin Native. (line 30) 26695 * set debug: Debugging Output. (line 18) 26696 * set debug hppa: HPPA. (line 10) 26697 * set debug mips: MIPS. (line 104) 26698 * set debug monitor: Target Commands. (line 108) 26699 * set debug nto-debug: Neutrino. (line 9) 26700 * set debug-file-directory: Separate Debug Files. 26701 (line 47) 26702 * set debugevents: Cygwin Native. (line 59) 26703 * set debugexceptions: Cygwin Native. (line 70) 26704 * set debugexec: Cygwin Native. (line 66) 26705 * set debugmemory: Cygwin Native. (line 74) 26706 * set demangle-style: Print Settings. (line 255) 26707 * set detach-on-fork: Processes. (line 55) 26708 * set disassembly-flavor: Machine Code. (line 68) 26709 * set download-path: M32R/D. (line 15) 26710 * set editing: Editing. (line 15) 26711 * set endian: Byte Order. (line 13) 26712 * set environment: Environment. (line 39) 26713 * set exceptions, Hurd command: Hurd Native. (line 40) 26714 * set exec-done-display: Debugging Output. (line 11) 26715 * set extension-language: Show. (line 30) 26716 * set follow-fork-mode: Processes. (line 35) 26717 * set gnutarget: Target Commands. (line 28) 26718 * set hash, for remote monitors: Target Commands. (line 99) 26719 * set height: Screen Size. (line 21) 26720 * set history expansion: Command History. (line 65) 26721 * set history filename: Command History. (line 26) 26722 * set history save: Command History. (line 36) 26723 * set history size: Command History. (line 45) 26724 * set host-charset: Character Sets. (line 34) 26725 * set inferior controlling terminal: Input/Output. (line 44) 26726 * set inferior-tty: Input/Output. (line 49) 26727 * set input-radix: Numbers. (line 14) 26728 * set language: Manually. (line 9) 26729 * set listsize: List. (line 32) 26730 * set logging: Logging output. (line 9) 26731 * set machine: Renesas Special. (line 8) 26732 * set max-user-call-depth: Define. (line 73) 26733 * set memory MOD: H8/500. (line 6) 26734 * set mips abi: MIPS. (line 55) 26735 * set mips mask-address: MIPS. (line 84) 26736 * set mips saved-gpreg-size: MIPS. (line 32) 26737 * set mips stack-arg-size: MIPS. (line 50) 26738 * set mipsfpu: MIPS Embedded. (line 60) 26739 * set monitor-prompt, MIPS remote: MIPS Embedded. (line 107) 26740 * set monitor-warnings, MIPS remote: MIPS Embedded. (line 123) 26741 * set new-console: Cygwin Native. (line 42) 26742 * set new-group: Cygwin Native. (line 51) 26743 * set opaque-type-resolution: Symbols. (line 232) 26744 * set osabi: ABI. (line 11) 26745 * set output-radix: Numbers. (line 31) 26746 * set overload-resolution: Debugging C plus plus. 26747 (line 47) 26748 * set pagination: Screen Size. (line 38) 26749 * set print: Print Settings. (line 11) 26750 * set processor: Targets. (line 31) 26751 * set procfs-file: SVR4 Process Information. 26752 (line 59) 26753 * set procfs-trace: SVR4 Process Information. 26754 (line 53) 26755 * set prompt: Prompt. (line 16) 26756 * set radix: Numbers. (line 44) 26757 * set rdiheartbeat: ARM. (line 93) 26758 * set rdiromatzero: ARM. (line 83) 26759 * set remote: Remote configuration. 26760 (line 6) 26761 * set remote system-call-allowed: system. (line 38) 26762 * set remote-mips64-transfers-32bit-regs: MIPS. (line 94) 26763 * set remoteaddhost: WinCE. (line 24) 26764 * set remotecache: Caching Remote Data. (line 13) 26765 * set remotedirectory: WinCE. (line 9) 26766 * set remoteupload: WinCE. (line 16) 26767 * set retransmit-timeout: MIPS Embedded. (line 83) 26768 * set rstack_high_address: A29K. (line 6) 26769 * set sdstimeout: PowerPC. (line 21) 26770 * set server-address: M32R/D. (line 27) 26771 * set shell: Cygwin Native. (line 78) 26772 * set signal-thread: Hurd Native. (line 21) 26773 * set signals, Hurd command: Hurd Native. (line 11) 26774 * set sigs, Hurd command: Hurd Native. (line 11) 26775 * set sigthread: Hurd Native. (line 21) 26776 * set solib-absolute-prefix: Files. (line 366) 26777 * set solib-search-path: Files. (line 380) 26778 * set step-mode: Continuing and Stepping. 26779 (line 92) 26780 * set stop-on-solib-events: Files. (line 346) 26781 * set stopped, Hurd command: Hurd Native. (line 32) 26782 * set struct-convention: i386. (line 7) 26783 * set substitute-path: Source Path. (line 114) 26784 * set symbol-reloading: Symbols. (line 215) 26785 * set syn-garbage-limit, MIPS remote: MIPS Embedded. (line 98) 26786 * set target-charset: Character Sets. (line 28) 26787 * set task, Hurd commands: Hurd Native. (line 49) 26788 * set thread, Hurd command: Hurd Native. (line 91) 26789 * set timeout: MIPS Embedded. (line 83) 26790 * set trace-commands: Messages/Warnings. (line 65) 26791 * set tracepoint: Create and Delete Tracepoints. 26792 (line 6) 26793 * set trust-readonly-sections: Files. (line 258) 26794 * set tui active-border-mode: TUI Configuration. (line 25) 26795 * set tui border-kind: TUI Configuration. (line 10) 26796 * set tui border-mode: TUI Configuration. (line 30) 26797 * set unwindonsignal: Calling. (line 26) 26798 * set usehardbreakpoints, E7000: Renesas ICE. (line 41) 26799 * set variable: Assignment. (line 16) 26800 * set verbose: Messages/Warnings. (line 15) 26801 * set watchdog: Maintenance Commands. 26802 (line 245) 26803 * set width: Screen Size. (line 21) 26804 * set write: Patching. (line 15) 26805 * set-mark (C-@): Miscellaneous Commands. 26806 (line 32) 26807 * set_debug_traps: Stub Contents. (line 10) 26808 * setting variables: Assignment. (line 6) 26809 * setting watchpoints: Set Watchpoints. (line 6) 26810 * SH: remote stub. (line 63) 26811 * sh-stub.c: remote stub. (line 63) 26812 * share: Files. (line 327) 26813 * shared libraries: Files. (line 281) 26814 * sharedlibrary: Files. (line 327) 26815 * shell: Shell Commands. (line 10) 26816 * shell escape: Shell Commands. (line 10) 26817 * show: Help. (line 113) 26818 * show all user variables: Convenience Vars. (line 37) 26819 * show annotate: Annotations Overview. 26820 (line 34) 26821 * show architecture: Targets. (line 21) 26822 * show args: Arguments. (line 28) 26823 * show arm: ARM. (line 22) 26824 * show auto-solib-add: Files. (line 317) 26825 * show backtrace: Backtrace. (line 105) 26826 * show board-address: M32R/D. (line 24) 26827 * show breakpoint pending: Set Breaks. (line 211) 26828 * show can-use-hw-watchpoints: Set Watchpoints. (line 71) 26829 * show case-sensitive: Symbols. (line 40) 26830 * show charset: Character Sets. (line 53) 26831 * show check range: Range Checking. (line 34) 26832 * show check type: Type Checking. (line 42) 26833 * show coerce-float-to-double: ABI. (line 50) 26834 * show com1base: DJGPP Native. (line 137) 26835 * show com1irq: DJGPP Native. (line 137) 26836 * show com2base: DJGPP Native. (line 137) 26837 * show com2irq: DJGPP Native. (line 137) 26838 * show com3base: DJGPP Native. (line 137) 26839 * show com3irq: DJGPP Native. (line 137) 26840 * show com4base: DJGPP Native. (line 137) 26841 * show com4irq: DJGPP Native. (line 137) 26842 * show commands: Command History. (line 78) 26843 * show complaints: Messages/Warnings. (line 35) 26844 * show confirm: Messages/Warnings. (line 56) 26845 * show convenience: Convenience Vars. (line 37) 26846 * show copying: Help. (line 137) 26847 * show cp-abi: ABI. (line 53) 26848 * show cygwin-exceptions: Cygwin Native. (line 38) 26849 * show debug: Debugging Output. (line 22) 26850 * show debug mips: MIPS. (line 108) 26851 * show debug monitor: Target Commands. (line 112) 26852 * show debug nto-debug: Neutrino. (line 13) 26853 * show debug-file-directory: Separate Debug Files. 26854 (line 51) 26855 * show detach-on-follow: Processes. (line 71) 26856 * show directories: Source Path. (line 111) 26857 * show disassembly-flavor: Machine Code. (line 77) 26858 * show download-path: M32R/D. (line 18) 26859 * show editing: Editing. (line 22) 26860 * show environment: Environment. (line 33) 26861 * show exceptions, Hurd command: Hurd Native. (line 46) 26862 * show exec-done-display: Debugging Output. (line 14) 26863 * show follow-fork-mode: Processes. (line 49) 26864 * show gnutarget: Target Commands. (line 40) 26865 * show hash, for remote monitors: Target Commands. (line 105) 26866 * show height: Screen Size. (line 21) 26867 * show history: Command History. (line 70) 26868 * show host-charset: Character Sets. (line 56) 26869 * show inferior-tty: Input/Output. (line 52) 26870 * show input-radix: Numbers. (line 36) 26871 * show language: Show. (line 10) 26872 * show last commands: Command History. (line 78) 26873 * show listsize: List. (line 36) 26874 * show logging: Logging output. (line 26) 26875 * show machine: Renesas Special. (line 8) 26876 * show max-user-call-depth: Define. (line 73) 26877 * show mips abi: MIPS. (line 77) 26878 * show mips mask-address: MIPS. (line 90) 26879 * show mips saved-gpreg-size: MIPS. (line 47) 26880 * show mipsfpu: MIPS Embedded. (line 60) 26881 * show monitor-prompt, MIPS remote: MIPS Embedded. (line 119) 26882 * show monitor-warnings, MIPS remote: MIPS Embedded. (line 129) 26883 * show new-console: Cygwin Native. (line 47) 26884 * show new-group: Cygwin Native. (line 56) 26885 * show opaque-type-resolution: Symbols. (line 247) 26886 * show osabi: ABI. (line 11) 26887 * show output-radix: Numbers. (line 39) 26888 * show overload-resolution: Debugging C plus plus. 26889 (line 64) 26890 * show pagination: Screen Size. (line 42) 26891 * show paths: Environment. (line 29) 26892 * show print: Print Settings. (line 39) 26893 * show processor: Targets. (line 31) 26894 * show procfs-file: SVR4 Process Information. 26895 (line 64) 26896 * show procfs-trace: SVR4 Process Information. 26897 (line 56) 26898 * show prompt: Prompt. (line 19) 26899 * show radix: Numbers. (line 44) 26900 * show rdiheartbeat: ARM. (line 98) 26901 * show rdiromatzero: ARM. (line 90) 26902 * show remote: Remote configuration. 26903 (line 6) 26904 * show remote system-call-allowed: system. (line 42) 26905 * show remote-mips64-transfers-32bit-regs: MIPS. (line 100) 26906 * show remoteaddhost: WinCE. (line 28) 26907 * show remotecache: Caching Remote Data. (line 18) 26908 * show remotedirectory: WinCE. (line 13) 26909 * show remoteupload: WinCE. (line 21) 26910 * show retransmit-timeout: MIPS Embedded. (line 83) 26911 * show rstack_high_address: A29K. (line 17) 26912 * show sdstimeout: PowerPC. (line 25) 26913 * show server-address: M32R/D. (line 31) 26914 * show shell: Cygwin Native. (line 82) 26915 * show signal-thread: Hurd Native. (line 28) 26916 * show signals, Hurd command: Hurd Native. (line 17) 26917 * show sigs, Hurd command: Hurd Native. (line 17) 26918 * show sigthread: Hurd Native. (line 28) 26919 * show solib-absolute-prefix: Files. (line 377) 26920 * show solib-search-path: Files. (line 390) 26921 * show stop-on-solib-events: Files. (line 352) 26922 * show stopped, Hurd command: Hurd Native. (line 37) 26923 * show struct-convention: i386. (line 15) 26924 * show substitute-path: Source Path. (line 151) 26925 * show symbol-reloading: Symbols. (line 229) 26926 * show syn-garbage-limit, MIPS remote: MIPS Embedded. (line 103) 26927 * show target-charset: Character Sets. (line 59) 26928 * show task, Hurd commands: Hurd Native. (line 57) 26929 * show thread, Hurd command: Hurd Native. (line 101) 26930 * show timeout: MIPS Embedded. (line 83) 26931 * show unwindonsignal: Calling. (line 33) 26932 * show usehardbreakpoints, E7000: Renesas ICE. (line 41) 26933 * show user: Define. (line 67) 26934 * show values: Value History. (line 47) 26935 * show verbose: Messages/Warnings. (line 21) 26936 * show version: Help. (line 127) 26937 * show warranty: Help. (line 141) 26938 * show width: Screen Size. (line 21) 26939 * show write: Patching. (line 26) 26940 * show-all-if-ambiguous: Readline Init File Syntax. 26941 (line 164) 26942 * show-all-if-unmodified: Readline Init File Syntax. 26943 (line 170) 26944 * si (stepi): Continuing and Stepping. 26945 (line 190) 26946 * signal: Signaling. (line 6) 26947 * signal annotation: Annotations for Running. 26948 (line 42) 26949 * signal-name annotation: Annotations for Running. 26950 (line 22) 26951 * signal-name-end annotation: Annotations for Running. 26952 (line 22) 26953 * signal-string annotation: Annotations for Running. 26954 (line 22) 26955 * signal-string-end annotation: Annotations for Running. 26956 (line 22) 26957 * signalled annotation: Annotations for Running. 26958 (line 22) 26959 * signals: Signals. (line 6) 26960 * SIGQUIT signal, dump core of GDB: Maintenance Commands. 26961 (line 69) 26962 * silent: Break Commands. (line 38) 26963 * sim: Z8000. (line 15) 26964 * sim, a command: Embedded Processors. (line 13) 26965 * simulator, Z8000: Z8000. (line 6) 26966 * size of remote memory accesses: Packets. (line 172) 26967 * size of screen: Screen Size. (line 6) 26968 * snapshot of a process: Checkpoint/Restart. (line 6) 26969 * software watchpoints: Set Watchpoints. (line 22) 26970 * source: Command Files. (line 14) 26971 * source annotation: Source Annotations. (line 6) 26972 * source file and line of a symbol: Print Settings. (line 51) 26973 * source line and its code address: Machine Code. (line 6) 26974 * source path: Source Path. (line 6) 26975 * Sparc: remote stub. (line 66) 26976 * sparc-stub.c: remote stub. (line 66) 26977 * sparcl-stub.c: remote stub. (line 69) 26978 * Sparclet: Sparclet. (line 6) 26979 * SparcLite: remote stub. (line 69) 26980 * Special Fortran commands: Special Fortran commands. 26981 (line 6) 26982 * speed: Renesas Boards. (line 11) 26983 * spr: OpenRISC 1000. (line 33) 26984 * SSE registers (x86): Registers. (line 71) 26985 * ST2000 auxiliary commands: ST2000. (line 26) 26986 * st2000 CMD: ST2000. (line 30) 26987 * stack frame: Frames. (line 6) 26988 * stack on Alpha: MIPS. (line 6) 26989 * stack on MIPS: MIPS. (line 6) 26990 * stack pointer register: Registers. (line 26) 26991 * stacking targets: Active Targets. (line 6) 26992 * standard registers: Registers. (line 26) 26993 * start: Starting. (line 70) 26994 * start a new trace experiment: Starting and Stopping Trace Experiment. 26995 (line 6) 26996 * start-kbd-macro (C-x (): Keyboard Macros. (line 6) 26997 * starting: Starting. (line 6) 26998 * starting annotation: Annotations for Running. 26999 (line 6) 27000 * startup code, and backtrace: Backtrace. (line 87) 27001 * stat, file-i/o system call: stat/fstat. (line 6) 27002 * static members of C++ objects: Print Settings. (line 301) 27003 * static members of Pacal objects: Print Settings. (line 312) 27004 * status of trace data collection: Starting and Stopping Trace Experiment. 27005 (line 20) 27006 * status output in GDB/MI: GDB/MI Output Syntax. 27007 (line 92) 27008 * STDBUG commands (ST2000): ST2000. (line 30) 27009 * step: Continuing and Stepping. 27010 (line 46) 27011 * stepi: Continuing and Stepping. 27012 (line 190) 27013 * stepping: Continuing and Stepping. 27014 (line 6) 27015 * stepping into functions with no line info: Continuing and Stepping. 27016 (line 93) 27017 * stop a running trace experiment: Starting and Stopping Trace Experiment. 27018 (line 12) 27019 * stop on C++ exceptions: Set Catchpoints. (line 13) 27020 * stop reply packets: Stop Reply Packets. (line 6) 27021 * stop, a pseudo-command: Hooks. (line 21) 27022 * stopped threads: Thread Stops. (line 31) 27023 * stopping annotation: Annotations for Running. 27024 (line 6) 27025 * stream records in GDB/MI: GDB/MI Stream Records. 27026 (line 6) 27027 * struct return convention: i386. (line 7) 27028 * struct stat, in file-i/o protocol: struct stat. (line 6) 27029 * struct timeval, in file-i/o protocol: struct timeval. (line 6) 27030 * struct user contents: OS Information. (line 9) 27031 * struct/union returned in registers: i386. (line 7) 27032 * stub example, remote debugging: remote stub. (line 6) 27033 * stupid questions: Messages/Warnings. (line 50) 27034 * Super-H: Super-H. (line 6) 27035 * supported packets, remote query: General Query Packets. 27036 (line 182) 27037 * switching threads: Threads. (line 6) 27038 * switching threads automatically: Threads. (line 152) 27039 * symbol decoding style, C++: Print Settings. (line 255) 27040 * symbol dump: Symbols. (line 250) 27041 * symbol from address: Symbols. (line 54) 27042 * symbol lookup, remote request: General Query Packets. 27043 (line 292) 27044 * symbol names: Symbols. (line 14) 27045 * symbol overloading: Breakpoint Menus. (line 6) 27046 * symbol table: Files. (line 6) 27047 * symbol tables, listing GDB's internal: Symbols. (line 269) 27048 * symbol, source file and line: Print Settings. (line 51) 27049 * symbol-file: Files. (line 45) 27050 * symbols, reading from relocatable object files: Files. (line 132) 27051 * symbols, reading immediately: Files. (line 90) 27052 * synchronize with remote MIPS target: MIPS Embedded. (line 98) 27053 * syscall DSO: Files. (line 162) 27054 * sysinfo: DJGPP Native. (line 19) 27055 * system calls and thread breakpoints: Thread Stops. (line 36) 27056 * system, file-i/o system call: system. (line 6) 27057 * T packet: Packets. (line 259) 27058 * t packet: Packets. (line 254) 27059 * T packet reply: Stop Reply Packets. (line 22) 27060 * tabset NCHARS: TUI Commands. (line 65) 27061 * target: Target Commands. (line 49) 27062 * target abug: M68K. (line 9) 27063 * target architecture: Targets. (line 17) 27064 * target array: MIPS Embedded. (line 49) 27065 * target byte order: Byte Order. (line 6) 27066 * target character set: Character Sets. (line 6) 27067 * target cpu32bug: M68K. (line 12) 27068 * target dbug: M68K. (line 15) 27069 * target ddb PORT: MIPS Embedded. (line 41) 27070 * target debugging info: Debugging Output. (line 111) 27071 * target dink32: PowerPC. (line 6) 27072 * target e7000, with H8/300: H8/300. (line 11) 27073 * target e7000, with Renesas ICE: Renesas ICE. (line 6) 27074 * target e7000, with Renesas SH: SH. (line 11) 27075 * target est: M68K. (line 18) 27076 * target hms, and serial protocol: Renesas Boards. (line 48) 27077 * target hms, with H8/300: H8/300. (line 6) 27078 * target hms, with Renesas SH: SH. (line 6) 27079 * target jtag: OpenRISC 1000. (line 9) 27080 * target lsi PORT: MIPS Embedded. (line 44) 27081 * target m32r: M32R/D. (line 6) 27082 * target m32rsdi: M32R/D. (line 9) 27083 * target mips PORT: MIPS Embedded. (line 14) 27084 * target op50n: PA. (line 6) 27085 * target output in GDB/MI: GDB/MI Output Syntax. 27086 (line 108) 27087 * target pmon PORT: MIPS Embedded. (line 38) 27088 * target ppcbug: PowerPC. (line 9) 27089 * target ppcbug1: PowerPC. (line 10) 27090 * target r3900: MIPS Embedded. (line 46) 27091 * target rdi: ARM. (line 6) 27092 * target rdp: ARM. (line 11) 27093 * target remote: Connecting. (line 11) 27094 * target rom68k: M68K. (line 21) 27095 * target rombug: M68K. (line 25) 27096 * target sds: PowerPC. (line 14) 27097 * target sh3, with H8/300: H8/300. (line 14) 27098 * target sh3, with SH: SH. (line 14) 27099 * target sh3e, with H8/300: H8/300. (line 14) 27100 * target sh3e, with SH: SH. (line 14) 27101 * target sim, with Z8000: Z8000. (line 15) 27102 * target sparclite: Sparclite. (line 6) 27103 * target vxworks: VxWorks. (line 6) 27104 * target w89k: PA. (line 9) 27105 * task attributes (GNU Hurd): Hurd Native. (line 49) 27106 * task exception port, GNU Hurd: Hurd Native. (line 68) 27107 * task suspend count: Hurd Native. (line 60) 27108 * tbreak: Set Breaks. (line 74) 27109 * TCP port, target remote: Connecting. (line 29) 27110 * tdump: tdump. (line 6) 27111 * terminal: Input/Output. (line 6) 27112 * Text User Interface: TUI. (line 6) 27113 * tfind: tfind. (line 6) 27114 * thbreak: Set Breaks. (line 101) 27115 * this, inside C++ member functions: C plus plus expressions. 27116 (line 22) 27117 * thread apply: Threads. (line 143) 27118 * thread attributes info, remote request: General Query Packets. 27119 (line 328) 27120 * thread breakpoints: Thread Stops. (line 10) 27121 * thread breakpoints and system calls: Thread Stops. (line 36) 27122 * thread default settings, GNU Hurd: Hurd Native. (line 131) 27123 * thread identifier (GDB): Threads. (line 56) 27124 * thread identifier (GDB), on HP-UX: Threads. (line 82) 27125 * thread identifier (system): Threads. (line 44) 27126 * thread identifier (system), on HP-UX: Threads. (line 86) 27127 * thread info (Solaris): Threads. (line 126) 27128 * thread information, remote request: General Query Packets. 27129 (line 148) 27130 * thread number: Threads. (line 56) 27131 * thread properties, GNU Hurd: Hurd Native. (line 91) 27132 * thread suspend count, GNU Hurd: Hurd Native. (line 110) 27133 * thread THREADNO: Threads. (line 128) 27134 * threads and watchpoints: Set Watchpoints. (line 143) 27135 * threads of execution: Threads. (line 6) 27136 * threads, automatic switching: Threads. (line 152) 27137 * threads, continuing: Thread Stops. (line 69) 27138 * threads, stopped: Thread Stops. (line 31) 27139 * time of command execution: Maintenance Commands. 27140 (line 225) 27141 * timeout for commands: Maintenance Commands. 27142 (line 245) 27143 * timeout for serial communications: Remote configuration. 27144 (line 68) 27145 * timeout, MIPS protocol: MIPS Embedded. (line 83) 27146 * tload, M32R: M32R/D. (line 39) 27147 * trace: Create and Delete Tracepoints. 27148 (line 6) 27149 * trace experiment, status of: Starting and Stopping Trace Experiment. 27150 (line 20) 27151 * traceback: Backtrace. (line 6) 27152 * tracepoint actions: Tracepoint Actions. (line 6) 27153 * tracepoint data, display: tdump. (line 6) 27154 * tracepoint deletion: Create and Delete Tracepoints. 27155 (line 34) 27156 * tracepoint number: Create and Delete Tracepoints. 27157 (line 31) 27158 * tracepoint packets: Tracepoint Packets. (line 6) 27159 * tracepoint pass count: Tracepoint Passcounts. 27160 (line 6) 27161 * tracepoint variables: Tracepoint Variables. 27162 (line 6) 27163 * tracepoints: Tracepoints. (line 6) 27164 * trailing underscore, in Fortran symbols: Fortran. (line 9) 27165 * translating between character sets: Character Sets. (line 6) 27166 * transpose-chars (C-t): Commands For Text. (line 30) 27167 * transpose-words (M-t): Commands For Text. (line 36) 27168 * tstart: Starting and Stopping Trace Experiment. 27169 (line 6) 27170 * tstatus: Starting and Stopping Trace Experiment. 27171 (line 20) 27172 * tstop: Starting and Stopping Trace Experiment. 27173 (line 12) 27174 * tty: Input/Output. (line 23) 27175 * TUI: TUI. (line 6) 27176 * TUI commands: TUI Commands. (line 6) 27177 * TUI configuration variables: TUI Configuration. (line 6) 27178 * TUI key bindings: TUI Keys. (line 6) 27179 * tui reg: TUI Commands. (line 42) 27180 * TUI single key mode: TUI Single Key Mode. (line 6) 27181 * type casting memory: Expressions. (line 42) 27182 * type chain of a data type: Maintenance Commands. 27183 (line 174) 27184 * type checking: Checks. (line 31) 27185 * type conversions in C++: C plus plus expressions. 27186 (line 27) 27187 * u (SingleKey TUI key): TUI Single Key Mode. (line 31) 27188 * u (until): Continuing and Stepping. 27189 (line 117) 27190 * UDP port, target remote: Connecting. (line 49) 27191 * undisplay: Auto Display. (line 46) 27192 * undo (C-_ or C-x C-u): Miscellaneous Commands. 27193 (line 22) 27194 * unions in structures, printing: Print Settings. (line 195) 27195 * universal-argument (): Numeric Arguments. (line 10) 27196 * unix-filename-rubout (): Commands For Killing. 27197 (line 32) 27198 * unix-line-discard (C-u): Commands For Killing. 27199 (line 12) 27200 * unix-word-rubout (C-w): Commands For Killing. 27201 (line 28) 27202 * unknown address, locating: Output Formats. (line 35) 27203 * unlink, file-i/o system call: unlink. (line 6) 27204 * unlinked object files: Files. (line 26) 27205 * unload symbols from shared libraries: Files. (line 336) 27206 * unmap an overlay: Overlay Commands. (line 39) 27207 * unmapped overlays: How Overlays Work. (line 6) 27208 * unset environment: Environment. (line 55) 27209 * unset substitute-path: Source Path. (line 143) 27210 * unsupported languages: Unsupported languages. 27211 (line 6) 27212 * until: Continuing and Stepping. 27213 (line 117) 27214 * unwind stack in called functions: Calling. (line 26) 27215 * Up: TUI Keys. (line 57) 27216 * up: Selection. (line 35) 27217 * up-silently: Selection. (line 64) 27218 * upcase-word (M-u): Commands For Text. (line 41) 27219 * update: TUI Commands. (line 57) 27220 * upload, M32R: M32R/D. (line 34) 27221 * use only software watchpoints: Set Watchpoints. (line 60) 27222 * use_dbt_break: M32R/D. (line 64) 27223 * use_debug_dma: M32R/D. (line 53) 27224 * use_ib_break: M32R/D. (line 61) 27225 * use_mon_code: M32R/D. (line 57) 27226 * user-defined command: Define. (line 6) 27227 * user-defined macros: Macros. (line 54) 27228 * user-defined variables: Convenience Vars. (line 6) 27229 * v (SingleKey TUI key): TUI Single Key Mode. (line 34) 27230 * value history: Value History. (line 6) 27231 * value optimized out, in backtrace: Backtrace. (line 65) 27232 * variable name conflict: Variables. (line 36) 27233 * variable object debugging info: Debugging Output. (line 122) 27234 * variable objects in GDB/MI: GDB/MI Variable Objects. 27235 (line 41) 27236 * variable values, wrong: Variables. (line 58) 27237 * variables, readline: Readline Init File Syntax. 27238 (line 34) 27239 * variables, setting: Assignment. (line 16) 27240 * vCont packet: Packets. (line 273) 27241 * vCont? packet: Packets. (line 299) 27242 * vector unit: Vector Unit. (line 6) 27243 * vector, auxiliary: OS Information. (line 21) 27244 * verbose operation: Messages/Warnings. (line 6) 27245 * verify remote memory image: Memory. (line 101) 27246 * vFlashDone packet: Packets. (line 349) 27247 * vFlashErase packet: Packets. (line 310) 27248 * vFlashWrite packet: Packets. (line 327) 27249 * virtual functions (C++) display: Print Settings. (line 323) 27250 * visible-stats: Readline Init File Syntax. 27251 (line 179) 27252 * VTBL display: Print Settings. (line 323) 27253 * VxWorks: VxWorks. (line 6) 27254 * vxworks-timeout: VxWorks. (line 23) 27255 * w (SingleKey TUI key): TUI Single Key Mode. (line 37) 27256 * watch: Set Watchpoints. (line 33) 27257 * watchdog timer: Maintenance Commands. 27258 (line 245) 27259 * watchpoint annotation: Annotations for Running. 27260 (line 50) 27261 * watchpoints: Breakpoints. (line 20) 27262 * watchpoints and threads: Set Watchpoints. (line 143) 27263 * weak alias functions: Calling. (line 36) 27264 * whatis: Symbols. (line 66) 27265 * where: Backtrace. (line 34) 27266 * where to look for shared libraries: Files. (line 361) 27267 * while: Command Files. (line 67) 27268 * while-stepping (tracepoints): Tracepoint Actions. (line 67) 27269 * wild pointer, interpreting: Print Settings. (line 79) 27270 * Windows CE: WinCE. (line 6) 27271 * winheight: TUI Commands. (line 61) 27272 * word completion: Completion. (line 6) 27273 * working directory: Source Path. (line 99) 27274 * working directory (of your program): Working Directory. (line 6) 27275 * working language: Languages. (line 13) 27276 * write data into object, remote request: General Query Packets. 27277 (line 410) 27278 * write, file-i/o system call: write. (line 6) 27279 * writing into corefiles: Patching. (line 6) 27280 * writing into executables: Patching. (line 6) 27281 * wrong values: Variables. (line 58) 27282 * x (examine memory): Memory. (line 9) 27283 * x command, default address: Machine Code. (line 30) 27284 * X packet: Packets. (line 357) 27285 * x(examine), and info line: Machine Code. (line 30) 27286 * x86 hardware debug registers: Maintenance Commands. 27287 (line 211) 27288 * yank (C-y): Commands For Killing. 27289 (line 59) 27290 * yank-last-arg (M-. or M-_): Commands For History. 27291 (line 64) 27292 * yank-nth-arg (M-C-y): Commands For History. 27293 (line 55) 27294 * yank-pop (M-y): Commands For Killing. 27295 (line 62) 27296 * yanking text: Readline Killing Commands. 27297 (line 6) 27298 * z packet: Packets. (line 370) 27299 * Z packets: Packets. (line 370) 27300 * Z0 packet: Packets. (line 385) 27301 * z0 packet: Packets. (line 385) 27302 * Z1 packet: Packets. (line 411) 27303 * z1 packet: Packets. (line 411) 27304 * Z2 packet: Packets. (line 432) 27305 * z2 packet: Packets. (line 432) 27306 * Z3 packet: Packets. (line 446) 27307 * z3 packet: Packets. (line 446) 27308 * Z4 packet: Packets. (line 460) 27309 * z4 packet: Packets. (line 460) 27310 * Z8000: Z8000. (line 6) 27311 * Zilog Z8000 simulator: Z8000. (line 6) 27312 * {TYPE}: Expressions. (line 42) 27313 27314 27315 27316 Tag Table: 27317 Node: Top1199 27318 Node: Summary3625 27319 Node: Free Software5261 27320 Node: Contributors10829 27321 Node: Sample Session18813 27322 Node: Invocation25649 27323 Node: Invoking GDB26193 27324 Node: File Options28506 27325 Node: Mode Options31266 27326 Node: Startup37678 27327 Ref: Startup-Footnote-140133 27328 Node: Quitting GDB40242 27329 Node: Shell Commands41139 27330 Node: Logging output41981 27331 Node: Commands42827 27332 Node: Command Syntax43465 27333 Node: Completion45631 27334 Node: Help49966 27335 Node: Running55196 27336 Node: Compilation56378 27337 Node: Starting59017 27338 Node: Arguments63906 27339 Node: Environment65176 27340 Node: Working Directory68444 27341 Node: Input/Output69552 27342 Node: Attach71523 27343 Node: Kill Process73959 27344 Node: Threads74925 27345 Node: Processes81069 27346 Node: Checkpoint/Restart86120 27347 Ref: Checkpoint/Restart-Footnote-190653 27348 Node: Stopping90688 27349 Node: Breakpoints91835 27350 Node: Set Breaks95253 27351 Node: Set Watchpoints106972 27352 Node: Set Catchpoints114810 27353 Node: Delete Breaks118288 27354 Node: Disabling120005 27355 Node: Conditions122772 27356 Node: Break Commands127720 27357 Node: Breakpoint Menus130605 27358 Node: Error in Breakpoints132337 27359 Node: Breakpoint related warnings133915 27360 Node: Continuing and Stepping136242 27361 Node: Signals145582 27362 Node: Thread Stops149854 27363 Node: Stack154459 27364 Node: Frames155934 27365 Node: Backtrace158686 27366 Ref: Backtrace-Footnote-1163576 27367 Node: Selection163764 27368 Node: Frame Info166628 27369 Node: Source168959 27370 Node: List169963 27371 Node: Edit173492 27372 Ref: Edit-Footnote-1175223 27373 Node: Search175458 27374 Node: Source Path176266 27375 Ref: set substitute-path182020 27376 Node: Machine Code184241 27377 Node: Data187651 27378 Node: Expressions190032 27379 Node: Variables192000 27380 Node: Arrays195986 27381 Node: Output Formats198515 27382 Ref: Output Formats-Footnote-1200737 27383 Node: Memory200894 27384 Node: Auto Display205930 27385 Node: Print Settings209702 27386 Node: Value History221488 27387 Node: Convenience Vars223904 27388 Node: Registers227428 27389 Ref: Registers-Footnote-1232103 27390 Node: Floating Point Hardware232498 27391 Node: Vector Unit233028 27392 Node: OS Information233413 27393 Node: Memory Region Attributes235411 27394 Node: Dump/Restore Files239227 27395 Node: Core File Generation241530 27396 Node: Character Sets242762 27397 Node: Caching Remote Data249594 27398 Node: Macros250732 27399 Node: Tracepoints257683 27400 Node: Set Tracepoints259525 27401 Node: Create and Delete Tracepoints260724 27402 Node: Enable and Disable Tracepoints262368 27403 Node: Tracepoint Passcounts263067 27404 Node: Tracepoint Actions264491 27405 Node: Listing Tracepoints267491 27406 Node: Starting and Stopping Trace Experiment268612 27407 Node: Analyze Collected Data269790 27408 Node: tfind271095 27409 Node: tdump275488 27410 Node: save-tracepoints277147 27411 Node: Tracepoint Variables277566 27412 Node: Overlays278581 27413 Node: How Overlays Work279301 27414 Ref: A code overlay281861 27415 Node: Overlay Commands285299 27416 Node: Automatic Overlay Debugging289489 27417 Node: Overlay Sample Program291630 27418 Node: Languages293390 27419 Node: Setting294553 27420 Node: Filenames296255 27421 Node: Manually297041 27422 Node: Automatically298250 27423 Node: Show299311 27424 Node: Checks300633 27425 Node: Type Checking302023 27426 Node: Range Checking304756 27427 Node: Supported languages307157 27428 Node: C308330 27429 Node: C Operators309561 27430 Node: C Constants313942 27431 Node: C plus plus expressions316429 27432 Node: C Defaults319972 27433 Node: C Checks320655 27434 Node: Debugging C321378 27435 Node: Debugging C plus plus321898 27436 Node: Objective-C324984 27437 Node: Method Names in Commands325445 27438 Node: The Print Command with Objective-C327160 27439 Node: Fortran327811 27440 Node: Fortran Operators328536 27441 Node: Fortran Defaults329126 27442 Node: Special Fortran commands329511 27443 Node: Pascal330011 27444 Node: Modula-2330526 27445 Node: M2 Operators331501 27446 Node: Built-In Func/Proc334499 27447 Node: M2 Constants337277 27448 Node: M2 Types338878 27449 Node: M2 Defaults342151 27450 Node: Deviations342756 27451 Node: M2 Checks343857 27452 Node: M2 Scope344675 27453 Node: GDB/M2345699 27454 Node: Ada346611 27455 Node: Ada Mode Intro347410 27456 Node: Omissions from Ada349282 27457 Node: Additions to Ada353243 27458 Node: Stopping Before Main Program357141 27459 Node: Ada Glitches357673 27460 Node: Unsupported languages359651 27461 Node: Symbols360341 27462 Node: Altering373702 27463 Node: Assignment374671 27464 Node: Jumping377776 27465 Node: Signaling379933 27466 Node: Returning381064 27467 Node: Calling382266 27468 Node: Patching384159 27469 Node: GDB Files385236 27470 Node: Files385777 27471 Node: Separate Debug Files403518 27472 Node: Symbol Errors411860 27473 Node: Targets415463 27474 Node: Active Targets416992 27475 Node: Target Commands418571 27476 Node: Byte Order423811 27477 Node: Remote424803 27478 Node: Remote Debugging425913 27479 Node: Connecting426303 27480 Node: Server431171 27481 Ref: Server-Footnote-1435534 27482 Node: Remote configuration435654 27483 Ref: set remotebreak436678 27484 Ref: set remote hardware-watchpoint-limit438403 27485 Ref: set remote hardware-breakpoint-limit438403 27486 Node: remote stub440317 27487 Node: Stub Contents443214 27488 Node: Bootstrapping445325 27489 Node: Debug Session449134 27490 Node: Configurations450694 27491 Node: Native451463 27492 Node: HP-UX452057 27493 Node: BSD libkvm Interface452346 27494 Node: SVR4 Process Information453417 27495 Node: DJGPP Native456847 27496 Node: Cygwin Native463427 27497 Node: Non-debug DLL symbols466825 27498 Node: Hurd Native471375 27499 Node: Neutrino476638 27500 Node: Embedded OS477013 27501 Node: VxWorks477489 27502 Node: VxWorks Connection479706 27503 Node: VxWorks Download480640 27504 Node: VxWorks Attach482375 27505 Node: Embedded Processors482773 27506 Node: ARM484150 27507 Node: H8/300487104 27508 Node: Renesas Boards488603 27509 Node: Renesas ICE493027 27510 Node: Renesas Special494754 27511 Node: H8/500495204 27512 Node: M32R/D495579 27513 Node: M68K497284 27514 Node: MIPS Embedded497918 27515 Node: OpenRISC 1000502863 27516 Node: PowerPC505717 27517 Node: PA506381 27518 Node: SH506661 27519 Node: Sparclet507122 27520 Node: Sparclet File508594 27521 Node: Sparclet Connection509476 27522 Node: Sparclet Download509956 27523 Node: Sparclet Execution511007 27524 Node: Sparclite511600 27525 Node: ST2000511976 27526 Node: Z8000513521 27527 Node: AVR514902 27528 Node: CRIS515265 27529 Node: Super-H516243 27530 Node: WinCE516499 27531 Node: Architectures517407 27532 Node: i386517755 27533 Node: A29K518439 27534 Node: Alpha519278 27535 Node: MIPS519411 27536 Node: HPPA522723 27537 Node: Controlling GDB523229 27538 Node: Prompt523990 27539 Node: Editing524769 27540 Node: Command History525712 27541 Node: Screen Size529092 27542 Node: Numbers530797 27543 Node: ABI532774 27544 Node: Messages/Warnings535703 27545 Node: Debugging Output538196 27546 Node: Sequences542403 27547 Node: Define543005 27548 Node: Hooks546356 27549 Node: Command Files548546 27550 Node: Output552399 27551 Node: Interpreters554813 27552 Node: TUI556904 27553 Node: TUI Overview557598 27554 Node: TUI Keys560683 27555 Node: TUI Single Key Mode563184 27556 Node: TUI Commands564027 27557 Node: TUI Configuration565964 27558 Node: Emacs567442 27559 Node: GDB/MI572550 27560 Node: GDB/MI Command Syntax574341 27561 Node: GDB/MI Input Syntax574554 27562 Node: GDB/MI Output Syntax576108 27563 Node: GDB/MI Compatibility with CLI579526 27564 Node: GDB/MI Development and Front Ends580263 27565 Node: GDB/MI Output Records582065 27566 Node: GDB/MI Result Records582347 27567 Node: GDB/MI Stream Records583074 27568 Node: GDB/MI Out-of-band Records584345 27569 Node: GDB/MI Simple Examples585782 27570 Node: GDB/MI Command Description Format587595 27571 Node: GDB/MI Breakpoint Commands588475 27572 Node: GDB/MI Program Context604844 27573 Node: GDB/MI Thread Commands609326 27574 Node: GDB/MI Program Execution611402 27575 Node: GDB/MI Stack Manipulation620011 27576 Node: GDB/MI Variable Objects629645 27577 Ref: -var-list-children635409 27578 Node: GDB/MI Data Manipulation638642 27579 Node: GDB/MI Tracepoint Commands653008 27580 Node: GDB/MI Symbol Query653252 27581 Node: GDB/MI File Commands656540 27582 Node: GDB/MI Target Manipulation660646 27583 Node: GDB/MI Miscellaneous Commands667825 27584 Ref: -interpreter-exec669957 27585 Node: Annotations671179 27586 Node: Annotations Overview672019 27587 Node: Prompting674477 27588 Node: Errors676001 27589 Node: Invalidation676897 27590 Node: Annotations for Running677374 27591 Node: Source Annotations678894 27592 Node: GDB Bugs679819 27593 Node: Bug Criteria680545 27594 Node: Bug Reporting681422 27595 Node: Command Line Editing689044 27596 Node: Introduction and Notation689712 27597 Node: Readline Interaction691332 27598 Node: Readline Bare Essentials692521 27599 Node: Readline Movement Commands694308 27600 Node: Readline Killing Commands695271 27601 Node: Readline Arguments697189 27602 Node: Searching698231 27603 Node: Readline Init File700380 27604 Node: Readline Init File Syntax701443 27605 Node: Conditional Init Constructs713375 27606 Node: Sample Init File715906 27607 Node: Bindable Readline Commands719021 27608 Node: Commands For Moving720076 27609 Node: Commands For History720935 27610 Node: Commands For Text724057 27611 Node: Commands For Killing726781 27612 Node: Numeric Arguments728921 27613 Node: Commands For Completion730058 27614 Node: Keyboard Macros731600 27615 Node: Miscellaneous Commands732169 27616 Node: Readline vi Mode735528 27617 Node: Using History Interactively736445 27618 Node: History Interaction736950 27619 Node: Event Designators738372 27620 Node: Word Designators739305 27621 Node: Modifiers740942 27622 Node: Formatting Documentation742167 27623 Ref: Formatting Documentation-Footnote-1745487 27624 Node: Installing GDB745551 27625 Node: Requirements746063 27626 Node: Running Configure747144 27627 Node: Separate Objdir750683 27628 Node: Config Names753567 27629 Node: Configure Options755012 27630 Node: Maintenance Commands757349 27631 Ref: maint info breakpoints758008 27632 Node: Remote Protocol767516 27633 Node: Overview767923 27634 Ref: Binary Data770109 27635 Node: Packets771915 27636 Ref: read registers packet775521 27637 Ref: cycle step packet776674 27638 Ref: write register packet778550 27639 Ref: step with signal packet779428 27640 Ref: X packet783099 27641 Ref: insert breakpoint or watchpoint packet783389 27642 Node: Stop Reply Packets785835 27643 Node: General Query Packets788894 27644 Ref: qSupported795880 27645 Ref: qXfer read803384 27646 Ref: qXfer auxiliary vector read803882 27647 Ref: qXfer memory map read804227 27648 Ref: General Query Packets-Footnote-1807029 27649 Node: Register Packet Format807356 27650 Node: Tracepoint Packets808274 27651 Node: Interrupts814363 27652 Node: Examples815826 27653 Node: File-I/O remote protocol extension816439 27654 Node: File-I/O Overview816897 27655 Node: Protocol basics819044 27656 Node: The F request packet821274 27657 Node: The F reply packet822173 27658 Node: The Ctrl-C message823089 27659 Node: Console I/O824716 27660 Node: List of supported calls825932 27661 Node: open826292 27662 Node: close828786 27663 Node: read829168 27664 Node: write829775 27665 Node: lseek830542 27666 Node: rename831420 27667 Node: unlink832816 27668 Node: stat/fstat833755 27669 Node: gettimeofday834642 27670 Node: isatty835077 27671 Node: system835673 27672 Node: Protocol specific representation of datatypes837215 27673 Node: Integral datatypes837590 27674 Node: Pointer values838397 27675 Node: Memory transfer839105 27676 Node: struct stat839725 27677 Node: struct timeval841927 27678 Node: Constants842444 27679 Node: Open flags842891 27680 Node: mode_t values843232 27681 Node: Errno values843724 27682 Node: Lseek flags844535 27683 Node: Limits844720 27684 Node: File-I/O Examples845080 27685 Node: Memory map format846194 27686 Node: Agent Expressions848649 27687 Node: General Bytecode Design851570 27688 Node: Bytecode Descriptions856370 27689 Node: Using Agent Expressions867056 27690 Node: Varying Target Capabilities868589 27691 Node: Tracing on Symmetrix869762 27692 Node: Rationale875584 27693 Node: Copying882963 27694 Node: GNU Free Documentation License902179 27695 Node: Index924614 27696 27697 End Tag Table 27698