HPlogo System Debug Reference Manual > Chapter 5 System Debug Command Specifications Fx-LOG

LEV

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Sets the current environment to the specified stack level in the stack markers.

Syntax



   LEV [number]
   LEV [number] [interrupt_level]

The LEV command changes the current environment to the environment at the specified stack level.

All commands accurately reflect the register values that are in effect a level change. Windows also reflect the new level values.

If the CONTINUE or SS command in Debug is issued after changing levels, an implicit LEV 0 is performed.

If any error is encountered during a level change, the environment is automatically set to stack level 0.

The following algorithm is used to set level n on the CM stack:
  • WHILE lev <> desired level DO

    • Get previous stack marker.

    • Set Q based on delta-Q in marker.

    • Set S to Q-4.

    • Set X based on X in marker.

    • Set STATUS based on status marker.

    • Set CMPC based on status and P offset in marker.

    • Set CIR based on fetch from new value of CMPC.

The following algorithm is used to set level n on the NM stack:

Get current frame info (based on unwind info);
  • WHILE lev <> desired level DO

  • Restore entry save registers (based on frame unwind info);

  • Get previous frame (based on unwind info);

  • IF frame is an interrupt stack marker (ISM) THEN

    • Restore RP, SP, DP, SR4, SR5, SR0, PCQ from the ISM

  • ELSE

    • Set RP, SP, DP, SR4, to new values from the stack;

    • Restore call save registers (based on unwind info);

Parameters


number

The stack level number at which the environment should be set.

interrupt_level

The interrupt level number at which the environment should be set. If this parameter is omitted, the current interrupt level is assumed.

This parameter is valid only for NM.

Examples



   %cmdebug > tr
         PROG %   0.1421   PROCESSSTUDENT+14   (mITroc CCG)  SEG'
   *  0) PROG %   0.2004   PROCESSSTUDENT+377  (mITroc CCG)  SEG'
      1) PROG %   0.253    OB'+253             (mITroc CCG)  SEG'
      2) SYS  %  25.0      ?TERMINATE          (MItroc CCG)  CMSWITCH''

   %cmdebug > dr cmpc
   CMPC=PROG %0.1421

   %cmdebug > lev 2

First use TR to list the stack trace in order to decide which level is desired. The current value of CMPC is then displayed. Next the stack level is set to level 2.

   %cmdebug > tr
         PROG %   0.1421   PROCESSSTUDENT+14   (mITroc CCG)  SEG'
      0) PROG %   0.2004   PROCESSSTUDENT+377  (mITroc CCG)  SEG'
      1) PROG %   0.253    OB'+253             (mITroc CCG)  SEG'
   *  2) SYS  %  25.0      ?TERMINATE          (MItroc CCG)  CMSWITCH''

   %cmdebug > dr cmpc
   CMPC=PROG %0.253

The above stack trace reveals that the level has been changed to stack level two (note the asterisk). The current value of CMPC is also displayed and confirms that the registers have been correctly updated as well.

   $nmdebug > tr,ism
        PC=a.006777fc trap_handler
   * 0) SP=40221338 RP=a.002a1fec conditional+$ac
     1) SP=40221338 RP=a.000a5040 hpe_interrupt_marker_stub
    --- Interrupt Marker
     2) SP=402211e8 RP=25d.00015134 small_divisor+$8
    --- End Interrupt Marker Frame ---

        PC=25d.00015134 small_divisor+$8
     0) SP=402211e8 RP=25d.00015d38 average+$b0
     1) SP=402211e8 RP=25d.00015c74 ?average+$8
          export stub: 25c.00005d98 processstudent+$74
     2) SP=40221180 RP=25c.00006b1c PROGRAM+$300
     3) SP=40221100 RP=25c.00000000
        (end of NM stack)

Show a native mode stack trace that contains an interrupt marker.

   $nmdebug > lev 1,1
   $nmdebug > tr,ism
        PC=25d.00015134 small_divisor+$8
     0) SP=402211e8 RP=25d.00015d38 average+$b0
   * 1) SP=402211e8 RP=25d.00015c74 ?average+$8
          export stub: 25c.00005d98 processstudent+$74
     2) SP=40221180 RP=25c.00006b1c PROGRAM+$300
     3) SP=40221100 RP=25c.00000000
        (end of NM stack)

Use the LEV command to set the environment to stack level 1, interrupt level 1. A stack trace confirms that the environment has been correctly changed.

Limitations, Restrictions


You must be at stack level 0 in order to modify any registers.

For native mode code, if you are in procedure entry or exit code, this command may not function properly. For example, if the user is stopped in entry code, callee save registers have not been saved and therefore are restored incorrectly. Other scenarios exist.

If the environment for the CM stack is set to a level that is a switch marker, no values for CMPC and CIR are available.




KILL


LIST