|
|
System Debug Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 4 System Debug Command SpecificationsB (break) |
|
Debug only Privileged Mode: BA, BAX, BS Break. Sets a breakpoint.
The various forms of the BREAK command are used to set process-local and global (system-wide) breakpoints. Only users with privileged mode (PM) capability are allowed to set global breakpoints. Users without PM capability may only specify PINs that are descendant processes (any generation) of the current PIN. Setting a breakpoint for another process is implemented such that it appears the target process set the breakpoint itself. Therefore, when the target process encounters the breakpoint, it enters Debug with its output directed to the LDEV associated with the target process. If a breakpoint is set in CM code that has been translated by the Object Code Translator (OCT), Debug automatically sets a NM breakpoint in the closest previous corresponding translated code node point. If more than one CM breakpoint is set within a given node, only one NM breakpoint is set; however, a counter is incremented so the number of corresponding CM breakpoints can be tracked. If a NM breakpoint is set in translated code, no corresponding CM emulated breakpoint is set. Refer to appendix C for a discussion of CM object code translation, node points, and breakpoints in translated CM code.
Show the list of loaded files and the space into which they are loaded.
Set a breakpoint at the procedure PROGRAM plus an offset of $270. This corresponds to a statement in the outer block of the program being debugged. The name and offset were determined by looking at the statement map produced by the Pascal compiler (all language compilers produce similar maps). The expression evaluator found the procedure PROGRAM in the program file.
Break in the program file at offset $6a90. Remember that when only an offset is specified as a logical address for this command, the space (SID) for the program file is assumed. A STOLOG conversion (not STOL) with the "prog" selector is used to accomplish this.
Set a breakpoint at the procedure called processstudent and provide a command list to be executed each time the breakpoint is encountered. In this example, we know that the student number being processed is passed to the routine in general register 26. Each time the routine is entered, Debug prints the student number and automatically continue execution of the process.
Set a breakpoint at the nested procedure highscore that is contained in the level 1 procedure processstudent. The NMADDR function is used to specify the breakpoint address since the expression parent_proc.nested_proc would not have been recognized by the expression evaluator (a.b implies space.offset, for example, a long pointer). This breakpoint is a temporary breakpoint, which is automatically deleted after it is encountered. T[4] indicates a temporary breakpoint with index number 4.
Set a breakpoint at the procedure average. Notice that the routine was found in the group (GRP) library. The B command starts searching for symbol names in the program file and continues through all of the loaded library files until a match is found. The second example uses the BG command to explicitly restrict the search for symbol names to the group library. The third example shows how the coercion function GRP is used to restrict procedure name lookups to the group library. In the fourth example above, the BS command is used to restrict the search for procedure names to the system library. The routine average was not found in the system library, and so an error was generated.
The above example starts by showing that Debug has stopped in the group library in the average procedure. The B command was used to set a breakpoint at the address specified in r2, and this caused the command to fail. Recall that the B command assumes that the breakpoint is to be set in the program file when only an offset is provided. The SID for the program file ($115) is retrieved, and a long pointer is generated by performing a STOLOG conversion. The resulting address ($115.$15c74) does not exist in the program file; thus an error is generated.
The BG command is used to set a breakpoint at the offset indicated by the contents of general register 2. This command assumes the breakpoint is to be set in the group library. The SID for the group library ($118) is retrieved, and a long pointer is generated by performing a STOLOG conversion. The resulting address ($118.$15c74) is a valid group library virtual address, and so the breakpoint is set. The address corresponds to the export stub for the average procedure. Refer to the Procedure Calling Conventions Reference Manual (09740-90015) for an explanation of the use and purpose of export stubs.
The BV command is used to set a breakpoint at the offset indicated by general register 2. Unlike the above example, the offset in r2 is converted to a long pointer by performing a STOL conversion. The resulting address (sr4.r2 = $118.$15c74) is a valid group library virtual address, and so the breakpoint is set. A full long pointer is always valid, so the command b 118.r2 also results in the breakpoint being set.
The above example sets a breakpoint at the procedure P_INIT_HEAP. The routine was found in one of the loaded user libraries (this process only has one loaded user library). The BU command is used in the second example to specify which user library to search when looking for procedure names. The U_INIT_TRAPS routine was found in the user library XL.PUB.SYS and a breakpoint was set.
Set a breakpoint at the FREAD intrinsic. Every #100 times the routine is called, stop and print out a message. The QUIET option is specified so this operation produces no extra terminal output. The vertical bars in the breakpoint notation indicates that the process does not stop the next time the breakpoint is encountered, since the count is not yet exhausted.
Set a system-wide breakpoint in the trap handler. This routine is in the system NL. When the breakpoint is hit, perform a stack trace. The "@" indicates that the breakpoint is a global breakpoint.
Break at the address specified by adding 4 to the address of the first line in the program window. In this case, the program window must have been aimed at initstudentrecord+10.
Now list all of the breakpoints just set above.
Show the list of all currently loaded files.
Set a breakpoint at the entry point (indicated by the ? character) of the procedure PROCESSSTUDENT. The expression evaluator found the procedure in the program file in logical segment zero, at an offset of %1665 CM words from the start of the segment procedure.
Set a breakpoint %1670 CM words into the program file's logical segment zero. That address corresponds to the %263rd CM word from the start of the PROCESSSTUDENT procedure. Note that this command sets a breakpoint in the program file, no matter where the process was stopped (in the group library for example), since the B command implies the program file.
Set a breakpoint %1672 CM words into the program file. The logical segment number from the current value of CMPC is used as the segment number for this command.
Set a breakpoint %14 CM words into the start of the procedure PROCESSSTUDENT. This address corresponds to the first statement of the nested procedure HIGHSCORE which is contained in the level 1 procedure PROCESSSTUDENT. The correct offset to use for nested procedures is determined by looking at the statement map produced by the Pascal compiler. (All language compilers produce similar maps.) Unfortunately, information about nested procedure names and size is not available for CM programs.
Set a breakpoint %40 words into the procedure ob' (the outer block of the Pascal program being run). The third time the breakpoint is encountered, stop in Debug and delete the breakpoint. The notation T|5| indicates a temporary breakpoint with index number 2. The vertical bars indicate that the process does not stop the next time the breakpoint is encountered, since the count is not yet exhausted.
Set a breakpoint at the entry point to the procedure average. Notice that the procedure was found in the group (GRP) library. The B command starts searching for symbol names in the program file and continues through all of the loaded library files until a match is found. The second example uses the BG command to explicitly restrict the search for symbol names to the group library. The third example shows how the coercion function GRP is used to specify a logical segment in the group library rather than the program file.
The above example sets a breakpoint at the entry point of the FWRITE intrinsic which is located in the system library SL.PUB.SYS. Every #100 times the routine is called, stop and print out a message. The QUIET option is specified so this operation produces no extra terminal output. SL.PUB.SYS has been translated with the Object Code Translator (OCT), and so Debug automatically sets a breakpoint in the translated native mode code. Refer to appendix C for a discussion of CM object code translation, node points, and breakpoints in translated CM code.
Now list the breakpoints that were set in the above examples.
Set a breakpoint in the group library at the entry point to the AVERAGE procedure. The group library and program file have been translated by the Object Code Translator (OCT). Debug determined that the code is translated and thus set a CM breakpoint in the emulated code and a NM breakpoint in the translated code. Refer to appendix C for a discussion of CM object code translation, node points, and breakpoints in translated CM code.
Set a breakpoint at the entry point to the PROCESSSTUDENT procedure. As in the above example, the code is translated, and so Debug sets two breakpoints.
Set a breakpoint at the current CM program counter. Both the CM emulated and NM translated breakpoints are set. Next, set a breakpoint at the instruction following the current CM program counter. Again, both the CM and NM breakpoints are set. Note that the index number for the NM breakpoint is the same. This is because the two CM breakpoints are contained in the same node. Appendix C provides a description of node points.
Break in space 20 at the indicated offset. Every 100 times the routine is called, stop and print out a message. As with all breakpoint commands, the address typed in is converted to a logical address. In this example, the long to logical (LTOLOG) routine is used by the debugger. Space 20 does not correspond to any of the native mode libraries or the program file. It is, however, found to correspond to a translated body of CM code (in this instance, the FREAD intrinsic). Note that the corresponding CM emulator breakpoint is not set by Debug.
Now list the breakpoints that have been set. You cannot set a breakpoint on a gateway page. If breakpoints are set for a process other than the current PIN, Debug has no knowledge of the procedure names for the specified process unless the specified process is running the exact same program file. Having breakpoints set causes slight process overhead. Arming a global breakpoint causes all processes to suffer this overhead. Breakpoints are ignored in the following circumstances:
Breakpoints set in CM translated code (which has been optimized) may not always be hit. In some cases, the optimizer saves an instruction by targeting a branch to the delay slot immediately following a node point. As a result, a breakpoint that was set at the node point is not hit.
|
|