beautypg.com

HP gnu source-level debugger 5992-4701 User Manual

Page 3

background image

Table of Contents

Summary of GDB........................................................................................................................15

Free Software......................................................................................................................15
Contributors to GDB...........................................................................................................15

1 A Sample GDB Session.............................................................................................................19

1.1 Loading the Executable.................................................................................................19
1.2 Setting Display width....................................................................................................20
1.3 Setting Breakpoints.......................................................................................................20
1.4 Running the executable under GDB.............................................................................20
1.5 Stepping to the next line in the source program...........................................................20
1.6 Stepping into a subroutine............................................................................................21
1.7 Examining the Stack......................................................................................................21
1.8 Printing Variable Values................................................................................................21
1.9 Listing Source Code......................................................................................................22
1.10 Setting Variable Values During a Session....................................................................22

2 Getting In and Out of GDB.......................................................................................................25

2.1 Invoking GDB................................................................................................................25

2.1.1 Choosing files........................................................................................................26
2.1.2 Choosing modes....................................................................................................27
2.1.3 Redirecting WDB input and output to a file.........................................................30

2.2 Quitting GDB................................................................................................................30
2.3 Shell commands............................................................................................................31

3 GDB Commands......................................................................................................................33

3.1 Command syntax..........................................................................................................33
3.2 Command completion...................................................................................................33
3.3 Getting help...................................................................................................................35

4 Running Programs Under GDB...................................................................................................39

4.1 Compiling for debugging..............................................................................................39
4.2 Starting your program..................................................................................................39
4.3 Arguments To Your Program........................................................................................41
4.4 Program Environment..................................................................................................41
4.5 Working directory.........................................................................................................43
4.6 Program Input and Output...........................................................................................43
4.7 Debugging a Running Process......................................................................................44
4.8 Killing the child process................................................................................................45

Table of Contents

3