DEBUG CALL — VMS C_3.0
The CALL command enables you to execute a routine that was linked
with your program, independently of the normal flow of execution
of your program. The program does not have to include a call to
that routine. One common use of the command is to invoke
procedures that dump debugging information.
Format:
CALL routine-name [(argument [,...])]
The CALL command is one of the four debugger commands that can
cause your program to execute (the others are GO, STEP, and
EXIT).
When you enter the CALL command at an exception breakpoint, any
breakpoints, tracepoints, or watchpoints that were previously set
within the called routine are disabled temporarily so that the
debugger does not lose the exception context. However, such
eventpoints are active if you enter the CALL command at a
location other than an exception breakpoint.
When you enter a CALL command, the debugger takes the following
action:
1. Saves the current values of the general registers.
2. Constructs an argument list.
3. Executes a call to the routine specified in the command and
passes any arguments.
4. Executes the routine.
5. Displays the value returned by the routine in R0. By VMS
convention, after a called routine has executed, register R0
contains the function return value (if the routine is a
function) or the procedure completion status (if the routine
is a procedure that returns a status value). If a called
procedure does not return a status value or function value,
the value in R0 may be meaningless, and the "value returned"
message can be ignored.
6. Restores the values of the general registers to the values
they had just before the CALL command was executed.
7. Issues the prompt.
Additional information available:
ExamplesParametersQualifiersMultiprocess Programs
Examples
1 DBG> CALL SUB1(X)
value returned is 19
DBG>
This command calls the routine SUB1, passing the address of "X"
as the required parameter (by default, the address of the
argument specified is passed). The routine is a function whose
returned value is 19.
2 DBG> CALL SUB(%REF 1)
value returned is 1
DBG>
This command passes a pointer to a memory location containing the
numeric literal 1, into the routine SUB.
3 DBG> SET MODULE SHARE$LIBRTL
DBG> CALL LIB$SHOW_VM
1785 calls to LIB$GET_VM, 284 calls to LIB$FREE_VM, 122216 bytes
still allocated, value returned is 00000001
DBG>
This example shows how you could call the run-time library
routine LIB$SHOW_VM (in the shareable image LIBRTL) to display
virtual memory statistics. The SET MODULE command makes the
universal symbols (routine names) in LIBRTL visible in the main
image. See the description of the /SHARE qualifier of the SHOW
MODULE command for more information on this subject.
Parameters
routine-name
Specifies the name or the virtual address of the procedure to be
called.
argument
Specifies an argument that is required by the routine. Arguments
can be passed by address (the default), by descriptor, by
reference, and by value, as described in the subtopics.
The debugger assumes that the called routine conforms to the VMS
procedure calling standard (see the VAX Architecture Handbook).
However, note that the debugger does not know about all the
argument-passing mechanisms for all supported languages.
Therefore, you may need to specify how to pass parameters-- for
example, use CALL SUB1(%VAL X) rather than CALL SUB1(X). See
your language documentation for complete information on how
arguments are passed to routines.
Additional information available:
%ADDR
Passes the argument by address. This is the default.
Format
CALL routine-name (%ADDR address-expression)
The debugger evaluates the address expression and passes that
address to the routine specified. For simple variables (such as
X), the address of X is passed into the routine. This passing
mechanism is how FORTRAN implements ROUTINE(X). In other words,
for named variables, using %ADDR corresponds to a call by
reference in FORTRAN. For other expressions, however, you must
use the %REF function to call by reference. For complex or
structured variables (such as arrays, records, and access types),
the address is passed when you specify %ADDR, but the called
routine may not handle the passed data properly. Do not specify
a literal value (a number or an expression composed of numbers)
when using %ADDR.
%DESCR
Passes the argument by descriptor.
Format
CALL routine-name (%DESCR language-expression)
The debugger evaluates the language expression and builds a
VAX-standard descriptor to describe the value. The descriptor is
then passed to the routine you named. You would use this
technique to pass strings to a FORTRAN routine.
%REF
Passes the argument by reference.
Format
CALL routine-name (%REF language-expression)
The debugger evaluates the language expression and passes a
pointer to the value, into the called routine. This passing
mechanism corresponds to the way FORTRAN passes the result of an
expression.
%VAL
Passes the argument by value.
Format
CALL routine-name (%VAL language-expression)
The debugger evaluates the language expression and passes the
value directly to the called routine.
Qualifiers
You can specify whether you want the delivery of asynchronous
system traps (ASTs) enabled or disabled during the routine call.
By default, if you do not specify /AST or /NOAST, delivery of
ASTs is enabled in the called routine if, and only if, delivery
was enabled before the CALL command was issued.
/AST
Specifies that ASTs can be delivered during execution of the
called routine.
/NOAST
Specifies that ASTs cannot be delivered during execution of the
called routine.
Multiprocess Programs
If you are using the multiprocess debugging configuration to
debug a multiprocess program (if the logical name DBG$PROCESS has
the value MULTIPROCESS), note the following additional points:
1. The CALL command is executed in the context of the visible
process, but images in any other unheld processes (processes
that have not been placed on HOLD with a SET PROCESS/HOLD
command) are also allowed to execute. If you use the DO
command to broadcast a CALL command to one or more processes,
the CALL command is executed in the context of each specified
unheld process, but images in any other unheld processes are
also allowed to execute. In all cases, a HOLD condition in
the visible process is ignored.
2. Once execution is started, the way in which it continues
depends on whether the command SET MODE [NO]INTERRUPT was
entered. By default (SET MODE INTERRUPT), execution
continues until it is suspended in any process. At that
point, execution is interrupted in any other processes that
were executing images, and the debugger prompts for input.