From the command pane, you can call procedures in your program if the program being debugged has been compiled with the Debugging Level set to MULTI (which should result in the program being linked with libmulti.a).
When you set Debugging Level to MULTI, and then do a build, the builder automatically links in a library called libmulti.a. This is necessary for doing procedure calls. If you are not using the builder, then to achieve the same result do one of the following:
When MULTI detects that libmulti.a was not linked in to the executable, and you try to do a procedure call, it will give an error message saying that the -lmulti is necessary.
Normally, every program calling a library function has a copy of that function included in its executable.
Procedures are handled from within the expression evaluator. Therefore they are accessed in expressions. For example:
fly = AddArgs(1, 2) * 3; |
In C++, overloaded operators are called, provided they are not inlined, thus the following expression:
complex(1,2) + complex(2,3) |
is converted into the appropriate procedure calls. Constructors are called when appropriate, again provided they are not inlined.
You can make a procedure call to any text label in the file being debugged. For example, assume the procedure printf is referenced in the program and thus the code for this is on the target. Enter:
printf("Hello, %s!\n", "world") |
On many systems, it is necessary to print a new line before any of the information appears.
To find out what procedures are available to be called, do a list procedures command:
l p * |
See (lower case L) l. To gain access to library routines for debugging purposes that are not referenced anywhere in the program code, and thus are not linked into the program image, add a dummy reference to the program and recompile.
See also "Caveats for procedure calls".