Tuesday, January 8, 2008

What Is Debug?

Debug provides non-privileged and privileged users with both interactive and programmatic debugging facilities for examining their operating environments.
Debug enables you to do the following:


Set, delete, and list breakpoints in a program. The program executes until a breakpoint is reached, then stops and passes control to the user. When you set breakpoints, you can specify a list of commands that automatically are executed when the breakpoint is hit.
Single step (multiple steps) through a program.
Display and/or modify the contents of memory locations. A full set of addressing modes is offered, including absolute CM memory, code segment relative, data segment relative, S relative, Q relative, DB relative, HP Precision Architecture virtual addresses, and HP Precision Architecture real memory addresses.
Display a symbolic procedure stack trace, optionally displaying interleaved NM and CM calls. You can also set the current debug environment back temporarily to the environment which existed at any marker on the stack.
Calculate the value of expressions in order to determine the correct values of variables at a given point in a program. Values can be custom formatted in several bases.
Use new full screen displays (windows) which allow inspection of registers, program code, the current stack frame, and the top of stack. Groups of custom user windows can be aimed at important data blocks to monitor changing values dynamically.
Display online help for all commands, predefined functions, and environment variables.
Create and reference user-defined variables.
Define powerful parameterized macros. Macros can be invoked as new commands to perform useful sequences of commands, or as functions within expressions that return single values.
Define aliases for command and macro names.
Execute commands from a file, record all user input to a log file, and record all Debug output to a list file.What Is the Dump Analysis Tool (DAT)?
The Dump Analysis Tool (DAT) aids support and lab personnel in analyzing MPE XL system events such as process hangs, operating system failures, or hardware failures. This tool is used primarily by Hewlett-Packard support personnel.
Refer to chapter 9 for detailed information regarding DAT.What Is the Standalone Analysis Tool (SAT)?
The Standalone Analysis Tool (SAT) aids support and lab personnel in analyzing MPE XL system events such as process hangs, operating system failures, and hardware failures.
Refer to chapter 10 for detailed information regarding SAT.How to Debug
This chapter gives a very brief introduction to debugging. For additional information, refer to the Programmer's Guide corresponding to the language compiler you are using. There you will find details and examples specific to your language.
How to Debug a CM Program
Compile and, using the Segmenter, prepare your program file and optional library files.
In order to take full advantage of Debug's symbolic capabilities, you must ensure that your program (and library) contain the necessary FPMAP symbolic records. This is easily accomplished with the Segmenter as follows:
For program files, use the FPMAP option when you prepare your program:
:PREP USLFILE, PROGFILE;FPMAP
For libraries, use the FPMAP option each time you add a segment to the library:
ADDSL SEG ; FPMAP
To debug your program, specify the Debug parameter in the RUN command:
:RUN CMPROG.GRP.ACCT;LIB=G;DEBUG
The program file is loaded, and you break at the first instruction in your program, at the main entry point.
Debug announces your arrival into the debugger. You are now ready to debug your program (set breakpoints, define macros, turn on the windows, and so on). For example,
:RUN CMPROG.GRP.ACCT;LIB=G;DEBUG
CM DEBUG Intrinsic: PROG %0.22
%cmdebug > won
How to Debug an NM Program
Compile and link your program file and any necessary libraries.
To Debug your program, specify the DEBUG parameter in the RUN command:
:RUN NMPROG;DEBUG
The NM program file is loaded, and a temporary breakpoint is set at the external stub that is linked to your program's main entry point.
When the program is launched into execution, the temporary breakpoint is hit, and you immediately enter Debug (in NM mode). Debug announces your arrival and deletes the temporary breakpoint.
To best observe the actual entrance (through the stub procedure) into your main program, type WON to turn the windows on. Note that you are at a stub procedure, which is marked with a question mark:
> ?PROGRAM
?PROGRAM+0004 etc.
Single step a few times to advance the program through the stub and into the main body of the program. In summary,
:RUN NMPROG;DEBUG
Break at: [0] PROG 31.00022e7c ?PROGRAM
$nmdebug > won
$nmdebug > s
$nmdebug > s
You are now ready to debug your program (set breakpoints, define macros, turn on the windows, and so forth).

Artikel yang Berkaitan

0 komentar:

Post a Comment