Debugging with GDB (February 2008)

Table Of Contents
v
14.10.8.1 Stop when freeing unallocated or
deallocated blocks . . . . . . . . . . . . . . . . . . . . . . . 147
14.10.8.2 Stop when freeing a block if bad writes
occurred outside block boundary . . . . . . . . . . 147
14.10.8.3 Stop when a specified block address is
allocated or deallocated . . . . . . . . . . . . . . . . . . 147
14.10.8.4 Scramble previous memory contents at
malloc/free calls . . . . . . . . . . . . . . . . . . . . . . . . . 148
14.10.8.5 Detect dangling pointers and dangling
blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
14.10.8.6 Detect in-block corruption of freed blocks
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
14.10.8.7 Specify the amount of guard bytes for
every block of allocated memory . . . . . . . . . . 149
14.10.9 Comparison of Memory Debugging Commands in
Interactive Mode and Batch Mode . . . . . . . . . . . . . . . 149
14.10.10 Heap Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
14.10.10.1 Commands for heap profiling . . . . . . 152
14.10.10.2 info heap arena . . . . . . . . . . . . . . . . . 152
14.10.10.3 info heap arena [0 |1|2|..] blocks
stacks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
14.10.10.4 info module ADDRESS . . . . . . . . . . . . . 153
14.10.10.5 info heap process . . . . . . . . . . . . . . . 153
14.10.10.6 Example for heap profiling. . . . . . . . . 153
14.10.11 Memory Checking Analysis for User Defined
Memory Management Routines . . . . . . . . . . . . . . . . . . 154
14.10.12 Commands to track the change in data segment
value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
14.11 Thread Debugging Support . . . . . . . . . . . . . . . . . . . . . . . . . . 155
14.11.1 Support for Enabling and Disabling Specific
Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
14.11.2 Backtrace Support for Thread Debugging . . . . 156
14.11.3 Advanced Thread Debugging Support . . . . . . . . 156
14.11.3.1 Pre-requisites for Advanced Thread
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
14.11.3.2 Enabling and Disabling Advanced
Thread Debugging Features. . . . . . . . . . . . . . . 157
14.11.3.3 Commands to view information on
pthread primitives . . . . . . . . . . . . . . . . . . . . . . . 160
14.11.4 Debugging Threads Interactively After Attaching
to a Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
14.11.5 Thread Debugging in Batch Mode . . . . . . . . . . . 161
14.11.5.1 Pre-requisites for Batch mode of Thread
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
14.11.5.2 Limitations in Batch mode of thread
debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
14.11.6 Known issues with Thread Debugging for
Interactive and Batch mode . . . . . . . . . . . . . . . . . . . . . 163