In This Book

Examining Core Files

You can use the debugger to diagnose some run-time errors after a program has aborted and produced a core ￿le.

The operating system generates a core ￿le when a signal is not caught by the program. The core ￿le records the state of the program at the time that the fatal error occurred.

You can use the debugger to:

Determine which signal or signals caused the failure.

Trace back the call/return stack.

Examine the state of global static variables, local static variables, variables stored on the stack, and registers.

You cannot modify or execute the program.

Attaching to a Core File

When attaching the debugger to a core ￿le on HP-UX systems, you must supply both the name of the core ￿le (usually core) and the name of the program object module that was being executed. (On Solaris systems, you can specify just the name of the core ￿le.)

Choose File:Load Corefile or use the debug command with the following syntax:

debug core ￿le object program pathname

If the core ￿le was pro duced by a stripp ed version of the executable, you can debug it using the unstripped version of the executable. For example, suppose you have two executables, prog.stripped and prog.unstripped . If prog.stripped dumps core, issue the command

debug core prog.unstripped

The stripped and unstripped executables m ust be identical except for the stripping.

8-2 Debugging in Special Situations