Debug Manual

Table Of Contents
Sample Debug Sessions
Debug Manual421921-003
F-31
Native Program Example
Selecting a location near the end of the EXAMPLE_INIT procedure in our noft listing,
we see that EXAMPLE_INIT is 212 (decimal) bytes long. To make sure we that get to
the end of the procedure we want to work with, rather than a procedure that precedes
it, it is important that we find the starting address of the instruction that is second from
the end of the procedure. We ensure the correct location by subtracting 8 bytes (2 * 4)
from the length of the procedure. To find the ending address of EXAMPLE_INIT, we
add 8 to its beginning address. The following shows this formula:
We resume the program and let it hit the first breakpoint.
LMAP Command
The $PC value shows that we have hit the breakpoint at the beginning of
EXAMPLE_INIT, but we can confirm this using the LMAP command. We pass the
$PC register to the LMAP command.
Displaying Variable Values
We can look at the content of program’s global variable MY_TERMNUM located a
program _GLOBAL + 0, and the procedure variables HOMETERM_LEN and
HOMETERM located at stack + %H7E and stack + %H80, respectively. Note that
hexadecimal numbers can be entered with the numeric prefix %H or 0X. Also note that
_GLOBAL has the address 0x08000000. We will see this address when we look at the
HANDLE_PTR variable in the EXAMPLE_INIT procedure, later in the example.
We used %H30/2 for the length of the A command based on the declaration in the
listing. The array was declared as [0:47], which is 48 (decimal) bytes long. For the A
command, the length is the number of 16-bit words. Because there are 2 bytes per
16-bit word, we divide the length by 2. We also use the B display format to group the
output into bytes rather than the default of 16-bit words.
050,03,00266-B 0x70000390 + (#212 - #8)
N: 0x7000045C INS: 0x03E00008
INS: JR ra
050,03,00266-R
DEBUG $PC=0x7000039C -RISC BREAKPOINT ($PC: 0x7000039C)-
050,03,00266-LMAP $PC
EXAMPLE_INIT + 0xC (UCr)
050,03,00266-D N 0x08000000, 1 :H
08000000: 0x0000
050,03,00266-D N $SP + %H7E , 1:D
4FFFFEAE: #00000
050,03,00266-A N $SP + %H80, %h30/2, B
4FFFFEB0:................................................