Oppolzer - Informatik / Stanford Pascal Compiler


Home       Lebenslauf       Schwerpunkte       Kenntnisse       Seminare       Kunden       Projekte       Produkte       Blog       Stanford Pascal       Kontakt

The Stanford Pascal Compiler / Evolution Steps

Back to Compiler main page

PASSNAP prints variables from more than one source file

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:

This all worked without much problems; see below the coding from the procedure PRINT_VARIABLE in PASSNAP, where the debug information file is opened:


if not ( PID in PROCSTOCOME ) then begin if FALSE then WRITELN ( 'print_variable: try reset(qrd), sourcename = ' , SOURCENAME ) ; CMSCMD := 'STATE XXXXXXXX DBGINFO * #' ; INS_SOURCENAME ( CMSCMD , SOURCENAME , 7 ) ; CMSX ( ADDR ( CMSCMD ) , RC ) ; if FALSE then WRITELN ( 'print_variable: state command returns rc = ' , RC ) ; STATERC := RC ; CMSCMD := 'FILEDEF QRD CLEAR #' ; CMSX ( ADDR ( CMSCMD ) , RC ) ; if STATERC = 0 then begin CMSCMD := 'FILEDEF QRD DISK XXXXXXXX DBGINFO * ' '(RECFM F LRECL 80#' ; INS_SOURCENAME ( CMSCMD , SOURCENAME , 18 ) ; CMSX ( ADDR ( CMSCMD ) , RC ) ; if FALSE then WRITELN ( 'print_variable: filedef returns rc = ' , RC ) ; RESET ( QRD ) ; PROCSTOCOME := [ 0 .. 255 ] end (* then *) else begin WRITELN ( OUTPUT , ' Debug information file for ' 'program/module ' , SOURCENAME , ' not found' ) ; WRITELN ( OUTPUT ) ; return ; end (* else *) ; end (* then *) ;

You will find an example of a Snapshot output with multiple modules in the next story

Back to Compiler main page