Native Inspect Manual Abstract This manual describes how to use the symbolic command-line debugger Native Inspect for debugging TNS/E native processes and snapshot files on HP NonStop™ Series TNS/E systems. Product Version Native Inspect H01 Supported Release Version Updates (RVUs) This publication supports the H06.07 RVU and all subsequent H-series RVUs until otherwise indicated in its replacement publication.
Document History Part Number Product Version Published 528122-003 Native Inspect H01 July 2005 528122-004 Native Inspect H01 November 2005 528122-005 Native Inspect H01 May 2006 526122-006 Native Inspect H01 August 2006
Native Inspect Manual Glossary Index What’s New in This Manual ix Manual Information ix New and Changed Information Figures Tables ix About This Manual v Who Should Read This Manual v Related Products and Manuals v Organization vi Notation Conventions vi 1.
1. Introducing Native Inspect (continued) Contents 1.
2. Using Native Inspect (continued) Contents 2. Using Native Inspect (continued) Sample Native Inspect Session (COBOL Program) 2-11 Start Program Under Native Inspect Control 2-13 Step Execution 2-14 Display a Level 88 Condition Name 2-14 Examine a Record 2-15 Modify a Record Field 2-16 Examine Tables 2-16 Set a Breakpoint on a Nested Program Unit 2-19 Debugging Copy Libraries 2-20 Terminate the Debugging Session 2-21 3.
4. Syntax of Native Inspect Commands Contents 4.
4. Syntax of Native Inspect Commands (continued) Contents 4.
4. Syntax of Native Inspect Commands (continued) Contents 4.
5. Using Tcl Scripting (continued) Contents 5. Using Tcl Scripting (continued) Tcl Examples 5-5 Tcl Commands Provided by Native Inspect 5-7 A. Command Mapping With Debug and Inspect Glossary Index Figures Figure 1-1. Figure 1-2. Figure 1-3. Native Inspect Runs in Same CPU as Current Process 1-7 Debugger Selection for a TNS/E Native Process 1-10 Debugger Selection for a TNS Process Running on TNS/E 1-11 Tables Table i. Table 1-1. Table 1-2. Table 2-1. Table 4-1. Table 4-2. Table 4-3. Table 5-1.
Contents Native Inspect Manual—528122-006 viii
What’s New in This Manual Manual Information Native Inspect Manual Abstract This manual describes how to use the symbolic command-line debugger Native Inspect for debugging TNS/E native processes and snapshot files on HP NonStop™ Series TNS/E systems. Product Version Native Inspect H01 Supported Release Version Updates (RVUs) This publication supports the H06.07 RVU and all subsequent H-series RVUs until otherwise indicated in its replacement publication.
New and Changed Information What’s New in This Manual ° ° Added a description of the unmap-source-name command.
About This Manual This manual describes the use of the Native Inspect symbolic command-line debugger for TNS/E systems. Who Should Read This Manual Anyone who wants to debug TNS/E native processes or snapshot files using a command-line debugger on a TNS/E system.
Organization About This Manual Organization Table i. Contents of the Native Inspect Manual Section Description 1, Introducing Native Inspect Describes the basic principles of using Native Inspect to debug TNS/E native processes and snapshot files. 2, Using Native Inspect Presents a sample session using Native Inspect to debug a TNS/E native process. 3, Using Native Inspect With COBOL Programs Describes features and behavior of Native Inspect that are specific to the debugging of COBOL programs.
General Syntax Notation About This Manual lowercase italic letters. Lowercase italic letters indicate variable items that you supply. Items not enclosed in brackets are required. For example: file-name computer type. Computer type letters within text indicate C and Open System Services (OSS) keywords and reserved words. Type these items exactly as shown. Items not enclosed in brackets are required. For example: myfile.c italic computer type.
General Syntax Notation About This Manual An ellipsis immediately following a single syntax item indicates that you can repeat that syntax item any number of times. For example: "s-char…" Punctuation. Parentheses, commas, semicolons, and other symbols not previously described must be typed as shown. For example: error := NEXTFILENAME ( file-name ) ; LISTOPENS SU $process-name.
1 Introducing Native Inspect Debuggers on NonStop TNS/E Systems on page 1-2 Origins of Native Inspect on page 1-3 Industry Standard, Open Source on page 1-3 Additional NonStop Extensions on page 1-3 Not Part of the Inspect Subsystem on page 1-4 Documentation for Native Inspect on page 1-4 Comparing Native Inspect to Debug on page 1-4 Comparing Native Inspect to Inspect on page 1-5 COBOL-Specific Differences on page 1-6 Process Debugging With Native Inspect on page 1-6 Languages Supported by Native Inspect
Native Inspect on TNS/E Systems Introducing Native Inspect Native Inspect on TNS/E Systems Native Inspect is a system-level command-line symbolic debugger that you use to debug TNS/E native processes and snapshot files. Native Inspect runs only on a NonStop TNS/E host system (not on a TNS/R or TNS system).
Origins of Native Inspect Introducing Native Inspect Table 1-1.
Not Part of the Inspect Subsystem Introducing Native Inspect Not Part of the Inspect Subsystem Because Native Inspect originated in the UNIX world, Native Inspect is not part of the Inspect subsystem. Both Inspect and Visual Inspect, however, are part of the Inspect subsystem.
Comparing Native Inspect to Inspect Introducing Native Inspect list of Debug commands that have equivalent Native Inspect commands, see Table A-1, Debug Commands and Equivalent Native Inspect Commands.
COBOL-Specific Differences Introducing Native Inspect COBOL-Specific Differences The following capabilities of Inspect are not supported in Native Inspect: • • • • Setting breakpoints using the program-unit.label or program-unit.linenumber notation. Using PICTURE and FORMAT clauses for displaying items. Formatting records as an arbitrary type (DISPLAY AS command). Setting breakpoints on statement ordinals.
Starting Native Inspect Introducing Native Inspect Figure 1-1. Native Inspect Runs in Same CPU as Current Process NonStop TNS/E Host CPU 1 CPU 2 Native Inspect Current Process User Terminal VST0101.vsd Starting Native Inspect You can start or enter Native Inspect in several ways: • • • • You can start a process under the control of the debugger, subject to the Debugger Selection Criteria (using the TACL RUND command or the run -debug command in OSS).
Starting Native Inspect Introducing Native Inspect Starting a Process Under the Control of the Debugger At the TACL prompt, enter a RUND command, specifying the file name of the TNS/E native object file you want to debug: TACL> rund $DISK2.MYSUBVOL.MYFILE In OSS, enter a run command with the -debug option and specify the file name of the TNS/E native object file you want to debug: OSS> run -debug usr/bin/myfile Native Inspect is automatically run in the same CPU as the process ($DISK2.MYSUBVOL.
Debugger Selection Criteria Introducing Native Inspect Invoking the Debugger From a Running Process Native Inspect is automatically started by the NonStop operating system when a debugger is required for any of the following reasons: • • • TNS/E native process code calls the PROCESS_DEBUG_ or DEBUG procedure. A TNS/E native process encounters a breakpoint set by a prior debugging session. The user of another debugger switches to Native Inspect.
Debugger Selection Criteria Introducing Native Inspect To summarize, Native Inspect is selected as the debugger: • • For TNS/E native processes when you have not established a Visual Inspect connection to the NonStop host, or the INSPECT attribute is OFF (Figure 1-2). For TNS processes when the Inspect subsystem is not running (that is, neither Visual Inspect nor Inspect is available) (Figure 1-3). Note, however, that Native Inspect has only limited capabilities for debugging TNS processes.
Debugger Selection Criteria Introducing Native Inspect Note that in Figure 1-3 there is no checking for the INSPECT setting (ON or OFF) for the process. All TNS processes are given to the Inspect subsystem for debugging, so the INSPECT attribute has no effect. Figure 1-3. Debugger Selection for a TNS Process Running on TNS/E Emulated TNS Process Visual Inspect session? Yes Select Visual Inspect No Inspect available? No Yes Select Inspect Select Native Inspect End VST0103.
Debugger Selection Criteria Introducing Native Inspect Explicitly Starting Native Inspect At the TACL prompt, enter a RUN command specifying the Native Inspect object file (EINSPECT) and the CPU in which the process is running (the process that you want to debug). For example, to start Native Inspect in CPU 2 in the Guardian environment, enter: \SYSTEM.$D0117.INSPECT 1> einspect / cpu 2 / TNS/E Native Inspect gdb Debugger [T1237 - 13-Jan-2005 12:45] Copyright 1998 Free Software Foundation, Inc.
Abbreviating Native Inspect Commands Introducing Native Inspect Reading the eInspect Custom File As Native Inspect initializes, it reads the contents of its custom file, named EINSCSTM, located in your logon default $vol.subvol on the TNS/E host. This file can contain any Native Inspect commands that you want to take effect during initialization. For example, you might establish your typical debugging environment by including a number of set commands (see set command (environment)).
Debugging Two Processes With One Instance of Native Inspect Introducing Native Inspect • • Use a separate Native Inspect instance for each process so that you are issuing debug requests from separate terminal sessions. Use one instance of Native Inspect for all processes so that one process is the current process and the other processes are in the background.
Using a Separate Instance of Native Inspect for Each Process Introducing Native Inspect Remember that while you are debugging this second process on a different terminal session, the home terminal for the process itself remains unchanged, and the process might attempt to prompt or output to its home terminal, causing more contention. Because of this potential problem, use Visual Inspect as the preferred debugger for multiprocess debugging. 2.
Using One Instance of Native Inspect to Debug Multiple Processes Introducing Native Inspect The display on the new terminal session reveals that the attach has completed, and process 3,32 is the current process for the new instance of Native Inspect: (eInspect 3,-2): attach 32 Symbols read in for program loadfile \PIPPIN.$D0117.TESTS.ODISP3.
Global Debugging Introducing Native Inspect • • • When debugging multiple programs, Native Inspect, like Inspect, sets the designated current process to be the process for which the most recent debugging event has been reported. The current process is the process to which all commands apply and for which Native Inspect waits for events. Use the vector command to explicitly change the designated current process.
Debugging TNS Processes Introducing Native Inspect • • • • To set a global breakpoint, you must enable privileged debugging and then specify the -g flag when setting a breakpoint. Global breakpoints are triggered by any process that executes the code on which the breakpoint is set. Global debugging mode begins when the first global breakpoint is set, and ends when the last global breakpoint is deleted. While global debugging is in effect, all other debugging in the CPU is suspended.
Snapshot File Analysis Introducing Native Inspect Snapshot File Analysis A process snapshot file or snapshot is a disk file that is an image of a process, its data, and its status at the moment it was saved—analogous in function to “core” files on UNIX systems. Snapshot files have file code 130. All three debuggers—Native Inspect, Visual Inspect, and Inspect—can be used to debug snapshot files (Inspect refers to snapshot files as save files).
Suspending Process Execution on DLL Events Introducing Native Inspect Suspending Process Execution on DLL Events You can use the LOAD and UNLOAD options catch command to gain control when a DLL is loaded or unloaded, respectively. Listing DLLs Native Inspect maintains a list of the loadfiles that compose the current program. You can display the list of loadfiles by entering the info command with the dll option.
Assessing Your Location After an Event Introducing Native Inspect list the current frame by using the frame command, select-frame command: (eInspect 6,679): frame #0 test_complexTypes() () at \SYS03.$D007.SYMBAT1.SCXXTST:424 424 printf( "%s test_complexTypes\n", getStepPrefix( 1 ) ); Table 1-2.
Switching Debuggers (To or From Inspect and Visual Inspect) Introducing Native Inspect Switching Debuggers (To or From Inspect and Visual Inspect) If you need to use features that are unique to another debugger, you can switch to a different debugger as follows: From You Can Switch to Using Native Inspect Inspect or Visual Inspect (according to Debugger Selection Criteria on page 1-9) switch command Visual Inspect Native Inspect Switch to System Debugger command in Visual Inspect (switches to Nati
Stopping Native Inspect Introducing Native Inspect Stopping Native Inspect Native Inspect runs as a separate process from the current process being debugged and stops: • • When the current process stops, if Native Inspect was started automatically to debug a process. If you enter the exit command or the quit command to explicitly stop. Native Inspect detaches from the current process and stops, leaving breakpoints in place.
Introducing Native Inspect Differences Between Native Inspect and WDB and GDB Native Inspect Manual—528122-006 1- 24
2 Using Native Inspect Preparing to Debug Using Native Inspect on page 2-2 Compiling and Transferring Program Files on page 2-2 Gaining Control of a Process Using Native Inspect on page 2-3 Loading Symbols Information (If Necessary) on page 2-3 Scope of Symbol Files: Global versus Per-Process on page 2-4 Load Address of Symbol Files on page 2-4 Considerations for Locating Symbols on page 2-4 How Native Inspect Locates Files on page 2-4 Determining the Compilation-Time Source File Name (If Necessary) on pa
Preparing to Debug Using Native Inspect Using Native Inspect Table 2-1.
Gaining Control of a Process Using Native Inspect Using Native Inspect If you are developing your program on a remote system or on a Windows PC, transfer your files to the system where you will perform debugging. You will need the program files in addition to the DLLs you are using.
Loading Symbols Information (If Necessary) Using Native Inspect Scope of Symbol Files: Global versus Per-Process When Native Inspect loads a symbol file, by default the symbols are available only to the current process. Such a symbol file has per-process scope. Specifying the -g (global) option when loading a symbol file gives the symbol file global scope. The symbols are then available to all processes being debugged by a single Native Inspect instance.
Using Native Inspect Determining the Compilation-Time Source File Name (If Necessary) You can reduce confusion by immediately entering a cd command and setting the default subvolume for Native Inspect to be your current working subvolume (that is, the subvolume where your source files are stored), in this example $data1.mysubvol): (eInspect 0,380): cd $data1.mysubvol Native Inspect also maintains a source search path for locating source files.
For C/C++, Advancing Execution to main() Using Native Inspect Path Change If the unqualified file names of your source files have not changed between compilation and debugging, use the dir command to add entries to the directory search list that Native Inspect uses to locate source files. For example: (eInspect 0,330): dir $myvol.
Sample Native Inspect Session (C++ Program) Using Native Inspect Specifying set continue-to-main off is useful for debugging global constructors in a C++ program.
Using Native Inspect Launch a C++ Program Under Native Inspect Control Launch a C++ Program Under Native Inspect Control $DATA3 NITEST 30> rund nitest TNS/E Native Inspect gdb Debugger [T1237 - 04-Apr-2006 09:00] Copyright 1998 Free Software Foundation, Inc. Copyright 2003-2006 Hewlett-Packard Development Company, L.P. Native Inspect (based on GDB) is covered by the GNU General Public License. Type "show copying" for conditions for changing and/or distributing copies.
List Source Using Native Inspect List Source (eInspect 3,591):list 74 void main(void) 75 { 75.1 char local_buf[80]; 76 char *local_ptr1, *local_ptr2; 77 int local_q; 78 local_ptr1 = "From main"; 78.1 strcpy( local_buf, "Hello world" ); 78.2 local_ptr2 = local_buf; 79 local_q = 0; 80 call1(local_ptr1,local_q); Trace the Stack (eInspect 3,591):bt #0 main () at \PIPPIN.$D0117.NITEST.GARTCC:78 #1 0x700034d0:0 in _MAIN () at \SPEEDY.$RLSE.T8432H01.
Print Variables and Memory Using Native Inspect Print Variables and Memory (eInspect 3,591):print local_ptr1 $1 = 0x80001f0 "From main" (eInspect 3,591):print /x &local_ptr1[0] $2 = 0x80001f0 (eInspect 7,911):print local_ptr2 $10 = 0x6ffffedc "Hello world" (eInspect 7,911):x /4 local_ptr2 0x6ffffedc: 72 'H' 101 'e' 108 'l' 108 'l' Notes • Use the print command to print the values of variables. Note. C/C++ character pointers are automatically dereferenced.
Set a Memory Access Breakpoint Using Native Inspect Set a Memory Access Breakpoint (eInspect 3,591):mab strucure.a No symbol "strucure" in current context. (eInspect 3,591):next 86 printf("%s q = %d\n",string,q); (eInspect 3,591):print a1 $3 = { a = 0x0, b = 0 } (eInspect 3,591):mab a1.b (eInspect 3,591):c Continuing. About to execute 'break 0x247' Process (3,591) called DEBUG. 0x70001190:0 in print_and_break() () at \PIPPIN.$D0117.NITEST.GARTCC:72 72 DEBUG(); (eInspect 3,591):c Continuing.
Sample Native Inspect Session (COBOL Program) Using Native Inspect Display a variable print command Modify a variable set command (variable) Resume execution continue command End program and session kill command Native Inspect Manual—528122-006 2- 12
Using Native Inspect Start Program Under Native Inspect Control Start Program Under Native Inspect Control DATA3 COBBAT 53> rund xcs000ds0 TNS/E Native Inspect gdb Debugger [T1237 - 04-Apr-2006 09:00] Copyright 1998 Free Software Foundation, Inc. Copyright 2003-2006 Hewlett-Packard Development Company, L.P. Native Inspect (based on GDB) is covered by the GNU General Public License. Type "show copying" for conditions for changing and/or distributing copies.
Step Execution Using Native Inspect Step Execution eInspect 3,1012):step 351 PERFORM OPEN-SEQ1-FILE. (eInspect 3,1012):next 352 IF SEQ1-FILE-ER THEN Notes • • • The step command steps execution into PERFORM invocations and calls to program units. The next command steps execution over PERFORM invocations and calls to program units. PERFORM invocations are not listed on the call stack. Display a Level 88 Condition Name 77 SEQ1-FLAG PIC 9. 88 SEQ1-FILE-ER VALUE 0. 88 SEQ1-FILE-OPENED VALUE 1.
Examine a Record Using Native Inspect Examine a Record Breakpoint 2, CALE-1 () at \PELICAN.$DATA3.COBBAT.SCS000D:319 319 PERFORM READ-SEQ1-TABLE THRU SEQ1-TABLE-EXIT 4 TIMES. (eInspect 3,1012):next 320 IF ERROR-DETECTED (eInspect 3,1012):next 322 PERFORM READ-SEQ2-TABLE UNTIL EOF OR ERROR-DETECTED.
Modify a Record Field Using Native Inspect Modify a Record Field (eInspect 3,1012):set name of seq2-rec = "Bach" (eInspect 3,1012):print seq2-rec $4 = NAME = "Bach " FILLER = " " WORKS = "opera04" FILLER = " " REST-OF-LINE = "Gypsy Baron 1881Fledermouse 1879" Notes • • Values are padded or truncated according to COBOL rules. Native Inspect ignores any JUSTIFIED clause on a data item.
Examine Tables Using Native Inspect NAME = "Bellini " WORKS = ( TITLE = "Semiramide " LISTING-INFO = CONDUCTOR = "Davis " SCHWANN-LISTING = "LN1233/\2700" PRICE = "$34,597.00" TITLE = "Norma " LISTING-INFO = CONDUCTOR = "Rudel " SCHWANN-LISTING = "DG1233/\2670" PRICE = "$34,602.00" (eInspect 3,1012):print schwann-listing This variable is an element of an array which has not been subscripted. Supply necessary subscripts and try again.
Examine Tables Using Native Inspect (eInspect 1,301): ptype rec5 type = RECORD R51 RECORD OCCURS 2 TIMES R511 PIC X(16) R512 PIC X(16) R513 RECORD OCCURS 3 TIMES R5131 PIC XXX R5132 PIC XXX (eInspect 1,301): p rec5 $40 = R51 = ( R511 = "REC5.R51[1].R511" R512 = "REC5.R51[1].R512" R513 = ( R5131 = "111" R5132 = "112", R5131 = "111" R5132 = "112", R5131 = "111" R5132 = "112"), R511 = "REC5.R51[1].R511" R512 = "REC5.R51[1].
Using Native Inspect Set a Breakpoint on a Nested Program Unit Notes • • You can apply subscripts to an unqualified record element name as long as the name is unique. Subscripts are separated by commas and must always occur in the last item of the reference. Set a Breakpoint on a Nested Program Unit (eInspect 3,1012):b cale-1.cale-1-1 Breakpoint 3 at 0x7000c200:2: file \PELICAN.$DATA3.COBBAT.SCS000D, line 588. (eInspect 3,1012):c Continuing. Breakpoint 3, CALE-1.
Debugging Copy Libraries Using Native Inspect Debugging Copy Libraries (eInspect 3,1012):list 310 Test-SingleInclusion. 311 DISPLAY " ". 312 DISPLAY "Test-SingleInclusion: Begin". 313 ?SOURCE CLIBCLB1( RANGE-110-112 ) 314 DISPLAY " ". 315 DISPLAY "Test-SingleInclusion: End". (eInspect 3,1012):list CLIBCLB1:110 105 02 ALPHA-A26 PIC A(26) VALUE "abcdef". 106 107 108 109 ?SECTION RANGE-110-112 110 DISPLAY " CLIBCLB1: RANGE-110-112: line 110". 111 DISPLAY " CLIBCLB1: RANGE-110-112: line 111".
Terminate the Debugging Session Using Native Inspect • To set a breakpoint on a line in a copy library, specify the base file name and line number. Native Inspect sets breakpoints at each program location where that copy library line is included; therefore, multiple breakpoints might be reported. You can clear any breakpoints you do not wish to be set. Terminate the Debugging Session (eInspect 3,1012):kill Notes • Use the kill command to terminate the process and debugging session.
Terminate the Debugging Session Using Native Inspect Native Inspect Manual—528122-006 2- 22
3 Using Native Inspect With COBOL Programs This section describes concepts and additional details for using Native Inspect with COBOL programs. How Native Inspect Finds Data Items Native Inspect follows COBOL scoping rules for finding data items specified in Native Inspect commands. That is, Native Inspect attempts to find the item in the current program unit (the program unit where execution is currently suspended).
Using Native Inspect With COBOL Programs Displaying Source Lines Displaying Source Lines In a program consisting of multiple files, Native Inspect handles the list command as follows: • • • If the list command specifies a file name, Native Inspect lists the contents of that file. If the list command does not specify a file name, Native Inspect lists the contents of the last source file listed since execution was last suspended.
Using Native Inspect With COBOL Programs Specifying Tables The variable INT is defined in both REC and REC2. You would specify the variable INT that is contained in REC2 in any of the following ways: INT OF REC2 INT IN REC2 REC2.INT When you use the period (.) syntax, the record name comes first, followed by the variable name. (This use of the period is Native Inspect syntax, not COBOL syntax.
Using Native Inspect With COBOL Programs Specifying Tables With Variable Upper Bounds Examples of valid table references are: MODEL (3) STYLE OF MODEL (3,11) COLOR OF STYLE OF MODEL (3,11,14) MODEL.STYLE.COLOR (3,11,14) You reference an entire table by specifying the table name without subscripts. For example, the following command displays all elements of table TOTAL-A: print TOTAL-A Subscripts are used to refer to specific instances of scalar variables that are part of a table of records.
Using Native Inspect With COBOL Programs Specifying Level 88 Condition Names Specifying Level 88 Condition Names You can attach a condition name to any data item. You specify a condition name the same way as you would specify a member of a record. For example, consider the declaration: 01 REC. 05 ITEM PIC 99. 88 GOOD-ITEM VALUE 10 THRU 20. You could specify: GOOD-ITEM OF ITEM OF REC or omit any qualifiers not required for uniqueness, just as you would for any other data item.
Using Native Inspect With COBOL Programs Displaying Level 88 Condition Names Displaying Level 88 Condition Names Native Inspect displays Level 88 condition names as one of the values ‘T’ or ‘F’. The value displayed depends on the value of the variable to which the condition belongs. For example, consider the following declaration: 77 VAR PIC S99 VALUE 1. 88 COND-1 VALUE 1. 88 COND-2 VALUE -1.
Using Native Inspect With COBOL Programs Assigning Values to Data Items Assigning Values to Data Items Assigning Values to Variables Native Inspect provides two ways of assigning values to data items: • • Using the set command. Using the command print data-item = value. Native Inspect follows COBOL rules for assigning values to numeric and alphanumeric variables. Some considerations are: • • • • • Native Inspect follows COBOL rules for truncation and padding, but ignores the JUSTIFIED clause.
Using Native Inspect With COBOL Programs Assigning Values to Level 88 Condition Names Assigning Values to Level 88 Condition Names You cannot modify a level 88 condition name. For example, consider the following declaration: 01 REC. 02 TABLE OCCURS 4 TIMES. 03 ITEM PIC 99. 88 ITEM-OK VALUE 12. You cannot assign a new value to ITEM-OK. You can change only the value of the underlying data item, in this case, the level 03 item ITEM.
Using Native Inspect With COBOL Programs Assigning Values to Character Strings If, in an assignment, you specify more values than there are elements in the table, an error is generated. If you specify fewer values, the assignment terminates when all values in the list are used. You cannot assign a value to an entire table or record by specifying a single value.
Using Native Inspect With COBOL Programs Evaluating Expressions Evaluating Expressions Native Inspect supports COBOL arithmetic expressions and a subset of COBOL conditional expressions, and follows COBOL rules for evaluating these expressions. The COBOL arithmetic operators are: +, -, *, /, and ** Conditional expressions use these operators: GREATER, NOT GREATER, LESS THAN, NOT LESS THAN, EQUAL TO, NOT EQUAL TO and also the logical operators AND and OR. You can also use the symbols >, <, <>, <=, >=.
Using Native Inspect With COBOL Programs Execution Control Execution Control You control execution of a program by setting breakpoints at locations in the program where you want execution to be suspended. As discussed previously, you can identify locations in a COBOL program using program unit and paragraph names, in addition to source line numbers. Once program execution is suspended, you resume execution by entering a continue command.
Using Native Inspect With COBOL Programs Native Inspect Manual—528122-006 3- 12 Considerations
4 Syntax of Native Inspect Commands • • • • Categories of Native Inspect Commands on page 4-1 Table 4-1, Commands of Native Inspect, on page 4-1 (commands listed in related groups) Syntax of Common Command Elements on page 4-6 Detailed syntax and examples for all the Native Inspect commands in alphabetic order (from # command to x command) Categories of Native Inspect Commands In Table 4-1, Native Inspect commands are grouped as follows: Command-line options Utility commands Session control commands Snaps
Categories of Native Inspect Commands Syntax of Native Inspect Commands Table 4-1.
Categories of Native Inspect Commands Syntax of Native Inspect Commands Table 4-1.
Categories of Native Inspect Commands Syntax of Native Inspect Commands Table 4-1.
Categories of Native Inspect Commands Syntax of Native Inspect Commands Table 4-1.
Syntax of Common Command Elements Syntax of Native Inspect Commands Syntax of Common Command Elements This subsection describes the syntax of: • • • • • linespec native-address llce (low-level conditional expression) expression /format Syntax of linespec linespec specifies a single source line; used in the list command for printing source lines and in the breakpoint command for specifying where to plant an instruction breakpoint.
Syntax of Common Command Elements Syntax of Native Inspect Commands to specify a code location within a subprocedure. Specifying Code Locations for COBOL Programs To specify a code location for a COBOL program, you use a line specification, as defined previously. A line specification specifies a single source line. It is used by commands that specify a single source line, such as the list command for listing source lines and the break command for specifying where to set an instruction breakpoint.
Syntax of Common Command Elements Syntax of Native Inspect Commands • octal (for example, 044000016700) If the address is in the range of 0 through 0xFFFFFFFF, it is sign-extended to form a 64-bit address. Example: 0x80000 & 0x72000000 If the address is greater than 0xFFFFFFFF, it is treated as a 64-bit address, and no sign extension is done. Example: 0xFFFFC5000000 The output format for native-address is 0xnnnnnnnnnnnnnnnn with leading zeros included.
Syntax of Common Command Elements Syntax of Native Inspect Commands Native Inspect does not support expressions in pTAL. To specify pTAL expressions, use C-style syntax: pTAL C-Style x :=y; x = y; flag := (a<>b); flag = (a !=b); pTAL pointer example: Using C-style pointers: int x[0:9]; int .xptr; ... @xptr ;= @x[0]; ... To display the address, enter: p xptr To dereference ptr (display what xptr points to), enter: p *xptr Variable names are not casesensitive. Variable names are casesensitive.
Syntax of Common Command Elements Syntax of Native Inspect Commands Syntax of /format /format is a repeat count, followed by a format letter and a size letter in any order: /[ count ][ format ][ size ] count is an integer specifying the number of units of size to display or print.
Specifying Pathnames in Native Inspect Commands Syntax of Native Inspect Commands Specifying Pathnames in Native Inspect Commands Certain Native Inspect commands require you to specify either an OSS or a Guardian pathname. Here are the rules Native Inspect follows for resolving pathnames and determining the current working directory.
# command Syntax of Native Inspect Commands • You can switch the current working directory from OSS format to Guardian format, and vice versa, by using the cd command. # command An alias for the comment command, used to embed a comment in a Native Inspect command line. a command A Debug-compatible Tcl command that displays memory in ASCII format. Alias: an a native-address [ count ] native-address is the address in memory that you want to display in ASCII. count is the amount of memory to display.
amap command Syntax of Native Inspect Commands If there is no current process, the added symbol file has global scope, and the -g option is optional. -readnow expands the symbol table immediately rather than incrementally as needed. pathname is the Guardian or OSS pathname of the TNS/E native code file (with file code 800) that Native Inspect is to open and from which Native Inspect will load symbols. address (optional for DLLs only) is the load address relative to which symbols should be rebased.
base command Syntax of Native Inspect Commands pin is the process ID (process number) of the process you want to attach. This process must be running in the same CPU as Native Inspect. To attach to a running OSS process, you must use its Guardian process ID. The attach command issues a PROCESS_DEBUG_ request for the specified process, and Native Inspect then waits for the next debugging event. (When privileged debugging is enabled, the attach command specifies the DEBUGNOW option.
break command, tbreak command Syntax of Native Inspect Commands break command, tbreak command Break sets an instruction breakpoint for the current process, at a specified line, function, or address. The tbreak command is similar, but sets a temporary breakpoint that is deleted after it is hit. Related Commands: Use the enable command and disable command to enable and disable breakpoints, respectively.
break command, tbreak command Syntax of Native Inspect Commands You can also use the condition command to associate a condition with a previously set breakpoint. Setting Global Breakpoints Global breakpoints are breakpoints that are set using the -g command option. To set global breakpoints, you must be logged on as the super ID, you must turn on priv mode by using the priv command, and no one else can be performing global debugging at the same time.
bt command Syntax of Native Inspect Commands To define a conditional breakpoint: (eInspect 1,329):b 352 Breakpoint 1 at 0x70002540:0: file \SIERRA.$YOSE1.SYMBAT1.SCXXTST, line 352. (eInspect 1,329):condition 1 pcb->pin == 2 (eInspect 1,329):info break Num Type Disp Enb Address What 1 breakpoint keep y 0x70002540 in pcbDataStructs_initialize at \SIERRA.$YOSE1.SYMBAT1.
catch command Syntax of Native Inspect Commands Example To display the current frame: (eInspect 4,770): bt #0 pcbDataStructs_initialize () at \SIERRA.$YOSE1.SYMBAT1.SCXXTST:362 #1 0x700016a0:0 in main (argc=1, argv=0x8003010) at \SIERRA.$YOSE1.SYMBAT1.SCXXTST:217 #2 0x700011f0:0 in _MAIN () at \SPEEDY.$RLSE.T8432H01.CPLMAINC:68 catch command Sets a logical breakpoint on a specified event (a catch event).
cd command Syntax of Native Inspect Commands You can switch a stopping process to another debugger by using the switch command. The process is eventually given back to the original instance of Native Inspect, and the process will still be in the stopping state. After you examine a stopping process, you must use the continue, detach, or kill command to disassociate the process from Native Inspect and allow the process to terminate.
comment command Syntax of Native Inspect Commands breakpoint-number is the number of the breakpoint or catch event at which you want the commands to be executed. Example To define breakpoint actions: (eInspect 1,329):commands 1 Type commands for when breakpoint 1 is hit, one per line. End with a line saying just "end". >print PCB >end comment command A Tcl command that introduces a line of comment.
continue command Syntax of Native Inspect Commands operating system. High-level conditional expressions (HLCEs), such as those supported by the condition command, are evaluated by Native Inspect. continue command Continues execution of the current process. Native Inspect suspends command prompting until the next debugging event occurs, or until you press the Break key. continue [ ignore-count ] ignore-count specifies the number of times to ignore a breakpoint at the current location.
delete command Syntax of Native Inspect Commands a for ASCII i for icode o[n] for octal d[n] for decimal h[n] for hexadecimal [n] is the bit size; bit sizes are 8, 16, 32, or 64. The default value is 32. If you omit the format option, 32-bit quantities are displayed in the default output base.
delete display command Syntax of Native Inspect Commands delete display command Deletes an expression from the list of expressions that are automatically displayed when the program is suspended. If you do not specify a num, the command deletes all automatic display expressions. delete display [ num ] num is an ordinal number that identifies one expression on the automatic display list. Considerations • • To specify an expression for automatic display, use the display command.
dir command Syntax of Native Inspect Commands • • If the process you name in a detach command is suspended, it will automatically be resumed. If you enter the detach command when breakpoints are set in the process, Native Inspect issues a warning describing the situation and gives you the option of continuing or aborting the operation. Example See Example of Using Multiple Instances of Native Inspect on page 1-15.
disable command Syntax of Native Inspect Commands disable command Disables specified breakpoints, which remain defined but are not hit until reenabled. Use the enable command to enable a disabled breakpoint. If you do not enter any breakpoint numbers, the command disables all the breakpoints associated with the current process. Alias: dis, disa disable [ breakpoints ] [ breakpoint-number ... ] breakpoint-number is the number of a breakpoint or catch event that you want disabled.
disassemble command, da command Syntax of Native Inspect Commands disassemble command, da command Displays a range of memory as instructions. The da command is an alias for the disassemble command. To display the instructions that compose the current line, first use the info line command to display the line’s address range and then use the disassemble command. Note. COBOL programs are often lengthy.
display command Syntax of Native Inspect Commands Example To display instructions for a function: (eInspect 3,663):da PCB_addAttribute Dump of assembler code for function PCB_addAttribute: ;;; File: \SIERRA.$YOSE1.SYMBAT1.SCXXTST 239 { 0x70001820:0 : [MII] alloc r34=ar.pfs,30,30,0 0x70001820:1 : adds r12=-96,r12 0x70001820:2 : nop.i 0x0;; 0x70001830:0 : [MMI] adds r27=32,r12 0x70001830:1 : nop.
dmab command Syntax of Native Inspect Commands Example To use the automatic display list: (eInspect 4,798):display pcb->attributeCount 1: pcb->attributeCount = 1 (eInspect 4,798):display pcb->pin 2: pcb->pin = 0 (eInspect 4,798):next 364 PCB_addAttribute( pcb, PCBAttribute_createNonstop( PCBLis t.
down command, down-silently command Syntax of Native Inspect Commands down command, down-silently command Selects the stack frame that is called by the current stack frame. The selected stack frame becomes the stack frame relative to which program state is displayed. The down command also prints out information about the selected stack frame. Related Commands: up command, up-silently command Alias: do, dow { down | down-silently } count count is the number of frames to go before selecting a frame.
enable display command Syntax of Native Inspect Commands Example To disable and then enable a breakpoint: (eInspect 1,329):disable 1 (eInspect 1,329):info break Num Type Disp Enb Address What 1 breakpoint keep n 0x70002540 in pcbDataStructs_initialize at \SIERRA.$YOSE1.SYMBAT1.SCXXTST:352 stop only if pcb->pin == 2 print PCB (eInspect 1,329):enable 1 (eInspect 1,329):info break Num Type Disp Enb Address What 1 breakpoint keep y 0x70002540 in pcbDataStructs_initialize at \SIERRA.$YOSE1.SYMBAT1.
env command Syntax of Native Inspect Commands env command Displays information about the environment of the current process, including register values; segment numbers for data space, code space and user stack; and user segment information. env Native Inspect also displays the current input and output base, whether logging is currently on or off, and the number of lines in a page (show height). For process debugging, the terminal name and the priv mode (show priv) are also displayed.
fc command Syntax of Native Inspect Commands fc command Redisplays a previous command and allows you to edit and reexecute the command. This command behaves like the fc command in TACL on a NonStop system. fc [ command-number | command-string ] command-number is the number of the command you want to redisplay, edit, and reexecute. Use the show command with the commands option to display the commands entered in the current session.
finish command Syntax of Native Inspect Commands finish command Executes the current process until execution either returns from the currently selected frame (by default, the current frame) or encounters a debugging event. The finish command prints the return value, if there is one. Use the frame command, select-frame command to select the current frame. The finish command operates relative to the currently selected frame, which might differ from the current execution frame.
frame command, select-frame command Syntax of Native Inspect Commands frame command, select-frame command Selects a stack frame and prints information about the selected stack frame. The selected stack frame becomes the frame relative to which program state is displayed. The select-frame command, the “silent” version of the frame command, does not print out information about the selected frame. Alias: f [ frame | select-frame ] [ number ] number is the number of the frame you want to select.
help command, help option Syntax of Native Inspect Commands To display frame number 1: (eInspect 6,679): frame 1 #1 0x70001570:0 in main (argc=1, argv=0x8003010) at \SYS04.$D0117.SYMBAT1.SCXXTST:218 218 test_complexTypes(); (eInspect 6,679): help command, help option Displays information about commands of Native Inspect. The online help for Native Inspect has been inherited from its WDG/GDB parents and thus provides somewhat different information than that provided in this manual.
hold command Syntax of Native Inspect Commands Examples To display help: (eInspect 3,-2): help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data filecmd -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without
ignore command Syntax of Native Inspect Commands native-address is the address at which you want to display instructions. count is the number of instructions to display. The default value is 1. function-name is the name of the function in the source whose instructions you want to display. Example To display instructions: (eInspect 3,663):i 0x700023c0 5 Dump of assembler code from 0x700023c0:0 to 0x700023d0:0: ;;; File: \SIERRA.$YOSE1.SYMBAT1.
info command Syntax of Native Inspect Commands ih [ signal_name ] signal-name is the name of the signal about which you want information. If you do not specify a signal name, Native Inspect displays information about all the signals. Table 4-2 on page 4-54 contains a list of signal names. The command output includes information such as the address of the signal handler, whether the signal handler is priv or not, and various flags.
info command Syntax of Native Inspect Commands attribute is one of: address symbolic-name describes where the specified symbol is stored. all-registers lists all registers and their contents for the currently selected frame. Listing includes floating-point registers. architecture lists information about the target architecture. args lists argument variables of the currently selected stack frame.
info command Syntax of Native Inspect Commands functions [ regular-expression ] prints all function names or those matching the specified regular expression. handle [ signal-number ] displays the response that Native Inspect gives when the current program receives various signals. line linespec displays the starting and ending addresses of the code corresponding to the specified source line. locals prints the values of local variables of the currently selected stack frame.
info command Syntax of Native Inspect Commands source prints information about the current source file. stack prints a backtrace of the stack, like the bt command. symbol native-address describes what symbol is at the specified address. symbol-files prints the names of all the symbol files visible to the current process, including both per-process and global symbol files. target prints information about the target being debugged.
info command Syntax of Native Inspect Commands To display information about current breakpoints: (eInspect 1,325): info break Num Type Disp Enb Address What 1 breakpoint keep y 0x70001672 in main at \SIERRA.$YOSE1.SYMBAT1.SCXXTST:216 2 breakpoint keep y 0x70003700 in test_complexTypes at \SIERRA.$YOSE1.SYMBAT1.
info command Syntax of Native Inspect Commands To list information about currently loaded DLLs, including the program loadfile: (eInspect 3,331):info dll Loadfiles: \PELICAN.$DATA3.COBBAT.XCS000D0: (symbol file:\PELICAN.$DATA3.COBBAT.XCS000D0) ( PIC ELF PROG) Text : 0x0000000070000000 (size: 0x25000) Data : 0x0000000008000000 UID : 21576679|146 \PELICAN.$SYSTEM.SYS00.ZCOBDLL:(PIC ELF DLL, Public LIB) Text : 0xfffffffffeb10000 (size: 0xc8000) Data : 0x000000006db50000 UID : 12085384|6 \PELICAN.$SYSTEM.
jump command Syntax of Native Inspect Commands To display the contents of the registers (output is several screens long): (eInspect 2,647):info reg pr0: 0x1 pr1: 0x0 pr2: 0x0 pr3: 0x0 pr4: 0x0 pr5: 0x0 pr6: 0x0 pr7: 0x0 pr8: 0x1 pr9: 0x0 pr10: 0x0 pr11: 0x0 pr12: 0x1 pr13: 0x0 pr14: 0x1 ...
kill command Syntax of Native Inspect Commands Example To jump to a specified location (line 51): (eInspect 3,638): list 44 } 45 46 void call1(char *string,long long q) 47 { 48 eight_byte_struct structure; 49 structure.a = "from call1"; 50 structure.b = 1; 51 printf("%s q = %d\n",string,q); 52 print_and_break(); 53 call2(structure); (eInspect 3,638): fr 0 #0 call1 (string=0x0, q=0) at C:\cygwin\home\save\test\gartest.c:49 49 structure.
list command Syntax of Native Inspect Commands list command Lists source code starting at the most recently listed location. Native Inspect reads source from EDIT files (file code 101) and unstructured files (file code 180). By default, Native Inspect displays 10 lines, with the current execution location in the middle of the display, where possible. The current line is indicated by an asterisk (*) at the beginning of the line.
list command Syntax of Native Inspect Commands • Otherwise, use the map-source-name command to map the compile-time file name to the current name. You can copy and paste the path name displayed in the error message as the left-hand argument to the map command. For examples of locating source files, see Determining the Compilation-Time Source File Name (If Necessary) on page 2-5 and Configuring a Search Path for Your Source Files (If Necessary) on page 2-5.
list command Syntax of Native Inspect Commands To list source at a line: (eInspect 1,463):list 200 195 static PCBAttribute_t *PCBAttribute_createNonstop(); 196 static PCBAttribute_t *PCBAttribute_createSystem(); 197 static PCBHandle_t *PCBHandle_create( PCB_t *pcb ); 198 static PCBHandle_t *PCBHandle_addRef( PCBHandle_t ); 199 static void PCBList_add( PCBLink_t **list, PCBHandle_t ); 200 201 static void pcbDataStructs_initialize(); 202 203 static void test_complexTypes(); 204 (eInspect 1,463): To list so
log command Syntax of Native Inspect Commands log command Turns logging on or off: • • If you specify a pathname, logging is turned on. If you omit the pathname, Native Inspect turns off logging and closes the current log file. log [ pathname | -d ] pathname is the OSS or Guardian pathname of the log file. Native Inspect creates a text file (file code 101) in the current working directory or in the location you specify in the log command.
mab command Syntax of Native Inspect Commands *native-address is a 32-bit or 64-bit address. variable is the name of a variable in the current process on which you want to set a memory access breakpoint. If you specify a variable, then size is optional. size is an optional number of bytes if you specify a variable. By default, Native Inspect uses the size of the variable as the address range to watch. If you specify *native-address, you must also specify size.
map-source-name command Syntax of Native Inspect Commands Examples To display the memory access breakpoint: (eInspect 1,480):mab MAB addr = 0x080000e0 segid = 65535 mabtype = 2 global = 0 haltloop = 0 length = 1 There is no global MAB set To set a MAB by address: (eInspect 3,880): mab *0x8000370 (eInspect 3,880): c Continuing. Process (3, 880) received DS_EVENT_MAB (seg:65535, addr:0x08000370, pc:0xa4bd4c1 1ea887459, len:-233208559 type:1) 0x700024e0:2 in pcbDataStructs_initialize () at \SIERRA.$YOSE1.
map-source-name command Syntax of Native Inspect Commands source-name is the fully qualified name of the source file at compilation time. If source-name is omitted, the fully qualified name of the current source file is used. alias-name is either a fully qualified file name or an unqualified file name to which you are mapping the fully qualified source-name. If alias-name is unqualified, Native Inspect locates it using the subvolume search path defined by the dir command.
mh command Syntax of Native Inspect Commands • New aliases created as a result of prefix matches are added to the mapping list. For example, if you enter the command map D:/usr/T1000=/h/src then a source file name of, for example, D:/usr/T1000/src/cpu/mips/x.c is aliased to /h/src/src/cpu/mips/x.c. when the source file name is listed. A subsequent map command displays the following aliases: 2. D:/usr/T1000/src/cpu/mips/x.c is aliased to /h/src/src/cpu/mips/x.c (Prefix match) 1.
mh command Syntax of Native Inspect Commands SIG_IGN | SIG_ABORT | SIG_DFL | SIG_DBG are the signal handlers (in this case, actions): SIG_IGN SIG_ABORT SIG_DFL SIG_DBG Ignore signal Abort program Invoke default Invoke debugger native-address is the procedure entry address at which the signal handler is set up. Table 4-2 lists the signal names. Signal names are used in both the mh command and the ih command. Table 4-2.
modify command Syntax of Native Inspect Commands Example In this example of the mh command and the ih command, the first mh command causes the signal to be reported to the debugger; the second mh command restores the default signal handler; and the ih command displays information about the signal handlers: (eInspect 4,658):mh SIGNOMEM DIG_DBG (eInspect 4,658):mh SIGCHLD SIG_DFL (eInspect 4,658):ih Signal Priv/Non SIGHUP N SIGINT N SIGQUIT N SIGILL N SIGURG N SIGABRT N SIGIO N SIGFPE N SIGKILL N SIGSEGV N
next command, nexti command Syntax of Native Inspect Commands value is the value you want to assign to native-address. The options 8, 16, 32, and 64 specify the bit size of value. After completion of the command, Native Inspect prints out the address that was modified, the number of bytes that were modified, and the old and the new values. If the specified value does not fit in the size specified, an error is returned.
nocstm option Syntax of Native Inspect Commands Example To step execution using the next, step, and finish commands: (eInspect 1,329):next 351 pcb = PCB_create(); (eInspect 1,329):step PCB_create () at \SIERRA.$YOSE1.SYMBAT1.SCXXTST:226 226 { (eInspect 1,329):next 227 PCB_t *pcb = (PCB_t *) malloc( sizeof( PCB_t ) ); (eInspect 1,329):next 228 memset( pcb, 0, sizeof( PCB_t ) ); (eInspect 1,329):finish Run till exit from #0 PCB_create () at \SIERRA.$YOSE1.SYMBAT1.
print command Syntax of Native Inspect Commands print command Evaluates and displays the value of a specified expression. The print command assigns a number to each output value, and the displayed result is saved in the value history buffer. You can use the value history buffer to display the result of previous print commands; specify the number assigned by the print command ($1, $2, $3, and so on). Entered with no options, redisplays the last value in the value history buffer.
print command Syntax of Native Inspect Commands Considerations • Other functions of the print command (illustrated in Examples on page 4-60) include: Print Command Form Function print (cast-type) variable Displays a variable formatted as a specific type (specified by a C/C++ cast expression) print {struct} buffer Displays a buffer formatted as the specified structure. Equivalent to the DISPLAY AS command in Inspect. print variable@elements Displays the specified number of instances of a variable.
print command Syntax of Native Inspect Commands Examples To display constant expressions (compared to display of eq command): (eInspect 3,638): $9 = 0x6fffff89 (eInspect 3,638): $8 = 64 '@‚ (eInspect 3,638): OCT: 000100 DEC: print /x 0x6ffffe40 + (47 *7) print /c 64 eq 64 64 HEX: 0x0040 ASCII: '...
print command Syntax of Native Inspect Commands To display pointers: (eInspect 3,657): print pcb $1 = (PCB_t *) 0x80048a0 (eInspect 3,657):print *pcb $2 = { state = 0, flags = { word = 0, item = { isBad = 0, isReady = 0, isHappy = 0, isStarved = 0, waitState = 0 } }, dispatchCount = 0, pin = 0, attributeCount = 2, attribute = {0x8004ee0, 0x8004f40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} } (eInspect 3,657) print pcb->flags.item.
print command Syntax of Native Inspect Commands To display a buffer formatted as a struct (use the set print pretty command to control display format of structures): (eInspect 3,663): print gBuffer $7 = '\000' , "\003\b\000N\340\b\000O@\b\000O\240", '\000' (eInspect 3,663): print {PCB_t} gBuffer $8 = { state = 0, flags = { word = 0, item = { isBad = 0, isReady = 0, isHappy = 0, isStarved = 0, waitState = 0 } }, dispatchCount = 0, pin = 0, attributeCount = 3, attribute
print command Syntax of Native Inspect Commands To display an item from the value history list: (eInspect 1,463): print *PCBList.
priv command Syntax of Native Inspect Commands priv command Sets, unsets, or shows the privilege level of the debugging session. The privilege level in turn controls whether a user can perform privileged debugging operations such as setting breakpoints on or stepping in to privileged functions. To use the priv command to turn privileged debugging on or off, you must be logged on as the super ID. Entered with no options, displays the current priv mode status.
pwd command Syntax of Native Inspect Commands COBOL example: (eInspect 7,444):ptype EM type = PIC X(4) (eInspect 7.444):ptype RECX type = RECORD 02 NATA NATIVE-4 02 NATB NATIVE-8 (eInspect 7,444):ptype ARRX type = NATIVE-2 OCCURS 4 TIMES pwd command Prints the current working directory. pwd Example To display the current working directory: (eInspect 2,1142):pwd Working directory \PIPPIN.$D0101.INSPECT. quit command Ends a Native Inspect session.
save command Syntax of Native Inspect Commands Table 4-3 lists the names of the registers on a TNS/E native NonStop system. The info, print, and reg commands in particular use register names. You can use any C assignment operator (such as += or -=) when assigning a value to a register. Table 4-3.
set command (environment) Syntax of Native Inspect Commands set command (environment) Sets debugging session options and environment variables. Compare with the set command (variable), which modifies the value of a variable in the program being debugged. All the environment attributes available to the set command are also supported by the show command. Some attributes, however, are supported only by the show command.
set command (environment) Syntax of Native Inspect Commands history sub-attribute value sets attributes of the command history maintained by Native Inspect. sub-attribute is one of: expansion { on | off } sets history expansion on command input. filename { on | off } sets the name of the file in which to record the command history. save { on | off } sets saving of the history record on exit from Native Inspect. size number sets the size of the command history. The default value is 256.
set command (environment) Syntax of Native Inspect Commands See Syntax of expression on page 4-8 for more information about using pTAL with Native Inspect. listsize number sets the value of the size of the list displayed by the list command. The default value is 10. mode { user | priv } sets the working session as priv (privileged) mode for process debugging. Applies to individual debug sessions; restricted to the super ID (user 255,255).
set command (environment) Syntax of Native Inspect Commands null-stop { on | off } sets printing of char arrays to stop a first null char. object { on | off } sets printing of objects; derives type based on vtable information. pretty { on | off } sets pretty printing of structures (prints one field per line rather than compressing multiple fields on one line). See following examples. repeats number sets threshold for repeated print elements. The default value is 10.
set command (environment) Syntax of Native Inspect Commands width number sets the number of characters Native Inspect expects in a line. Examples To set pretty printing on and off: (eInspect 4,770): set print pretty off (eInspect 4,770): print pcb $2 = (PCB_t *) 0x0 (eInspect 4,770): c Continuing. Breakpoint 3, pcbDataStructs_initialize () at \SIERRA.$YOSE1.SYMBAT1.
set command (variable) Syntax of Native Inspect Commands To set the number of elements to print: (eInspect 4,774): set print elements 5 (eInspect 4,774): print pcb->attribute $5 = {0x0, 0x0, 0x0, 0x0, 0x0...} set command (variable) Evaluates an expression and assigns the resulting value to a variable. set [ variable ] var-name { expression | value } var-name is the name of a variable in the current process. expression is an expression whose value you want to be assigned to var-name.
show command Syntax of Native Inspect Commands show command Displays either the environment settings for Native Inspect or the value of a variable in the program being debugged. show [ attribute | { history | print | check } [ sub-attr ] ] attribute is typically one of the same attributes as for the set command (environment). The history, print, and check attributes are as described for the set command (environment).
snapshot command Syntax of Native Inspect Commands Example To display the source search path: (eInspect 1,-2):show directories Source directories searched: $d0117.tests:$cdir:$cwd snapshot command Opens a TNS/E native process snapshot file (file code 130) for analysis. snapshot pathname filename is the OSS or Guardian pathname of a TNS/E native snapshot file (with file code 130) that you want to open.
step command, stepi command Syntax of Native Inspect Commands step command, stepi command Advances program execution by one source statement or by a specified number of statements. For COBOL programs, execution advances to the next verb. Execution steps “in” any function calls or PERFORM statements that are executed within the step range. If a function call is made within the stepping range, the call is followed and execution suspended after the function’s prolog code is executed.
symbol command or symbol-file command Syntax of Native Inspect Commands • Transfers a TNS process to Inspect switch After you enter a switch command, Native Inspect suspends command prompting until one of the following happens: • • • The process is transferred back to Native Inspect. You press the Break key. The process terminates. Native Inspect continues to maintain the associated state for the process until the process terminates or is transferred back to Native Inspect.
tbreak command Syntax of Native Inspect Commands Entered without the -g option, loads a symbol file that has per-process scope. Symbols are visible only to the current process. If there is no current process, the added symbol file has global scope by default, and the -g option is optional. You can add the same file with per-process scope and global scope. -readnow expands the symbol table immediately rather than incrementally as needed.
tu command Syntax of Native Inspect Commands Note. Unexpected results can occur if the native address specified does not correspond to a valid native jump buffer. tu command Traces the stack relative to the location stored in a ucontext buffer. Set up ucontext_t* as the third parameter of a signal handler function (in C/C++ or pTAL). The tu command lists stack traces from a ucontext buffer contained at the specified address.
tn command Syntax of Native Inspect Commands Examples To obtain the name of the jump buffer (in this case, env), and then trace the stack relative to the jump buffer: (eInspect 1,1028):info var All defined variables: File \SIERRA.$OS.VIVTEST.
unload-symbol-file command Syntax of Native Inspect Commands Alias: bt, bt command tn unload-symbol-file command Unloads all symbol data associated with a specified loadfile name. • Entered with no arguments, prompts you before unloading all symbol data having a per-process scope associated with the current process. • Entered with only the -g option, prompts you before unloading all symbol files having global scope.
until command Syntax of Native Inspect Commands Examples This example shows that when you delete a mapping for a pathname prefix that has resulted in the creation of new aliases, all such aliases are deleted. Display existing mappings: (eInspect 3,-2): map 4. D:/usr/T1000/src/cpu/mips/x.c is aliased to /v/src/src/cpu/mips/x/c (Prefix match) 3. D:/usr/T1000 is aliased to /v/src 2. D:/usr/T1000/src/cpu/mips/x.c is aliased to /h/src/src/cpu/mips/x/c (Prefix match) 1.
up command, up-silently command Syntax of Native Inspect Commands To execute until a specified location (line 382): (eInspect 1,329):until 382 pcbDataStructs_initialize () at \SIERRA.$YOSE1.SYMBAT1.SCXXTST:382 382 pcb->flags.item.isReady = 1; up command, up-silently command Selects the stack frame that calls the currently selected stack frame. The selected stack frame becomes the stack frame relative to which program state is displayed.
vector command Syntax of Native Inspect Commands To use the up and down commands (COBOL example): (eInspect 7,416): bt #0 EMMA.LISA () at \SIERRA.$AUDIT.DIVA.CBINIT:155 #1 0X70006950:0 in EMMA () at \SIERRA.$AUDIT.DIVA.CBINIT:136 #2 0x70003110:0 in EMMA () at \SIERRA.$AUDIT.DIVA.CBINIT:53 (eInspect 7,416):up #1 0x70006950:0 in EMMA () at \SIERRA.$AUDIT.DIVA.CBINIT:136 136 Call “Lisa”. (eInspect 7,416):up #2 0x70003110:0 in MAIN () at \SIERRA.$AUDIT.DIVA.CBINIT:53 53 Call “Emma”.
version option Syntax of Native Inspect Commands version option A command-line option that displays the versions of Native Inspect, GDB, and the Tool Command Language (Tcl). This option is an alias for the show command with the version option. --version vq command Displays information about process segments or, if you specify a segid, changes the selectable segment viewed by Native Inspect. vq [ segid ] segid is the segment ID for the segment about which to display information.
x command Syntax of Native Inspect Commands expression is an expression used in the current debugging target process. The whatis command is similar to the ptype command, except that ptype prints detailed information about the data type, and whatis prints just the name of the data type. x command Examines memory in any of several formats, independently of your program’s data types.
x command Syntax of Native Inspect Commands Default Values The defaulting rules for arguments to the x command enable you to easily display successive memory ranges using the same formatting: • • Default address—if you do not specify an address, the x command displays memory following the last address examined, or 0 if no address was previously examined.
x command Syntax of Native Inspect Commands To display memory at an address: (eInspect 0,794):x /20c 0x70000ca8 0x70000ca8 <__STRING$4>: 109 'm' 105 'i' 116 't' 111 'o' 0x70000cb0 <__STRING$6>: 102 'f' 100 'd' 0 '\000' 0 '\000' 0x70000cb8 <__STRING$5>: 100 'd' 0 '\ 000' 111 'o' 110 'n' 114 'r' 114 'r' 0 '\000' 101 'e' 0 '\000' 112 'p' 0 '\000' 50 '2' To display memory referenced by a pointer: (eInspect 0,794):x /5xw pcbAttribute 0x8004ee0: 0x00030000 0x00000005 0x8004ef0: 0x00000000 (eInspect 0,794
x command Syntax of Native Inspect Commands To use the current default to continue displaying memory (once you enter a format specification and an address, the x command uses those values as the defaults until you change the specification): (eInspect 6,1103):x /3i 0x70000ca8 0x70000ca8 <__STRING$2+24>: data8 0x14c84a407a 0x70000cb2 <__STRING$2+34>: [MII] break.m 0x0 0x70000cb8 <__STRING$2+40>: break.i 0x0 (eInspect 6,1103):x/2 0x70000cbe <__STRING$2+46>: break.
5 Using Tcl Scripting Introduction to Tcl on page 5-1 Learning Tcl on page 5-1 Using Native Inspect Tcl Commands on page 5-1 Loading a Tcl Script on page 5-2 Using Variables Defined in a Tcl Script on page 5-2 Programming Native Inspect Tcl Commands on page 5-2 Namespaces and Package Loading Rules on page 5-3 Tcl Examples on page 5-5 Tcl Commands Provided by Native Inspect on page 5-7 Introduction to Tcl Native Inspect includes Version 8.
Pass-Through of Tcl Commands Using Tcl Scripting Pass-Through of Tcl Commands Some commands, such as set and help, exist in both Native Inspect and Tcl. To use the Tcl version of such a command, you must “pass through” commands to Tcl by specifying Tcl on the Native Inspect command line, as follows: (eInspect 3,301): tcl tcl-command Native Inspect Commands Implemented in Tcl Native Inspect contains several commands that are implemented in Tcl.
Namespaces and Package Loading Rules Using Tcl Scripting • Procedure headers (one or more) ° Abstract ° Arguments ° Results Namespaces and Package Loading Rules Tcl supports packages and hierarchical namespaces. Creating Packages Packages are libraries of Tcl code that you can create using the Tcl package provide command: # mySub.tcl package provide mySub 1.0 # my package code Putting a Package in a Namespace The global namespace contains the built-in Tcl commands, such as set, puts, and open.
Namespaces and Package Loading Rules Using Tcl Scripting Explicitly Export Your Public Commands: Your package should export its public commands (but not its private commands), as follows: namespace eval ::mySub::: { namespace export {[a-z]*} } proc ::mySub::myPublicProc{} {...} Each namespace exports symbols that can be explicitly included, and unambiguously defined.
Tcl Examples Using Tcl Scripting Tcl Examples The code for the Native Inspect eq command is implemented in Tcl: # Syntax: eq # # Effect: Evaluate the expression and display the result in different # formats.
Tcl Examples Using Tcl Scripting To use a Tcl command (ListPCBs) to walk data structure (symexpr is a Tcl command used to evaluate symbolic expressions): #-----------------------------------------------------------------# Syntax: ListPCBS # Synopsis: Walk the PCBList, printing info about each PCB #-----------------------------------------------------------------proc ListPCBs { } { set pcbCount [FORMAT [SYMEXPR PCBList.
Tcl Commands Provided by Native Inspect Using Tcl Scripting Tcl Commands Provided by Native Inspect Native Inspect includes the built-in commands that are provided by open-source Tcl (such as package provide and namespace eval). In addition to these, the commands listed in Table 5-1 are provided specifically for the NonStop platform. Table 5-1. Tcl Commands for NonStop Systems Tcl Command Description expr expression Evaluates a 32-bit expression.
Using Tcl Scripting Tcl Commands Provided by Native Inspect Native Inspect Manual—528122-006 5 -8
A Command Mapping With Debug and Inspect • • Table A-1 lists Debug commands and equivalent Native Inspect commands. Table A-2 lists Inspect commands and equivalent Native Inspect commands. Table A-1.
Command Mapping With Debug and Inspect Table A-2.
Command Mapping With Debug and Inspect Table A-2.
Command Mapping With Debug and Inspect Table A-2.
Glossary address space. The memory locations to which a process has access. break condition. An event indicator or sequence of data from a terminal or terminal emulator that requests interruption of an application program. breakpoint. A location that you specify in a program at which execution stops and the debugger allows you to examine the state of the program and its variables. command. A demand for action by or information from a subsystem or the operation demanded by an operator or application.
export Glossary export. To offer a symbol definition for use by other loadfiles. A loadfile exports a symbol definition for use by other loadfiles that need a data item or function having that symbolic name. extended link format (ELF). A standard binary file format common on UNIX systems. The ELF format is used for position-independent code (PIC) files on both TNS/R and TNS/E systems. file name. A string of characters that uniquely identifies a file.
native Glossary native. An adjective that can modify object code, object file, loadfile, process, procedure, and mode of process execution. Native object files contain native object code, which directly uses the processor's instruction set and the corresponding conventions for register handling and procedure calls. Native processes are those created by executing native object files. Native procedures are units of native object code.
signal Glossary process, data for the process, and the status of the process at the time the save file was created. See also snapshot. A save file can be created through an Inspect or Native Inspect SAVE command at any time. A save file called a saveabend file can be created by the DMON debug monitor when a process’s SAVEABEND attribute is set and the process terminates abnormally. signal. The method by which an environment notifies a process of an event.
TNS/E Glossary TNS/E. Fault-tolerant HP NonStop computers that support the HP NonStop operating system and are based on the Intel® Itanium® processor. TNS/E systems run the Itanium instruction set and can run TNS object files by interpretation or after acceleration. TNS/E systems include all HP NonStop systems that use NSE-x processors. Contrast with TNS mode and user code. TNS/E library. A TNS/E native-mode library.
TNS/R native compiler Glossary TNS/R native compiler. A compiler in the TNS/R development environment that generates TNS/R native object code, following the TNS/R native-mode conventions for memory, stack, 32-bit registers, and call linkage. The TNS/R native C compiler is an example of such a compiler. Contrast with TNS/E native compiler. TNS/R native mode.
Visual Inspect Glossary Visual Inspect. A symbolic debugger that runs on a Windows workstation. Visual Inspect is an indepent product bundled with the NonStop Enterprise Toolkit (ETK). Visual Inspect supports CISC (TNS), RISC (TNS/R), and Itanium (TNS/E) machine architectures and compilers (that is, C, C++, COBOL, TAL, and pTAL) in both the Guardian and HP NonStop Open System Services (OSS) execution environments. Visual Inspect uses client-server architecture.
Visual Inspect Glossary Native Inspect Manual—528122-006 Glossary- 8
Index A Buffers, displaying 4-62 a command 4-4, 4-12, 4-22 Abbreviation of commands 1-13 add source assign (Inspect) A-2 Address of symbol file 2-4 address option 4-69 Address, attributes 4-13 add-symbol-file command 1-19, 4-5, 4-12 Advancing execution to main() 2-6 Alias, for commands 1-13 all-registers option 4-39 amap command 4-1, 4-13 an command 4-12 Application registers 4-66 architecture option 4-39 args option 4-39 Array elements, displaying 4-62 array option 4-69 ASCII 4-12, 4-22 asm-demangle opti
D Index D E d command 4-4, 4-21, 4-22 da command 4-4, 4-26 Data structures, displaying 4-62 debug command 1-8, 2-3 DEBUG procedure 1-9 Debugger selection 1-9 switching 1-22 DEBUGNOW command 1-8 Default subvolume 2-4 Deferred breakpoints 1-23 delete command 2-2, 4-3, 4-22 delete display command 4-4, 4-23 demangle option 4-69 detach command 1-15, 1-17, 4-2, 4-23 dir command 1-19, 2-6, 4-2, 4-24, 4-52 directories option 4-24, 4-73 Directory search path 4-24 Directory, working.
G Index G K GDB 1-3 General registers Global breakpoint 4-50 Global debugging Global MAB 4-28 Global symbol file kill command 4-3, 4-45 4-66 1-17, 1-18, 4-15, 4-16, 1-17 2-4, 4-12, 4-76 H h command 4-35 handle option 4-40 height option 4-67 help command 4-1, 4-2, 4-35 History buffer 4-58 History of commands 4-73 history option 4-68 hlce (high-level conditional expression) 4-21 hold command 4-3, 4-36 HP NonStop Open System Services (OSS) 1-7, 1-8, 4-14 I i command 4-4, 4-36 icode 4-22 ignore command 4
N Index N n command 4-56 namespace eval command (Tcl) 5-3 native-address specification 4-7 next command 1-18, 4-3, 4-56 nexti command 4-3, 4-56 ni command 4-56 nocstm option 4-1, 4-57 null-stop option 4-70 O object option 4-70 OCA (Object Code Accelerator) 1-18 Optimization level 2-2 OSS See HP NonStop Open System Services (OSS) output command 4-4, 4-10, 4-57 output-radix option 4-69 OutsideView 1-14 P p command 4-58 package provide command (Tcl) 5-3 package require command (Tcl) 5-3 Pointers (pTAL) 4-9
T Index show command 4-2, 4-32, 4-73 show directories command 4-24 si command 4-75 Signal handlers 4-53 Signal names 4-54 signals option 4-40 snapshot command 1-19, 4-2, 4-74 Snapshot file 1-19 source command 4-2, 4-74 Source files 4-46 Source name mapping 2-6, 4-46 source option 4-41 Source search path 2-6, 4-24, 4-73 SPI buffers 1-5 stack option 4-41 Starting Native Inspect 1-7 static-members option 4-70 step command 1-18, 2-1, 4-3, 4-34, 4-75 stepi command 4-3, 4-75 Stopping Native Inspect 1-23 Structu
W Index W wait command 1-14, 1-18, 4-2, 4-84 warranty option 4-41, 4-73 WDB 1-3 whatis command 4-5, 4-84 width option 4-71 Working directory 2-4, 4-65 X x command 4-4, 4-10, 4-85 Special Characters != (operator) 4-8 # command 4-2, 4-12 #, in frame number 4-17 $ 4-9, 4-58 $cdir 4-24, 4-73 $cwd 4-24, 4-73 $SYSTEM.SYSnn.