Debug Manual

Table Of Contents
Debug Commands
Debug Manual421921-003
4-10
Set Unconditional Code Breakpoint
101 int getloc(void)
102 {
103 int loc_num, i_val, tm, *row;
.
.
115 if (i_val == loc_num)
116 return nextloc (row, loc_num);
In a native program, the address of the base of a function or procedure can be
determined using the noft utility. After noft has been started and the name of the
object file has been provided, the function getloc is specified with the listproc
command:
noft> listproc getloc
This command causes noft to display the base address of the function getloc.
Procedure : # Address
getloc : 2 0x70000448
The address displayed is then supplied as input to the dumpaddress command. This
command causes noft to display disassembled native code starting at the beginning of
getloc for forty 32-bit words:
noft> dumpaddress 0x70000448 for 40 words
The resulting display includes the RISC code associated with source line 115. (The
source line number is multiplied by 1000 in the display.)
Procedure Src Line Address Long Word Instructions
----------------------------------------------------------------
--
.
[getloc 115000] 0x700004a4 0x8fae008c lw t6,0x8c(sp)
[getloc 115000] 0x700004a8 0x8faf0088 lw t7,0x88(sp)
[getloc 115000] 0x700004ac 0x0000000000 nop
[getloc 115000] 0x700004b0 0x15cf0009 bne t6,t7,0x700004d8
[getloc 115000] 0x700004b4 0x0000000000 nop
.
The display shows the first instruction associated with line 115 to be at 0x700004A4. A
breakpoint is placed at that location:
106,06,00125-B 0x700004A4 ! (set breakpoint)
N: 0x700004A4 INS: LW t6,140(sp)
106,06,00125-R ! (resume)
The process enters the debug state each time the instruction at RISC address
0x700004A4 is executed.
DEBUG PC=0x700004A4 -RISC BREAKPOINT ($PC:0x700004A4)-
Note. In optimized code, instructions might be rearranged in the object file. Where possible,
noft indicates this by a “+” or “-” in the dumpaddress display. In highly optimized code, you
might have to rely on your own judgment to decide where a breakpoint is appropriate.