Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)

14.10.1 When to suspect a memory leak.............................................................................120
14.10.2 Memory debugging restrictions..............................................................................121
14.10.3 Memory Debugging Methodologies........................................................................121
14.10.4 Debugging Memory in Interactive Mode.................................................................121
14.10.4.1 Commands for interactive memory debugging..................................................122
14.10.4.2 Example for interactive debugging session.......................................................124
14.10.5 Debugging Memory in Batch Mode........................................................................125
14.10.5.1 Setting Configuration Options for Batch Mode..................................................125
14.10.5.2 Environment variable setting for Batch mode debugging....................................128
14.10.5.3 Example for Batch Mode RTC.........................................................................129
14.10.6 Debugging Memory Interactively After Attaching to a Running Process........................131
14.10.7 Open-files reporting..............................................................................................133
14.10.8 Configuring memory debugging settings.................................................................133
14.10.8.1 Specifying the stack depth..............................................................................133
14.10.8.2 Specifying minimum leak size.........................................................................133
14.10.8.3 Specifying minimum block size.......................................................................134
14.10.9 Scenarios in memory debugging............................................................................134
14.10.9.1 Stop when freeing unallocated or deallocated blocks.........................................134
14.10.9.2 Stop when freeing a block if bad writes occurred outside block boundary............134
14.10.9.3 Stop when a specified block address is allocated or deallocated.........................134
14.10.9.4 Scramble previous memory contents at malloc/free calls....................................135
14.10.9.5 Detect dangling pointers and dangling blocks..................................................135
14.10.9.6 Detect in-block corruption of freed blocks.........................................................135
14.10.9.7 Specify the amount of guard bytes for every block of allocated memory...............136
14.10.10 Comparison of Memory Debugging Commands in Interactive Mode and Batch
Mode.............................................................................................................................136
14.10.11 Heap Profiling.....................................................................................................137
14.10.11.1 Commands for heap profiling.........................................................................137
14.10.11.2 info heap arena...........................................................................................137
14.10.11.3 info heap arena [0 |1|2|..] blocks stacks.......................................................137
14.10.11.4 info heap process.........................................................................................138
14.10.11.5 Example for heap profiling.............................................................................138
14.10.12 Memory Checking Analysis for User Defined Memory Management Routines..............138
14.10.13 Commands to track the change in data segment value.............................................139
14.10.14 Support for Memory Debugging Feature on Applications Using libmallocng Library for
Heap Allocation Management...........................................................................................139
14.11 Thread Debugging Support............................................................................................139
14.11.1 Support for Enabling and Disabling Specific Threads..................................................139
14.11.2 Backtrace Support for Thread Debugging.................................................................140
14.11.3 Advanced Thread Debugging Support.....................................................................140
14.11.3.1 Pre-requisites for Advanced Thread Debugging..................................................141
14.11.3.2 Enabling and Disabling Advanced Thread Debugging Features...........................141
14.11.3.3 Commands to view information on pthread primitives.........................................144
14.11.4 Debugging Threads Interactively After Attaching to a Process......................................144
14.11.5 Thread Debugging in Batch Mode...........................................................................146
14.11.5.1 Pre-requisites for Batch mode of Thread Debugging............................................146
14.11.5.2 Limitations in Batch mode of thread debugging..................................................149
14.11.6 Thread Debugging in +check Mode........................................................................149
14.11.7 Known issues with Thread Debugging for Interactive and Batch mode..........................149
14.12 Debugging MPI Programs.............................................................................................150
14.13 Debugging multiple processes (programs with fork and vfork calls).....................................150
14.13.1 Ask mode for set follow-fork-mode...........................................................................150
14.13.2 Serial mode for set follow-fork-mode........................................................................150
14.13.3 Support for showing unwind info............................................................................150
14.14 Command to Search for a Pattern in the Memory Address Space........................................151
6 Contents