debugging with gdb
gdb调试参考手册Table of ContentsSummary of GDB..…Free SoftwareFree Software Needs free documentationContributors to gdB31 A Sample GDB Session2 Getting In and Out of GDB112.1 Invoking gdB2.1.1 Choosing Files122.1.2 Choosing Modes..........132.1.3 What GDB Does During Startup162.2 Quitting GDB173 Shell co172. 4 Logging o3 GDB Commands申非193.1 Command Syntax3.2 Command Completion3.3 Getting Help着着·着鲁香垂,垂224 Running Programs Under GDB254.1 Compiling for Debugging254.2 Starting your PrograM,,264.3 Your Program's arguments304.4 Your Programs Environment304.5 Your Programs Working Directory314.6 Your Program's Input and Output324.7 Debugging an Alrcady-running Proccss324.8 Killing the child process334.9 Debugging Multiple Inferiors and Programs334.10 Debugging Programs with Multiple Threads364.11 Debugging Forks404.12 Setting a Bookmark to Return to Later434.12.1 A Non-obvious Benefit of Using CheckpOIntsugging with GDB5 Stopping and Continuing455. 1 Breakpoints, Watchpoints, and Calchpoinls455.1.1 Setting Breakpoints165.1.2 Setting Watchpoints525.1.3 Setting Catchpoints545.1. 4 Deleting Breakpoints·;···.······595.1.5 Disabling Breakpoints605.1.6 Break Conditions..615.1.7 Breakpoint Command Lists625.1.8 Dynamic Printf645.1.9 How to save breakpoints to a file655.1.10 Static Probe Points...655.1.11 Cannot insert breakpoints675.1.12“ Breakpoint address adjusted..”675.2 Continuing and stepping683 Skipping Over Functions and Files715.4 Signals∴..745.5 Stopping and Starting Multi-thread Programs775.5.1 All-Stop Mode.…775.5. 2 Non-Stop Mode785.5. 3 Background Execution5.5.4 Thread-Specific Breakpoints5.5.5 Interrupted Systeln calls∴,815.5.6 Observer Mode826 Running programs backward857 Recording Inferiors Execution and ReplayingIt878 Examining the Stack...958.1 Stack frames鲁鲁,·958.2 Backt968.3 Selecting a frame988. 4 Information About a frame998.5 Management of frame Filters.1009 Examining Source Files.1039.1 Printing source lines1039.2Specifying a location1049.2.1 Linespec Locations,,1049.2.2 Explicit Locations..………,,1059.2.3 Address locations1069.3 Editing source files...1063.1 Choosing your Edito1079.1 Scarching sourcc files1079.5 Specifying Source Directories·····.1079. 6 Source and machine code11010卫 examining Data.......∴∴,,11510.1 Expressions....11710.2 Ambiguous Expressions11810.3 Program Varia bles11910.4 Artificial Array12110.5 Output Formats12210.6 Examining Memory.12310.7 Automatic Display12610.8 Print Settings12710.9 Pretty Printing..13510.9.1 Pretty-Printer Introduction............... 13610.9.2 Pretty-Printer Example13610.9.3 Pretty-Printer Commands............... 13710.10 Value Histol13810.11 Convenience Variables..13910.12 Convenience functions,11110.13 Registers14410.14 Floating point hardware.................. 14610.15V14610.16 Opcrating System Auxiliary Information14610.17 Memory Region Attributes ................ 14810.17.1 Attributes..14910.17.1 1 Memory Access Mode14910. 17.1.2 Memory Access Size..14910.17.1.3 Data Cache14910.17.2 Memory Access Checking15010.18 Copy Between Memory and a File15010. 19 How to Produce a Core File from Your Program...... 15110.20 Character sets.15210.21 Caching Data of Targets.................. 15410.22 Search Memor.15610.23 Value sizes15711 Debugging Optimized Code........ 15911.1 Inline functions..15911.2 Tail Call Frames160ugging with GDB12 C Preprocessor Macros16313 Tracepoints16713.1 Commands to Set tracepoints16713.1.1 Create and Delete Tr16813. 1.2 Enable and Disable Tracepoints17013.1.3 Tracepoint Passcounts17013.1.4 Tracepoint Conditions17113.1.5 Trace State Variables17113.1.6 Tracepoint Action Lists..17213. 1.7 Listing Tracepoints17413.1. 8 Listing Static Tracepoint Markers17513.1.9 Starting and Stopping Trace Ex]ts∴∴,17613.1.10 Tracepoint restrictions...17813.2 Using the Collected Dala.17913.2.1 tfind n.17913.2.2 thump...∴,,,,∴,18113.2.3 save tracepoints filename∴.,18213.3 Convenience Variables for Tracepoints..,.18213.4 USing Trace Files18314 Debugging Programs That Use Overlays18514.1 How Overlays Work18514.2 Overlay Commands18614.3 Automatic Overlay Debugging18814.4 Overlay Sample program18915 Using GDB with Different Languages... 19115.1 Switching Bctwccn Sourcc Languages19115.1.1 List of Filename Extensions and Languages....... 19115.1.2 Setting the Working language............. 19215.1.3 Having GDB Infer the Source Language19215.2 Displaying the language∴..19215.3 Type and Range Checking19315.3.1 An Overview of Type Checking............ 19315.3.2 An Overview of Range Checking19415.4 Supported languages19515.4.1 C and c++19515.4.1.1 C and o++O19515.4.1.2 C and C++ Constants∴..,,19715.4. 1.3 C++ Expressions19815.1.1.1C and C++ Defaults19915.4.1.5 C and C++ Type and range Checks19915.1.1.6 GDB and C19915.4.1.7 GDB Features for c++19915.4.1. 8 Decimal Floating point format∴....20115.4.2D20115.4.3Go..,.20115.4.4 Objective-C20215.4.4.1 Method names in Commands20215.4.4.2 The Print Command With Objective-C∴..20215.4.5 OpenCL C....,20315.4.5. 1 Open CL C Datatypes20315.1.5.2 Open CL C Expressions20315.4.5. 3 OpenCL C operators20315.4.6 Fortran15.4.6. 1 Fortran Operators and Expressions........ 20315.4.6.2 Fortran Defaults20315.4.6.3 Special Fortran Commands20415.4.7 Pascal20415.4.8Rus20415.4.9 Modula-215.4.9.1 Operators0515.4.9.2 Built-in Functions and procedures20615.4.9.3 Constants0715.4.9. Modula-2 Types.20815.4.9.5 Modula-2 Defaults21015.4.9.6 Deviations from Standard Modula-215.4. 9.7 Modula-2 Type and Range Checks21015.498TheOperatorsd15.4.9.9 GDB and modula-221115.4.10Ada21115.4.10.1 Introduction...,,,21115.4.10.2 Omissions from Ada21215.1.10.3 Addition21315.4.10.4 Overloading support for Ada........... 21415.1.10.5 Stopping at the very Beginning.,21515.4.10.6 Ada Exceptions.,,21515.4. 10.7 Extensions for Ada Tasks21515.4. 10.8 Tasking Support when Debugging Core Files..... 21815.4.10.9 Tasking Support when using the Raar profile21915.4.10.10 Known Pcculiaritics of Ada modc.21915.5 Unsupported Languages22016 Examining the Symbol Table221Debugging with GDB17 Altering Execution22917.1 Assignment to Variables22917.2 Continuing at a Different Address23017.3 Giving your Program a signal..23117.1 Returning from a Function23217.5 Calling Program Functions23317.6 Patching programs∴..23417.7 Compiling and injecting code in GDB∴,,,23417.7.1 Compilation options for the compile command..... 23617.7.2 Caveats when using the compile command.23617.7.3 Compiler search for the compile command381 8 GDB Files24118.1 Commands to Specify files24118.2 File Caching.......24918.3 Debugging Information in Separate Files∴....25018.4 Debugging information in a special section25318.5 Index Files Speed Up GDB∴.,25118.6 Errors Reading Symbol Files25518.7 GDB Data Files25619 Specifying a Debugging Target25719.1 Active Targets25719.2 Commands for Managing targets.............. 25719.3 Choosing Target Byte Order26020 Debugging Remote Programs26120.1 Connecting to a Remote Target,,,26120.1.1 Types of Remote Connections26120.1.2 Host and Target Files26220.1.3 Remote Connection commands.26320.2 Sending files to26420.3 Using the gdbserver program..26520.3.1 Running gdbserver26520.3. 1 1 Attaching to a Running program26620.3. 1.2 TCP port allocation lifecycle of gdbserver........ 26620.3. 1.3 Other Command-Line Arguments for gdbserver .. 26720.3.2 Connecting to gdbserver.26720.3. 3 Monitor Commands for gdbserver..26820.3.4 Tracepoints support in gdbserver26920.4 Remote Configuration.,………,27020.5 Implementing a Remote Stub27520.5.1 What the Stub Can Do for You27620.5.2 What You must Do for the stub27720.5.3 Putting it All TogetherVIl21 Configuration-Specific Information..28121.1 Native.......28121.1.1 BSD libkvm Interface28121.1.2 SVR4 Process Information28121.1.3 Features for Debugging DjCPP Programs28321.1.4 Features for Debugging Ms Windows PE executables. 28521.1.4.1 Support for DlLs without Debugging Symbols... 28721.1.4.2 DLL Name prefixes28721.1.4.3 Working with Minimal Symbols28821. 1.5 Commands specific to gnu Hurd systems....... 28821.1.6 Darwin..,,,,,,29121.2 Embedded Operating systems29121.3 Embedded processors21.3.1 Synopsys arc..29221.3.2ARM29221.3.3M68k.29321.3.4 Microblaze29321.3.5 MIPS Embedded29421.3.6 PowerPC embedded.................. 29421.3.7 Atmel AVR29521.3.8CRIS621.3.9 Renesas Super-H29621.4 Architectures9621.4.1 AArch64..,,,21.4.2 x86 Architecture-specific Issues.............29721.4.2.1 Intel Memory Protection Extensions(MPX)29721.4. 3 Alpha....9821.4.4MIPs29821.4.5HPPA30021.4.6 Ccll Broadband Enginc spu architecture30021 4.7 PowerPc21.4.8 Nios Il..30122 Controlling GDB30322.1 Prompt30322.2 Command editing.3032.3 Command history.…..30422. Screen Size,.,,30522.5 Numbers30622.6 Configuring the Current ABI..,3072.7 Automatically loading associated files..30822.7.1 Automatically loading init file in the current directorv.. 31022.7. 2 Automatically loading thread debugging library..... 31022.7.3 Security restriction for auto-loading31122.7.4 Displaying files tried for auto-load.………,31222.8 Optional Warnings and Messages31322.9 Optional Messages about Internal Happenings........ 31422.10 Other Miscellaneous Settings319ugging with GDB23 Extending GDB32123.1 Canned Sequences of commands32123.1.1 User-defined Commands32123.1.2 User-defined Command Hooks............. 32323.1. 3 Command files..32123.1. 4 Commands for Controlled Output32623.1.5 Controlling auto-loading native GDB scripts32723.2 Extending GDB using Python32823.2.1 Python Commands32823.2.2 Python aPt32923.2.2. 1 Basic Python32923.2.2.2 Exception Handling...33323.2.2.3 Values from Inferior∴.,,33423.2.2.4 Types In python33823.2. 2.5 Pretty Printing API∴..34323.2.2.6 Selecting Pretty-Printers34423.2.2.7 Writing a Pretty-Printer............. 34423.2.2. 8 Type Printing API34723.2.2.9 Filtering Frames34823.2.2.10 Decorating Frames35023.2.2.11 Writing a Frame Filter∴..35223.2.2.12 Unwinding Frames in Python35623.2.2. 13 INethods In Python35823. 2.2.14 Xmethod APl35923.2. 2.15 Writing an Xmethod36123.2.2. 16 Inferiors In Python................36423.2.2.17 Events In Python36523.2.2. 18 Thrcads In python..36823.2.2. 19 Recordings In Python.,3623 2.2.20 Commands In python37323.2.2.21 Parameters In python.37623.2.2.22 Writing new convenience functions........ 37823.2.2.23 Program Spaces In Python37923.2.2.24 Obifiles In Python38023.2. 2.25 Accessing inferior stack frames from Python38223.2. 2.26 Accessing blocks from Python..38523.2.2.27Pythyion representation of Syi38723.2.2. 28 Symbol table representation in Python39023.2.2. 29 Manipulating line tables using Python...39223.2.2. 30 Manipulating breakpoints using Python...... 39323.2.2.31 Finish Breakpoints...39623.2.2. 32 Python representation of lazy strings39623.2.2. 33 Python representation of architectures39723.2.3 Python Aulo-loading...,.........39823.2.1 Python modules39823.2.4.1 gdb prinTing..............39923.2.4.2 gdb types39923.2.4. 3 gdb. prompt400
用户评论