Resumen del contenido incluido en la página 1
D ebugging w ith GD B Man ual
T he GNU S o ur ce -L e v e l D ebugge r
HP P ar t Numbe r : 5 9 9 2 - 4 7 0 1
P u blished: F ebr uar y 200 9
E diti o n: 1 9
Resumen del contenido incluido en la página 2
© Copyright 2009 Hewlett-Packard Development Company, L.P. Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. The information contained herein is subject to change without notice. The only warranties for HP products and services are s
Resumen del contenido incluido en la página 3
T a ble o f C o n t e n ts Summar y o f GD B........................................................................................................................ 15 Free Software......................................................................................................................15 Contributors to GDB...........................................................................................................15 1 A S am ple GD B S e s si o n.......................................
Resumen del contenido incluido en la página 4
4.9 Debugging programs with multiple threads................................................................46 4.10 Debugging programs with multiple processes...........................................................49 5 S t opp ing and C o n tin uing.......................................................................................................... 51 5.1 Breakpoints....................................................................................................................51 5.1.
Resumen del contenido incluido en la página 5
8.11 Printing Floating Point Values....................................................................................99 8.12 Floating point hardware..............................................................................................99 9 U sing GD B w ith Diff e r e n t L anguage s........................................................................................ 101 9.1 Switching between source languages..........................................................................10
Resumen del contenido incluido en la página 6
1 3 S pec if y ing a D ebugging T ar ge t.............................................................................................. 133 13.1 Active targets.............................................................................................................133 13.2 Commands for managing targets..............................................................................133 13.3 Choosing target byte order.................................................................................
Resumen del contenido incluido en la página 7
14.10.8 Scenarios in memory debugging.....................................................................174 14.10.8.1 Stop when freeing unallocated or deallocated blocks.............................174 14.10.8.2 Stop when freeing a block if bad writes occurred outside block boundary................................................................................................................174 14.10.8.3 Stop when a specified block address is allocated or deallocated............175 14.10.8.4
Resumen del contenido incluido en la página 8
14.15.2 Support for theinfo target Command.....................................................201 14.15.3 Support for thedumpcore command.............................................................202 14.15.3.1 Enhancements to thedumpcore command............................................202 14.15.4 Support for display of run time type information..........................................203 14.16 Printing the Execution Path Entries for the Current Frame or Thread...................203 14.16.
Resumen del contenido incluido en la página 9
14.25.3 Support for_ _fpreg data type on IPF.........................................................222 14.25.4 Support for _Complex variables in HP C........................................................222 14.25.5 Support for debugging namespaces................................................................222 14.25.6 Command for evaluating the address of an expression..................................223 14.26 Viewing Wide Character Strings................................................
Resumen del contenido incluido en la página 10
14.35.3.1 Printing of locals and globals in a stripped module...............................240 14.35.3.2 Backtrace on stripped frames..................................................................240 14.35.3.3 Command line calls to non-stripped library...........................................240 14.35.3.4 Setting breakpoints in unstripped shared library...................................240 14.36 Displaying the current block scope information................................................
Resumen del contenido incluido en la página 11
16.2.10 Miscellaneous commands................................................................................265 16.3 XDB data formats and HP WDB equivalents............................................................266 16.4 XDB location syntax and HP WDB equivalents........................................................268 16.5 XDB special language operators and HP WDB equivalents.....................................268 16.6 XDB special variables and HP WDB equivalents.......................
Resumen del contenido incluido en la página 12
20.7 Errors.........................................................................................................................302 20.8 Information on breakpoints.......................................................................................302 20.9 Invalidation notices...................................................................................................303 20.10 Running the program.........................................................................................
Resumen del contenido incluido en la página 13
L is t o f T a ble s 14-1 Memory Debugging Commands in Interactive and Batch Mode.............................177 16-1 Invocation commands...............................................................................................254 16-2 Window mode commands........................................................................................254 16-3 File viewing commands............................................................................................255 16-4 Data viewing and mo
Resumen del contenido incluido en la página 14
L is t o f Ex am ple s 14-1 Sample Output for thefind command....................................................................198 14-2 Sample Commands to Print NaT Registers...............................................................214 14 List of Examples
Resumen del contenido incluido en la página 15
Summar y o f GD B The purpose of a debugger such as GDB is to allow you to see what is going on “inside” another program while it executes―or what another program was doing at the moment it crashed. GDB allows you to do the following: • Load the executable along with any required arguments. • Stop your program on specified blocks of code. • Examine your program when it has stopped running due to an error. • Change things in your program, so you can experiment with correcting the effects of one b
Resumen del contenido incluido en la página 16
Plea: Additions to this section are particularly welcome. If you or your friends (or enemies, to be evenhanded) have been unfairly omitted from this list, we would like to add your names! So that they may not regard their many labors as thankless, we particularly thank those who shepherded GDB through major releases: Andrew Cagney (release 5.0); Jim Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs (release 4.14); Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10, and 4.9); St
Resumen del contenido incluido en la página 17
Brian Fox is the author of the readline libraries providing command-line editing and command history. Andrew Beers of SUNY Buffalo wrote the language-switching code, the Modula-2 support, and contributed the Languages chapter of this manual. Fred Fish wrote most of the support for Unix System Vr4. He also enhanced the command-completion support to cover C++ overloaded symbols. Hitachi America, Ltd. sponsored the support for H8/300, H8/500, and Super-H processors. NEC sponsored the support for th
Resumen del contenido incluido en la página 18
18
Resumen del contenido incluido en la página 19
1 A S am ple GD B S e s si o n This chapter describes the most common GDB commands with the help of an example. The following topics are discussed: • Loading the Executable • Setting the Display Width • Setting Breakpoints • Running the Executable under GDB • Stepping to the next line • Stepping into a Subroutine • Examining the Stack • Printing Variable Values • Listing the Source Code • Setting Variable Values During a Debug Session In this sample session, we emphasize user input like this: in
Resumen del contenido incluido en la página 20
$ (gdb) m4 HP gdb 3.0 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00. Copyright 1986 - 2001 Free Software Foundation, Inc. Hewlett-Packard Wildebeest 3.0 (based on GDB ) is covered by the GNU General Public License. Type "show copying" to see the conditions to change it and/or distribute copies. Type "show warranty" for warranty/support. GDB reads only enough symbol data to know where to find the rest when needed; as a result, the first prompt comes up very quickly. 1 .2 S e t ting Dis pla y w i d