Debug Manual
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction
- Execution Modes on TNS/R Systems
- What User Access Is Required for Debugging
- How to Make a Process Enter Debug
- How to Select Debug as the Debugger
- Why a Process Enters Debug
- How to Determine Process State on a Trap or Signal
- Ending a Debug Session
- What Appears in the Debug Header Message
- How to Use Debug
- How Debug Breakpoints Work
- 2 Using Debug on TNS/R Processors
- 3 Debug Command Overview
- 4 Debug Commands
- Command Summary
- A Command
- AMAP Command
- B Command
- BASE Command
- BM Command
- C Command
- CM Command
- D Command
- DJ Command
- DN Command
- EX[IT] Command
- F[ILES] Command
- FC Command
- FN Command
- FNL Command
- FREEZE Command
- HALT Command
- H[ELP] Command
- I Command
- IH Command (TNS/R Native and OSS Processes)
- INSPECT Command
- LMAP Command
- M Command
- MH Command (TNS/R Native and OSS Processes)
- P[AUSE] Command
- PMAP Command (Accelerated Programs)
- PRV Command
- R Command
- S[TOP] Command
- T Command
- V Command
- VQ Command
- VQA Command
- = Command
- ? Command
- A Error Messages
- B ASCII Character Set
- C Command Syntax Summary
- Register Syntax
- Expression Syntax
- Address Syntax
- A Command
- AMAP Command
- B Command
- BASE Command
- BM Command
- C Command
- CM Command
- D Command
- DJ Command
- DN Command
- EX[IT] Command
- F[ILES] Command
- FC Command
- FN Command
- FNL Command
- FREEZE Command
- HALT Command
- H[ELP] Command
- I Command
- IH Command
- INSPECT Command
- LMAP Command
- M Command
- MH Command
- Output-Device Syntax
- P[AUSE] Command
- PMAP Command
- PRV Command
- R Command
- S[TOP] Command
- T Command
- V Command
- VQ Command
- VQA Command
- = Command
- ? Command
- D Session Boundaries
- E Correspondence Between Debug and Inspect Commands
- F Sample Debug Sessions
- Glossary
- Index
Sample Debug Sessions
Debug Manual—421921-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:................................................