Debugging with GDB (February 2008)

Table Of Contents
Chapter 14: HP-UX Configuration-Specific Information 169
14.15.1 Compiler Dependencies for Printing the Execution
Path Entries
The +pathtrace compiler option provides a mechanism to record program execution
control flow into global path tables, local path tables, or both. This saved information
enables the debugger to print the execution path entries in the current thread or frame.
To print the execution path entries in the current thread or frame for programs running
on Integrity systems, you can set the required sub-options for the +pathtrace compiler
option.
You must set the following +pathtrace compiler option to enable the debugger to print
the execution path entries:
+pathtrace= [<global|global_fixed_size>:<local>]
For more information on this feature, see the following example.
14.15.2 Example Illustrating Execution Path Recovery
The following example illustrates the use of the execution path recovery feature in HP
WDB:
Sample Program:
$cat execpath.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int a = 3, b = 0, c = 4;
if (a)
printf("Value of a greater than 0\n");
if (b)
printf("Value of b greater than 0\n");
if (c)
printf("Value of c greater than 0\n");
printf("All condition checking done\n");
return 0;
}
Sample Debugging Session:
$cc +pathtrace -g execpath.c
$gdb a.out
HP gdb ...