Previous Topic Next topic Print topic


Call

Use

Calls a user procedure or function.

Command Syntax

CALL subroutine-name [(argument-list)]

where:

subroutine-name
Is a block name that may or may not return a value
argument-list
Is a list of variable names and/or constants separated by commas

Description

The CALL command will set up any given arguments and perform a subroutine call to the specified subroutine (function or procedure). If a breakpoint is set within a called subroutine (or in a routine which it in turn calls), then it is taken as usual. In this case, a new debugger prompt is used to indicate that a different level of debugger invocation has been entered. At this point, debugging can continue as usual, including stack tracebacks (with traceback only to the called routine), and calling another routine, thus entering yet a higher debugger invocation level. In this way, there is no change in the debugging environments across subroutine calls.

If the called subroutine is a function, the return value of the function will be printed at the end of the call. Functions may also be called through the use of Evaluate and Let, for example,

LET x = foo(y) * z

or:

EVALUATE foo(x) * foo(goo(y,foo(123))) / z

Functions that are defined or declared in the current execution environment may be called. In this case, the number and type of arguments given will be checked against the declaration or definition of the subroutine. If they do not match, an error will be given and the call will not be made.

It is not required that called functions be compiled in debug mode. If they are not, however, it will not be possible to set breakpoints within that function. The calling conventions of the source language of the environment from which the call is being made are properly upheld (for example, call-by-value versus call-by-reference).

Non-local Gotos within a called function are legal and executed only if the target is within an environment that has been called (that is, activated) subsequent to the initial call. If it is not, an error will be given and the call aborted.

The CALL command will not accept as an argument block names containing characters not allowed in a variable name for the source language of the current scope.

The maximum number of arguments allowed to be passed to a called routine is 240.

Illegal non-local Gotos within a called function do generate an appropriate error message and abort the call. However, the user program is terminated and must be reloaded using Reload to continue debugging.

Example

The following call takes no arguments.

CodeWatch> CALL page_in_info ()

The following is a function call returning an integer.

CodeWatch> CALL get_user_id(name) 
174    { int }

The following is the same call as in the previous example, except that a breakpoint is incurred at the entry point of get_user_id.

CodeWatch> CALL get_user_id(name) 
Break at get_user_id\%ENTRY
DEB(1:get_user_id)>

Related Commands

  • Evaluate
  • Let
Previous Topic Next topic Print topic