Inspect Manual

Using Inspect With TNS/R Native Programs
Inspect Manual429164-006
17-13
Examples
Examples
1. Translating Machine Addresses into Procedure names
Inspect can be used to convert machine level TNS/R code addresses into
procedure names. The following example displays the RISC $PC register as TYPE
LOCATION. The output indicates that the current value of the $PC register is at
procedure #M statement 2, line number 34 in source file
\SYS.$VOL.SUBVOL.FILE, and at hexadecimal offset F.
The following example uses an arbitrary code address instead of the $PC register.
This can be useful if you want to determine where a TNS/R JAL instruction will
jump to.
2. Compiling at Optimization Level 1
The following source code has been compiled at optimization 1.
Inspect emits warning 198 at the first statement of the program, which indicates
that an optimization has occurred on this statement. The SOURCE ICODE and
INFO LOCATION commands can be used to determine the effects.
-PROG-DISPLAY REGISTER $PC TYPE LOCATION
REGISTER $PC = #M.2, #M.#34(\SYS.$VOL.SUBVOL.FILE), #M + %HFI
-PROG-DISPLAY VALUE %H70000390 TYPE LOCATION
#A.1, #A.#23(\SYS.$VOL.SUBVOL.FILE), #A + %H0I
-PROG-SOURCE ICODE FOR 1 STATEMENT
*#38.1 CALL B (Def^1+1, Local^1);
#38.1 00000080 LI a0,11
#38.1 00000084 JAL 0x70000560
#38.1 00000088 ADDIU a1,sp,62
-PROG-DISPLAY VALUE %h70000560 TYPE LOCATION
#B.1, #B.#75(\SYS.$VOL.SUBVOL.FILE), #B + %H0I
#28 PROC M MAIN;
#29 BEGIN
#30 INT Local^1;
#31 INT Local^2;
#32 INT Local^3;
#32.01
#32.1 Local^1 := Lit^1 + 60;
#33 Local^1 := Local^1 / 2;
#34 CALL A (Def^1, Local^2);
#36 Local^1 := (Def^1*6) / 2;
#38 Local^3 := Local^1 + Local^2;
#38.1 CALL A (Def^1+1, Local^1);
#40 END;