PASSNAP (the Snapshot routine) uses debug information files which are written by the compiler. These files contain informations about the layout of structure types, the location of variables etc., variable names of course, procedure names and so on.
At runtime, PASSNAP examines the save area trace, gets the entry point and the stack addresses from there and so it can access the storage and print the variables in Pascal notation.
Up until now, PASSNAP only could print the variables of one source file; that is the file which is run by the PASRUN command, that is, the main program. External procedures which reside in separate modules could not be handled by PASSNAP, because those modules had a separate debug information file (called "modulename" QRR up until now), and PASSNAP could open only one, which was FILEDEFed statically in the PASRUN EXEC.
So to enable PASSNAP to print variables in other modules, too, several problems had to be solved:
the name of the source file must be available to PASSNAP, when it examines a procedure in storage at runtime; that is: it has to be added to the debug information in the object code
that was a little problem, because the name of the source file was not available to the compiler (up until now); I solved this by always calling the compiler with the source file name (without filetype) as first parameter; this is done in the EXEC which calls the compiler (in my installation PASCOMPN EXEC). So OSPARM is never empty; in the case when there are no other options, it is always 8 Bytes long.
PASSNAP had to be changed, so that it retrieves the name of the source file at runtime and
PASSNAP has to issue a FILEDEF using this name before doing a RESET on the debug information file (BTW: I changed the debug information file DDNAME to DBGINFO in both passes of the compiler; the filetype of the DBGINFO files was changed to DBGINFO, too - in PASSNAP, the file DDNAME had to remain at QRD, because modules at this time only can read and write the six predefined files (INPUT, OUTPUT, PRR, PRD, QRR, QRD), because the file descriptors of the standard files are stored at standard locations known to every Pascal program - other files will have a problem).
This all worked without much problems; see below the coding from the procedure PRINT_VARIABLE in PASSNAP, where the debug information file is opened:
|
You will find an example of a Snapshot output with multiple modules in the next story