OLD | NEW |
1 This is gdb.info, produced by makeinfo version 4.8 from ./gdb.texinfo. | 1 This is gdb.info, produced by makeinfo version 4.8 from ./gdb.texinfo. |
2 | 2 |
3 INFO-DIR-SECTION Software development | 3 INFO-DIR-SECTION Software development |
4 START-INFO-DIR-ENTRY | 4 START-INFO-DIR-ENTRY |
5 * Gdb: (gdb). The GNU debugger. | 5 * Gdb: (gdb). The GNU debugger. |
6 END-INFO-DIR-ENTRY | 6 END-INFO-DIR-ENTRY |
7 | 7 |
8 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, | 8 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, |
9 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | 9 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, |
10 2010 Free Software Foundation, Inc. | 10 2010 2011, 2012 Free Software Foundation, Inc. |
11 | 11 |
12 Permission is granted to copy, distribute and/or modify this document | 12 Permission is granted to copy, distribute and/or modify this document |
13 under the terms of the GNU Free Documentation License, Version 1.3 or | 13 under the terms of the GNU Free Documentation License, Version 1.3 or |
14 any later version published by the Free Software Foundation; with the | 14 any later version published by the Free Software Foundation; with the |
15 Invariant Sections being "Free Software" and "Free Software Needs Free | 15 Invariant Sections being "Free Software" and "Free Software Needs Free |
16 Documentation", with the Front-Cover Texts being "A GNU Manual," and | 16 Documentation", with the Front-Cover Texts being "A GNU Manual," and |
17 with the Back-Cover Texts as in (a) below. | 17 with the Back-Cover Texts as in (a) below. |
18 | 18 |
19 (a) The FSF's Back-Cover Text is: "You are free to copy and modify | 19 (a) The FSF's Back-Cover Text is: "You are free to copy and modify |
20 this GNU Manual. Buying copies from GNU Press supports the FSF in | 20 this GNU Manual. Buying copies from GNU Press supports the FSF in |
21 developing GNU and promoting software freedom." | 21 developing GNU and promoting software freedom." |
22 | 22 |
23 This file documents the GNU debugger GDB. | 23 This file documents the GNU debugger GDB. |
24 | 24 |
25 This is the Tenth Edition, of `Debugging with GDB: the GNU | 25 This is the Tenth Edition, of `Debugging with GDB: the GNU |
26 Source-Level Debugger' for GDB (GDB) Version 7.4.1. | 26 Source-Level Debugger' for GDB (GDB) Version 7.5.1. |
27 | 27 |
28 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, | 28 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, |
29 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | 29 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, |
30 2010 Free Software Foundation, Inc. | 30 2010 2011, 2012 Free Software Foundation, Inc. |
31 | 31 |
32 Permission is granted to copy, distribute and/or modify this document | 32 Permission is granted to copy, distribute and/or modify this document |
33 under the terms of the GNU Free Documentation License, Version 1.3 or | 33 under the terms of the GNU Free Documentation License, Version 1.3 or |
34 any later version published by the Free Software Foundation; with the | 34 any later version published by the Free Software Foundation; with the |
35 Invariant Sections being "Free Software" and "Free Software Needs Free | 35 Invariant Sections being "Free Software" and "Free Software Needs Free |
36 Documentation", with the Front-Cover Texts being "A GNU Manual," and | 36 Documentation", with the Front-Cover Texts being "A GNU Manual," and |
37 with the Back-Cover Texts as in (a) below. | 37 with the Back-Cover Texts as in (a) below. |
38 | 38 |
39 (a) The FSF's Back-Cover Text is: "You are free to copy and modify | 39 (a) The FSF's Back-Cover Text is: "You are free to copy and modify |
40 this GNU Manual. Buying copies from GNU Press supports the FSF in | 40 this GNU Manual. Buying copies from GNU Press supports the FSF in |
41 developing GNU and promoting software freedom." | 41 developing GNU and promoting software freedom." |
42 | 42 |
43 | 43 |
| 44 File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up:
Data |
| 45 |
| 46 10.7 Automatic Display |
| 47 ====================== |
| 48 |
| 49 If you find that you want to print the value of an expression frequently |
| 50 (to see how it changes), you might want to add it to the "automatic |
| 51 display list" so that GDB prints its value each time your program stops. |
| 52 Each expression added to the list is given a number to identify it; to |
| 53 remove an expression from the list, you specify that number. The |
| 54 automatic display looks like this: |
| 55 |
| 56 2: foo = 38 |
| 57 3: bar[5] = (struct hack *) 0x3804 |
| 58 |
| 59 This display shows item numbers, expressions and their current values. |
| 60 As with displays you request manually using `x' or `print', you can |
| 61 specify the output format you prefer; in fact, `display' decides |
| 62 whether to use `print' or `x' depending your format specification--it |
| 63 uses `x' if you specify either the `i' or `s' format, or a unit size; |
| 64 otherwise it uses `print'. |
| 65 |
| 66 `display EXPR' |
| 67 Add the expression EXPR to the list of expressions to display each |
| 68 time your program stops. *Note Expressions: Expressions. |
| 69 |
| 70 `display' does not repeat if you press <RET> again after using it. |
| 71 |
| 72 `display/FMT EXPR' |
| 73 For FMT specifying only a display format and not a size or count, |
| 74 add the expression EXPR to the auto-display list but arrange to |
| 75 display it each time in the specified format FMT. *Note Output |
| 76 Formats: Output Formats. |
| 77 |
| 78 `display/FMT ADDR' |
| 79 For FMT `i' or `s', or including a unit-size or a number of units, |
| 80 add the expression ADDR as a memory address to be examined each |
| 81 time your program stops. Examining means in effect doing `x/FMT |
| 82 ADDR'. *Note Examining Memory: Memory. |
| 83 |
| 84 For example, `display/i $pc' can be helpful, to see the machine |
| 85 instruction about to be executed each time execution stops (`$pc' is a |
| 86 common name for the program counter; *note Registers: Registers.). |
| 87 |
| 88 `undisplay DNUMS...' |
| 89 `delete display DNUMS...' |
| 90 Remove items from the list of expressions to display. Specify the |
| 91 numbers of the displays that you want affected with the command |
| 92 argument DNUMS. It can be a single display number, one of the |
| 93 numbers shown in the first field of the `info display' display; or |
| 94 it could be a range of display numbers, as in `2-4'. |
| 95 |
| 96 `undisplay' does not repeat if you press <RET> after using it. |
| 97 (Otherwise you would just get the error `No display number ...'.) |
| 98 |
| 99 `disable display DNUMS...' |
| 100 Disable the display of item numbers DNUMS. A disabled display |
| 101 item is not printed automatically, but is not forgotten. It may be |
| 102 enabled again later. Specify the numbers of the displays that you |
| 103 want affected with the command argument DNUMS. It can be a single |
| 104 display number, one of the numbers shown in the first field of the |
| 105 `info display' display; or it could be a range of display numbers, |
| 106 as in `2-4'. |
| 107 |
| 108 `enable display DNUMS...' |
| 109 Enable display of item numbers DNUMS. It becomes effective once |
| 110 again in auto display of its expression, until you specify |
| 111 otherwise. Specify the numbers of the displays that you want |
| 112 affected with the command argument DNUMS. It can be a single |
| 113 display number, one of the numbers shown in the first field of the |
| 114 `info display' display; or it could be a range of display numbers, |
| 115 as in `2-4'. |
| 116 |
| 117 `display' |
| 118 Display the current values of the expressions on the list, just as |
| 119 is done when your program stops. |
| 120 |
| 121 `info display' |
| 122 Print the list of expressions previously set up to display |
| 123 automatically, each one with its item number, but without showing |
| 124 the values. This includes disabled expressions, which are marked |
| 125 as such. It also includes expressions which would not be |
| 126 displayed right now because they refer to automatic variables not |
| 127 currently available. |
| 128 |
| 129 If a display expression refers to local variables, then it does not |
| 130 make sense outside the lexical context for which it was set up. Such an |
| 131 expression is disabled when execution enters a context where one of its |
| 132 variables is not defined. For example, if you give the command |
| 133 `display last_char' while inside a function with an argument |
| 134 `last_char', GDB displays this argument while your program continues to |
| 135 stop inside that function. When it stops elsewhere--where there is no |
| 136 variable `last_char'--the display is disabled automatically. The next |
| 137 time your program stops where `last_char' is meaningful, you can enable |
| 138 the display expression once again. |
| 139 |
| 140 |
| 141 File: gdb.info, Node: Print Settings, Next: Pretty Printing, Prev: Auto Displ
ay, Up: Data |
| 142 |
| 143 10.8 Print Settings |
| 144 =================== |
| 145 |
| 146 GDB provides the following ways to control how arrays, structures, and |
| 147 symbols are printed. |
| 148 |
| 149 These settings are useful for debugging programs in any language: |
| 150 |
| 151 `set print address' |
| 152 `set print address on' |
| 153 GDB prints memory addresses showing the location of stack traces, |
| 154 structure values, pointer values, breakpoints, and so forth, even |
| 155 when it also displays the contents of those addresses. The default |
| 156 is `on'. For example, this is what a stack frame display looks |
| 157 like with `set print address on': |
| 158 |
| 159 (gdb) f |
| 160 #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>") |
| 161 at input.c:530 |
| 162 530 if (lquote != def_lquote) |
| 163 |
| 164 `set print address off' |
| 165 Do not print addresses when displaying their contents. For |
| 166 example, this is the same stack frame displayed with `set print |
| 167 address off': |
| 168 |
| 169 (gdb) set print addr off |
| 170 (gdb) f |
| 171 #0 set_quotes (lq="<<", rq=">>") at input.c:530 |
| 172 530 if (lquote != def_lquote) |
| 173 |
| 174 You can use `set print address off' to eliminate all machine |
| 175 dependent displays from the GDB interface. For example, with |
| 176 `print address off', you should get the same text for backtraces on |
| 177 all machines--whether or not they involve pointer arguments. |
| 178 |
| 179 `show print address' |
| 180 Show whether or not addresses are to be printed. |
| 181 |
| 182 When GDB prints a symbolic address, it normally prints the closest |
| 183 earlier symbol plus an offset. If that symbol does not uniquely |
| 184 identify the address (for example, it is a name whose scope is a single |
| 185 source file), you may need to clarify. One way to do this is with |
| 186 `info line', for example `info line *0x4537'. Alternately, you can set |
| 187 GDB to print the source file and line number when it prints a symbolic |
| 188 address: |
| 189 |
| 190 `set print symbol-filename on' |
| 191 Tell GDB to print the source file name and line number of a symbol |
| 192 in the symbolic form of an address. |
| 193 |
| 194 `set print symbol-filename off' |
| 195 Do not print source file name and line number of a symbol. This |
| 196 is the default. |
| 197 |
| 198 `show print symbol-filename' |
| 199 Show whether or not GDB will print the source file name and line |
| 200 number of a symbol in the symbolic form of an address. |
| 201 |
| 202 Another situation where it is helpful to show symbol filenames and |
| 203 line numbers is when disassembling code; GDB shows you the line number |
| 204 and source file that corresponds to each instruction. |
| 205 |
| 206 Also, you may wish to see the symbolic form only if the address being |
| 207 printed is reasonably close to the closest earlier symbol: |
| 208 |
| 209 `set print max-symbolic-offset MAX-OFFSET' |
| 210 Tell GDB to only display the symbolic form of an address if the |
| 211 offset between the closest earlier symbol and the address is less |
| 212 than MAX-OFFSET. The default is 0, which tells GDB to always |
| 213 print the symbolic form of an address if any symbol precedes it. |
| 214 |
| 215 `show print max-symbolic-offset' |
| 216 Ask how large the maximum offset is that GDB prints in a symbolic |
| 217 address. |
| 218 |
| 219 If you have a pointer and you are not sure where it points, try `set |
| 220 print symbol-filename on'. Then you can determine the name and source |
| 221 file location of the variable where it points, using `p/a POINTER'. |
| 222 This interprets the address in symbolic form. For example, here GDB |
| 223 shows that a variable `ptt' points at another variable `t', defined in |
| 224 `hi2.c': |
| 225 |
| 226 (gdb) set print symbol-filename on |
| 227 (gdb) p/a ptt |
| 228 $4 = 0xe008 <t in hi2.c> |
| 229 |
| 230 _Warning:_ For pointers that point to a local variable, `p/a' does |
| 231 not show the symbol name and filename of the referent, even with |
| 232 the appropriate `set print' options turned on. |
| 233 |
| 234 You can also enable `/a'-like formatting all the time using `set |
| 235 print symbol on': |
| 236 |
| 237 `set print symbol on' |
| 238 Tell GDB to print the symbol corresponding to an address, if one |
| 239 exists. |
| 240 |
| 241 `set print symbol off' |
| 242 Tell GDB not to print the symbol corresponding to an address. In |
| 243 this mode, GDB will still print the symbol corresponding to |
| 244 pointers to functions. This is the default. |
| 245 |
| 246 `show print symbol' |
| 247 Show whether GDB will display the symbol corresponding to an |
| 248 address. |
| 249 |
| 250 Other settings control how different kinds of objects are printed: |
| 251 |
| 252 `set print array' |
| 253 `set print array on' |
| 254 Pretty print arrays. This format is more convenient to read, but |
| 255 uses more space. The default is off. |
| 256 |
| 257 `set print array off' |
| 258 Return to compressed format for arrays. |
| 259 |
| 260 `show print array' |
| 261 Show whether compressed or pretty format is selected for displaying |
| 262 arrays. |
| 263 |
| 264 `set print array-indexes' |
| 265 `set print array-indexes on' |
| 266 Print the index of each element when displaying arrays. May be |
| 267 more convenient to locate a given element in the array or quickly |
| 268 find the index of a given element in that printed array. The |
| 269 default is off. |
| 270 |
| 271 `set print array-indexes off' |
| 272 Stop printing element indexes when displaying arrays. |
| 273 |
| 274 `show print array-indexes' |
| 275 Show whether the index of each element is printed when displaying |
| 276 arrays. |
| 277 |
| 278 `set print elements NUMBER-OF-ELEMENTS' |
| 279 Set a limit on how many elements of an array GDB will print. If |
| 280 GDB is printing a large array, it stops printing after it has |
| 281 printed the number of elements set by the `set print elements' |
| 282 command. This limit also applies to the display of strings. When |
| 283 GDB starts, this limit is set to 200. Setting NUMBER-OF-ELEMENTS |
| 284 to zero means that the printing is unlimited. |
| 285 |
| 286 `show print elements' |
| 287 Display the number of elements of a large array that GDB will |
| 288 print. If the number is 0, then the printing is unlimited. |
| 289 |
| 290 `set print frame-arguments VALUE' |
| 291 This command allows to control how the values of arguments are |
| 292 printed when the debugger prints a frame (*note Frames::). The |
| 293 possible values are: |
| 294 |
| 295 `all' |
| 296 The values of all arguments are printed. |
| 297 |
| 298 `scalars' |
| 299 Print the value of an argument only if it is a scalar. The |
| 300 value of more complex arguments such as arrays, structures, |
| 301 unions, etc, is replaced by `...'. This is the default. |
| 302 Here is an example where only scalar arguments are shown: |
| 303 |
| 304 #1 0x08048361 in call_me (i=3, s=..., ss=0xbf8d508c, u=..., e=gr
een) |
| 305 at frame-args.c:23 |
| 306 |
| 307 `none' |
| 308 None of the argument values are printed. Instead, the value |
| 309 of each argument is replaced by `...'. In this case, the |
| 310 example above now becomes: |
| 311 |
| 312 #1 0x08048361 in call_me (i=..., s=..., ss=..., u=..., e=...) |
| 313 at frame-args.c:23 |
| 314 |
| 315 By default, only scalar arguments are printed. This command can |
| 316 be used to configure the debugger to print the value of all |
| 317 arguments, regardless of their type. However, it is often |
| 318 advantageous to not print the value of more complex parameters. |
| 319 For instance, it reduces the amount of information printed in each |
| 320 frame, making the backtrace more readable. Also, it improves |
| 321 performance when displaying Ada frames, because the computation of |
| 322 large arguments can sometimes be CPU-intensive, especially in |
| 323 large applications. Setting `print frame-arguments' to `scalars' |
| 324 (the default) or `none' avoids this computation, thus speeding up |
| 325 the display of each Ada frame. |
| 326 |
| 327 `show print frame-arguments' |
| 328 Show how the value of arguments should be displayed when printing |
| 329 a frame. |
| 330 |
| 331 `set print entry-values VALUE' |
| 332 Set printing of frame argument values at function entry. In some |
| 333 cases GDB can determine the value of function argument which was |
| 334 passed by the function caller, even if the value was modified |
| 335 inside the called function and therefore is different. With |
| 336 optimized code, the current value could be unavailable, but the |
| 337 entry value may still be known. |
| 338 |
| 339 The default value is `default' (see below for its description). |
| 340 Older GDB behaved as with the setting `no'. Compilers not |
| 341 supporting this feature will behave in the `default' setting the |
| 342 same way as with the `no' setting. |
| 343 |
| 344 This functionality is currently supported only by DWARF 2 |
| 345 debugging format and the compiler has to produce |
| 346 `DW_TAG_GNU_call_site' tags. With GCC, you need to specify `-O |
| 347 -g' during compilation, to get this information. |
| 348 |
| 349 The VALUE parameter can be one of the following: |
| 350 |
| 351 `no' |
| 352 Print only actual parameter values, never print values from |
| 353 function entry point. |
| 354 #0 equal (val=5) |
| 355 #0 different (val=6) |
| 356 #0 lost (val=<optimized out>) |
| 357 #0 born (val=10) |
| 358 #0 invalid (val=<optimized out>) |
| 359 |
| 360 `only' |
| 361 Print only parameter values from function entry point. The |
| 362 actual parameter values are never printed. |
| 363 #0 equal (val@entry=5) |
| 364 #0 different (val@entry=5) |
| 365 #0 lost (val@entry=5) |
| 366 #0 born (val@entry=<optimized out>) |
| 367 #0 invalid (val@entry=<optimized out>) |
| 368 |
| 369 `preferred' |
| 370 Print only parameter values from function entry point. If |
| 371 value from function entry point is not known while the actual |
| 372 value is known, print the actual value for such parameter. |
| 373 #0 equal (val@entry=5) |
| 374 #0 different (val@entry=5) |
| 375 #0 lost (val@entry=5) |
| 376 #0 born (val=10) |
| 377 #0 invalid (val@entry=<optimized out>) |
| 378 |
| 379 `if-needed' |
| 380 Print actual parameter values. If actual parameter value is |
| 381 not known while value from function entry point is known, |
| 382 print the entry point value for such parameter. |
| 383 #0 equal (val=5) |
| 384 #0 different (val=6) |
| 385 #0 lost (val@entry=5) |
| 386 #0 born (val=10) |
| 387 #0 invalid (val=<optimized out>) |
| 388 |
| 389 `both' |
| 390 Always print both the actual parameter value and its value |
| 391 from function entry point, even if values of one or both are |
| 392 not available due to compiler optimizations. |
| 393 #0 equal (val=5, val@entry=5) |
| 394 #0 different (val=6, val@entry=5) |
| 395 #0 lost (val=<optimized out>, val@entry=5) |
| 396 #0 born (val=10, val@entry=<optimized out>) |
| 397 #0 invalid (val=<optimized out>, val@entry=<optimized out>) |
| 398 |
| 399 `compact' |
| 400 Print the actual parameter value if it is known and also its |
| 401 value from function entry point if it is known. If neither |
| 402 is known, print for the actual value `<optimized out>'. If |
| 403 not in MI mode (*note GDB/MI::) and if both values are known |
| 404 and identical, print the shortened `param=param@entry=VALUE' |
| 405 notation. |
| 406 #0 equal (val=val@entry=5) |
| 407 #0 different (val=6, val@entry=5) |
| 408 #0 lost (val@entry=5) |
| 409 #0 born (val=10) |
| 410 #0 invalid (val=<optimized out>) |
| 411 |
| 412 `default' |
| 413 Always print the actual parameter value. Print also its |
| 414 value from function entry point, but only if it is known. If |
| 415 not in MI mode (*note GDB/MI::) and if both values are known |
| 416 and identical, print the shortened `param=param@entry=VALUE' |
| 417 notation. |
| 418 #0 equal (val=val@entry=5) |
| 419 #0 different (val=6, val@entry=5) |
| 420 #0 lost (val=<optimized out>, val@entry=5) |
| 421 #0 born (val=10) |
| 422 #0 invalid (val=<optimized out>) |
| 423 |
| 424 For analysis messages on possible failures of frame argument |
| 425 values at function entry resolution see *Note set debug |
| 426 entry-values::. |
| 427 |
| 428 `show print entry-values' |
| 429 Show the method being used for printing of frame argument values |
| 430 at function entry. |
| 431 |
| 432 `set print repeats' |
| 433 Set the threshold for suppressing display of repeated array |
| 434 elements. When the number of consecutive identical elements of an |
| 435 array exceeds the threshold, GDB prints the string `"<repeats N |
| 436 times>"', where N is the number of identical repetitions, instead |
| 437 of displaying the identical elements themselves. Setting the |
| 438 threshold to zero will cause all elements to be individually |
| 439 printed. The default threshold is 10. |
| 440 |
| 441 `show print repeats' |
| 442 Display the current threshold for printing repeated identical |
| 443 elements. |
| 444 |
| 445 `set print null-stop' |
| 446 Cause GDB to stop printing the characters of an array when the |
| 447 first NULL is encountered. This is useful when large arrays |
| 448 actually contain only short strings. The default is off. |
| 449 |
| 450 `show print null-stop' |
| 451 Show whether GDB stops printing an array on the first NULL |
| 452 character. |
| 453 |
| 454 `set print pretty on' |
| 455 Cause GDB to print structures in an indented format with one member |
| 456 per line, like this: |
| 457 |
| 458 $1 = { |
| 459 next = 0x0, |
| 460 flags = { |
| 461 sweet = 1, |
| 462 sour = 1 |
| 463 }, |
| 464 meat = 0x54 "Pork" |
| 465 } |
| 466 |
| 467 `set print pretty off' |
| 468 Cause GDB to print structures in a compact format, like this: |
| 469 |
| 470 $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \ |
| 471 meat = 0x54 "Pork"} |
| 472 |
| 473 This is the default format. |
| 474 |
| 475 `show print pretty' |
| 476 Show which format GDB is using to print structures. |
| 477 |
| 478 `set print sevenbit-strings on' |
| 479 Print using only seven-bit characters; if this option is set, GDB |
| 480 displays any eight-bit characters (in strings or character values) |
| 481 using the notation `\'NNN. This setting is best if you are |
| 482 working in English (ASCII) and you use the high-order bit of |
| 483 characters as a marker or "meta" bit. |
| 484 |
| 485 `set print sevenbit-strings off' |
| 486 Print full eight-bit characters. This allows the use of more |
| 487 international character sets, and is the default. |
| 488 |
| 489 `show print sevenbit-strings' |
| 490 Show whether or not GDB is printing only seven-bit characters. |
| 491 |
| 492 `set print union on' |
| 493 Tell GDB to print unions which are contained in structures and |
| 494 other unions. This is the default setting. |
| 495 |
| 496 `set print union off' |
| 497 Tell GDB not to print unions which are contained in structures and |
| 498 other unions. GDB will print `"{...}"' instead. |
| 499 |
| 500 `show print union' |
| 501 Ask GDB whether or not it will print unions which are contained in |
| 502 structures and other unions. |
| 503 |
| 504 For example, given the declarations |
| 505 |
| 506 typedef enum {Tree, Bug} Species; |
| 507 typedef enum {Big_tree, Acorn, Seedling} Tree_forms; |
| 508 typedef enum {Caterpillar, Cocoon, Butterfly} |
| 509 Bug_forms; |
| 510 |
| 511 struct thing { |
| 512 Species it; |
| 513 union { |
| 514 Tree_forms tree; |
| 515 Bug_forms bug; |
| 516 } form; |
| 517 }; |
| 518 |
| 519 struct thing foo = {Tree, {Acorn}}; |
| 520 |
| 521 with `set print union on' in effect `p foo' would print |
| 522 |
| 523 $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}} |
| 524 |
| 525 and with `set print union off' in effect it would print |
| 526 |
| 527 $1 = {it = Tree, form = {...}} |
| 528 |
| 529 `set print union' affects programs written in C-like languages and |
| 530 in Pascal. |
| 531 |
| 532 These settings are of interest when debugging C++ programs: |
| 533 |
| 534 `set print demangle' |
| 535 `set print demangle on' |
| 536 Print C++ names in their source form rather than in the encoded |
| 537 ("mangled") form passed to the assembler and linker for type-safe |
| 538 linkage. The default is on. |
| 539 |
| 540 `show print demangle' |
| 541 Show whether C++ names are printed in mangled or demangled form. |
| 542 |
| 543 `set print asm-demangle' |
| 544 `set print asm-demangle on' |
| 545 Print C++ names in their source form rather than their mangled |
| 546 form, even in assembler code printouts such as instruction |
| 547 disassemblies. The default is off. |
| 548 |
| 549 `show print asm-demangle' |
| 550 Show whether C++ names in assembly listings are printed in mangled |
| 551 or demangled form. |
| 552 |
| 553 `set demangle-style STYLE' |
| 554 Choose among several encoding schemes used by different compilers |
| 555 to represent C++ names. The choices for STYLE are currently: |
| 556 |
| 557 `auto' |
| 558 Allow GDB to choose a decoding style by inspecting your |
| 559 program. |
| 560 |
| 561 `gnu' |
| 562 Decode based on the GNU C++ compiler (`g++') encoding |
| 563 algorithm. This is the default. |
| 564 |
| 565 `hp' |
| 566 Decode based on the HP ANSI C++ (`aCC') encoding algorithm. |
| 567 |
| 568 `lucid' |
| 569 Decode based on the Lucid C++ compiler (`lcc') encoding |
| 570 algorithm. |
| 571 |
| 572 `arm' |
| 573 Decode using the algorithm in the `C++ Annotated Reference |
| 574 Manual'. *Warning:* this setting alone is not sufficient to |
| 575 allow debugging `cfront'-generated executables. GDB would |
| 576 require further enhancement to permit that. |
| 577 |
| 578 If you omit STYLE, you will see a list of possible formats. |
| 579 |
| 580 `show demangle-style' |
| 581 Display the encoding style currently in use for decoding C++ |
| 582 symbols. |
| 583 |
| 584 `set print object' |
| 585 `set print object on' |
| 586 When displaying a pointer to an object, identify the _actual_ |
| 587 (derived) type of the object rather than the _declared_ type, using |
| 588 the virtual function table. Note that the virtual function table |
| 589 is required--this feature can only work for objects that have |
| 590 run-time type identification; a single virtual method in the |
| 591 object's declared type is sufficient. Note that this setting is |
| 592 also taken into account when working with variable objects via MI |
| 593 (*note GDB/MI::). |
| 594 |
| 595 `set print object off' |
| 596 Display only the declared type of objects, without reference to the |
| 597 virtual function table. This is the default setting. |
| 598 |
| 599 `show print object' |
| 600 Show whether actual, or declared, object types are displayed. |
| 601 |
| 602 `set print static-members' |
| 603 `set print static-members on' |
| 604 Print static members when displaying a C++ object. The default is |
| 605 on. |
| 606 |
| 607 `set print static-members off' |
| 608 Do not print static members when displaying a C++ object. |
| 609 |
| 610 `show print static-members' |
| 611 Show whether C++ static members are printed or not. |
| 612 |
| 613 `set print pascal_static-members' |
| 614 `set print pascal_static-members on' |
| 615 Print static members when displaying a Pascal object. The default |
| 616 is on. |
| 617 |
| 618 `set print pascal_static-members off' |
| 619 Do not print static members when displaying a Pascal object. |
| 620 |
| 621 `show print pascal_static-members' |
| 622 Show whether Pascal static members are printed or not. |
| 623 |
| 624 `set print vtbl' |
| 625 `set print vtbl on' |
| 626 Pretty print C++ virtual function tables. The default is off. |
| 627 (The `vtbl' commands do not work on programs compiled with the HP |
| 628 ANSI C++ compiler (`aCC').) |
| 629 |
| 630 `set print vtbl off' |
| 631 Do not pretty print C++ virtual function tables. |
| 632 |
| 633 `show print vtbl' |
| 634 Show whether C++ virtual function tables are pretty printed, or |
| 635 not. |
| 636 |
| 637 |
44 File: gdb.info, Node: Pretty Printing, Next: Value History, Prev: Print Setti
ngs, Up: Data | 638 File: gdb.info, Node: Pretty Printing, Next: Value History, Prev: Print Setti
ngs, Up: Data |
45 | 639 |
46 10.9 Pretty Printing | 640 10.9 Pretty Printing |
47 ==================== | 641 ==================== |
48 | 642 |
49 GDB provides a mechanism to allow pretty-printing of values using | 643 GDB provides a mechanism to allow pretty-printing of values using |
50 Python code. It greatly simplifies the display of complex objects. | 644 Python code. It greatly simplifies the display of complex objects. |
51 This mechanism works for both MI and the CLI. | 645 This mechanism works for both MI and the CLI. |
52 | 646 |
53 * Menu: | 647 * Menu: |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 938 |
345 `$__' | 939 `$__' |
346 The variable `$__' is automatically set by the `x' command to the | 940 The variable `$__' is automatically set by the `x' command to the |
347 value found in the last address examined. Its type is chosen to | 941 value found in the last address examined. Its type is chosen to |
348 match the format in which the data was printed. | 942 match the format in which the data was printed. |
349 | 943 |
350 `$_exitcode' | 944 `$_exitcode' |
351 The variable `$_exitcode' is automatically set to the exit code | 945 The variable `$_exitcode' is automatically set to the exit code |
352 when the program being debugged terminates. | 946 when the program being debugged terminates. |
353 | 947 |
| 948 `$_probe_argc' |
| 949 `$_probe_arg0...$_probe_arg11' |
| 950 Arguments to a static probe. *Note Static Probe Points::. |
| 951 |
354 `$_sdata' | 952 `$_sdata' |
355 The variable `$_sdata' contains extra collected static tracepoint | 953 The variable `$_sdata' contains extra collected static tracepoint |
356 data. *Note Tracepoint Action Lists: Tracepoint Actions. Note | 954 data. *Note Tracepoint Action Lists: Tracepoint Actions. Note |
357 that `$_sdata' could be empty, if not inspecting a trace buffer, or | 955 that `$_sdata' could be empty, if not inspecting a trace buffer, or |
358 if extra static tracepoint data has not been collected. | 956 if extra static tracepoint data has not been collected. |
359 | 957 |
360 `$_siginfo' | 958 `$_siginfo' |
361 The variable `$_siginfo' contains extra signal information (*note | 959 The variable `$_siginfo' contains extra signal information (*note |
362 extra signal information::). Note that `$_siginfo' could be | 960 extra signal information::). Note that `$_siginfo' could be |
363 empty, if the application has not yet received any signals. For | 961 empty, if the application has not yet received any signals. For |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 1159 |
562 `info auxv' | 1160 `info auxv' |
563 Display the auxiliary vector of the inferior, which can be either a | 1161 Display the auxiliary vector of the inferior, which can be either a |
564 live process or a core dump file. GDB prints each tag value | 1162 live process or a core dump file. GDB prints each tag value |
565 numerically, and also shows names and text descriptions for | 1163 numerically, and also shows names and text descriptions for |
566 recognized tags. Some values in the vector are numbers, some bit | 1164 recognized tags. Some values in the vector are numbers, some bit |
567 masks, and some pointers to strings or other data. GDB displays | 1165 masks, and some pointers to strings or other data. GDB displays |
568 each value in the most appropriate form for a recognized tag, and | 1166 each value in the most appropriate form for a recognized tag, and |
569 in hexadecimal for an unrecognized tag. | 1167 in hexadecimal for an unrecognized tag. |
570 | 1168 |
571 On some targets, GDB can access operating-system-specific information | 1169 On some targets, GDB can access operating system-specific |
572 and display it to user, without interpretation. For remote targets, | 1170 information and show it to you. The types of information available |
573 this functionality depends on the remote stub's support of the | 1171 will differ depending on the type of operating system running on the |
574 `qXfer:osdata:read' packet, see *Note qXfer osdata read::. | 1172 target. The mechanism used to fetch the data is described in *Note |
| 1173 Operating System Information::. For remote targets, this functionality |
| 1174 depends on the remote stub's support of the `qXfer:osdata:read' packet, |
| 1175 see *Note qXfer osdata read::. |
| 1176 |
| 1177 `info os INFOTYPE' |
| 1178 Display OS information of the requested type. |
| 1179 |
| 1180 On GNU/Linux, the following values of INFOTYPE are valid: |
| 1181 |
| 1182 `processes' |
| 1183 Display the list of processes on the target. For each |
| 1184 process, GDB prints the process identifier, the name of the |
| 1185 user, the command corresponding to the process, and the list |
| 1186 of processor cores that the process is currently running on. |
| 1187 (To understand what these properties mean, for this and the |
| 1188 following info types, please consult the general GNU/Linux |
| 1189 documentation.) |
| 1190 |
| 1191 `procgroups' |
| 1192 Display the list of process groups on the target. For each |
| 1193 process, GDB prints the identifier of the process group that |
| 1194 it belongs to, the command corresponding to the process group |
| 1195 leader, the process identifier, and the command line of the |
| 1196 process. The list is sorted first by the process group |
| 1197 identifier, then by the process identifier, so that processes |
| 1198 belonging to the same process group are grouped together and |
| 1199 the process group leader is listed first. |
| 1200 |
| 1201 `threads' |
| 1202 Display the list of threads running on the target. For each |
| 1203 thread, GDB prints the identifier of the process that the |
| 1204 thread belongs to, the command of the process, the thread |
| 1205 identifier, and the processor core that it is currently |
| 1206 running on. The main thread of a process is not listed. |
| 1207 |
| 1208 `files' |
| 1209 Display the list of open file descriptors on the target. For |
| 1210 each file descriptor, GDB prints the identifier of the process |
| 1211 owning the descriptor, the command of the owning process, the |
| 1212 value of the descriptor, and the target of the descriptor. |
| 1213 |
| 1214 `sockets' |
| 1215 Display the list of Internet-domain sockets on the target. |
| 1216 For each socket, GDB prints the address and port of the local |
| 1217 and remote endpoints, the current state of the connection, |
| 1218 the creator of the socket, the IP address family of the |
| 1219 socket, and the type of the connection. |
| 1220 |
| 1221 `shm' |
| 1222 Display the list of all System V shared-memory regions on the |
| 1223 target. For each shared-memory region, GDB prints the region |
| 1224 key, the shared-memory identifier, the access permissions, |
| 1225 the size of the region, the process that created the region, |
| 1226 the process that last attached to or detached from the |
| 1227 region, the current number of live attaches to the region, |
| 1228 and the times at which the region was last attached to, |
| 1229 detach from, and changed. |
| 1230 |
| 1231 `semaphores' |
| 1232 Display the list of all System V semaphore sets on the |
| 1233 target. For each semaphore set, GDB prints the semaphore set |
| 1234 key, the semaphore set identifier, the access permissions, |
| 1235 the number of semaphores in the set, the user and group of |
| 1236 the owner and creator of the semaphore set, and the times at |
| 1237 which the semaphore set was operated upon and changed. |
| 1238 |
| 1239 `msg' |
| 1240 Display the list of all System V message queues on the |
| 1241 target. For each message queue, GDB prints the message queue |
| 1242 key, the message queue identifier, the access permissions, |
| 1243 the current number of bytes on the queue, the current number |
| 1244 of messages on the queue, the processes that last sent and |
| 1245 received a message on the queue, the user and group of the |
| 1246 owner and creator of the message queue, the times at which a |
| 1247 message was last sent and received on the queue, and the time |
| 1248 at which the message queue was last changed. |
| 1249 |
| 1250 `modules' |
| 1251 Display the list of all loaded kernel modules on the target. |
| 1252 For each module, GDB prints the module name, the size of the |
| 1253 module in bytes, the number of times the module is used, the |
| 1254 dependencies of the module, the status of the module, and the |
| 1255 address of the loaded module in memory. |
575 | 1256 |
576 `info os' | 1257 `info os' |
577 List the types of OS information available for the target. If the | 1258 If INFOTYPE is omitted, then list the possible values for INFOTYPE |
578 target does not return a list of possible types, this command will | 1259 and the kind of OS information available for each INFOTYPE. If |
579 report an error. | 1260 the target does not return a list of possible types, this command |
580 | 1261 will report an error. |
581 `info os processes' | |
582 Display the list of processes on the target. For each process, | |
583 GDB prints the process identifier, the name of the user, and the | |
584 command corresponding to the process. | |
585 | 1262 |
586 | 1263 |
587 File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Pre
v: OS Information, Up: Data | 1264 File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Pre
v: OS Information, Up: Data |
588 | 1265 |
589 10.16 Memory Region Attributes | 1266 10.16 Memory Region Attributes |
590 ============================== | 1267 ============================== |
591 | 1268 |
592 "Memory region attributes" allow you to describe special handling | 1269 "Memory region attributes" allow you to describe special handling |
593 required by regions of your target's memory. GDB uses attributes to | 1270 required by regions of your target's memory. GDB uses attributes to |
594 determine whether to allow certain types of memory accesses; whether to | 1271 determine whether to allow certain types of memory accesses; whether to |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 executed. | 1898 executed. |
1222 | 1899 |
1223 This makes source-level debugging much clearer; you can see both the | 1900 This makes source-level debugging much clearer; you can see both the |
1224 context of the call and then the effect of the call. Only stepping by | 1901 context of the call and then the effect of the call. Only stepping by |
1225 a single instruction using `stepi' or `nexti' does not do this; single | 1902 a single instruction using `stepi' or `nexti' does not do this; single |
1226 instruction steps always show the inlined body. | 1903 instruction steps always show the inlined body. |
1227 | 1904 |
1228 There are some ways that GDB does not pretend that inlined function | 1905 There are some ways that GDB does not pretend that inlined function |
1229 calls are the same as normal calls: | 1906 calls are the same as normal calls: |
1230 | 1907 |
1231 * You cannot set breakpoints on inlined functions. GDB either | |
1232 reports that there is no symbol with that name, or else sets the | |
1233 breakpoint only on non-inlined copies of the function. This | |
1234 limitation will be removed in a future version of GDB; until then, | |
1235 set a breakpoint by line number on the first line of the inlined | |
1236 function instead. | |
1237 | |
1238 * Setting breakpoints at the call site of an inlined function may not | 1908 * Setting breakpoints at the call site of an inlined function may not |
1239 work, because the call site does not contain any code. GDB may | 1909 work, because the call site does not contain any code. GDB may |
1240 incorrectly move the breakpoint to the next line of the enclosing | 1910 incorrectly move the breakpoint to the next line of the enclosing |
1241 function, after the call. This limitation will be removed in a | 1911 function, after the call. This limitation will be removed in a |
1242 future version of GDB; until then, set a breakpoint on an earlier | 1912 future version of GDB; until then, set a breakpoint on an earlier |
1243 line or inside the inlined function instead. | 1913 line or inside the inlined function instead. |
1244 | 1914 |
1245 * GDB cannot locate the return value of inlined calls after using | 1915 * GDB cannot locate the return value of inlined calls after using |
1246 the `finish' command. This is a limitation of compiler-generated | 1916 the `finish' command. This is a limitation of compiler-generated |
1247 debugging information; after `finish', you can step to the next | 1917 debugging information; after `finish', you can step to the next |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 `$args' | 2724 `$args' |
2055 Collect all function arguments. | 2725 Collect all function arguments. |
2056 | 2726 |
2057 `$locals' | 2727 `$locals' |
2058 Collect all local variables. | 2728 Collect all local variables. |
2059 | 2729 |
2060 `$_ret' | 2730 `$_ret' |
2061 Collect the return address. This is helpful if you want to | 2731 Collect the return address. This is helpful if you want to |
2062 see more of a backtrace. | 2732 see more of a backtrace. |
2063 | 2733 |
| 2734 `$_probe_argc' |
| 2735 Collects the number of arguments from the static probe at |
| 2736 which the tracepoint is located. *Note Static Probe Points::. |
| 2737 |
| 2738 `$_probe_argN' |
| 2739 N is an integer between 0 and 11. Collects the Nth argument |
| 2740 from the static probe at which the tracepoint is located. |
| 2741 *Note Static Probe Points::. |
| 2742 |
2064 `$_sdata' | 2743 `$_sdata' |
2065 Collect static tracepoint marker specific data. Only | 2744 Collect static tracepoint marker specific data. Only |
2066 available for static tracepoints. *Note Tracepoint Action | 2745 available for static tracepoints. *Note Tracepoint Action |
2067 Lists: Tracepoint Actions. On the UST static tracepoints | 2746 Lists: Tracepoint Actions. On the UST static tracepoints |
2068 library backend, an instrumentation point resembles a | 2747 library backend, an instrumentation point resembles a |
2069 `printf' function call. The tracing library is able to | 2748 `printf' function call. The tracing library is able to |
2070 collect user specified data formatted to a character string | 2749 collect user specified data formatted to a character string |
2071 using the format provided by the programmer that instrumented | 2750 using the format provided by the programmer that instrumented |
2072 the program. Other backends have similar mechanisms. Here's | 2751 the program. Other backends have similar mechanisms. Here's |
2073 an example of a UST marker call: | 2752 an example of a UST marker call: |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3393 `show range' | 4072 `show range' |
3394 Show the current setting of the range checker, and whether or not | 4073 Show the current setting of the range checker, and whether or not |
3395 it is being set automatically by GDB. | 4074 it is being set automatically by GDB. |
3396 | 4075 |
3397 | 4076 |
3398 File: gdb.info, Node: Supported Languages, Next: Unsupported Languages, Prev:
Checks, Up: Languages | 4077 File: gdb.info, Node: Supported Languages, Next: Unsupported Languages, Prev:
Checks, Up: Languages |
3399 | 4078 |
3400 15.4 Supported Languages | 4079 15.4 Supported Languages |
3401 ======================== | 4080 ======================== |
3402 | 4081 |
3403 GDB supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, | 4082 GDB supports C, C++, D, Go, Objective-C, Fortran, Java, OpenCL C, |
3404 assembly, Modula-2, and Ada. Some GDB features may be used in | 4083 Pascal, assembly, Modula-2, and Ada. Some GDB features may be used in |
3405 expressions regardless of the language you use: the GDB `@' and `::' | 4084 expressions regardless of the language you use: the GDB `@' and `::' |
3406 operators, and the `{type}addr' construct (*note Expressions: | 4085 operators, and the `{type}addr' construct (*note Expressions: |
3407 Expressions.) can be used with the constructs of any supported language. | 4086 Expressions.) can be used with the constructs of any supported language. |
3408 | 4087 |
3409 The following sections detail to what degree each source language is | 4088 The following sections detail to what degree each source language is |
3410 supported by GDB. These sections are not meant to be language | 4089 supported by GDB. These sections are not meant to be language |
3411 tutorials or references, but serve only as a reference guide to what the | 4090 tutorials or references, but serve only as a reference guide to what the |
3412 GDB expression parser accepts, and what input and output formats should | 4091 GDB expression parser accepts, and what input and output formats should |
3413 look like for different languages. There are many good books written | 4092 look like for different languages. There are many good books written |
3414 on each of these languages; please look to these for a language | 4093 on each of these languages; please look to these for a language |
3415 reference or tutorial. | 4094 reference or tutorial. |
3416 | 4095 |
3417 * Menu: | 4096 * Menu: |
3418 | 4097 |
3419 * C:: C and C++ | 4098 * C:: C and C++ |
3420 * D:: D | 4099 * D:: D |
| 4100 * Go:: Go |
3421 * Objective-C:: Objective-C | 4101 * Objective-C:: Objective-C |
3422 * OpenCL C:: OpenCL C | 4102 * OpenCL C:: OpenCL C |
3423 * Fortran:: Fortran | 4103 * Fortran:: Fortran |
3424 * Pascal:: Pascal | 4104 * Pascal:: Pascal |
3425 * Modula-2:: Modula-2 | 4105 * Modula-2:: Modula-2 |
3426 * Ada:: Ada | 4106 * Ada:: Ada |
3427 | 4107 |
3428 | 4108 |
3429 File: gdb.info, Node: C, Next: D, Up: Supported Languages | 4109 File: gdb.info, Node: C, Next: D, Up: Supported Languages |
3430 | 4110 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3799 | 4479 |
3800 `catch throw' | 4480 `catch throw' |
3801 `catch catch' | 4481 `catch catch' |
3802 Debug C++ exception handling using these commands. *Note Setting | 4482 Debug C++ exception handling using these commands. *Note Setting |
3803 Catchpoints: Set Catchpoints. | 4483 Catchpoints: Set Catchpoints. |
3804 | 4484 |
3805 `ptype TYPENAME' | 4485 `ptype TYPENAME' |
3806 Print inheritance relationships as well as other information for | 4486 Print inheritance relationships as well as other information for |
3807 type TYPENAME. *Note Examining the Symbol Table: Symbols. | 4487 type TYPENAME. *Note Examining the Symbol Table: Symbols. |
3808 | 4488 |
| 4489 `info vtbl EXPRESSION.' |
| 4490 The `info vtbl' command can be used to display the virtual method |
| 4491 tables of the object computed by EXPRESSION. This shows one entry |
| 4492 per virtual table; there may be multiple virtual tables when |
| 4493 multiple inheritance is in use. |
| 4494 |
3809 `set print demangle' | 4495 `set print demangle' |
3810 `show print demangle' | 4496 `show print demangle' |
3811 `set print asm-demangle' | 4497 `set print asm-demangle' |
3812 `show print asm-demangle' | 4498 `show print asm-demangle' |
3813 Control whether C++ symbols display in their source form, both when | 4499 Control whether C++ symbols display in their source form, both when |
3814 displaying code as C++ source and when displaying disassemblies. | 4500 displaying code as C++ source and when displaying disassemblies. |
3815 *Note Print Settings: Print Settings. | 4501 *Note Print Settings: Print Settings. |
3816 | 4502 |
3817 `set print object' | 4503 `set print object' |
3818 `show print object' | 4504 `show print object' |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3876 | 4562 |
3877 In addition, in order to imitate GDB's behaviour with binary floating | 4563 In addition, in order to imitate GDB's behaviour with binary floating |
3878 point computations, error checking in decimal float operations ignores | 4564 point computations, error checking in decimal float operations ignores |
3879 underflow, overflow and divide by zero exceptions. | 4565 underflow, overflow and divide by zero exceptions. |
3880 | 4566 |
3881 In the PowerPC architecture, GDB provides a set of pseudo-registers | 4567 In the PowerPC architecture, GDB provides a set of pseudo-registers |
3882 to inspect `_Decimal128' values stored in floating point registers. | 4568 to inspect `_Decimal128' values stored in floating point registers. |
3883 See *Note PowerPC: PowerPC. for more details. | 4569 See *Note PowerPC: PowerPC. for more details. |
3884 | 4570 |
3885 | 4571 |
3886 File: gdb.info, Node: D, Next: Objective-C, Prev: C, Up: Supported Languages | 4572 File: gdb.info, Node: D, Next: Go, Prev: C, Up: Supported Languages |
3887 | 4573 |
3888 15.4.2 D | 4574 15.4.2 D |
3889 -------- | 4575 -------- |
3890 | 4576 |
3891 GDB can be used to debug programs written in D and compiled with GDC, | 4577 GDB can be used to debug programs written in D and compiled with GDC, |
3892 LDC or DMD compilers. Currently GDB supports only one D specific | 4578 LDC or DMD compilers. Currently GDB supports only one D specific |
3893 feature -- dynamic arrays. | 4579 feature -- dynamic arrays. |
3894 | 4580 |
3895 | 4581 |
3896 File: gdb.info, Node: Objective-C, Next: OpenCL C, Prev: D, Up: Supported La
nguages | 4582 File: gdb.info, Node: Go, Next: Objective-C, Prev: D, Up: Supported Language
s |
3897 | 4583 |
3898 15.4.3 Objective-C | 4584 15.4.3 Go |
| 4585 --------- |
| 4586 |
| 4587 GDB can be used to debug programs written in Go and compiled with |
| 4588 `gccgo' or `6g' compilers. |
| 4589 |
| 4590 Here is a summary of the Go-specific features and restrictions: |
| 4591 |
| 4592 `The current Go package' |
| 4593 The name of the current package does not need to be specified when |
| 4594 specifying global variables and functions. |
| 4595 |
| 4596 For example, given the program: |
| 4597 |
| 4598 package main |
| 4599 var myglob = "Shall we?" |
| 4600 func main () { |
| 4601 // ... |
| 4602 } |
| 4603 |
| 4604 When stopped inside `main' either of these work: |
| 4605 |
| 4606 (gdb) p myglob |
| 4607 (gdb) p main.myglob |
| 4608 |
| 4609 `Builtin Go types' |
| 4610 The `string' type is recognized by GDB and is printed as a string. |
| 4611 |
| 4612 `Builtin Go functions' |
| 4613 The GDB expression parser recognizes the `unsafe.Sizeof' function |
| 4614 and handles it internally. |
| 4615 |
| 4616 `Restrictions on Go expressions' |
| 4617 All Go operators are supported except `&^'. The Go `_' "blank |
| 4618 identifier" is not supported. Automatic dereferencing of pointers |
| 4619 is not supported. |
| 4620 |
| 4621 |
| 4622 File: gdb.info, Node: Objective-C, Next: OpenCL C, Prev: Go, Up: Supported L
anguages |
| 4623 |
| 4624 15.4.4 Objective-C |
3899 ------------------ | 4625 ------------------ |
3900 | 4626 |
3901 This section provides information about some commands and command | 4627 This section provides information about some commands and command |
3902 options that are useful for debugging Objective-C code. See also *Note | 4628 options that are useful for debugging Objective-C code. See also *Note |
3903 info classes: Symbols, and *Note info selectors: Symbols, for a few | 4629 info classes: Symbols, and *Note info selectors: Symbols, for a few |
3904 more commands specific to Objective-C support. | 4630 more commands specific to Objective-C support. |
3905 | 4631 |
3906 * Menu: | 4632 * Menu: |
3907 | 4633 |
3908 * Method Names in Commands:: | 4634 * Method Names in Commands:: |
3909 * The Print Command with Objective-C:: | 4635 * The Print Command with Objective-C:: |
3910 | 4636 |
3911 | 4637 |
3912 File: gdb.info, Node: Method Names in Commands, Next: The Print Command with O
bjective-C, Up: Objective-C | 4638 File: gdb.info, Node: Method Names in Commands, Next: The Print Command with O
bjective-C, Up: Objective-C |
3913 | 4639 |
3914 15.4.3.1 Method Names in Commands | 4640 15.4.4.1 Method Names in Commands |
3915 ................................. | 4641 ................................. |
3916 | 4642 |
3917 The following commands have been extended to accept Objective-C method | 4643 The following commands have been extended to accept Objective-C method |
3918 names as line specifications: | 4644 names as line specifications: |
3919 | 4645 |
3920 * `clear' | 4646 * `clear' |
3921 | 4647 |
3922 * `break' | 4648 * `break' |
3923 | 4649 |
3924 * `info line' | 4650 * `info line' |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3959 apply. | 4685 apply. |
3960 | 4686 |
3961 As another example, to clear a breakpoint established at the | 4687 As another example, to clear a breakpoint established at the |
3962 `makeKeyAndOrderFront:' method of the `NSWindow' class, enter: | 4688 `makeKeyAndOrderFront:' method of the `NSWindow' class, enter: |
3963 | 4689 |
3964 clear -[NSWindow makeKeyAndOrderFront:] | 4690 clear -[NSWindow makeKeyAndOrderFront:] |
3965 | 4691 |
3966 | 4692 |
3967 File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names i
n Commands, Up: Objective-C | 4693 File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names i
n Commands, Up: Objective-C |
3968 | 4694 |
3969 15.4.3.2 The Print Command With Objective-C | 4695 15.4.4.2 The Print Command With Objective-C |
3970 ........................................... | 4696 ........................................... |
3971 | 4697 |
3972 The print command has also been extended to accept methods. For | 4698 The print command has also been extended to accept methods. For |
3973 example: | 4699 example: |
3974 | 4700 |
3975 print -[OBJECT hash] | 4701 print -[OBJECT hash] |
3976 | 4702 |
3977 will tell GDB to send the `hash' message to OBJECT and print the | 4703 will tell GDB to send the `hash' message to OBJECT and print the |
3978 result. Also, an additional command has been added, `print-object' or | 4704 result. Also, an additional command has been added, `print-object' or |
3979 `po' for short, which is meant to print the description of an object. | 4705 `po' for short, which is meant to print the description of an object. |
3980 However, this command may only work with certain Objective-C libraries | 4706 However, this command may only work with certain Objective-C libraries |
3981 that have a particular hook function, `_NSPrintForDebugger', defined. | 4707 that have a particular hook function, `_NSPrintForDebugger', defined. |
3982 | 4708 |
3983 | 4709 |
3984 File: gdb.info, Node: OpenCL C, Next: Fortran, Prev: Objective-C, Up: Suppor
ted Languages | 4710 File: gdb.info, Node: OpenCL C, Next: Fortran, Prev: Objective-C, Up: Suppor
ted Languages |
3985 | 4711 |
3986 15.4.4 OpenCL C | 4712 15.4.5 OpenCL C |
3987 --------------- | 4713 --------------- |
3988 | 4714 |
3989 This section provides information about GDBs OpenCL C support. | 4715 This section provides information about GDBs OpenCL C support. |
3990 | 4716 |
3991 * Menu: | 4717 * Menu: |
3992 | 4718 |
3993 * OpenCL C Datatypes:: | 4719 * OpenCL C Datatypes:: |
3994 * OpenCL C Expressions:: | 4720 * OpenCL C Expressions:: |
3995 * OpenCL C Operators:: | 4721 * OpenCL C Operators:: |
3996 | 4722 |
3997 | 4723 |
3998 File: gdb.info, Node: OpenCL C Datatypes, Next: OpenCL C Expressions, Up: Ope
nCL C | 4724 File: gdb.info, Node: OpenCL C Datatypes, Next: OpenCL C Expressions, Up: Ope
nCL C |
3999 | 4725 |
4000 15.4.4.1 OpenCL C Datatypes | 4726 15.4.5.1 OpenCL C Datatypes |
4001 ........................... | 4727 ........................... |
4002 | 4728 |
4003 GDB supports the builtin scalar and vector datatypes specified by | 4729 GDB supports the builtin scalar and vector datatypes specified by |
4004 OpenCL 1.1. In addition the half- and double-precision floating point | 4730 OpenCL 1.1. In addition the half- and double-precision floating point |
4005 data types of the `cl_khr_fp16' and `cl_khr_fp64' OpenCL extensions are | 4731 data types of the `cl_khr_fp16' and `cl_khr_fp64' OpenCL extensions are |
4006 also known to GDB. | 4732 also known to GDB. |
4007 | 4733 |
4008 | 4734 |
4009 File: gdb.info, Node: OpenCL C Expressions, Next: OpenCL C Operators, Prev: O
penCL C Datatypes, Up: OpenCL C | 4735 File: gdb.info, Node: OpenCL C Expressions, Next: OpenCL C Operators, Prev: O
penCL C Datatypes, Up: OpenCL C |
4010 | 4736 |
4011 15.4.4.2 OpenCL C Expressions | 4737 15.4.5.2 OpenCL C Expressions |
4012 ............................. | 4738 ............................. |
4013 | 4739 |
4014 GDB supports accesses to vector components including the access as | 4740 GDB supports accesses to vector components including the access as |
4015 lvalue where possible. Since OpenCL C is based on C99 most C | 4741 lvalue where possible. Since OpenCL C is based on C99 most C |
4016 expressions supported by GDB can be used as well. | 4742 expressions supported by GDB can be used as well. |
4017 | 4743 |
4018 | 4744 |
4019 File: gdb.info, Node: OpenCL C Operators, Prev: OpenCL C Expressions, Up: Ope
nCL C | 4745 File: gdb.info, Node: OpenCL C Operators, Prev: OpenCL C Expressions, Up: Ope
nCL C |
4020 | 4746 |
4021 15.4.4.3 OpenCL C Operators | 4747 15.4.5.3 OpenCL C Operators |
4022 ........................... | 4748 ........................... |
4023 | 4749 |
4024 GDB supports the operators specified by OpenCL 1.1 for scalar and | 4750 GDB supports the operators specified by OpenCL 1.1 for scalar and |
4025 vector data types. | 4751 vector data types. |
4026 | 4752 |
4027 | 4753 |
4028 File: gdb.info, Node: Fortran, Next: Pascal, Prev: OpenCL C, Up: Supported L
anguages | 4754 File: gdb.info, Node: Fortran, Next: Pascal, Prev: OpenCL C, Up: Supported L
anguages |
4029 | 4755 |
4030 15.4.5 Fortran | 4756 15.4.6 Fortran |
4031 -------------- | 4757 -------------- |
4032 | 4758 |
4033 GDB can be used to debug programs written in Fortran, but it currently | 4759 GDB can be used to debug programs written in Fortran, but it currently |
4034 supports only the features of Fortran 77 language. | 4760 supports only the features of Fortran 77 language. |
4035 | 4761 |
4036 Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers | 4762 Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers |
4037 among them) append an underscore to the names of variables and | 4763 among them) append an underscore to the names of variables and |
4038 functions. When you debug programs compiled by those compilers, you | 4764 functions. When you debug programs compiled by those compilers, you |
4039 will need to refer to variables and functions with a trailing | 4765 will need to refer to variables and functions with a trailing |
4040 underscore. | 4766 underscore. |
4041 | 4767 |
4042 * Menu: | 4768 * Menu: |
4043 | 4769 |
4044 * Fortran Operators:: Fortran operators and expressions | 4770 * Fortran Operators:: Fortran operators and expressions |
4045 * Fortran Defaults:: Default settings for Fortran | 4771 * Fortran Defaults:: Default settings for Fortran |
4046 * Special Fortran Commands:: Special GDB commands for Fortran | 4772 * Special Fortran Commands:: Special GDB commands for Fortran |
4047 | 4773 |
4048 | 4774 |
4049 File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran | 4775 File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran |
4050 | 4776 |
4051 15.4.5.1 Fortran Operators and Expressions | 4777 15.4.6.1 Fortran Operators and Expressions |
4052 .......................................... | 4778 .......................................... |
4053 | 4779 |
4054 Operators must be defined on values of specific types. For instance, | 4780 Operators must be defined on values of specific types. For instance, |
4055 `+' is defined on numbers, but not on characters or other non- | 4781 `+' is defined on numbers, but not on characters or other non- |
4056 arithmetic types. Operators are often defined on groups of types. | 4782 arithmetic types. Operators are often defined on groups of types. |
4057 | 4783 |
4058 `**' | 4784 `**' |
4059 The exponentiation operator. It raises the first operand to the | 4785 The exponentiation operator. It raises the first operand to the |
4060 power of the second one. | 4786 power of the second one. |
4061 | 4787 |
4062 `:' | 4788 `:' |
4063 The range operator. Normally used in the form of array(low:high) | 4789 The range operator. Normally used in the form of array(low:high) |
4064 to represent a section of array. | 4790 to represent a section of array. |
4065 | 4791 |
4066 `%' | 4792 `%' |
4067 The access component operator. Normally used to access elements | 4793 The access component operator. Normally used to access elements |
4068 in derived types. Also suitable for unions. As unions aren't | 4794 in derived types. Also suitable for unions. As unions aren't |
4069 part of regular Fortran, this can only happen when accessing a | 4795 part of regular Fortran, this can only happen when accessing a |
4070 register that uses a gdbarch-defined union type. | 4796 register that uses a gdbarch-defined union type. |
4071 | 4797 |
4072 | 4798 |
4073 File: gdb.info, Node: Fortran Defaults, Next: Special Fortran Commands, Prev:
Fortran Operators, Up: Fortran | 4799 File: gdb.info, Node: Fortran Defaults, Next: Special Fortran Commands, Prev:
Fortran Operators, Up: Fortran |
4074 | 4800 |
4075 15.4.5.2 Fortran Defaults | 4801 15.4.6.2 Fortran Defaults |
4076 ......................... | 4802 ......................... |
4077 | 4803 |
4078 Fortran symbols are usually case-insensitive, so GDB by default uses | 4804 Fortran symbols are usually case-insensitive, so GDB by default uses |
4079 case-insensitive matches for Fortran symbols. You can change that with | 4805 case-insensitive matches for Fortran symbols. You can change that with |
4080 the `set case-insensitive' command, see *Note Symbols::, for the | 4806 the `set case-insensitive' command, see *Note Symbols::, for the |
4081 details. | 4807 details. |
4082 | 4808 |
4083 | 4809 |
4084 File: gdb.info, Node: Special Fortran Commands, Prev: Fortran Defaults, Up: F
ortran | 4810 File: gdb.info, Node: Special Fortran Commands, Prev: Fortran Defaults, Up: F
ortran |
4085 | 4811 |
4086 15.4.5.3 Special Fortran Commands | 4812 15.4.6.3 Special Fortran Commands |
4087 ................................. | 4813 ................................. |
4088 | 4814 |
4089 GDB has some commands to support Fortran-specific features, such as | 4815 GDB has some commands to support Fortran-specific features, such as |
4090 displaying common blocks. | 4816 displaying common blocks. |
4091 | 4817 |
4092 `info common [COMMON-NAME]' | 4818 `info common [COMMON-NAME]' |
4093 This command prints the values contained in the Fortran `COMMON' | 4819 This command prints the values contained in the Fortran `COMMON' |
4094 block whose name is COMMON-NAME. With no argument, the names of | 4820 block whose name is COMMON-NAME. With no argument, the names of |
4095 all `COMMON' blocks visible at the current program location are | 4821 all `COMMON' blocks visible at the current program location are |
4096 printed. | 4822 printed. |
4097 | 4823 |
4098 | 4824 |
4099 File: gdb.info, Node: Pascal, Next: Modula-2, Prev: Fortran, Up: Supported L
anguages | 4825 File: gdb.info, Node: Pascal, Next: Modula-2, Prev: Fortran, Up: Supported L
anguages |
4100 | 4826 |
4101 15.4.6 Pascal | 4827 15.4.7 Pascal |
4102 ------------- | 4828 ------------- |
4103 | 4829 |
4104 Debugging Pascal programs which use sets, subranges, file variables, or | 4830 Debugging Pascal programs which use sets, subranges, file variables, or |
4105 nested functions does not currently work. GDB does not support | 4831 nested functions does not currently work. GDB does not support |
4106 entering expressions, printing values, or similar features using Pascal | 4832 entering expressions, printing values, or similar features using Pascal |
4107 syntax. | 4833 syntax. |
4108 | 4834 |
4109 The Pascal-specific command `set print pascal_static-members' | 4835 The Pascal-specific command `set print pascal_static-members' |
4110 controls whether static members of Pascal objects are displayed. *Note | 4836 controls whether static members of Pascal objects are displayed. *Note |
4111 pascal_static-members: Print Settings. | 4837 pascal_static-members: Print Settings. |
4112 | 4838 |
4113 | 4839 |
4114 File: gdb.info, Node: Modula-2, Next: Ada, Prev: Pascal, Up: Supported Langu
ages | 4840 File: gdb.info, Node: Modula-2, Next: Ada, Prev: Pascal, Up: Supported Langu
ages |
4115 | 4841 |
4116 15.4.7 Modula-2 | 4842 15.4.8 Modula-2 |
4117 --------------- | 4843 --------------- |
4118 | 4844 |
4119 The extensions made to GDB to support Modula-2 only support output from | 4845 The extensions made to GDB to support Modula-2 only support output from |
4120 the GNU Modula-2 compiler (which is currently being developed). Other | 4846 the GNU Modula-2 compiler (which is currently being developed). Other |
4121 Modula-2 compilers are not currently supported, and attempting to debug | 4847 Modula-2 compilers are not currently supported, and attempting to debug |
4122 executables produced by them is most likely to give an error as GDB | 4848 executables produced by them is most likely to give an error as GDB |
4123 reads in the executable's symbol table. | 4849 reads in the executable's symbol table. |
4124 | 4850 |
4125 * Menu: | 4851 * Menu: |
4126 | 4852 |
4127 * M2 Operators:: Built-in operators | 4853 * M2 Operators:: Built-in operators |
4128 * Built-In Func/Proc:: Built-in functions and procedures | 4854 * Built-In Func/Proc:: Built-in functions and procedures |
4129 * M2 Constants:: Modula-2 constants | 4855 * M2 Constants:: Modula-2 constants |
4130 * M2 Types:: Modula-2 types | 4856 * M2 Types:: Modula-2 types |
4131 * M2 Defaults:: Default settings for Modula-2 | 4857 * M2 Defaults:: Default settings for Modula-2 |
4132 * Deviations:: Deviations from standard Modula-2 | 4858 * Deviations:: Deviations from standard Modula-2 |
4133 * M2 Checks:: Modula-2 type and range checks | 4859 * M2 Checks:: Modula-2 type and range checks |
4134 * M2 Scope:: The scope operators `::' and `.' | 4860 * M2 Scope:: The scope operators `::' and `.' |
4135 * GDB/M2:: GDB and Modula-2 | 4861 * GDB/M2:: GDB and Modula-2 |
4136 | 4862 |
4137 | 4863 |
4138 File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2 | 4864 File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2 |
4139 | 4865 |
4140 15.4.7.1 Operators | 4866 15.4.8.1 Operators |
4141 .................. | 4867 .................. |
4142 | 4868 |
4143 Operators must be defined on values of specific types. For instance, | 4869 Operators must be defined on values of specific types. For instance, |
4144 `+' is defined on numbers, but not on structures. Operators are often | 4870 `+' is defined on numbers, but not on structures. Operators are often |
4145 defined on groups of types. For the purposes of Modula-2, the | 4871 defined on groups of types. For the purposes of Modula-2, the |
4146 following definitions hold: | 4872 following definitions hold: |
4147 | 4873 |
4148 * _Integral types_ consist of `INTEGER', `CARDINAL', and their | 4874 * _Integral types_ consist of `INTEGER', `CARDINAL', and their |
4149 subranges. | 4875 subranges. |
4150 | 4876 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4239 GDB and Modula-2 scope operators. | 4965 GDB and Modula-2 scope operators. |
4240 | 4966 |
4241 _Warning:_ Set expressions and their operations are not yet | 4967 _Warning:_ Set expressions and their operations are not yet |
4242 supported, so GDB treats the use of the operator `IN', or the use | 4968 supported, so GDB treats the use of the operator `IN', or the use |
4243 of operators `+', `-', `*', `/', `=', , `<>', `#', `<=', and `>=' | 4969 of operators `+', `-', `*', `/', `=', , `<>', `#', `<=', and `>=' |
4244 on sets as an error. | 4970 on sets as an error. |
4245 | 4971 |
4246 | 4972 |
4247 File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operat
ors, Up: Modula-2 | 4973 File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operat
ors, Up: Modula-2 |
4248 | 4974 |
4249 15.4.7.2 Built-in Functions and Procedures | 4975 15.4.8.2 Built-in Functions and Procedures |
4250 .......................................... | 4976 .......................................... |
4251 | 4977 |
4252 Modula-2 also makes available several built-in procedures and functions. | 4978 Modula-2 also makes available several built-in procedures and functions. |
4253 In describing these, the following metavariables are used: | 4979 In describing these, the following metavariables are used: |
4254 | 4980 |
4255 A | 4981 A |
4256 represents an `ARRAY' variable. | 4982 represents an `ARRAY' variable. |
4257 | 4983 |
4258 C | 4984 C |
4259 represents a `CHAR' constant or variable. | 4985 represents a `CHAR' constant or variable. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4351 | 5077 |
4352 `VAL(T,I)' | 5078 `VAL(T,I)' |
4353 Returns the member of the type T whose ordinal value is I. | 5079 Returns the member of the type T whose ordinal value is I. |
4354 | 5080 |
4355 _Warning:_ Sets and their operations are not yet supported, so | 5081 _Warning:_ Sets and their operations are not yet supported, so |
4356 GDB treats the use of procedures `INCL' and `EXCL' as an error. | 5082 GDB treats the use of procedures `INCL' and `EXCL' as an error. |
4357 | 5083 |
4358 | 5084 |
4359 File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc,
Up: Modula-2 | 5085 File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc,
Up: Modula-2 |
4360 | 5086 |
4361 15.4.7.3 Constants | 5087 15.4.8.3 Constants |
4362 .................. | 5088 .................. |
4363 | 5089 |
4364 GDB allows you to express the constants of Modula-2 in the following | 5090 GDB allows you to express the constants of Modula-2 in the following |
4365 ways: | 5091 ways: |
4366 | 5092 |
4367 * Integer constants are simply a sequence of digits. When used in an | 5093 * Integer constants are simply a sequence of digits. When used in an |
4368 expression, a constant is interpreted to be type-compatible with | 5094 expression, a constant is interpreted to be type-compatible with |
4369 the rest of the expression. Hexadecimal integers are specified by | 5095 the rest of the expression. Hexadecimal integers are specified by |
4370 a trailing `H', and octal integers by a trailing `B'. | 5096 a trailing `H', and octal integers by a trailing `B'. |
4371 | 5097 |
(...skipping 18 matching lines...) Expand all Loading... |
4390 | 5116 |
4391 * Boolean constants consist of the identifiers `TRUE' and `FALSE'. | 5117 * Boolean constants consist of the identifiers `TRUE' and `FALSE'. |
4392 | 5118 |
4393 * Pointer constants consist of integral values only. | 5119 * Pointer constants consist of integral values only. |
4394 | 5120 |
4395 * Set constants are not yet supported. | 5121 * Set constants are not yet supported. |
4396 | 5122 |
4397 | 5123 |
4398 File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: M
odula-2 | 5124 File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: M
odula-2 |
4399 | 5125 |
4400 15.4.7.4 Modula-2 Types | 5126 15.4.8.4 Modula-2 Types |
4401 ....................... | 5127 ....................... |
4402 | 5128 |
4403 Currently GDB can print the following data types in Modula-2 syntax: | 5129 Currently GDB can print the following data types in Modula-2 syntax: |
4404 array types, record types, set types, pointer types, procedure types, | 5130 array types, record types, set types, pointer types, procedure types, |
4405 enumerated types, subrange types and base types. You can also print | 5131 enumerated types, subrange types and base types. You can also print |
4406 the contents of variables declared using these type. This section | 5132 the contents of variables declared using these type. This section |
4407 gives a number of simple source code examples together with sample GDB | 5133 gives a number of simple source code examples together with sample GDB |
4408 sessions. | 5134 sessions. |
4409 | 5135 |
4410 The first example contains the following section of code: | 5136 The first example contains the following section of code: |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4518 (gdb) ptype s | 5244 (gdb) ptype s |
4519 type = POINTER TO ARRAY [-2..2] OF foo = RECORD | 5245 type = POINTER TO ARRAY [-2..2] OF foo = RECORD |
4520 f1 : CARDINAL; | 5246 f1 : CARDINAL; |
4521 f2 : CHAR; | 5247 f2 : CHAR; |
4522 f3 : ARRAY [-2..2] OF CARDINAL; | 5248 f3 : ARRAY [-2..2] OF CARDINAL; |
4523 END | 5249 END |
4524 | 5250 |
4525 | 5251 |
4526 File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Mod
ula-2 | 5252 File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Mod
ula-2 |
4527 | 5253 |
4528 15.4.7.5 Modula-2 Defaults | 5254 15.4.8.5 Modula-2 Defaults |
4529 .......................... | 5255 .......................... |
4530 | 5256 |
4531 If type and range checking are set automatically by GDB, they both | 5257 If type and range checking are set automatically by GDB, they both |
4532 default to `on' whenever the working language changes to Modula-2. | 5258 default to `on' whenever the working language changes to Modula-2. |
4533 This happens regardless of whether you or GDB selected the working | 5259 This happens regardless of whether you or GDB selected the working |
4534 language. | 5260 language. |
4535 | 5261 |
4536 If you allow GDB to set the language automatically, then entering | 5262 If you allow GDB to set the language automatically, then entering |
4537 code compiled from a file whose name ends with `.mod' sets the working | 5263 code compiled from a file whose name ends with `.mod' sets the working |
4538 language to Modula-2. *Note Having GDB Infer the Source Language: | 5264 language to Modula-2. *Note Having GDB Infer the Source Language: |
4539 Automatically, for further details. | 5265 Automatically, for further details. |
4540 | 5266 |
4541 | 5267 |
4542 File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Mo
dula-2 | 5268 File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Mo
dula-2 |
4543 | 5269 |
4544 15.4.7.6 Deviations from Standard Modula-2 | 5270 15.4.8.6 Deviations from Standard Modula-2 |
4545 .......................................... | 5271 .......................................... |
4546 | 5272 |
4547 A few changes have been made to make Modula-2 programs easier to debug. | 5273 A few changes have been made to make Modula-2 programs easier to debug. |
4548 This is done primarily via loosening its type strictness: | 5274 This is done primarily via loosening its type strictness: |
4549 | 5275 |
4550 * Unlike in standard Modula-2, pointer constants can be formed by | 5276 * Unlike in standard Modula-2, pointer constants can be formed by |
4551 integers. This allows you to modify pointer variables during | 5277 integers. This allows you to modify pointer variables during |
4552 debugging. (In standard Modula-2, the actual address contained in | 5278 debugging. (In standard Modula-2, the actual address contained in |
4553 a pointer variable is hidden from you; it can only be modified | 5279 a pointer variable is hidden from you; it can only be modified |
4554 through direct assignment to another pointer variable or | 5280 through direct assignment to another pointer variable or |
4555 expression that returned a pointer.) | 5281 expression that returned a pointer.) |
4556 | 5282 |
4557 * C escape sequences can be used in strings and characters to | 5283 * C escape sequences can be used in strings and characters to |
4558 represent non-printable characters. GDB prints out strings with | 5284 represent non-printable characters. GDB prints out strings with |
4559 these escape sequences embedded. Single non-printable characters | 5285 these escape sequences embedded. Single non-printable characters |
4560 are printed using the `CHR(NNN)' format. | 5286 are printed using the `CHR(NNN)' format. |
4561 | 5287 |
4562 * The assignment operator (`:=') returns the value of its right-hand | 5288 * The assignment operator (`:=') returns the value of its right-hand |
4563 argument. | 5289 argument. |
4564 | 5290 |
4565 * All built-in procedures both modify _and_ return their argument. | 5291 * All built-in procedures both modify _and_ return their argument. |
4566 | 5292 |
4567 | 5293 |
4568 File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modul
a-2 | 5294 File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modul
a-2 |
4569 | 5295 |
4570 15.4.7.7 Modula-2 Type and Range Checks | 5296 15.4.8.7 Modula-2 Type and Range Checks |
4571 ....................................... | 5297 ....................................... |
4572 | 5298 |
4573 _Warning:_ in this release, GDB does not yet perform type or range | 5299 _Warning:_ in this release, GDB does not yet perform type or range |
4574 checking. | 5300 checking. |
4575 | 5301 |
4576 GDB considers two Modula-2 variables type equivalent if: | 5302 GDB considers two Modula-2 variables type equivalent if: |
4577 | 5303 |
4578 * They are of types that have been declared equivalent via a `TYPE | 5304 * They are of types that have been declared equivalent via a `TYPE |
4579 T1 = T2' statement | 5305 T1 = T2' statement |
4580 | 5306 |
4581 * They have been declared on the same line. (Note: This is true of | 5307 * They have been declared on the same line. (Note: This is true of |
4582 the GNU Modula-2 compiler, but it may not be true of other | 5308 the GNU Modula-2 compiler, but it may not be true of other |
4583 compilers.) | 5309 compilers.) |
4584 | 5310 |
4585 As long as type checking is enabled, any attempt to combine variables | 5311 As long as type checking is enabled, any attempt to combine variables |
4586 whose types are not equivalent is an error. | 5312 whose types are not equivalent is an error. |
4587 | 5313 |
4588 Range checking is done on all mathematical operations, assignment, | 5314 Range checking is done on all mathematical operations, assignment, |
4589 array index bounds, and all built-in functions and procedures. | 5315 array index bounds, and all built-in functions and procedures. |
4590 | 5316 |
4591 | 5317 |
4592 File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2 | 5318 File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2 |
4593 | 5319 |
4594 15.4.7.8 The Scope Operators `::' and `.' | 5320 15.4.8.8 The Scope Operators `::' and `.' |
4595 ......................................... | 5321 ......................................... |
4596 | 5322 |
4597 There are a few subtle differences between the Modula-2 scope operator | 5323 There are a few subtle differences between the Modula-2 scope operator |
4598 (`.') and the GDB scope operator (`::'). The two have similar syntax: | 5324 (`.') and the GDB scope operator (`::'). The two have similar syntax: |
4599 | 5325 |
4600 | 5326 |
4601 MODULE . ID | 5327 MODULE . ID |
4602 SCOPE :: ID | 5328 SCOPE :: ID |
4603 | 5329 |
4604 where SCOPE is the name of a module or a procedure, MODULE the name of | 5330 where SCOPE is the name of a module or a procedure, MODULE the name of |
4605 a module, and ID is any declared identifier within your program, except | 5331 a module, and ID is any declared identifier within your program, except |
4606 another module. | 5332 another module. |
4607 | 5333 |
4608 Using the `::' operator makes GDB search the scope specified by | 5334 Using the `::' operator makes GDB search the scope specified by |
4609 SCOPE for the identifier ID. If it is not found in the specified | 5335 SCOPE for the identifier ID. If it is not found in the specified |
4610 scope, then GDB searches all scopes enclosing the one specified by | 5336 scope, then GDB searches all scopes enclosing the one specified by |
4611 SCOPE. | 5337 SCOPE. |
4612 | 5338 |
4613 Using the `.' operator makes GDB search the current scope for the | 5339 Using the `.' operator makes GDB search the current scope for the |
4614 identifier specified by ID that was imported from the definition module | 5340 identifier specified by ID that was imported from the definition module |
4615 specified by MODULE. With this operator, it is an error if the | 5341 specified by MODULE. With this operator, it is an error if the |
4616 identifier ID was not imported from definition module MODULE, or if ID | 5342 identifier ID was not imported from definition module MODULE, or if ID |
4617 is not an identifier in MODULE. | 5343 is not an identifier in MODULE. |
4618 | 5344 |
4619 | 5345 |
4620 File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2 | 5346 File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2 |
4621 | 5347 |
4622 15.4.7.9 GDB and Modula-2 | 5348 15.4.8.9 GDB and Modula-2 |
4623 ......................... | 5349 ......................... |
4624 | 5350 |
4625 Some GDB commands have little use when debugging Modula-2 programs. | 5351 Some GDB commands have little use when debugging Modula-2 programs. |
4626 Five subcommands of `set print' and `show print' apply specifically to | 5352 Five subcommands of `set print' and `show print' apply specifically to |
4627 C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'. | 5353 C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'. |
4628 The first four apply to C++, and the last to the C `union' type, which | 5354 The first four apply to C++, and the last to the C `union' type, which |
4629 has no direct analogue in Modula-2. | 5355 has no direct analogue in Modula-2. |
4630 | 5356 |
4631 The `@' operator (*note Expressions: Expressions.), while available | 5357 The `@' operator (*note Expressions: Expressions.), while available |
4632 with any language, is not useful with Modula-2. Its intent is to aid | 5358 with any language, is not useful with Modula-2. Its intent is to aid |
4633 the debugging of "dynamic arrays", which cannot be created in Modula-2 | 5359 the debugging of "dynamic arrays", which cannot be created in Modula-2 |
4634 as they can in C or C++. However, because an address can be specified | 5360 as they can in C or C++. However, because an address can be specified |
4635 by an integral constant, the construct `{TYPE}ADREXP' is still useful. | 5361 by an integral constant, the construct `{TYPE}ADREXP' is still useful. |
4636 | 5362 |
4637 In GDB scripts, the Modula-2 inequality operator `#' is interpreted | 5363 In GDB scripts, the Modula-2 inequality operator `#' is interpreted |
4638 as the beginning of a comment. Use `<>' instead. | 5364 as the beginning of a comment. Use `<>' instead. |
4639 | 5365 |
4640 | 5366 |
4641 File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported Languages | 5367 File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported Languages |
4642 | 5368 |
4643 15.4.8 Ada | 5369 15.4.9 Ada |
4644 ---------- | 5370 ---------- |
4645 | 5371 |
4646 The extensions made to GDB for Ada only support output from the GNU Ada | 5372 The extensions made to GDB for Ada only support output from the GNU Ada |
4647 (GNAT) compiler. Other Ada compilers are not currently supported, and | 5373 (GNAT) compiler. Other Ada compilers are not currently supported, and |
4648 attempting to debug executables produced by them is most likely to be | 5374 attempting to debug executables produced by them is most likely to be |
4649 difficult. | 5375 difficult. |
4650 | 5376 |
4651 * Menu: | 5377 * Menu: |
4652 | 5378 |
4653 * Ada Mode Intro:: General remarks on the Ada syntax | 5379 * Ada Mode Intro:: General remarks on the Ada syntax |
4654 and semantics supported by Ada mode | 5380 and semantics supported by Ada mode |
4655 in GDB. | 5381 in GDB. |
4656 * Omissions from Ada:: Restrictions on the Ada expression syntax. | 5382 * Omissions from Ada:: Restrictions on the Ada expression syntax. |
4657 * Additions to Ada:: Extensions of the Ada expression syntax. | 5383 * Additions to Ada:: Extensions of the Ada expression syntax. |
4658 * Stopping Before Main Program:: Debugging the program during elaboration. | 5384 * Stopping Before Main Program:: Debugging the program during elaboration. |
4659 * Ada Tasks:: Listing and setting breakpoints in tasks. | 5385 * Ada Tasks:: Listing and setting breakpoints in tasks. |
4660 * Ada Tasks and Core Files:: Tasking Support when Debugging Core Files | 5386 * Ada Tasks and Core Files:: Tasking Support when Debugging Core Files |
4661 * Ravenscar Profile:: Tasking Support when using the Ravenscar | 5387 * Ravenscar Profile:: Tasking Support when using the Ravenscar |
4662 Profile | 5388 Profile |
4663 * Ada Glitches:: Known peculiarities of Ada mode. | 5389 * Ada Glitches:: Known peculiarities of Ada mode. |
4664 | 5390 |
4665 | 5391 |
4666 File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada | 5392 File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada |
4667 | 5393 |
4668 15.4.8.1 Introduction | 5394 15.4.9.1 Introduction |
4669 ..................... | 5395 ..................... |
4670 | 5396 |
4671 The Ada mode of GDB supports a fairly large subset of Ada expression | 5397 The Ada mode of GDB supports a fairly large subset of Ada expression |
4672 syntax, with some extensions. The philosophy behind the design of this | 5398 syntax, with some extensions. The philosophy behind the design of this |
4673 subset is | 5399 subset is |
4674 | 5400 |
4675 * That GDB should provide basic literals and access to operations for | 5401 * That GDB should provide basic literals and access to operations for |
4676 arithmetic, dereferencing, field selection, indexing, and | 5402 arithmetic, dereferencing, field selection, indexing, and |
4677 subprogram calls, leaving more sophisticated computations to | 5403 subprogram calls, leaving more sophisticated computations to |
4678 subprograms written into the program (which therefore may be | 5404 subprograms written into the program (which therefore may be |
(...skipping 22 matching lines...) Expand all Loading... |
4701 The debugger supports limited overloading. Given a subprogram call | 5427 The debugger supports limited overloading. Given a subprogram call |
4702 in which the function symbol has multiple definitions, it will use the | 5428 in which the function symbol has multiple definitions, it will use the |
4703 number of actual parameters and some information about their types to | 5429 number of actual parameters and some information about their types to |
4704 attempt to narrow the set of definitions. It also makes very limited | 5430 attempt to narrow the set of definitions. It also makes very limited |
4705 use of context, preferring procedures to functions in the context of | 5431 use of context, preferring procedures to functions in the context of |
4706 the `call' command, and functions to procedures elsewhere. | 5432 the `call' command, and functions to procedures elsewhere. |
4707 | 5433 |
4708 | 5434 |
4709 File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada M
ode Intro, Up: Ada | 5435 File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada M
ode Intro, Up: Ada |
4710 | 5436 |
4711 15.4.8.2 Omissions from Ada | 5437 15.4.9.2 Omissions from Ada |
4712 ........................... | 5438 ........................... |
4713 | 5439 |
4714 Here are the notable omissions from the subset: | 5440 Here are the notable omissions from the subset: |
4715 | 5441 |
4716 * Only a subset of the attributes are supported: | 5442 * Only a subset of the attributes are supported: |
4717 | 5443 |
4718 - 'First, 'Last, and 'Length on array objects (not on types | 5444 - 'First, 'Last, and 'Length on array objects (not on types |
4719 and subtypes). | 5445 and subtypes). |
4720 | 5446 |
4721 - 'Min and 'Max. | 5447 - 'Min and 'Max. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4807 | 5533 |
4808 * The names `True' and `False', when not part of a qualified name, | 5534 * The names `True' and `False', when not part of a qualified name, |
4809 are interpreted as if implicitly prefixed by `Standard', | 5535 are interpreted as if implicitly prefixed by `Standard', |
4810 regardless of context. Should your program redefine these names | 5536 regardless of context. Should your program redefine these names |
4811 in a package or procedure (at best a dubious practice), you will | 5537 in a package or procedure (at best a dubious practice), you will |
4812 have to use fully qualified names to access their new definitions. | 5538 have to use fully qualified names to access their new definitions. |
4813 | 5539 |
4814 | 5540 |
4815 File: gdb.info, Node: Additions to Ada, Next: Stopping Before Main Program, P
rev: Omissions from Ada, Up: Ada | 5541 File: gdb.info, Node: Additions to Ada, Next: Stopping Before Main Program, P
rev: Omissions from Ada, Up: Ada |
4816 | 5542 |
4817 15.4.8.3 Additions to Ada | 5543 15.4.9.3 Additions to Ada |
4818 ......................... | 5544 ......................... |
4819 | 5545 |
4820 As it does for other languages, GDB makes certain generic extensions to | 5546 As it does for other languages, GDB makes certain generic extensions to |
4821 Ada (*note Expressions::): | 5547 Ada (*note Expressions::): |
4822 | 5548 |
4823 * If the expression E is a variable residing in memory (typically a | 5549 * If the expression E is a variable residing in memory (typically a |
4824 local variable or array element) and N is a positive integer, then | 5550 local variable or array element) and N is a positive integer, then |
4825 `E@N' displays the values of E and the N-1 adjacent variables | 5551 `E@N' displays the values of E and the N-1 adjacent variables |
4826 following it in memory as an array. In Ada, this operator is | 5552 following it in memory as an array. In Ada, this operator is |
4827 generally not necessary, since its prime use is in displaying | 5553 generally not necessary, since its prime use is in displaying |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4898 * Printing an object of class-wide type or dereferencing an | 5624 * Printing an object of class-wide type or dereferencing an |
4899 access-to-class-wide value will display all the components of the | 5625 access-to-class-wide value will display all the components of the |
4900 object's specific type (as indicated by its run-time tag). | 5626 object's specific type (as indicated by its run-time tag). |
4901 Likewise, component selection on such a value will operate on the | 5627 Likewise, component selection on such a value will operate on the |
4902 specific type of the object. | 5628 specific type of the object. |
4903 | 5629 |
4904 | 5630 |
4905 | 5631 |
4906 File: gdb.info, Node: Stopping Before Main Program, Next: Ada Tasks, Prev: Ad
ditions to Ada, Up: Ada | 5632 File: gdb.info, Node: Stopping Before Main Program, Next: Ada Tasks, Prev: Ad
ditions to Ada, Up: Ada |
4907 | 5633 |
4908 15.4.8.4 Stopping at the Very Beginning | 5634 15.4.9.4 Stopping at the Very Beginning |
4909 ....................................... | 5635 ....................................... |
4910 | 5636 |
4911 It is sometimes necessary to debug the program during elaboration, and | 5637 It is sometimes necessary to debug the program during elaboration, and |
4912 before reaching the main procedure. As defined in the Ada Reference | 5638 before reaching the main procedure. As defined in the Ada Reference |
4913 Manual, the elaboration code is invoked from a procedure called | 5639 Manual, the elaboration code is invoked from a procedure called |
4914 `adainit'. To run your program up to the beginning of elaboration, | 5640 `adainit'. To run your program up to the beginning of elaboration, |
4915 simply use the following two commands: `tbreak adainit' and `run'. | 5641 simply use the following two commands: `tbreak adainit' and `run'. |
4916 | 5642 |
4917 | 5643 |
4918 File: gdb.info, Node: Ada Tasks, Next: Ada Tasks and Core Files, Prev: Stoppi
ng Before Main Program, Up: Ada | 5644 File: gdb.info, Node: Ada Tasks, Next: Ada Tasks and Core Files, Prev: Stoppi
ng Before Main Program, Up: Ada |
4919 | 5645 |
4920 15.4.8.5 Extensions for Ada Tasks | 5646 15.4.9.5 Extensions for Ada Tasks |
4921 ................................. | 5647 ................................. |
4922 | 5648 |
4923 Support for Ada tasks is analogous to that for threads (*note | 5649 Support for Ada tasks is analogous to that for threads (*note |
4924 Threads::). GDB provides the following task-related commands: | 5650 Threads::). GDB provides the following task-related commands: |
4925 | 5651 |
4926 `info tasks' | 5652 `info tasks' |
4927 This command shows a list of current Ada tasks, as in the | 5653 This command shows a list of current Ada tasks, as in the |
4928 following example: | 5654 following example: |
4929 | 5655 |
4930 (gdb) info tasks | 5656 (gdb) info tasks |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5086 (gdb) info tasks | 5812 (gdb) info tasks |
5087 ID TID P-ID Pri State Name | 5813 ID TID P-ID Pri State Name |
5088 1 140022020 0 15 Child Activation Wait main_task | 5814 1 140022020 0 15 Child Activation Wait main_task |
5089 * 2 140045060 1 15 Runnable t2 | 5815 * 2 140045060 1 15 Runnable t2 |
5090 3 140044840 1 15 Runnable t1 | 5816 3 140044840 1 15 Runnable t1 |
5091 4 140056040 1 15 Delay Sleep t3 | 5817 4 140056040 1 15 Delay Sleep t3 |
5092 | 5818 |
5093 | 5819 |
5094 File: gdb.info, Node: Ada Tasks and Core Files, Next: Ravenscar Profile, Prev
: Ada Tasks, Up: Ada | 5820 File: gdb.info, Node: Ada Tasks and Core Files, Next: Ravenscar Profile, Prev
: Ada Tasks, Up: Ada |
5095 | 5821 |
5096 15.4.8.6 Tasking Support when Debugging Core Files | 5822 15.4.9.6 Tasking Support when Debugging Core Files |
5097 .................................................. | 5823 .................................................. |
5098 | 5824 |
5099 When inspecting a core file, as opposed to debugging a live program, | 5825 When inspecting a core file, as opposed to debugging a live program, |
5100 tasking support may be limited or even unavailable, depending on the | 5826 tasking support may be limited or even unavailable, depending on the |
5101 platform being used. For instance, on x86-linux, the list of tasks is | 5827 platform being used. For instance, on x86-linux, the list of tasks is |
5102 available, but task switching is not supported. On Tru64, however, | 5828 available, but task switching is not supported. On Tru64, however, |
5103 task switching will work as usual. | 5829 task switching will work as usual. |
5104 | 5830 |
5105 On certain platforms, including Tru64, the debugger needs to perform | 5831 On certain platforms, including Tru64, the debugger needs to perform |
5106 some memory writes in order to provide Ada tasking support. When | 5832 some memory writes in order to provide Ada tasking support. When |
5107 inspecting a core file, this means that the core file must be opened | 5833 inspecting a core file, this means that the core file must be opened |
5108 with read-write privileges, using the command `"set write on"' (*note | 5834 with read-write privileges, using the command `"set write on"' (*note |
5109 Patching::). Under these circumstances, you should make a backup copy | 5835 Patching::). Under these circumstances, you should make a backup copy |
5110 of the core file before inspecting it with GDB. | 5836 of the core file before inspecting it with GDB. |
5111 | 5837 |
5112 | 5838 |
5113 File: gdb.info, Node: Ravenscar Profile, Next: Ada Glitches, Prev: Ada Tasks
and Core Files, Up: Ada | 5839 File: gdb.info, Node: Ravenscar Profile, Next: Ada Glitches, Prev: Ada Tasks
and Core Files, Up: Ada |
5114 | 5840 |
5115 15.4.8.7 Tasking Support when using the Ravenscar Profile | 5841 15.4.9.7 Tasking Support when using the Ravenscar Profile |
5116 ......................................................... | 5842 ......................................................... |
5117 | 5843 |
5118 The "Ravenscar Profile" is a subset of the Ada tasking features, | 5844 The "Ravenscar Profile" is a subset of the Ada tasking features, |
5119 specifically designed for systems with safety-critical real-time | 5845 specifically designed for systems with safety-critical real-time |
5120 requirements. | 5846 requirements. |
5121 | 5847 |
5122 `set ravenscar task-switching on' | 5848 `set ravenscar task-switching on' |
5123 Allows task switching when debugging a program that uses the | 5849 Allows task switching when debugging a program that uses the |
5124 Ravenscar Profile. This is the default. | 5850 Ravenscar Profile. This is the default. |
5125 | 5851 |
5126 `set ravenscar task-switching off' | 5852 `set ravenscar task-switching off' |
5127 Turn off task switching when debugging a program that uses the | 5853 Turn off task switching when debugging a program that uses the |
5128 Ravenscar Profile. This is mostly intended to disable the code | 5854 Ravenscar Profile. This is mostly intended to disable the code |
5129 that adds support for the Ravenscar Profile, in case a bug in | 5855 that adds support for the Ravenscar Profile, in case a bug in |
5130 either GDB or in the Ravenscar runtime is preventing GDB from | 5856 either GDB or in the Ravenscar runtime is preventing GDB from |
5131 working properly. To be effective, this command should be run | 5857 working properly. To be effective, this command should be run |
5132 before the program is started. | 5858 before the program is started. |
5133 | 5859 |
5134 `show ravenscar task-switching' | 5860 `show ravenscar task-switching' |
5135 Show whether it is possible to switch from task to task in a | 5861 Show whether it is possible to switch from task to task in a |
5136 program using the Ravenscar Profile. | 5862 program using the Ravenscar Profile. |
5137 | 5863 |
5138 | 5864 |
5139 | 5865 |
5140 File: gdb.info, Node: Ada Glitches, Prev: Ravenscar Profile, Up: Ada | 5866 File: gdb.info, Node: Ada Glitches, Prev: Ravenscar Profile, Up: Ada |
5141 | 5867 |
5142 15.4.8.8 Known Peculiarities of Ada Mode | 5868 15.4.9.8 Known Peculiarities of Ada Mode |
5143 ........................................ | 5869 ........................................ |
5144 | 5870 |
5145 Besides the omissions listed previously (*note Omissions from Ada::), | 5871 Besides the omissions listed previously (*note Omissions from Ada::), |
5146 we know of several problems with and limitations of Ada mode in GDB, | 5872 we know of several problems with and limitations of Ada mode in GDB, |
5147 some of which will be fixed with planned future releases of the debugger | 5873 some of which will be fixed with planned future releases of the debugger |
5148 and the GNU Ada compiler. | 5874 and the GNU Ada compiler. |
5149 | 5875 |
5150 * Static constants that the compiler chooses not to materialize as | 5876 * Static constants that the compiler chooses not to materialize as |
5151 objects in storage are invisible to the debugger. | 5877 objects in storage are invisible to the debugger. |
5152 | 5878 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5465 Display all Objective-C classes in your program, or (with the | 6191 Display all Objective-C classes in your program, or (with the |
5466 REGEXP argument) all those matching a particular regular | 6192 REGEXP argument) all those matching a particular regular |
5467 expression. | 6193 expression. |
5468 | 6194 |
5469 `info selectors' | 6195 `info selectors' |
5470 `info selectors REGEXP' | 6196 `info selectors REGEXP' |
5471 Display all Objective-C selectors in your program, or (with the | 6197 Display all Objective-C selectors in your program, or (with the |
5472 REGEXP argument) all those matching a particular regular | 6198 REGEXP argument) all those matching a particular regular |
5473 expression. | 6199 expression. |
5474 | 6200 |
5475 Some systems allow individual object files that make up your | |
5476 program to be replaced without stopping and restarting your | |
5477 program. For example, in VxWorks you can simply recompile a | |
5478 defective object file and keep on running. If you are running on | |
5479 one of these systems, you can allow GDB to reload the symbols for | |
5480 automatically relinked modules: | |
5481 | |
5482 `set symbol-reloading on' | |
5483 Replace symbol definitions for the corresponding source file | |
5484 when an object file with a particular name is seen again. | |
5485 | |
5486 `set symbol-reloading off' | |
5487 Do not replace symbol definitions when encountering object | |
5488 files of the same name more than once. This is the default | |
5489 state; if you are not running on a system that permits | |
5490 automatic relinking of modules, you should leave | |
5491 `symbol-reloading' off, since otherwise GDB may discard | |
5492 symbols when linking large programs, that may contain several | |
5493 modules (from different directories or libraries) with the | |
5494 same name. | |
5495 | |
5496 `show symbol-reloading' | |
5497 Show the current `on' or `off' setting. | |
5498 | |
5499 `set opaque-type-resolution on' | 6201 `set opaque-type-resolution on' |
5500 Tell GDB to resolve opaque types. An opaque type is a type | 6202 Tell GDB to resolve opaque types. An opaque type is a type |
5501 declared as a pointer to a `struct', `class', or `union'--for | 6203 declared as a pointer to a `struct', `class', or `union'--for |
5502 example, `struct MyType *'--that is used in one source file | 6204 example, `struct MyType *'--that is used in one source file |
5503 although the full declaration of `struct MyType' is in another | 6205 although the full declaration of `struct MyType' is in another |
5504 source file. The default is on. | 6206 source file. The default is on. |
5505 | 6207 |
5506 A change in the setting of this subcommand will not take effect | 6208 A change in the setting of this subcommand will not take effect |
5507 until the next time symbols for a file are loaded. | 6209 until the next time symbols for a file are loaded. |
5508 | 6210 |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6286 after typing `run'. If REGEX is omitted all shared libraries | 6988 after typing `run'. If REGEX is omitted all shared libraries |
6287 required by your program are loaded. | 6989 required by your program are loaded. |
6288 | 6990 |
6289 `nosharedlibrary' | 6991 `nosharedlibrary' |
6290 Unload all shared object library symbols. This discards all | 6992 Unload all shared object library symbols. This discards all |
6291 symbols that have been loaded from all shared libraries. Symbols | 6993 symbols that have been loaded from all shared libraries. Symbols |
6292 from shared libraries that were loaded by explicit user requests | 6994 from shared libraries that were loaded by explicit user requests |
6293 are not discarded. | 6995 are not discarded. |
6294 | 6996 |
6295 Sometimes you may wish that GDB stops and gives you control when any | 6997 Sometimes you may wish that GDB stops and gives you control when any |
6296 of shared library events happen. Use the `set stop-on-solib-events' | 6998 of shared library events happen. The best way to do this is to use |
6297 command for this: | 6999 `catch load' and `catch unload' (*note Set Catchpoints::). |
| 7000 |
| 7001 GDB also supports the the `set stop-on-solib-events' command for |
| 7002 this. This command exists for historical reasons. It is less useful |
| 7003 than setting a catchpoint, because it does not allow for conditions or |
| 7004 commands as a catchpoint does. |
6298 | 7005 |
6299 `set stop-on-solib-events' | 7006 `set stop-on-solib-events' |
6300 This command controls whether GDB should give you control when the | 7007 This command controls whether GDB should give you control when the |
6301 dynamic linker notifies it about some shared library event. The | 7008 dynamic linker notifies it about some shared library event. The |
6302 most common event of interest is loading or unloading of a new | 7009 most common event of interest is loading or unloading of a new |
6303 shared library. | 7010 shared library. |
6304 | 7011 |
6305 `show stop-on-solib-events' | 7012 `show stop-on-solib-events' |
6306 Show whether GDB stops and gives you control when shared library | 7013 Show whether GDB stops and gives you control when shared library |
6307 events happen. | 7014 events happen. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6507 command-line option in *Note Command Line Options: | 7214 command-line option in *Note Command Line Options: |
6508 (ld.info)Options. The debug info file's name is not specified | 7215 (ld.info)Options. The debug info file's name is not specified |
6509 explicitly by the build ID, but can be computed from the build ID, | 7216 explicitly by the build ID, but can be computed from the build ID, |
6510 see below. | 7217 see below. |
6511 | 7218 |
6512 Depending on the way the debug info file is specified, GDB uses two | 7219 Depending on the way the debug info file is specified, GDB uses two |
6513 different methods of looking for the debug file: | 7220 different methods of looking for the debug file: |
6514 | 7221 |
6515 * For the "debug link" method, GDB looks up the named file in the | 7222 * For the "debug link" method, GDB looks up the named file in the |
6516 directory of the executable file, then in a subdirectory of that | 7223 directory of the executable file, then in a subdirectory of that |
6517 directory named `.debug', and finally under the global debug | 7224 directory named `.debug', and finally under each one of the global |
6518 directory, in a subdirectory whose name is identical to the leading | 7225 debug directories, in a subdirectory whose name is identical to |
6519 directories of the executable's absolute file name. | 7226 the leading directories of the executable's absolute file name. |
6520 | 7227 |
6521 * For the "build ID" method, GDB looks in the `.build-id' | 7228 * For the "build ID" method, GDB looks in the `.build-id' |
6522 subdirectory of the global debug directory for a file named | 7229 subdirectory of each one of the global debug directories for a |
6523 `NN/NNNNNNNN.debug', where NN are the first 2 hex characters of | 7230 file named `NN/NNNNNNNN.debug', where NN are the first 2 hex |
6524 the build ID bit string, and NNNNNNNN are the rest of the bit | 7231 characters of the build ID bit string, and NNNNNNNN are the rest |
6525 string. (Real build ID strings are 32 or more hex characters, not | 7232 of the bit string. (Real build ID strings are 32 or more hex |
6526 10.) | 7233 characters, not 10.) |
6527 | 7234 |
6528 So, for example, suppose you ask GDB to debug `/usr/bin/ls', which | 7235 So, for example, suppose you ask GDB to debug `/usr/bin/ls', which |
6529 has a debug link that specifies the file `ls.debug', and a build ID | 7236 has a debug link that specifies the file `ls.debug', and a build ID |
6530 whose value in hex is `abcdef1234'. If the global debug directory is | 7237 whose value in hex is `abcdef1234'. If the list of the global debug |
6531 `/usr/lib/debug', then GDB will look for the following debug | 7238 directories includes `/usr/lib/debug', then GDB will look for the |
6532 information files, in the indicated order: | 7239 following debug information files, in the indicated order: |
6533 | 7240 |
6534 - `/usr/lib/debug/.build-id/ab/cdef1234.debug' | 7241 - `/usr/lib/debug/.build-id/ab/cdef1234.debug' |
6535 | 7242 |
6536 - `/usr/bin/ls.debug' | 7243 - `/usr/bin/ls.debug' |
6537 | 7244 |
6538 - `/usr/bin/.debug/ls.debug' | 7245 - `/usr/bin/.debug/ls.debug' |
6539 | 7246 |
6540 - `/usr/lib/debug/usr/bin/ls.debug'. | 7247 - `/usr/lib/debug/usr/bin/ls.debug'. |
6541 | 7248 |
6542 You can set the global debugging info directory's name, and view the | 7249 Global debugging info directories default to what is set by GDB |
6543 name GDB is currently using. | 7250 configure option `--with-separate-debug-dir'. During GDB run you can |
| 7251 also set the global debugging info directories, and view the list GDB |
| 7252 is currently using. |
6544 | 7253 |
6545 `set debug-file-directory DIRECTORIES' | 7254 `set debug-file-directory DIRECTORIES' |
6546 Set the directories which GDB searches for separate debugging | 7255 Set the directories which GDB searches for separate debugging |
6547 information files to DIRECTORY. Multiple directory components can | 7256 information files to DIRECTORY. Multiple path components can be |
6548 be set concatenating them by a directory separator. | 7257 set concatenating them by a path separator. |
6549 | 7258 |
6550 `show debug-file-directory' | 7259 `show debug-file-directory' |
6551 Show the directories GDB searches for separate debugging | 7260 Show the directories GDB searches for separate debugging |
6552 information files. | 7261 information files. |
6553 | 7262 |
6554 | 7263 |
6555 A debug link is a special section of the executable file named | 7264 A debug link is a special section of the executable file named |
6556 `.gnu_debuglink'. The section must contain: | 7265 `.gnu_debuglink'. The section must contain: |
6557 | 7266 |
6558 * A filename, with any leading directory components removed, | 7267 * A filename, with any leading directory components removed, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6729 Create an index file for each symbol file currently known by GDB. | 7438 Create an index file for each symbol file currently known by GDB. |
6730 Each file is named after its corresponding symbol file, with | 7439 Each file is named after its corresponding symbol file, with |
6731 `.gdb-index' appended, and is written into the given DIRECTORY. | 7440 `.gdb-index' appended, and is written into the given DIRECTORY. |
6732 | 7441 |
6733 Once you have created an index file you can merge it into your symbol | 7442 Once you have created an index file you can merge it into your symbol |
6734 file, here named `symfile', using `objcopy': | 7443 file, here named `symfile', using `objcopy': |
6735 | 7444 |
6736 $ objcopy --add-section .gdb_index=symfile.gdb-index \ | 7445 $ objcopy --add-section .gdb_index=symfile.gdb-index \ |
6737 --set-section-flags .gdb_index=readonly symfile symfile | 7446 --set-section-flags .gdb_index=readonly symfile symfile |
6738 | 7447 |
| 7448 GDB will normally ignore older versions of `.gdb_index' sections |
| 7449 that have been deprecated. Usually they are deprecated because they |
| 7450 are missing a new feature or have performance issues. To tell GDB to |
| 7451 use a deprecated index section anyway specify `set |
| 7452 use-deprecated-index-sections on'. The default is `off'. This can |
| 7453 speed up startup, but may result in some functionality being lost. |
| 7454 *Note Index Section Format::. |
| 7455 |
| 7456 _Warning:_ Setting `use-deprecated-index-sections' to `on' must be |
| 7457 done before gdb reads the file. The following will not work: |
| 7458 |
| 7459 $ gdb -ex "set use-deprecated-index-sections on" <program> |
| 7460 |
| 7461 Instead you must do, for example, |
| 7462 |
| 7463 $ gdb -iex "set use-deprecated-index-sections on" <program> |
| 7464 |
6739 There are currently some limitation on indices. They only work when | 7465 There are currently some limitation on indices. They only work when |
6740 for DWARF debugging information, not stabs. And, they do not currently | 7466 for DWARF debugging information, not stabs. And, they do not currently |
6741 work for programs using Ada. | 7467 work for programs using Ada. |
6742 | 7468 |
6743 | |
6744 File: gdb.info, Node: Symbol Errors, Next: Data Files, Prev: Index Files, Up
: GDB Files | |
6745 | |
6746 18.4 Errors Reading Symbol Files | |
6747 ================================ | |
6748 | |
6749 While reading a symbol file, GDB occasionally encounters problems, such | |
6750 as symbol types it does not recognize, or known bugs in compiler | |
6751 output. By default, GDB does not notify you of such problems, since | |
6752 they are relatively common and primarily of interest to people | |
6753 debugging compilers. If you are interested in seeing information about | |
6754 ill-constructed symbol tables, you can either ask GDB to print only one | |
6755 message about each such type of problem, no matter how many times the | |
6756 problem occurs; or you can ask GDB to print more messages, to see how | |
6757 many times the problems occur, with the `set complaints' command (*note | |
6758 Optional Warnings and Messages: Messages/Warnings.). | |
6759 | |
6760 The messages currently printed, and their meanings, include: | |
6761 | |
6762 `inner block not inside outer block in SYMBOL' | |
6763 The symbol information shows where symbol scopes begin and end | |
6764 (such as at the start of a function or a block of statements). | |
6765 This error indicates that an inner scope block is not fully | |
6766 contained in its outer scope blocks. | |
6767 | |
6768 GDB circumvents the problem by treating the inner block as if it | |
6769 had the same scope as the outer block. In the error message, | |
6770 SYMBOL may be shown as "`(don't know)'" if the outer block is not a | |
6771 function. | |
6772 | |
6773 `block at ADDRESS out of order' | |
6774 The symbol information for symbol scope blocks should occur in | |
6775 order of increasing addresses. This error indicates that it does | |
6776 not do so. | |
6777 | |
6778 GDB does not circumvent this problem, and has trouble locating | |
6779 symbols in the source file whose symbols it is reading. (You can | |
6780 often determine what source file is affected by specifying `set | |
6781 verbose on'. *Note Optional Warnings and Messages: | |
6782 Messages/Warnings.) | |
6783 | |
6784 `bad block start address patched' | |
6785 The symbol information for a symbol scope block has a start address | |
6786 smaller than the address of the preceding source line. This is | |
6787 known to occur in the SunOS 4.1.1 (and earlier) C compiler. | |
6788 | |
6789 GDB circumvents the problem by treating the symbol scope block as | |
6790 starting on the previous source line. | |
6791 | |
6792 `bad string table offset in symbol N' | |
6793 Symbol number N contains a pointer into the string table which is | |
6794 larger than the size of the string table. | |
6795 | |
6796 GDB circumvents the problem by considering the symbol to have the | |
6797 name `foo', which may cause other problems if many symbols end up | |
6798 with this name. | |
6799 | |
6800 `unknown symbol type `0xNN'' | |
6801 The symbol information contains new data types that GDB does not | |
6802 yet know how to read. `0xNN' is the symbol type of the | |
6803 uncomprehended information, in hexadecimal. | |
6804 | |
6805 GDB circumvents the error by ignoring this symbol information. | |
6806 This usually allows you to debug your program, though certain | |
6807 symbols are not accessible. If you encounter such a problem and | |
6808 feel like debugging it, you can debug `gdb' with itself, breakpoint | |
6809 on `complain', then go up to the function `read_dbx_symtab' and | |
6810 examine `*bufp' to see the symbol. | |
6811 | |
6812 `stub type has NULL name' | |
6813 GDB could not find the full definition for a struct or class. | |
6814 | |
6815 `const/volatile indicator missing (ok if using g++ v1.x), got...' | |
6816 The symbol information for a C++ member function is missing some | |
6817 information that recent versions of the compiler should have | |
6818 output for it. | |
6819 | |
6820 `info mismatch between compiler and debugger' | |
6821 GDB could not parse a type specification output by the compiler. | |
6822 | |
6823 | |
6824 | |
6825 File: gdb.info, Node: Data Files, Prev: Symbol Errors, Up: GDB Files | |
6826 | |
6827 18.5 GDB Data Files | |
6828 =================== | |
6829 | |
6830 GDB will sometimes read an auxiliary data file. These files are kept | |
6831 in a directory known as the "data directory". | |
6832 | |
6833 You can set the data directory's name, and view the name GDB is | |
6834 currently using. | |
6835 | |
6836 `set data-directory DIRECTORY' | |
6837 Set the directory which GDB searches for auxiliary data files to | |
6838 DIRECTORY. | |
6839 | |
6840 `show data-directory' | |
6841 Show the directory GDB searches for auxiliary data files. | |
6842 | |
6843 You can set the default data directory by using the configure-time | |
6844 `--with-gdb-datadir' option. If the data directory is inside GDB's | |
6845 configured binary prefix (set with `--prefix' or `--exec-prefix'), then | |
6846 the default data directory will be updated automatically if the | |
6847 installed GDB is moved to a new location. | |
6848 | |
6849 The data directory may also be specified with the `--data-directory' | |
6850 command line option. *Note Mode Options::. | |
6851 | |
6852 | |
6853 File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up:
Top | |
6854 | |
6855 19 Specifying a Debugging Target | |
6856 ******************************** | |
6857 | |
6858 A "target" is the execution environment occupied by your program. | |
6859 | |
6860 Often, GDB runs in the same host environment as your program; in | |
6861 that case, the debugging target is specified as a side effect when you | |
6862 use the `file' or `core' commands. When you need more flexibility--for | |
6863 example, running GDB on a physically separate host, or controlling a | |
6864 standalone system over a serial port or a realtime system over a TCP/IP | |
6865 connection--you can use the `target' command to specify one of the | |
6866 target types configured for GDB (*note Commands for Managing Targets: | |
6867 Target Commands.). | |
6868 | |
6869 It is possible to build GDB for several different "target | |
6870 architectures". When GDB is built like that, you can choose one of the | |
6871 available architectures with the `set architecture' command. | |
6872 | |
6873 `set architecture ARCH' | |
6874 This command sets the current target architecture to ARCH. The | |
6875 value of ARCH can be `"auto"', in addition to one of the supported | |
6876 architectures. | |
6877 | |
6878 `show architecture' | |
6879 Show the current target architecture. | |
6880 | |
6881 `set processor' | |
6882 `processor' | |
6883 These are alias commands for, respectively, `set architecture' and | |
6884 `show architecture'. | |
6885 | |
6886 * Menu: | |
6887 | |
6888 * Active Targets:: Active targets | |
6889 * Target Commands:: Commands for managing targets | |
6890 * Byte Order:: Choosing target byte order | |
6891 | |
6892 | |
6893 File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets | |
6894 | |
6895 19.1 Active Targets | |
6896 =================== | |
6897 | |
6898 There are multiple classes of targets such as: processes, executable | |
6899 files or recording sessions. Core files belong to the process class, | |
6900 making core file and process mutually exclusive. Otherwise, GDB can | |
6901 work concurrently on multiple active targets, one in each class. This | |
6902 allows you to (for example) start a process and inspect its activity, | |
6903 while still having access to the executable file after the process | |
6904 finishes. Or if you start process recording (*note Reverse | |
6905 Execution::) and `reverse-step' there, you are presented a virtual | |
6906 layer of the recording target, while the process target remains stopped | |
6907 at the chronologically last point of the process execution. | |
6908 | |
6909 Use the `core-file' and `exec-file' commands to select a new core | |
6910 file or executable target (*note Commands to Specify Files: Files.). To | |
6911 specify as a target a process that is already running, use the `attach' | |
6912 command (*note Debugging an Already-running Process: Attach.). | |
6913 | |
6914 | |
6915 File: gdb.info, Node: Target Commands, Next: Byte Order, Prev: Active Targets
, Up: Targets | |
6916 | |
6917 19.2 Commands for Managing Targets | |
6918 ================================== | |
6919 | |
6920 `target TYPE PARAMETERS' | |
6921 Connects the GDB host environment to a target machine or process. | |
6922 A target is typically a protocol for talking to debugging | |
6923 facilities. You use the argument TYPE to specify the type or | |
6924 protocol of the target machine. | |
6925 | |
6926 Further PARAMETERS are interpreted by the target protocol, but | |
6927 typically include things like device names or host names to connect | |
6928 with, process numbers, and baud rates. | |
6929 | |
6930 The `target' command does not repeat if you press <RET> again | |
6931 after executing the command. | |
6932 | |
6933 `help target' | |
6934 Displays the names of all targets available. To display targets | |
6935 currently selected, use either `info target' or `info files' | |
6936 (*note Commands to Specify Files: Files.). | |
6937 | |
6938 `help target NAME' | |
6939 Describe a particular target, including any parameters necessary to | |
6940 select it. | |
6941 | |
6942 `set gnutarget ARGS' | |
6943 GDB uses its own library BFD to read your files. GDB knows | |
6944 whether it is reading an "executable", a "core", or a ".o" file; | |
6945 however, you can specify the file format with the `set gnutarget' | |
6946 command. Unlike most `target' commands, with `gnutarget' the | |
6947 `target' refers to a program, not a machine. | |
6948 | |
6949 _Warning:_ To specify a file format with `set gnutarget', you | |
6950 must know the actual BFD name. | |
6951 | |
6952 *Note Commands to Specify Files: Files. | |
6953 | |
6954 `show gnutarget' | |
6955 Use the `show gnutarget' command to display what file format | |
6956 `gnutarget' is set to read. If you have not set `gnutarget', GDB | |
6957 will determine the file format for each file automatically, and | |
6958 `show gnutarget' displays `The current BDF target is "auto"'. | |
6959 | |
6960 Here are some common targets (available, or not, depending on the GDB | |
6961 configuration): | |
6962 | |
6963 `target exec PROGRAM' | |
6964 An executable file. `target exec PROGRAM' is the same as | |
6965 `exec-file PROGRAM'. | |
6966 | |
6967 `target core FILENAME' | |
6968 A core dump file. `target core FILENAME' is the same as | |
6969 `core-file FILENAME'. | |
6970 | |
6971 `target remote MEDIUM' | |
6972 A remote system connected to GDB via a serial line or network | |
6973 connection. This command tells GDB to use its own remote protocol | |
6974 over MEDIUM for debugging. *Note Remote Debugging::. | |
6975 | |
6976 For example, if you have a board connected to `/dev/ttya' on the | |
6977 machine running GDB, you could say: | |
6978 | |
6979 target remote /dev/ttya | |
6980 | |
6981 `target remote' supports the `load' command. This is only useful | |
6982 if you have some other way of getting the stub to the target | |
6983 system, and you can put it somewhere in memory where it won't get | |
6984 clobbered by the download. | |
6985 | |
6986 `target sim [SIMARGS] ...' | |
6987 Builtin CPU simulator. GDB includes simulators for most | |
6988 architectures. In general, | |
6989 target sim | |
6990 load | |
6991 run | |
6992 works; however, you cannot assume that a specific memory map, | |
6993 device drivers, or even basic I/O is available, although some | |
6994 simulators do provide these. For info about any | |
6995 processor-specific simulator details, see the appropriate section | |
6996 in *Note Embedded Processors: Embedded Processors. | |
6997 | |
6998 | |
6999 Some configurations may include these targets as well: | |
7000 | |
7001 `target nrom DEV' | |
7002 NetROM ROM emulator. This target only supports downloading. | |
7003 | |
7004 | |
7005 Different targets are available on different configurations of GDB; | |
7006 your configuration may have more or fewer targets. | |
7007 | |
7008 Many remote targets require you to download the executable's code | |
7009 once you've successfully established a connection. You may wish to | |
7010 control various aspects of this process. | |
7011 | |
7012 `set hash' | |
7013 This command controls whether a hash mark `#' is displayed while | |
7014 downloading a file to the remote monitor. If on, a hash mark is | |
7015 displayed after each S-record is successfully downloaded to the | |
7016 monitor. | |
7017 | |
7018 `show hash' | |
7019 Show the current status of displaying the hash mark. | |
7020 | |
7021 `set debug monitor' | |
7022 Enable or disable display of communications messages between GDB | |
7023 and the remote monitor. | |
7024 | |
7025 `show debug monitor' | |
7026 Show the current status of displaying communications between GDB | |
7027 and the remote monitor. | |
7028 | |
7029 `load FILENAME' | |
7030 Depending on what remote debugging facilities are configured into | |
7031 GDB, the `load' command may be available. Where it exists, it is | |
7032 meant to make FILENAME (an executable) available for debugging on | |
7033 the remote system--by downloading, or dynamic linking, for example. | |
7034 `load' also records the FILENAME symbol table in GDB, like the | |
7035 `add-symbol-file' command. | |
7036 | |
7037 If your GDB does not have a `load' command, attempting to execute | |
7038 it gets the error message "`You can't do that when your target is | |
7039 ...'" | |
7040 | |
7041 The file is loaded at whatever address is specified in the | |
7042 executable. For some object file formats, you can specify the | |
7043 load address when you link the program; for other formats, like | |
7044 a.out, the object file format specifies a fixed address. | |
7045 | |
7046 Depending on the remote side capabilities, GDB may be able to load | |
7047 programs into flash memory. | |
7048 | |
7049 `load' does not repeat if you press <RET> again after using it. | |
7050 | |
7051 | |
7052 File: gdb.info, Node: Byte Order, Prev: Target Commands, Up: Targets | |
7053 | |
7054 19.3 Choosing Target Byte Order | |
7055 =============================== | |
7056 | |
7057 Some types of processors, such as the MIPS, PowerPC, and Renesas SH, | |
7058 offer the ability to run either big-endian or little-endian byte | |
7059 orders. Usually the executable or symbol will include a bit to | |
7060 designate the endian-ness, and you will not need to worry about which | |
7061 to use. However, you may still find it useful to adjust GDB's idea of | |
7062 processor endian-ness manually. | |
7063 | |
7064 `set endian big' | |
7065 Instruct GDB to assume the target is big-endian. | |
7066 | |
7067 `set endian little' | |
7068 Instruct GDB to assume the target is little-endian. | |
7069 | |
7070 `set endian auto' | |
7071 Instruct GDB to use the byte order associated with the executable. | |
7072 | |
7073 `show endian' | |
7074 Display GDB's current idea of the target byte order. | |
7075 | |
7076 | |
7077 Note that these commands merely adjust interpretation of symbolic | |
7078 data on the host, and that they have absolutely no effect on the target | |
7079 system. | |
7080 | |
7081 | |
7082 File: gdb.info, Node: Remote Debugging, Next: Configurations, Prev: Targets,
Up: Top | |
7083 | |
7084 20 Debugging Remote Programs | |
7085 **************************** | |
7086 | |
7087 If you are trying to debug a program running on a machine that cannot | |
7088 run GDB in the usual way, it is often useful to use remote debugging. | |
7089 For example, you might use remote debugging on an operating system | |
7090 kernel, or on a small system which does not have a general purpose | |
7091 operating system powerful enough to run a full-featured debugger. | |
7092 | |
7093 Some configurations of GDB have special serial or TCP/IP interfaces | |
7094 to make this work with particular debugging targets. In addition, GDB | |
7095 comes with a generic serial protocol (specific to GDB, but not specific | |
7096 to any particular target system) which you can use if you write the | |
7097 remote stubs--the code that runs on the remote system to communicate | |
7098 with GDB. | |
7099 | |
7100 Other remote targets may be available in your configuration of GDB; | |
7101 use `help target' to list them. | |
7102 | |
7103 * Menu: | |
7104 | |
7105 * Connecting:: Connecting to a remote target | |
7106 * File Transfer:: Sending files to a remote system | |
7107 * Server:: Using the gdbserver program | |
7108 * Remote Configuration:: Remote configuration | |
7109 * Remote Stub:: Implementing a remote stub | |
7110 | |
7111 | |
7112 File: gdb.info, Node: Connecting, Next: File Transfer, Up: Remote Debugging | |
7113 | |
7114 20.1 Connecting to a Remote Target | |
7115 ================================== | |
7116 | |
7117 On the GDB host machine, you will need an unstripped copy of your | |
7118 program, since GDB needs symbol and debugging information. Start up | |
7119 GDB as usual, using the name of the local copy of your program as the | |
7120 first argument. | |
7121 | |
7122 GDB can communicate with the target over a serial line, or over an | |
7123 IP network using TCP or UDP. In each case, GDB uses the same protocol | |
7124 for debugging your program; only the medium carrying the debugging | |
7125 packets varies. The `target remote' command establishes a connection | |
7126 to the target. Its arguments indicate which medium to use: | |
7127 | |
7128 `target remote SERIAL-DEVICE' | |
7129 Use SERIAL-DEVICE to communicate with the target. For example, to | |
7130 use a serial line connected to the device named `/dev/ttyb': | |
7131 | |
7132 target remote /dev/ttyb | |
7133 | |
7134 If you're using a serial line, you may want to give GDB the | |
7135 `--baud' option, or use the `set remotebaud' command (*note set | |
7136 remotebaud: Remote Configuration.) before the `target' command. | |
7137 | |
7138 `target remote `HOST:PORT'' | |
7139 `target remote `tcp:HOST:PORT'' | |
7140 Debug using a TCP connection to PORT on HOST. The HOST may be | |
7141 either a host name or a numeric IP address; PORT must be a decimal | |
7142 number. The HOST could be the target machine itself, if it is | |
7143 directly connected to the net, or it might be a terminal server | |
7144 which in turn has a serial line to the target. | |
7145 | |
7146 For example, to connect to port 2828 on a terminal server named | |
7147 `manyfarms': | |
7148 | |
7149 target remote manyfarms:2828 | |
7150 | |
7151 If your remote target is actually running on the same machine as | |
7152 your debugger session (e.g. a simulator for your target running on | |
7153 the same host), you can omit the hostname. For example, to | |
7154 connect to port 1234 on your local machine: | |
7155 | |
7156 target remote :1234 | |
7157 Note that the colon is still required here. | |
7158 | |
7159 `target remote `udp:HOST:PORT'' | |
7160 Debug using UDP packets to PORT on HOST. For example, to connect | |
7161 to UDP port 2828 on a terminal server named `manyfarms': | |
7162 | |
7163 target remote udp:manyfarms:2828 | |
7164 | |
7165 When using a UDP connection for remote debugging, you should keep | |
7166 in mind that the `U' stands for "Unreliable". UDP can silently | |
7167 drop packets on busy or unreliable networks, which will cause | |
7168 havoc with your debugging session. | |
7169 | |
7170 `target remote | COMMAND' | |
7171 Run COMMAND in the background and communicate with it using a | |
7172 pipe. The COMMAND is a shell command, to be parsed and expanded | |
7173 by the system's command shell, `/bin/sh'; it should expect remote | |
7174 protocol packets on its standard input, and send replies on its | |
7175 standard output. You could use this to run a stand-alone simulator | |
7176 that speaks the remote debugging protocol, to make net connections | |
7177 using programs like `ssh', or for other similar tricks. | |
7178 | |
7179 If COMMAND closes its standard output (perhaps by exiting), GDB | |
7180 will try to send it a `SIGTERM' signal. (If the program has | |
7181 already exited, this will have no effect.) | |
7182 | |
7183 | |
7184 Once the connection has been established, you can use all the usual | |
7185 commands to examine and change data. The remote program is already | |
7186 running; you can use `step' and `continue', and you do not need to use | |
7187 `run'. | |
7188 | |
7189 Whenever GDB is waiting for the remote program, if you type the | |
7190 interrupt character (often `Ctrl-c'), GDB attempts to stop the program. | |
7191 This may or may not succeed, depending in part on the hardware and the | |
7192 serial drivers the remote system uses. If you type the interrupt | |
7193 character once again, GDB displays this prompt: | |
7194 | |
7195 Interrupted while waiting for the program. | |
7196 Give up (and stop debugging it)? (y or n) | |
7197 | |
7198 If you type `y', GDB abandons the remote debugging session. (If you | |
7199 decide you want to try again later, you can use `target remote' again | |
7200 to connect once more.) If you type `n', GDB goes back to waiting. | |
7201 | |
7202 `detach' | |
7203 When you have finished debugging the remote program, you can use | |
7204 the `detach' command to release it from GDB control. Detaching | |
7205 from the target normally resumes its execution, but the results | |
7206 will depend on your particular remote stub. After the `detach' | |
7207 command, GDB is free to connect to another target. | |
7208 | |
7209 `disconnect' | |
7210 The `disconnect' command behaves like `detach', except that the | |
7211 target is generally not resumed. It will wait for GDB (this | |
7212 instance or another one) to connect and continue debugging. After | |
7213 the `disconnect' command, GDB is again free to connect to another | |
7214 target. | |
7215 | |
7216 `monitor CMD' | |
7217 This command allows you to send arbitrary commands directly to the | |
7218 remote monitor. Since GDB doesn't care about the commands it | |
7219 sends like this, this command is the way to extend GDB--you can | |
7220 add new commands that only the external monitor will understand | |
7221 and implement. | |
7222 | |
7223 | |
7224 File: gdb.info, Node: File Transfer, Next: Server, Prev: Connecting, Up: Rem
ote Debugging | |
7225 | |
7226 20.2 Sending files to a remote system | |
7227 ===================================== | |
7228 | |
7229 Some remote targets offer the ability to transfer files over the same | |
7230 connection used to communicate with GDB. This is convenient for | |
7231 targets accessible through other means, e.g. GNU/Linux systems running | |
7232 `gdbserver' over a network interface. For other targets, e.g. embedded | |
7233 devices with only a single serial port, this may be the only way to | |
7234 upload or download files. | |
7235 | |
7236 Not all remote targets support these commands. | |
7237 | |
7238 `remote put HOSTFILE TARGETFILE' | |
7239 Copy file HOSTFILE from the host system (the machine running GDB) | |
7240 to TARGETFILE on the target system. | |
7241 | |
7242 `remote get TARGETFILE HOSTFILE' | |
7243 Copy file TARGETFILE from the target system to HOSTFILE on the | |
7244 host system. | |
7245 | |
7246 `remote delete TARGETFILE' | |
7247 Delete TARGETFILE from the target system. | |
7248 | |
7249 | |
OLD | NEW |