Heap variables allocated by the standard procedure NEW are printed by PASSNAP. If PASSNAP encounters a pointer variable during variable processing, it checks the value, that is: the address in the pointer variable. If it lies between the bounds of the allocated heap storage, it prints the contents of the heap storage; because pointers in Pascal are typed, this is done in the same way as for every other variable, that is: the variable is shown in Pascal notation.
Checking for heap boundaries is easy, because the "classical" heap in Stanford Pascal is a contiguous area of storage which is allocated in its maximum size at program start time.
Heap variables allocated by the new ALLOC function were not shown, because the addresses are outside the bounds of the "classical" Pascal heap storage.
I changed PASSNAP, so that, after checking for "classical" heap, it checks for ALLOC areas, too. This was done by creating a new function called CHKALLOC, which is implemented in PASLIBX. It walks through the list of heap segments and looks if the given address lies within one of the allocated heap segments; if so, it returns the address of the area, if the area is the beginning of an allocated segment and the address of the HANC, if the address is another address inside the HANC. In all other cases (address not in heap), it returns NIL. So a result, which is not NIL tells, that the address lies inside a heap segment and the heap storage can be accessed and printed.
PASSNAP was further extended
to show up to 500 heap variables (not only 50)
to print the pointers with 8 hex digits (not only 6)
to print a notice at each pointer, telling if the pointer value is NIL, if the pointer contains the initialization pattern (UNDEF. POINTER), if it points to the "classical" heap (HEAP/NEW) or the ALLOC-Heap (HEAP/ALLOC) or if it points to an unknown location (INVALID POINTER). "Invalid pointers" can be pointers to automatic or static storage locations, created by the ADDR function, or return values from ALLOCX (that is: "normal" GETMAIN). Maybe I will provide a function some day that extends CHKALLOC and tells the storage type, given a certain pointer; this should be easy for the Pascal heaps and stacks and maybe for STATIC values, too.
Here you have an example of a new Snapshot output; it was issued from a test version of the storage management routines in PASLIBX which did a SNAPSHOT at a certain place.
You will also see that the variables in this example come from separate modules (from PASLIBX and from the main module, which is called TESTDBG; the CSECT name is $PASMAIN).