HPlogo HP/DDE Debugger User's Guide: HP 9000 Series 700/800 Computers > Chapter 8 Debugging in Special Situations

Examining Core Files

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

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

The operating system generates a core file when a signal is not caught by the program. The core file 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 file on HP-UX systems, you must supply both the name of the core file (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 file.)

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

debug core_file object_program_pathname

If the core file was produced by a stripped 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 must be identical except for the stripping.

Core File Debugging

When your program is first loaded, the PC is set to the line that caused the core dump. The stack and all variables are as they were when the program was about to execute that line. Here are some useful actions that can help to locate problems:

  • Examine the line in the Source File Edit Area that was responsible for the core dump to see if there is an obvious problem.

  • Enter a local or global variable in the ( ): Input Box, then select Print ( ) to examine its value. Check for a value out of range.

  • Choose Show:Stack to look at the procedure call stack. Check values of passed parameters to see if the problem originated earlier in your program.

  • Choose Show:Assembly Instructions, and examine CPU registers or assembly instructions to get a low-level view of your program (see “Assembly Level Debugging ”).