Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)
Contents
Summary of GDB........................................................................................13
Free Software.........................................................................................................................13
Contributors to GDB................................................................................................................13
1 A Sample GDB Session.............................................................................17
1.1 Loading the Executable.......................................................................................................17
1.2 Setting Display width.........................................................................................................18
1.3 Setting Breakpoints............................................................................................................18
1.4 Running the executable under GDB.....................................................................................18
1.5 Stepping to the next line in the source program.....................................................................18
1.6 Stepping into a subroutine..................................................................................................18
1.7 Examining the Stack..........................................................................................................18
1.8 Printing Variable Values.....................................................................................................19
1.9 Listing Source Code...........................................................................................................19
1.10 Setting Variable Values During a Session............................................................................20
2 Getting In and Out of GDB........................................................................21
2.1 Invoking GDB...................................................................................................................21
2.1.1 Choosing files............................................................................................................21
2.1.2 Choosing modes........................................................................................................22
2.1.3 Redirecting HP WDB input and output to a file...............................................................24
2.2 Quitting GDB...................................................................................................................25
2.3 Shell commands...............................................................................................................25
3 GDB Commands......................................................................................27
3.1 Command syntax..............................................................................................................27
3.2 Command completion.......................................................................................................27
3.3 Getting help.....................................................................................................................28
4 Running Programs Under GDB...................................................................31
4.1 Compiling for debugging...................................................................................................31
4.2 Starting your program.......................................................................................................31
4.3 Arguments To Your Program...............................................................................................32
4.4 Program Environment........................................................................................................32
4.5 Working directory............................................................................................................33
4.6 Program Input and Output.................................................................................................33
4.7 Debugging a Running Process............................................................................................34
4.8 Killing the child process.....................................................................................................35
4.9 Debugging programs with multiple threads..........................................................................35
4.10 Debugging programs with multiple processes......................................................................37
5 Stopping and Continuing..........................................................................39
5.1 Breakpoints......................................................................................................................39
5.1.1 Setting breakpoints.....................................................................................................39
5.1.2 Setting catchpoints.....................................................................................................42
5.1.3 Deleting breakpoints...................................................................................................43
5.1.4 Disabling breakpoints.................................................................................................44
Contents 3