|
OpenVMS Alpha System Analysis Tools Manual
SDA$TYPE
Formats and types a single line to SYS$OUTPUT.
Format
int sda$type (char *ctrstr, __optional_params);
Arguments
ctrstr
| OpenVMS usage |
char_string |
| type |
character-coded text string |
| access |
read only |
| mechanism |
by reference |
Address of a zero-terminated control string.
prmlst
| OpenVMS usage |
varying_arg |
| type |
quadword (signed or unsigned) |
| access |
read only |
| mechanism |
by value |
Optional FAO parameters. All arguments after the control string are
copied into a quadword parameter list, as used by $FAOL_64.
Description
Formats and prints a single line to the terminal. This is unaffected by
the use of the SDA commands SET OUTPUT or SET LOG.
Condition Values Returned
|
SDA$_SUCCESS
|
Successful completion.
|
|
SDA$_CNFLTARGS
|
Indicates more than twenty FAO parameters given.
|
|
Other
|
Returned from the $PUT issued by SDA$TYPE (the error is also signaled).
If the $FAOL_64 call issued by SDA$TYPE fails, a blank line is output.
|
Status returns one of the above.
Example
|
int status;
...
status = sda$type ("Invoking SHOW SUMMARY to output file...");
|
This example displays the message "Invoking SHOW SUMMARY to output
file..." to the terminal.
SDA$VALIDATE_QUEUE
Validates queue structures.
Format
void sda$validate_queue (VOID_PQ queue_header, __optional_params);
Arguments
queue_header
| OpenVMS usage |
address |
| type |
quadword (unsigned) |
| access |
read only |
| mechanism |
by value |
Address from which to start search.
options
| OpenVMS usage |
mask_longword |
| type |
longword (unsigned) |
| access |
read only |
| mechanism |
by value |
The following table show the flags that indicate the type of queue:
| Flag |
Meaning |
|
None
|
Defaults to double-linked longword queue
|
|
SDA_OPT$M_QUEUE_BACKLINK
|
Validates the integrity of a double-linked queue using the back links
instead of the forward links
|
|
SDA_OPT$M_QUEUE_LISTQUEUE
|
Displays queue elements for debugging
|
|
SDA_OPT$M_QUEUE_QUADLINK
|
Sets a quadword queue
|
|
SDA_OPT$M_QUEUE_SELF
|
Sets a self-relative queue
|
|
SDA_OPT$M_QUEUE_SINGLINK
|
Sets a single-linked queue
|
Description
This routine can be used to validate the integrity of double-linked,
single-linked or self-relative queues either with longword or quadword
links. If you specify the option SDA_OPT$M_QUEUE_LISTQUEUE, the queue
elements are displayed for debugging purposes. Otherwise a one-line
summary will indicate how many elements were found and whether the
queue is intact.
Condition Values Returned
If an error occurs, it is signaled by SDA$VALIDATE_QUEUE.
Example
|
int64 temp;
int64 *queue;
...
sda$symbol_value ("EXE$GL_NONPAGED", &temp);
temp += 4;
sda$reqmem ((VOID_PQ)temp, &queue, 4);
sda$validate_queue (queue, SDA_OPT$M_QUEUE_SINGLINK);
|
This sequence validates the nonpaged pool free list, and outputs a
message of the form:
|
Queue is zero-terminated, total of 204 elements in the queue
|
Part 2 OpenVMS Alpha System Code Debugger & System Dump Debugger
Part II describes the System Code Debugger and the System Dump
Debugger. It presents how to use the System Code Debugger and System
Dump Debugger tools by doing the following:
- Building a system image to be debugged
- Setting up the target system for connections
- Setting up the host system
- Starting the system code debugger
- Troubleshooting connections and network failures
- Looking at a sample system code debugging session
- Analyzing memory as recorded in a system dump
Chapter 7 The OpenVMS Alpha System Code Debugger
This chapter describes the OpenVMS Alpha System Code Debugger and how
it can be used to debug nonpageable system code and device drivers
running at any interrupt priority level (IPL).
The system code debugger can be used to perform the following tasks:
- Control the system software's execution----stop at points of
interest, resume execution, intercept fatal exceptions, and so on
- Trace the execution path of the system software
- Monitor exception conditions
- Examine and modify the values of variables
- Test the effect of modifications, in some cases, without having to
edit the source code, recompile, and relink
The use of the system code debugger requires two systems:
- The host system, probably also the system where the image to be
debugged has been built.
- The target system, usually a standalone test system, where the
image being debugged is executed.
The system code debugger is a symbolic debugger. You can specify
variable names, routine names, and so on, precisely as they appear in
your source code. The system code debugger can also display the source
code where the software is executing, and allow you to step by source
line.
The system code debugger recognizes the syntax, data typing, operators,
expressions, scoping rules, and other constructs of a given language.
If your code or driver is written in more than one language, you can
change the debugging context from one language to another during a
debugging session.
To use the system code debugger, you must do the following:
- Build a system image or device driver to be debugged.
- Set up the target kernel on a standalone system.
The
target kernel is the part of the system code debugger
that resides on the system that is being debugged. It is integrated
with XDELTA and is part of the SYSTEM_DEBUG execlet.
- Set up the host system, which is integrated with the OpenVMS
Debugger.
The following sections cover these tasks in more detail, describe the
available user-interface options, summarize applicable OpenVMS Debugger
commands, and provide a sample system code debugger session.
7.1 User-Interface Options
The system code debugger has the following user-interface options:
- A DECwindows Motif interface for workstations
When using this
interface, you interact with the system code debugger by using a mouse
and pointer to choose items from menus, click on buttons, select names
in windows, and so on. Note that you can also use OpenVMS Debugger
commands with the DECwindows Motif interface.
- A character cell interface for terminals and workstations
When
using this interface, you interact with the system code debugger by
entering commands at a prompt. The sections in this chapter describe
how to use the system code debugger with the character cell interface.
For more information about using the OpenVMS DECwindows Motif interface
and OpenVMS Debugger commands with the system code debugger, see the
OpenVMS Debugger Manual.
7.2 Building a System Image to Be Debugged
- Compile the sources you want to debug, and be sure to use the
/DEBUG and /NOOPT qualifiers.
Note
Debugging optimized code is much more difficult and is not recommended
unless you know the Alpha architecture well. The instructions are
reordered so much that single-stepping by source line will look like
you are randomly jumping all over the code. Also note that you cannot
access all variables. The system code debugger reports that they are
optimized away.
|
- Link your image using the /DSF (debug symbol file) qualifier. Do
not use the /DEBUG qualifier, which is for debugging user programs. The
/DSF qualifier takes an optional filename argument similar to the /EXE
qualifier. For more information, see the OpenVMS Linker Utility Manual. If you specify
a name in the /EXE qualifier, you will need to specify the same name
for the /DSF qualifier. For example, you would use the following
command:
$ LINK/EXE=EXE$:MY_EXECLET/DSF=EXE$:MY_EXECLET OPTIONS_FILE/OPT
|
The .DSF and .EXE file names must be the same. Only the extensions
will be different, that is .DSF and .EXE. The contents of the .EXE
file should be exactly the same as if you had linked without the /DSF
qualifier. The .DSF file will contain the image header and all the
debug symbol tables for .EXE file. It is not an executable file, and
cannot be run or loaded.
- Put the .EXE file on your target system.
- Put the .DSF file on your host system, because when you use the
system code debugger to debug code in your image, it will try to look
for a .DSF file first and then look for a .EXE file. The .DSF file is
better because it has symbols in it. Section 7.4 describes how to
tell the system code debugger where to find your .DSF and .EXE files.
7.3 Setting Up the Target System for Connections
The target kernel is controlled by flags and devices specified when the
system is booted, XDELTA commands, a configuration file, and several
sysgen parameters. The following sections contain more information
about these items.
Boot Command
The form of the boot command varies depending on the type of OpenVMS
Alpha system you are using. However, all boot commands have the concept
of boot flags and boot devices as well as a way to save the default
boot flags and devices. This section uses syntax from a DEC 3000 Model
400 Alpha Workstation in examples.
To use the system code debugger, you must specify an Ethernet device
with the boot command on the target system. This device will be used by
the target system to communicate with the host debugger. It is
currently a restriction that this device must not be used for anything
else (either for booting or network software such as DECnet, TCP/IP
products, and LAT products). Thus, you must also specify a different
device to boot from. For example, the following command will boot a DEC
3000 Model 400 from the dkb100 disk, and the system code debugger will
use the esa0 Ethernet device.
To find out the Ethernet devices available on your system, enter the
following command:
In addition to devices, you can also specify flags on the boot command
line. Boot flags are specified as a hex number; each bit of the number
represents a true or false value for a flag. The following flag values
are relevant to the system code debugger.
- 8000
This is the system code debugger boot
flag. It enables operation of the target kernel. If this system code
debugger boot flag is not set, not only will it be impossible to use
the system code debugger to debug the system, but the additional XDELTA
commands related to the target kernel will generate an XDELTA error
message. If this boot flag is set, SYSTEM_DEBUG is loaded, and the
system code debugger is enabled.
- 0004
This is the initial breakpoint boot flag.
It controls whether the system calls INI$BRK at the beginning and end
of EXEC_INIT. Notice that if the system code debugger is the default
debugger, the first breakpoint is not as early as it is for XDELTA. It
is delayed until immediately after the PFN database is set up.
- 0002
This is the XDELTA boot flag, which
controls whether XDELTA is loaded. It behaves slightly differently when
the system code debugger boot flag is also set. If the system code
debugger boot flag is clear, this flag simply determines if XDELTA is
loaded. If the system code debugger boot flag is set, this flag
determines whether XDELTA or the system code debugger is the default
debugger. If the XDELTA flag is set, XDELTA will be the default
debugger. In this state, the initial system breakpoints and any calls
to INI$BRK trigger XDELTA, and you must enter an XDELTA command to
start using the system code debugger. If the XDELTA boot flag is clear,
the initial breakpoints and calls to INI$BRK go to the system code
debugger. You cannot use XDELTA if the XDELTA boot flag is clear.
Boot Command Example
The following command boots a DEC 3000 Model 400 from the dka0 disk,
enables the system code debugger, defaults to using XDELTA, and takes
the initial system boot breakpoints.
>>> boot dka0,esa0 -fl 0,8006
|
You can set these devices and flags to be the default values so that
you will not have to specify them each time you boot the system. On a
DEC 3000 Model 400, use the following commands:
>>> set BOOTDEF_DEV dka0,esa0
>>> set BOOT_OSFLAGS 0,8006
|
System Code Debugger Configuration File
The system code debugger target system reads a configuration file in
SYS$SYSTEM named DBGTK$CONFIG.SYS. The first line of this file contains
a default password, which must be specified by the host debug system to
connect to the target. Other lines in this file are reserved by Compaq.
Note that you must create this file because Compaq does not supply it.
If this file does not exist, you cannot run the system code debugger.
XDELTA Commands
When the system is booted with the system code debugger boot flag, the
following two additional XDELTA commands are enabled:
- n,\xxxx;R ContRol System Code Debugger connection
This command
can be used to do the following:
- Change the password which the system code debugger must present
- Disconnect the current session from the system code debugger
- Give control to the remote debugger by simulating a call to INI$BRK
- Any combination of these
Optional string argument xxxx specifies the password that the
system code debugger must present for its connection to be accepted. If
this argument is left out, the required password is unchanged. The
initial password is taken from the first line of the
SYS$SYSTEM:DBGTK$CONFIG.SYS file. The optional integer argument
n controls the behavior of the ;R command as follows:
| Value of N |
Action |
|
+1
|
Gives control to the system code debugger by simulating a call to
INI$BRK
|
|
+2
|
Returns to XDELTA after changing the password. 2;R without a password
is a no-op
|
|
0
|
Performs the default action
|
|
-1
|
Changes the password, breaks any existing connection to the System
Debugger, and then simulates a call to INI$BRK (which will wait for a
new connection to be established and then give control to the system
code debugger)
|
|
-2
|
Returns to XDELTA after changing the password and breaking an existing
connection
|
Currently, the default action is the same action as +1. If the
system code debugger is already connected, the ;R command transfers
control to the system code debugger, and optionally changes the
password that must be presented the next time a system code debugger
tries to make a connection. This new password does not last across a
boot of the target system.
- n;K Change inibrK behavior
If optional argument n is
1, future calls to INI$BRK will result in a breakpoint being taken by
the system code debugger. If the argument is 0, or no argument is
specified, future calls to INI$BRK will result in a breakpoint being
taken by XDELTA.
SYSGEN Parameters
- DBGTK_SCRATCH
This new parameter specifies how
many pages of memory are allocated for the system code debugger. This
memory is allocated only if system code debugging is enabled with the
system code debugger boot flag (described earlier in this section).
Usually, the default value of 1 is adequate; however, if the system
code debugger displays an error message, increase this value.
- SCSNODE
Identifies the target kernel node name
for the system code debugger. See Section 7.3.1 for more information.
7.3.1 Making Connections Between the Target Kernel and the System Code Debugger
It is always the system code debugger that initiates a connection to
the target kernel. When the system code debugger initiates this
connection, the target kernel accepts or rejects the connection based
on whether the remote debugger presents it with a node name and
password that matches the password in the target system (either the
default password from the SYS$SYSTEM:DBGTK$CONFIG.SYS file, or a
different password specified via XDELTA). The system code debugger gets
the node name from the SCSNODE SYSGEN parameter.
The target kernel can accept a connection from the system code debugger
anytime the system is running below IPL 22, or if XDELTA is in control
(at IPL 31). However, the target kernel actually waits at IPL 31 for a
connection from the system code debugger in two cases: when it has no
existing connection to a system code debugger and (1) it receives a
breakpoint caused by a call to INI$BRK (including either of the initial
breakpoints), or (2) when you enter a 1;R or -1;R command from XDELTA.
7.3.2 Interactions Between XDELTA and the Target Kernel/System Code Debugger
XDELTA and the target kernel are integrated into the same system.
Normally, you choose to use one or the other. However, XDELTA and the
target kernel can be used together. This section explains how they
interoperate.
The XDELTA boot flag controls which debugger (XDELTA or the target
kernel) gets control first. If it is not set, the target kernel gets
control first, and it is not possible to use XDELTA without rebooting.
If it is set, XDELTA gets control first, but you can use XDELTA
commands to switch to the system code debugger and to switch INI$BRK
behavior such that the system code debugger gets control when INI$BRK
is called.
Breakpoints always stick to the debugger that set them; for
example, if you set a breakpoint at location "A" with XDELTA,
and then you enter the command 1;K (switch INI$BRK to the system code
debugger) and ;R (start using the system code debugger). Then, from the
system code debugger, you set a breakpoint at location "B".
If the system executes the breakpoint at A, XDELTA will report a
breakpoint, and the remote debugger will see nothing (though you could
switch the system code debugger by issuing the XDELTA ;R command). If
the system executes the breakpoint at B, the system code debugger will
get control and report a breakpoint (you cannot switch to XDELTA).
Notice that if you examine location A with the system code debugger, or
location B with XDELTA, you will see a BPT instruction, not the
instruction that was originally there. This is because neither debugger
has any information about the breakpoints set by the other debugger.
One useful way to use both debuggers together is when you have a system
that exhibits a failure only after hours or days of heavy use. In this
case, you can boot the system with the system code debugger enabled
(8000), but with XDELTA the default (0002) and with initial breakpoints
enabled (0004). When you reach the initial breakpoint, set an XDELTA
breakpoint at a location that will only be reached when the error
occurs. Then proceed. When the error breakpoint is reached, possibly
days later, then you can set up a remote system to debug it and enter
the ;R command to XDELTA to switch control to the system code debugger.
Here is another technique to use when you do not know where to put an
error breakpoint as previously mentioned. Boot the system with only the
system code debugger flag. When you see that the error has happened,
halt the system and initiate an IPL 14 interrupt, as you would to start
XDELTA. The target kernel will get control and wait for a connection
for the system code debugger.
|