System Debug Reference Manual (32650-90888)

298 Chapter7
Symbolic Formatting Symbolic Access
$ VIRT 7b8.40200040 $ 00000000 00000000 00000000 00000000
$nmdebug > dv addr1,6,a
$ VIRT 7b8.40200010 A .... Bill .... .... .... ....
This leaves to the user the task of matching the displayed data to the declared types. When
more complicated data structures are involved, it is easy to see that the process of
matching the raw data to the corresponding high-level declarations could become
exceedingly cumbersome.
The symbolic formatting facility allows users to display data in terms of the declared
structures. In the case of the record StudentRecord in the above example, the symbolic
formatter produces the following output:
$nmdebug > fv addr1 "StudentRecord"
RECORD
NAME : 'Bill'
ID : 1
YEAR : SENIOR
NUMGRADES : 4
GRADES :
[ 1 ]: 2d
[ 2 ]: 41
[ 3 ]: 4e
[ 4 ]: 42
[ 5 ]: 0
[ 6 ]: 0
[ 7 ]: 0
[ 8 ]: 0
[ 9 ]: 0
[ a ]: 0
END
Just as you can display data symbolically, you can also use symbolic addressing to locate
and restrict the data to be displayed. The symbolic access facility allows users to extract
simple values from a data structure by name for use in expressions and macros. For
example, to test if year (year in school) is SENIOR, one could write:
$nmdebug > VAR year = SYMVAL(addr1, "StudentRecord.Year")
$nmdebug > IF year = "SENIOR" THEN WL "He is a SENIOR!!"
This is obviously more lucid than the corresponding bit-extraction sequence:
$nmdebug > VAR year = BITX( [addr1+$14], 0, #8 )
$nmdebug > IF ( year = 0 ) THEN WL "He is a SENIOR!!"
In summary, the symbolic formatting and access facility allows the user to display and
reference data in a more natural way, namely through the use of the symbolic data type
names declared at the source level. Furthermore, it frees authors of macros and simple
formatted displays from worrying about the allocation of data within a data structure and
from tracking changes to these structures as they evolve.
The remaining subsections describe the symbolic formatting and access facility in more
detail.