Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
2. Run the program.
3. Start a debugging session as follows:
gdb -leaks <executable-name> <process-id>
4. Use info heap and info leaks commands to obtain a memory analysis report
of the application.
NOTE: From HP WDB 5.7 onwards, the archive version of the run time check library,
librtc.a, is not available. You must use the shared version of the library,
librtc.[sl|so], instead.
14.10.7 Open-files reporting
From version 6.2 onwards, HP WDB enables you to obtain a report containing a list of
file descriptors corresponding to files open by the application at the point of its exit. The
report not only provides you the names and types of those files, but also details such as
backtraces and function names at the point of the files being opened. This enables you
to identify potential file descriptor leaks in the application.
Table 1
DescriptionCommand
Enable/Disable the detection of open file descriptors.check_openfd=[on | off]
NOTE: This feature is currently supported only for batch-mode of memory debugging
on HP Integrity systems.
14.10.8 Configuring memory debugging settings
The following configuration settings are supported to control the level of details of
information required to be displayed when debugging memory leaks.
14.10.8.1 Specifying the stack depth
Memory debugging reduces the performance of an application by 20-40% because of
stack unwinding. To provide a clear profile of every allocation in the program, the
debugger collects the stack trace information for every allocation in the debugged
application. Reducing the stack depth (the number of stack frames that the debugger
collects for each allocation) reduces the performance degradation.
The set heap-check frame-count command enables you to control the depth of
the stack frames that are collected by HP WDB for each allocation. By default, four stack
frames are displayed from the allocating call stack.
To set the depth of the stack frames that is collected by HP WDB, enter the following
command at the gdb prompt:
14.10 Debugging Memory Problems 167