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-28
Native Program Example
Native Program Example
To show the use of Debug commands on a program compiled with a native compiler, 
we compiled the sample program in Example F-1 on page F-2 with pTAL as follows:
Example F-3. pTAL Compiled Listing
PTAL /IN demo1, OUT $S.#ldemo1/ tdemo1; optimize 0
Copyright (c) 1992-1995, Tandem Computers Incorporated
   Directives = ?OPTIMIZE 0
Source file: [1] \node.ndemo1 1998-07-08 14:53:11
 7.010  0 0  ?NOLIST, SOURCE $system.system.extdecs (DEBUG, FILE_OPEN_,
 8.100  0 0  INT   my_termnum;
 8.101  0 0  INT   process_handle [0:9];
 8.110  0 0  STRING .EXT sp := %2000000D;
 8.220  1 0  PROC example_init;
 8.230  1 1  BEGIN
 8.300 1 1  INT  error_init;
 8.301 1 1  INT .EXT handle_ptr;
 8.302  1 1   STRING  hometerm [0:47];
 8.304 1 1  INT  hometerm_len;
 8.305  1 1   STRING .hometerm_ptr;
 8.307  1 1   INITIALIZER; ! external system procedure
 8.308  1 1   error_init := PROCESSHANDLE_NULLIT_ (process_handle);
 8.310  1 1   error_init := PROCESS_GETINFO_ (process_handle,
  8.311 1  1   !fname:max!, !fname-len!, !priority!,
  8.312 1  1   !mom!, hometerm:48, hometerm_len);
 8.313  1 1   error_init := FILE_OPEN_ (hometerm:hometerm_len, my_termnum);
 8.317  1 1   IF error_init <> 0 THEN
 8.320  1 1   DEBUG;
 8.340  1 1   @hometerm_ptr := @hometerm [0];
  8.341 1  1  @handle_ptr := $WADDR_TO_EXTADDR (@process_handle [0]);
  8.350 1  1 END; -- example_init
ERROR_INIT       INT(16)
         %HB6  %H2  LOCAL VARIABLE
HANDLE_PTR        INT(16) EXT POINTER
         %HB0  %H4  LOCAL VARIABLE
HOMETERM       STRING [0:47]
         %H80  %H30  LOCAL VARIABLE
HOMETERM_LEN      INT(16)
         %H7E  %H2  LOCAL VARIABLE
HOMETERM_PTR      STRING POINTER
         %H78  %H4  LOCAL VARIABLE
 9.  1 0  PROC example_fill_array (array_num);
 9.010  1 0   INT array_num;
 9.100  1 1  BEGIN
 9.101  1 1   INT  count_read;
 9.110  1 1   INT  error_fill_array;
 9.111  1 1   STRING  .in_out_msg [0:47];
 9.112  1 1   STRING .EXT segment_ptr;
 9.114  1 1   error_fill_array := SEGMENT_USE_ (array_num);
  9.120 1  1  IF error_fill_array <> 0 THEN
 9.121  1 1   DEBUG;
 9.122  1 1   sp [0] := array_num;
 9.123  1 1   @segment_ptr := @sp [41];
 9.124  1 1   in_out_msg [0] ‘:=’ “enter some data” & %h0D0A; -- CR LF
 9.130  1 1   WRITEREADX (my_termnum, in_out_msg, 17, 48, count_read);
 9.140  1 1   segment_ptr ‘:=’ in_out_msg [0] FOR count_read bytes;
  9.200 1  1 END; -- example_fill_array
ARRAY_NUM       INT(16)
         %H82  %H2  LOCAL PARAMETER
COUNT_READ       INT(16)
         %H7E  %H2  LOCAL VARIABLE
ERROR_FILL_ARRAY     INT(16)
         %H7C  %H2  LOCAL VARIABLE
IN_OUT_MSG       STRING [0:47]
         %H4C  %H30  LOCAL VARIABLE










