dbx User’s Guide Document Number 007-0906-090
CONTRIBUTORS Written by Wendy Ferguson and Ken Jones Edited by Christina Cary Production by Gloria Ackley, Kay Maitz, and Lorrie Williams Engineering contributions by Dave Anderson and Ray Milkey Cover design and illustration by Rob Aguilar, Rikk Carey, Dean Hodgkinson, Erik Lindholm, and Kay Maitz © Copyright 1994, Silicon Graphics, Inc.— All Rights Reserved This document contains proprietary and confidential information of Silicon Graphics, Inc.
Contents List of Tables ix About This Guide xi What This Guide Contains xi What You Should Know Before Reading This Guide Suggestions for Further Reading xii Conventions Used in This Guide xiii 1. 2.
Contents iv 3. Examining Source Files 13 Specifying Source Directories 13 Specifying Source Directories With Arguments 13 Specifying Source Directories With dbx Commands 14 Examples of dir and use 14 Using Path Remapping 15 Changing Source Files 15 Listing Source Code 16 Searching Through Source Code 17 Calling an Editor 18 4.
Contents 5.
Contents vi 6.
Contents Continuing Execution After a Machine-Level Breakpoint 91 Tracing Execution at the Machine Level 92 Writing Conditional Commands at the Machine Level 93 Stepping Through Machine Code 94 8.
List of Tables Table 2-1 Table 5-1 Table 5-2 Table 5-3 Table 5-4 Table 5-5 Table 6-1 Table 7-1 Table 7-2 Table 8-1 Table 8-2 Table B-1 Table C-1 dbx Command-Line Options 7 dbx Language Independent Operators 34 C Language Operators Recognized by dbx 35 Pascal Operators Recognized by dbx 35 Fortran 77 Operators Recognized by dbx 36 Variable Types 38 Effect of $stepintoall Variable on the step Command 79 Hardware Registers and Aliases 81 Memory Display Format Codes 86 How the $promptonfork Variable Affects d
About This Guide This guide explains how to use the source level debugger, dbx. You can use dbx to debug programs in C, C++, Fortran77, and assembly language. What This Guide Contains This guide describes the features of dbx and provides simple examples of how to use dbx to debug programs. Specifically, this guide includes: Chapter 1, “Getting Started With dbx,” introduces some basic dbx commands and offers some tips about how to approach a debugging session.
About This Guide Appendix A, “dbx Commands,” lists and describes all dbx commands. Appendix B, “Predefined Aliases,” lists and describes all predefined dbx aliases. Appendix C, “Predefined dbx Variables,” lists and describes all predefined dbx variables. What You Should Know Before Reading This Guide This manual is written for programmers, and assumes that you are familiar with general debugging techniques.
Conventions Used in This Guide Silicon Graphics offers software options to assist in software development. The CASEVision/Workshop option provides the WorkShop toolset: Debugger, Static Analyzer, Performance Analyzer, Tester, and Build Manager. You can order a printed manual from Silicon Graphics by calling SGI Direct at 1-800-800-SGI1 (800-7441). Outside the U.S. and Canada, contact your local sales office or distributor. Silicon Graphics also provides manuals online.
About This Guide • Mutually exclusive arguments to a command are enclosed in braces ({ ... }) and separated by a pipe character (|). In the first example below, you can provide either an activation level or a procedure name as an argument to the command.
Chapter 1 1. Getting Started With dbx You can use dbx to trace problems in a program at the source code level, rather than at the machine code level. dbx enables you to control a program’s execution, symbolically monitoring program control flow, variables, and memory locations. You can also use dbx to trace the logic and flow of control to acquaint yourself with a program written by someone else.
Chapter 1: Getting Started With dbx 2. Invoke dbx for the failed program as described in “Invoking dbx” on page 6. dbx automatically reads in the local core file. 3. Perform a stack trace using the where command (described in “Examining the Stack” on page 46) to locate the failure point. For example, suppose you examine the core file for a program called test. Suppose the stack trace appears as follows: (dbx) where > 0 1 2 3 foo2(i = 5) [“/usr/tmp/test.c”:44, 0x1000109c] foo(i = 4) [“/usr/tmp/test.
Studying a New Program problem areas. If your program crashes, first determine which line causes it to crash, then set a breakpoint just before that line. You can use several dbx commands to trace a variable’s value. Here’s a simple method for tracing a program variable: 1. Use the stop command (see “Setting Breakpoints” on page 59) to set breakpoints in the program at locations where you want to examine the state of the program stack or the values stored in program variables. 2.
Chapter 1: Getting Started With dbx • step executes the next line of the program. If the next line is a procedure call, step steps down into the procedure. step is described in “Stepping Using the step Command” on page 79. • next executes the next line; if it is a procedure, next executes it but does not step down into it. next is described in “Stepping Using the next Command” on page 79.
Chapter 2 2.
Chapter 2: Running dbx Compiling and Linking Programs With Dynamic Shared Objects This section summarizes a few things you need to know if you compile and link your program with Dynamic Shared Objects (DSOs). A DSO is a relocatable shared library. By linking with a DSO, you keep your program size small and use memory efficiently. If you compile and link with DSOs, dbx automatically notices their use in the program and picks up the relevant debugging information.
Invoking dbx dbx Options Table 2-1 lists options you can give to dbx. These options are described in detail later in this chapter. Table 2-1 dbx Command-Line Options Option Description –I dir Tells dbx to look in the specified directory (in addition to the current directory and the object file’s directory) for source files. To specify multiple directories, use a separate –I for each.
Chapter 2: Running dbx Specifying Object and Core Files The object_file is the name of the executable object file that you want to debug. It provides both the code that dbx executes and the symbol table that provides variable and procedure names and maps executable code to its corresponding source code in source files. A corefile is produced when a program exits abnormally and produces a core dump.
Running Your Program givenfile [file] If you provide a filename, dbx kills the currently running processes and loads the executable code and debugging information found in file. If you do not provide a filename, dbx displays the name of the program that it is currently debugging without changing it. corefile [file] If you provide a filename, dbx uses the program data stored in the core dump file. If you do not provide a filename, dbx displays the name of the current core file without changing it.
Chapter 2: Running dbx rerun [run-arguments] The rerun command, without any arguments, repeats the last run command if applicable. Otherwise rerun is equivalent to the run command without any arguments. The sort command takes an input file and produces a sorted output file; you can specify input and output files either through command-line arguments or file redirection.
Using Online Help Using Online Help The dbx command help has several options: help shows the supported dbx commands help keyword shows information pertaining to the given keyword, such as alias, help, most_used, quit, playback, record, and so on help all shows the entire dbx help file When you type help all, dbx displays the file using the command name given by the dbx $pager variable. The dbx help file is large and can be difficult to read even if you use a simple paging program like more(1).
Chapter 2: Running dbx For example: (dbx) alias foll "print *(struct list *)$p ; \ set $p = (int)((struct list *)($p))->next" Hint: You can also use the hed command for creating and modifying commands. “The History Editor” on page 24 has details on this command. Invoking a Shell To invoke a subshell, enter sh at the dbx prompt, or enter sh and a shell command at the dbx prompt. After invoking a subshell, type exit or to return to dbx. The syntax for the sh command is: sh Invoke a subshell.
Chapter 3 3. Examining Source Files This chapter explains how to examine source files under dbx. It describes: • “Specifying Source Directories” • “Changing Source Files” • “Listing Source Code” • “Searching Through Source Code” • “Calling an Editor” Specifying Source Directories Based on the information contained in an object file’s symbol table, dbx determines from which source files the program was compiled and prints portions of these files as appropriate.
Chapter 3: Examining Source Files For example, consider debugging a program called look in /usr/local/bin, the source for which resides in /usr/local/src/look.c. To debug this program, you can invoke dbx from the /usr/local/bin directory by entering: % dbx -I /usr/local/src look Specifying Source Directories With dbx Commands The dir and use commands allow you to specify a source directory list while dbx is running. dir [dir ...
Changing Source Files If you use the use command instead, the current directory is no longer contained in the source directory list: (dbx) use /usr/local/src (dbx) use /usr/local/src Using Path Remapping Files compiled with –g have full pathnames to source files. If you’re debugging a program that was compiled somewhere else and you want to specify a new path to the sources, use path remapping. Just substitute one pattern for another pattern to remap the path so dbx can find the source file.
Chapter 3: Examining Source Files the current source file to whatever file contains the source for the procedure (see “Examining the Stack” on page 46 for more information on activation levels). If you enter the file command without any arguments, dbx prints the current source file: (dbx) file procedure.
Searching Through Source Code list func Lists $listwindow lines starting at procedure func. list func,exp Lists all source between func and exp, inclusive. list func:exp Lists exp lines, beginning at func. A > symbol prints to the left of the line that is the current line. A * symbol prints to the left of the line of the current pc location.
Chapter 3: Examining Source Files ?[reg_exp] Search backward through the current file from the current line for the regular expression reg_exp. If dbx reaches the beginning of the file without finding the regular expression, it wraps around to the end of the file. dbx prints the first source line containing a match of the search expression. If you don’t supply a regular expression, dbx searches backward based on the last regular expression searched.
Chapter 4 4. Controlling dbx This chapter describes features of dbx that affect its operation while debugging a program. Specifically, this chapter covers: • “Creating and Removing dbx Variables” • “Using the History Feature and the History Editor” • “Creating and Removing dbx Aliases” • “Recording and Playing Back dbx Input and Output” • “Executing dbx Scripts” Creating and Removing dbx Variables dbx allows you to define variables that you can use within dbx to store values.
Chapter 4: Controlling dbx The commands described in this section apply only to the manipulations of dbx variables, not program variables. “Displaying and Changing Program Variables” on page 39 describes how to manipulate program variables. Setting dbx Variables The set command sets a dbx variable to a given value, defining the variable if it does not exist: set var = exp Define (or redefine) the specified dbx variable, setting its value to that of the expression you provide.
Using the History Feature and the History Editor Listing dbx Variables If you enter the set command without providing any arguments, dbx displays (in alphabetical order) a list of all currently defined dbx variables, including predefined variables. Partial output looks like this: (dbx) set $addrfmt “0x%x” $addrfmt64 “0x%llx” $assignverify 1 $casesense 2 $ctypenames 1 $curevent 3 $curline 44 $curpc 268439708 ...
Chapter 4: Controlling dbx Examining the History List dbx stores all commands that you enter in the history list. The value of the dbx variable $lines determines how many commands are stored in the history list. The default value is 100. Display the history list with the history command.
Using the History Feature and the History Editor For example: (dbx) next 5 Process 22545 (test) stopped at [main:60 ,0x10001150] 60 total += j; (dbx) !! (!! = next 5) Process 22545 (test) stopped at [main:65 ,0x100011a0] 65 printf(“i = %d, j = %d, total = %d\n”,i,j,total); Another convenient way to repeat a commonly used command is with !string. For example, suppose that you occasionally print the values of certain variables using the printf command while running your program under dbx.
Chapter 4: Controlling dbx The History Editor The history editor, hed, lets you use your favorite editor on any or all of the commands in the current dbx history list. When you enter the hed command, dbx copies all or part of the history list into a temporary file that you can edit. When you quit the editor, any commands left in this temporary file are automatically executed by dbx. If you have set the dbx variable $editor to the name of an editor, the hed command invokes that editor.
Creating and Removing dbx Aliases If you find that you often create the same aliases in your debugging sessions, you can include their definitions in your .dbxinit file so that they are automatically defined for you. See “Automatically Executing Commands on Startup” on page 10 for more information on the .dbxinit file. Listing Aliases You can display the definition of aliases using the alias command: alias Lists all existing aliases. alias name Lists the alias definition for name.
Chapter 4: Controlling dbx of these aliases, dbx simply replaces it with the command for which it is an alias. Any arguments that you include on the command line are passed to the command.
Creating and Removing dbx Aliases The “p” alias takes four arguments and prints them surrounded by vertical bars (|). For example: (dbx) p(1,2,3,4) |1|2|3|4| (dbx) p( first, second, 3rd,4) | first| second| 3rd|4| In the previous example, dbx retains any spaces that you enter when calling an alias.
Chapter 4: Controlling dbx member. Because the command is too long to fit onto one line, this example uses the backslash character (\) to continue the command on a second line: (dbx) alias foll "print *(struct list *)$p ; \ set $p = (long)((struct list *)($p))->next" Casting $p to an integer type when following the link (the second assignment in the alias) is essential. If omitted, dbx may leave the $p reference symbolic and if so, goes into an infinite loop.
Recording and Playing Back dbx Input and Output Recording Input Use the record input command to start an input recording session. Once you start an input recording session, all commands to dbx are copied to the specified file. If the specified file already exists, dbx appends the input to the existing file. You can start and run as many simultaneous dbx input recording sessions as you need. Each recording session is assigned a number when you begin it.
Chapter 4: Controlling dbx For example, to stop recording session 4, enter the dbx command: (dbx) unrecord 4 To stop all recording sessions, enter: (dbx) unrecord all The dbx status command does not report on recording sessions. To see whether or not any active recording sessions exist, use the record command described in “Examining the Record State” on page 31. Playing Back Input Use playback input to execute commands that you recorded with the record input command.
Recording and Playing Back dbx Input and Output review the output file using any IRIX system text viewing command (such as vi(1)). For example, to record the dbx output in a file called gaffa, enter: (dbx) record output gaffa To record both the commands and the output, enter: (dbx) set $rimode=1 (dbx) record output gaffa If you omit the filename, dbx saves the recorded output in a temporary file in /tmp. The temporary file is deleted at the end of the dbx session.
Chapter 4: Controlling dbx Executing dbx Scripts You can create dbx command scripts using an external editor and then execute these scripts using the pi or playback input command. This is a convenient method for creating and executing automated test scripts. You can include comments in your command scripts by using a single pound sign (#) to introduce a comment. To include a # operator (described in “Operators” on page 33) in a dbx script, use two pound signs (for example, ##27).
Chapter 5 5. Examining and Changing Data This chapter describes how to examine and change data in your program while running it under dbx.
Chapter 5: Examining and Changing Data language precedence. You can also use parentheses to explicitly determine the order of evaluation. Table 5-1 lists the operators provided by dbx.
Using Expressions To print the address of line 27 in the source file foo.c (assuming that foo.c contains source that was used to compile the current object file), enter: (dbx) print "foo.c" #27 To print the address of line 27 in the source file containing the procedure bar (assuming that bar is a function in the current object file), enter: (dbx) print bar #27 Note: A pound sign (#) introduces a comment in a dbx script file.
Chapter 5: Examining and Changing Data Table 5-4 lists the Fortran 77 language operators recognized by dbx. Note that dbx does not recognize Fortran logical operators (such as .or. and .TRUE.). Fortran 77 Operators Recognized by dbx Table 5-4 Type Operators Unary + - Binary + - * / Note: Fortran array subscripting must use “[]” not “()”. For example, if x is a two-dimension Fortran array, print x(1,2) won’t work; however, print x[1,2] will work.
Printing Expressions the dbx variable $hexints to a nonzero value. If you set both $octints and $hexints to nonzero values, $hexints takes precedence. String Constants Most dbx expressions cannot include string constants. The print and printf commands are two of the dbx commands that accept string constants as arguments. You can also use the set command to assign a string value to a dbx variable. Otherwise, string constants are useful only as arguments to functions that you call interactively.
Chapter 5: Examining and Changing Data The variable types are listed in Table 5-5. Variable Types Table 5-5 Type Variable Name Value signed char sc 0xff unsigned char usc 0xff signed short ssh 0xffff unsigned short ush 0xffff Examples include: (dbx) pd -1 (dbx) pd -1 (dbx) px 0xff (dbx) px 0xffff (dbx) pd 255 (dbx) pd 65535 sc ssh sc ssh usc ush dbx always prints the bits in the appropriate type.
Using Data Types and Type Coercion (Casts) printf string [, exp1 [, exp2, ... ] ] Print the value(s) of the specified expression(s) in the format specified by the string, string. The printf command supports all formats of the IRIX printf command except “%s.” For a list of formats, see the printf(3S) reference page. Using Data Types and Type Coercion (Casts) You can use data types for type conversion (casting) by including the name of the data type in parentheses before the expression you want to cast.
Chapter 5: Examining and Changing Data Under dbx, however, you need to be able to distinguish between different variables that may have the same name. To do so, you can qualify a reference to a variable to specify its scope. dbx qualifies variables with the file (also called module), the procedure, a block, or a structure. You can manually specify the full scope of a variable by separating scopes with periods. For example, in the expression: mrx.main.
Displaying and Changing Program Variables The leading dot is useful when a file and a procedure have the same name. For instance, suppose mrx.c contains a function called mrx. Further, suppose that mrx.c contains a global variable called mi and a local variable, also called mi. To refer to the global variable, use the qualified form .mrx.mi, and to refer to the local variable, use the qualified form mrx.mrx.mi. Variable Scope You can access the value of a variable only while it is in scope.
Chapter 5: Examining and Changing Data dbx prints the value of each element in the array: { [0] struct list { next = (nil) value = 1034 } [1] struct list { next = 0x10012258 value = 1031 } [2] struct list { next = 0x10012270 value = 1028 } [3] struct list { next = 0x10012288 value = 1025 } [4] struct list { next = 0x100122a0 value = 1022 } [5] struct list { next = 0x100122b8 value = 1019 } ...
Displaying and Changing Program Variables Suppose a single-precision floating point array is named float_vals. To see the six consecutive elements beginning with the fifth element, enter: (dbx) &float_vals[4] / 6f 10012018: 0.25000000000000000 0.20000000298023224 0.16666699945926666 0.14280000329017639 10012028: 0.12500000000000000 0.11111100018024445 Changing the Value of a Variable The assign command changes the value of existing program variables.
Chapter 5: Examining and Changing Data Conflicts Between Variable Names and Keywords When naming variables in your program, avoid using any dbx keywords. If you have a variable with the same name as a dbx keyword and you attempt to use that variable in a dbx command, dbx reports a syntax error. If you do have a program variable with the same name as a dbx command, you can force dbx to treat it as a variable by enclosing the variable in parentheses.
Determining the Scope of Variables (the default), then C type keywords are treated as dbx keywords; if $ctypenames is set to 0, they are not. Case Sensitivity in Variable Names Whether or not dbx is case sensitive when it evaluates program variable names depends on the value of the dbx variable $casesense. If $casesense is 2 (the default), then the language in which the variable was defined is taken into account (for example, C and C++ are case sensitive while Pascal and Fortran are not).
Chapter 5: Examining and Changing Data For example, to display the type declaration for the variable i, enter: (dbx) whatis i int i; The following example illustrates the output of whatis for an array of structures: (dbx) whatis array struct list { struct list* next; int value; } array[12]; When you provide a procedure name to whatis, dbx reports the type of the value returned by the procedure and the types of all arguments to the procedure: (dbx) whatis foo int foo(i) int i; (dbx) whatis main int main(a
Examining the Stack Printing Stack Traces The where command prints stack traces. Stack traces show the current activation levels (procedures) of a program. For example, consider the following stack trace for a program called test: (dbx) where > 0 foo2(i = 5) [“/usr/var/tmp/dbx_examples/test.c”:44, 0x1000109c] 1 foo(i = 4) [“/usr/var/tmp/dbx_examples/test.c”:38, 0x1000105c] 2 main(argc = 1, argv = 0xffffffad78) [“/usr/var/tmp/dbx_examples/ test.
Chapter 5: Examining and Changing Data { fooexample(3,4,5); return 0; } int fooexample(int i, int j, int k) { int x = i + j + 3*k; return x; } The examples below show register values from code compiled without a –g option. MIPS1 or MIPS2 code using the 32-bit ABI (for example, on an Indy): (dbx) where > 0 subr1(0x3, 0x7fffaf14, 0x7fffaf1c, 0x0) [“t.c”:3, 0x4009ec] 1 test(0x3, 0x7fffaf14, 0x7fffaf1c, 0x0) [“t.c”:8, 0x400a10] 2 main(0x1, 0x7fffaf14, 0x7fffaf1c, 0x0) [“t.
Examining the Stack The debugger reports the integer argument-passing registers because this information may be of some value. For example, for the code samples above, the following code calls subr1(): int test(void) { subr1(3); } This code displays 0x3 as the argument register value. The other registers listed for subr1 contain arbitrary data. Moving Within the Stack The up and down commands move up and down the activation levels in the stack.
Chapter 5: Examining and Changing Data (dbx) print i 5 (dbx) up foo: 40 r = foo2(i+1); The current activation level is now the procedure foo. As indicated in the output, the variable i receives the argument passed to foo and is therefore local to foo. The variable i at this activation level is different from the variable i in the foo2 activation level. You can reference the currently active i as “i”; whereas you must qualify the reference to the i in foo2: (dbx) print i 4 (dbx) print foo2.
Examining the Stack The syntax for the func command is: func {activation_level | procedure} Changes the current activation level. If you specify an activation level by number, dbx changes to that activation level. If you specify a procedure, dbx changes to the activation level of that procedure. If you specify a procedure name and that procedure has called itself recursively, dbx changes to the most recently called instance of that procedure.
Chapter 5: Examining and Changing Data If you use the func command to go to a function that is not on the activation stack, dbx changes only the current source file to the one containing the procedure’s source and the current line to the first line of the procedure: (dbx) func bar 3 { (dbx) file /usr/var/tmp/dbx_examples/bar.
Using Interactive Function Calls To perform a complete dump of the program’s active variables, enter: (dbx) dump . > 0 foo2(i = 5) [“/usr/var/tmp/dbx_examples/foo.c”:46, 0x10001214] 1 foo(i = 4) [“/usr/var/tmp/dbx_examples/foo.c”:40, 0x100011d4] r=0 2 main(argc = 1, argv = 0xffffffad78) [“/usr/var/tmp/dbx_examples/ test4.c”:25, 0x10000fa0] j=4 i = 12 r = a=0 total = 0 Using Interactive Function Calls You can interactively call a function in your program from dbx.
Chapter 5: Examining and Changing Data Functions called interactively honor breakpoints. Thus you can debug a function by setting breakpoints and then calling it interactively. If you perform a stack trace using the where command while stopped in a routine executed interactively, dbx displays only those activation levels created by your interactive function call. The activation levels for your active program are effectively invisible.
Using Interactive Function Calls ==== interactive function call ==== For example, if the procedure foo() is interactively called from main(), you see the following stack: > 0 foo2(i = 9) [“/usr/var/tmp/dbx_examples/foo.c”:46, 0x10001214] 1 foo(i = 8) [“/usr/var/tmp/dbx_examples/foo.c”:40, 0x100011d4] ===== interactive function call ===== 2 foo2(i = 5) [“/usr/var/tmp/dbx_examples/foo.c”:46, 0x10001214] 3 foo(i = 4) [“/usr/var/tmp/dbx_examples/foo.
Chapter 5: Examining and Changing Data 5 foo(i = 4) [“/usr/var/tmp/dbx_examples/foo.c”:40, 0x100011d4] 6 main(argc = 1, argv = 0xffffffad78) [“/usr/var/tmp/src/ dbx_examples/test4.c”:25, 0x10000fa0] 7 __start() [“/shamu/lib/libc/libc_64/csu/ crt1text.s”:137, 0x10000f34] To set a conditional breakpoint, for example, type: (dbx) stop in foo if j == 7 Process 0: [3] stop in foo if j==7 If j is not within the scope of foo, then you will receive an error message if you attempt to call foo interactively.
C++ Considerations Referring to C++ Functions For the purpose of dbx debugging, functions in C++ programs fall into three general categories: Member functions Refers to member functions using the syntax classname::functionname. For example, refers to the member function foo in the class Window as Window::foo. Global C++ functions Refers to global functions using the syntax ::functionname. For example, refers to the global function foo as ::foo.
Chapter 5: Examining and Changing Data int foo:: bar(int x) { return n + x; } foo::foo(int x) { n = x; } int square(int x) { return x*x; } main() { foo a; foo b = 11; int x = a.bar(); int y = b.bar(x) + square(x); printf("y = %d\n", y); } If you enter: (dbx) stop in foo::foo dbx stops execution in the constructor for the variable b; dbx may stop in the constructor for the variable a (the ability to stop in an inline function may not yet be fully implemented).
Chapter 6 6. Controlling Program Execution A program typically runs until it exits or encounters an unrecoverable error. You can use dbx, however, to stop a program under various conditions, step through your program line by line, stop execution on receiving a signal, and execute conditional commands based on your program’s status.
Chapter 6: Controlling Program Execution Each breakpoint is assigned a number when you create it. Use this number to reference a breakpoint in the various commands provided for manipulating breakpoints (for example, disable, enable, and delete, all described in “Managing Breakpoints, Traces, and Conditional Commands” on page 70).
Setting Breakpoints Stopping If a Variable or Memory Location Has Changed By including a variable clause in your stop command, you can cause dbx to stop if the value of a variable or the contents of a memory location has changed. If you provide only a variable name in your variable clause, the breakpoint stops your program if the value of the variable has changed since the last time dbx checked it. If instead of a variable name, you provide an expression of type pointer, dbx checks the data pointed to.
Chapter 6: Controlling Program Execution stop [expression|variable] in procedure Inspects the value at every source line within a given procedure. Stops if the value has changed. If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). Using Fast Watchpoints You can use fast watchpoints with the stop command.
Setting Breakpoints dbx still needs to use the single-step approach if the stop command contains an expression to watch, such as in stop if global == 1. The performance of the debugged program can be greatly enhanced by including a variable to watch in the stop command. For example, the previous stop command can be expressed equivalently as stop global if global == 1. This instructs the debugger to check only the expression global == 1 if the value of global changes.
Chapter 6: Controlling Program Execution The following forms of the stop command combine both the variable and test clauses: stop [expression1|variable] if expression2 Tests both conditions before executing each source line. Stops if both conditions are true. If expression1 is of type pointer, look at the data pointed to and watch until it changes. If expression1 is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address).
Tracing Program Execution cont {at | to} line Sets a temporary breakpoint at the specified source line, then resumes execution with the current line. When your program reaches the breakpoint at line, dbx stops your program and deletes the temporary breakpoint. The keywords at and to are equivalent. cont in procedure Sets a temporary breakpoint to stop execution upon entering the specified procedure, then resumes execution with the current line.
Chapter 6: Controlling Program Execution The syntax of the trace command is: trace variable Whenever the specified variable changes, dbx prints the old and new values of that variable. trace procedure Prints the values of the parameters passed to the specified procedure whenever your program calls it. Upon return, dbx prints the return value. trace [expression|variable] at line Whenever your program reaches the specified line, dbx prints the value of the variable if its value has changed.
Tracing Program Execution and watch until it changes. If expression1 is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). To examine the parameters passed to and values returned from a function, you can trace that function. For example, if the function name is foo, set the trace by entering: (dbx) trace foo When you execute your program, dbx prints the values of the parameters passed to foo whenever your program calls it.
Chapter 6: Controlling Program Execution (dbx) trace arg_process.curarg Process 2395: [7] trace .test.arg_process.
Writing Conditional Commands If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). when [expression|variable] at line {command-list} Inspects the value at the given source line. If it has changed, executes the command list. If the expression is of type pointer, look at the data pointed to and watch until it changes.
Chapter 6: Controlling Program Execution and watch until it changes. If expression1 is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). when [expression1|variable] at line if expression2 {command-list} Checks if the value of the variable has changed each time the line is executed. If the value has changed and the expression is true, executes the command list. If expression1 is of type pointer, look at the data pointed to and watch until it changes.
Managing Breakpoints, Traces, and Conditional Commands Listing Breakpoints, Traces, and Conditional Commands The status command lists all of the breakpoints, traces, and conditional commands that you have set and indicates whether they are enabled or disabled.
Chapter 6: Controlling Program Execution The syntax of the disable command is: disable item [, item ... ] Disables the specified breakpoint(s), trace(s), or conditional command(s). This command has no effect if the item you specify is already disabled.
Using Signal Processing Process 22631: [5] when at “/usr/var/tmp/dbx_examples/ test.c”:60 { print i, j Deleting Breakpoints, Traces, and Conditional Commands The delete command allows you to delete breakpoints, traces, and conditional commands: delete {item [, item ...] | all} Deletes the item or items specified. If you use the keyword all instead of listing individual items, dbx deletes all breakpoints, traces, and conditional commands.
Chapter 6: Controlling Program Execution The catch and ignore commands have the following syntax: catch {signal | all} Instructs dbx to stop your program whenever it receives the specified signal. If you use the keyword all rather than giving a specific signal, dbx catches all signals. ignore {signal | all} Instructs dbx to ignore the specified signal. All ignored signals are passed to your program normally. If you use the keyword all rather than giving a specific signal, dbx ignores all signals.
Using Signal Processing continues to run. Use the showproc command to see whether the process is still running. Then use the suspend command to stop the process. Continuing After Catching a Signal The cont command allows you to continue execution after catching a signal. You can also use the cont command to specify a different signal to send to your program than the one that dbx caught.
Chapter 6: Controlling Program Execution SIGALRM signal to your program. Your program then enters the alarm_handler procedure and stops. You can then single-step through the procedure and observe execution. Debugging a program that attempts to catch signals can be awkward if you also catch the signal in dbx.
Stopping at System Calls syscall ignore {call | return} {system_call | all} Clears the breakpoint to stop execution upon entering (call) or returning from (return) the specified system call. If you use the keyword all rather than giving a specific system call, dbx clears the breakpoints to stop execution upon entering (call) or returning from (return) all system calls. syscall catch [{call | return}] Prints a list of all system calls caught upon entry (call) or return (return).
Chapter 6: Controlling Program Execution Stepping Through Your Program Stepping is a process of executing your program for a fixed number of lines and then automatically returning control to dbx. dbx provides two commands for stepping through lines of code: step and next. For both step and next, dbx counts only those source lines that actually contain code; for the purposes of stepping, dbx ignores blank lines and lines consisting solely of comments.
Stepping Through Your Program Stepping Using the step Command The format of the step command is: step [integer] Executes the specified number of lines of source code, stepping into procedures. If you do not provide an argument, step executes one line. If step encounters any breakpoints, it immediately stops execution. By default, step steps into only those procedures that are compiled with the debugging option –g.
Chapter 6: Controlling Program Execution Using the return Command If you step into a procedure and then decide you don’t want to step through the rest of it, use return to finish executing the procedure and return to the calling procedure. The format of the return command is: return Continues execution until control returns to the procedure that invoked the return command. return proc Continues execution until control returns to the named procedure.
Chapter 7 7.
Chapter 7: Debugging Machine Language Code Table 7-1 (continued) Hardware Registers and Aliases Register Software Name Description $r8... $r11 $t0... $t7 Temporaries (32 bit) $a4... $a7, $ta0... $ta3 Arguments (64 bit) $t4... $t7, $t0... $t3 $ta0... $ta3 Temporaries (32 bit) $r16... $r23 $s0... $s7 Saved across procedure calls $r24... $r25 $t8... $t9 Temporaries $r26... $r27 $k0...
Examining and Changing Register Values Memory and Disassembling Code” on page 85). If $regstyle is set to 0, then dbx uses the alternate form of the register name (for example, “zero” instead of “r0,” and “t1” instead of “r9”); if $regstyle is anything other than 0, the machine names are used (“r0” through “r31”). Printing Register Values Use the printregs command to print the values stored in all registers.
Chapter 7: Debugging Machine Language Code f6=0.0000000e+00 f7=0.0000000e+00 f8=0.0000000e+00 f9=0.0000000e+00 f10=0.0000000e+00 f11=0.0000000e+00 f12=0.0000000e+00 f13=0.0000000e+00 f14=0.0000000e+00 f15=0.0000000e+00 f16=0.0000000e+00 f17=0.0000000e+00 f18=0.0000000e+00 f19=0.0000000e+00 f20=0.0000000e+00 f21=0.0000000e+00 f22=0.0000000e+00 f23=0.0000000e+00 f24=0.0000000e+00 f25=0.0000000e+00 f26=0.0000000e+00 f27=0.0000000e+00 f28=0.0000000e+00 f29=0.0000000e+00 f30=0.0000000e+00 f31=0.
Examining Memory and Disassembling Code assign register = expression Assigns the value of expression to register. You must precede the name of the register with a dollar sign ($). For example: (dbx) assign $f0 = 3.14159 3.1415899999999999 (dbx) assign $t3 = 0x5a 0x5a By default, the assign register command changes the register value in the current activation level, which is a typical operation.
Chapter 7: Debugging Machine Language Code address / count L value mask Examines count 32-bit words in increasing addresses; prints those 32-bit words which, when ORed with mask, equals value. This command searches memory for specific patterns. ./ Repeats the previous examine command with increasing address. .? Repeats the previous examine command with decreasing address.
Examining Memory and Disassembling Code Table 7-2 (continued) Memory Display Format Codes Format Code Displays Memory in the Format f print a single-precision real number g print a double-precision real number For example, to display 10 disassembled machine instructions starting at the current address of the program counter, enter: (dbx) $pc/10i *[main:26, 0x400290] [main:27, 0x400294] [main:29, 0x400298] [main:29, 0x40029c] [main:29, 0x4002a0] [main:29, 0x4002a4] [main:29, 0x4002a8] [main:29, 0x40
Chapter 7: Debugging Machine Language Code Consider a single-precision floating point array named array. You can examine the six consecutive elements, beginning with the fifth element, by entering: (dbx) &array[4] / 6f 7fffc748: 0.2500000 0.2000000 0.1666667 0.1428571 7fffc758: 0.1250000 0.1111111 Setting Machine-Level Breakpoints dbx allows you to set breakpoints while debugging machine code just as you can while debugging source code.
Setting Machine-Level Breakpoints stopi [expression|variable] Inspects the value before executing each machine instruction and stops if the value has changed. If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address).
Chapter 7: Debugging Machine Language Code If expression1 is of type pointer, look at the data pointed to and watch until it changes. If expression1 is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). stopi [expression1|variable] at address if expression2 Tests both conditions at the given address (for machinelevel debugging). Stops if both conditions are true.
Continuing Execution After a Machine-Level Breakpoint To avoid this problem, use the stopi in command: dbx() stopi in functionx If you really want to use stopi at, a safe alternative is to disassemble functionx and put the breakpoint after the gp_prolog. For more information on gp_prolog, see the MIPSpro Assembly Language Programmer’s Guide. The tracei at, wheni at, and conti at commands described in the following sections also follow this pattern.
Chapter 7: Debugging Machine Language Code Tracing Execution at the Machine Level The tracei command allows you to observe the progress of your program while debugging machine code, just as you can with the trace command while debugging source code. The tracei command traces in units of machine instructions instead of in lines of code. Each trace is assigned a number when you create it.
Writing Conditional Commands at the Machine Level tracei [expression|variable] in procedure Whenever the variable changes within the procedure that you specify, dbx prints the old and new values of that variable. (For machine-level debugging.) If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address).
Chapter 7: Debugging Machine Language Code the specified conditions are met, the command list is executed. If one of the commands in the list is stop (with no operands), then the process stops when the command list is executed. wheni if expression {command-list} Evaluates the expression before executing each machine instruction. If the expression is true, executes the command list. wheni at address if expression {command-list} Evaluates the expression at the given address.
Stepping Through Machine Code The formats of the nexti and stepi commands are: nexti [integer] Executes the specified number of machine instructions, stepping over procedures. If you do not provide an argument, nexti executes one instruction. If nexti encounters any breakpoints, even in procedures that it steps over, it immediately stops execution. stepi Single steps one machine instruction, stepping into procedures (as called by jal and jalr).
Appendix A A. dbx Commands All dbx commands are listed below along with a brief description. For more information about a command, refer to its description in the main text of this guide. ; Use the semicolon (;) as a separator to include multiple commands on the same command line. \ Use the backslash (\) at the end of a line of input to dbx to indicate that the command is continued on the next line. ./ Repeats the previous examine command by incrementing the address.
Appendix A: dbx Commands !! Repeats the previous command. If the value of the dbx variable $repeatmode is set to 1, then entering a carriage return at an empty line is equivalent to executing !!. By default, $repeatmode is set to 0. !string Repeats the most recent command that starts with the specified string. !integer Repeats the command associated with the specified integer in the history list. !-integer Repeats the command that occurred integer times before the most recent command.
alias Lists all existing aliases. alias name Lists the alias definition for name. alias name command Defines name as an alias for command. alias name “string” Defines name as an alias for string. With this form of the alias command, you can provide command arguments in the alias definition. alias name(arg1 [, ... argN]) “string” Defines name as an alias for string. arg1 through argN are arguments to the alias, appearing in the string definition.
Appendix A: dbx Commands cont in procedure Sets a temporary breakpoint to stop execution upon entering the specified procedure, then resumes execution with the current line. When your program reaches the breakpoint in procedure, dbx stops your program and deletes the temporary breakpoint. cont [signal] Continues execution with the current line and sends the specified signal to your program.
If you specify a signal, then dbx sends the signal to your program. If you do not provide a signal, but your program stopped because dbx caught a signal intended for your program, then dbx sends that signal to your program when you continue execution. conti [signal] in procedure Sets a temporary breakpoint to stop execution upon entering the specified procedure, then resumes execution with the current machine instruction.
Appendix A: dbx Commands disable item [, item ... ] Disables the item(s) listed. The specified breakpoint(s), trace(s), or conditional command(s) no longer affect program execution. This command has no effect if the item you specify is already disabled. down [num] Moves down the specified number of activation levels in the stack. The default is one level. dump Prints information about the variables in the current procedure.
file [file] Changes the current source file to file. The new file becomes the current source file, on which you can search, list, and perform other operations. func Displays the name of the procedure corresponding to the current activation level. func {activation_level | procedure} Changes the current activation level. If you specify an activation level by number, dbx changes to that activation level. If you specify procedure, dbx changes to the activation level of that procedure.
Appendix A: dbx Commands help help Explains how to display the help file in your favorite editor. help section Shows this help section. dbx displays the file using the command name given by the dbx $pager variable. (By default, it uses more.) A useful technique is to set the $pager variable to a text editor like vi(1). history Prints the commands in the history list. ignore Prints a list of all signals ignored. ignore {signal | all} Instructs dbx to ignore the specified signal.
nexti [n] Executes the specified number of machine instructions, stepping over procedures. If you do not provide an argument, nexti executes one line. If nexti encounters any breakpoints, even in procedures which it steps over, it immediately stops execution. playback input [file] Executes the commands from file. The default file is the current temporary file created for the record input command. If the dbx variable $pimode is nonzero, the commands are printed out as they are played back.
Appendix A: dbx Commands record output [file] Records all dbx output in file. The default file is a temporary dbx file in the /tmp directory. The name of the temporary file is stored in the dbx variable $defaultout. If the dbx variable $rimode is nonzero, dbx also records the commands you enter. rerun run-arguments Without any arguments, repeats the last run command, if applicable. Otherwise, rerun is equivalent to the run command without any arguments.
set Displays a list of predefined and user defined variables. set var = exp Defines (or redefines) the specified dbx variable, setting its value to that of the expression you provide. sh Invokes a subshell. To return to dbx from the subshell, enter exit at the command line, or otherwise terminate the subshell. sh com Executes the specified shell command.
Appendix A: dbx Commands stop expression Inspects the expression. If the expression is type pointer, checks the data being pointed at. Otherwise, checks the 32 bits at the address given by the expression. stop in procedure Sets a breakpoint to stop execution upon entering the specified procedure. stop [expression|variable] Inspects the value before executing each source line. If the expression is of type pointer, look at the data pointed to and watch until it changes.
stop at line if expression Evaluates the expression at the given source line. Stops if the expression is true. stop in procedure if expression Evaluates the expression at every source line within a given procedure. Stops if the expression is true. stop [expression1|variable] if expression2 Tests both conditions before executing each source line. Stops if both conditions are true. If expression1 is of type pointer, look at the data pointed to and watch until it changes.
Appendix A: dbx Commands stopi in procedure Sets an unconditional breakpoint to stop execution upon entering the specified procedure (for machine-level debugging). stopi [expression|variable] Inspects the value before executing each machine instruction and stops if the value has changed. If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address).
stopi [expression1|variable] if expression2 Tests both conditions before executing each machine instruction. Stops if both conditions are true. If expression1 is of type pointer, look at the data pointed to and watch until it changes. If expression1 is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). stopi [expression1|variable] at address if expression2 Tests both conditions at the given address (for machinelevel debugging).
Appendix A: dbx Commands syscall catch [{call | return}] Prints a list of all system calls caught upon entry (call) or return (return). If you provide neither the call nor return keyword, dbx lists all system calls that are caught. syscall ignore [{call | return}] Prints a list of all system calls not caught upon entry (call) or return (return). If you provide neither the call nor return keyword, dbx lists all system calls that are ignored.
trace [expression|variable] in procedure Whenever the variable changes within the procedure, dbx prints the old and new values of that variable. If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address).
Appendix A: dbx Commands tracei [expression|variable] at address Prints the value of the variable whenever your program reaches the specified address. (For machine-level debugging.) If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address).
unrecord session1 [, session2 ... ] Turns off the specified recording session(s) and closes the file(s) involved. unrecord all Turns off all recording sessions and closes all files involved. unset var Removes the specified dbx variable. up [num] Moves up the specified number of activation levels in the stack. The default is one level. use [dir ...] If you provide one or more directories, dbx replaces the source directory list with the directories that you provide.
Appendix A: dbx Commands when [expression|variable] in procedure {command-list} Inspects the value at every source line within a given procedure. If it has changed, executes the command list. If the expression is of type pointer, look at the data pointed to and watch until it changes. If the expression is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). when if expression {command-list} Evaluates the expression before executing each source line.
line of the given procedure. If the value has changed and the expression is true, executes the command list. If expression1 is of type pointer, look at the data pointed to and watch until it changes. If expression1 is not of type pointer, look at the 32 bits at that address (assume the expression evaluates to an address). wheni if expression {command-list} Evaluates the expression before executing each machine instruction. If the expression is true, executes the command list.
Appendix B B. Predefined Aliases Table B-1 lists all predefined dbx aliases. You can override any predefined alias by redefining it with the alias command or by removing it with the unalias command. Table B-1 Predefined Aliases Alias Definition Description a assign Assigns the specified expression to the specified program variable or register. b stop at Sets a breakpoint at the specified line. bp stop in Sets a breakpoint in the specified procedure.
Appendix B: Predefined Aliases Table B-1 (continued) 134 Predefined Aliases Alias Definition Description j status Lists all the currently set stop, trace, and when commands. l list Lists the next $listwindow lines of source code beginning at the current line. li $curpc/10i; \ set $curpc=$curpc+40 Lists the next 40 bytes of machine instructions (approximately 10 instructions). n next Executes the specified number of lines of source code, stepping over procedures.
Table B-1 (continued) Predefined Aliases Alias Definition Description ri record input Records to the specified file all the input you give to dbx. If you do not specify a file, dbx creates a temporary file. The name of the file is specified by $defaultin. ro record output Records all dbx output to the specified file. If no file is specified, records output to a temporary file. The name of the file is specified by $defaultout.
Appendix B: Predefined Aliases Table B-1 (continued) 136 Predefined Aliases Alias Definition Description w list $curline-5:10 Lists a window of source code around the current line. This command shows the four lines before the current code line, the current code line, and five lines after the current code line. This command does not change the current code line. W list $curline-10:20 Lists a window of source code around the current line.
Appendix C C. Predefined dbx Variables Predefined dbx variables are listed in Table C-1. The predefined variable names begin with “$” so that they do not conflict with variable, command, or alias names. Table C-1 Predefined dbx Variables Variable Default Description $addrfmt “0x%x” Specifies the format for addresses. This can be set to any format valid for the C language printf(3S) function. $addrfmt64 “0x%x” Specifies the format for 64-bit addresses.
Appendix C: Predefined dbx Variables Table C-1 (continued) Variable Default Description $curpc The current program counter. $cursrcline The current source listing line plus one. $debugrld 138 Predefined dbx Variables 0 If the value is 1, dbx allows you to set traps in rld code, so you can debug bugs in run-time initialization of C++ global variables and the like. $defaultin The name of the file that dbx uses when the record input or the playback input command is executed with no argument.
Table C-1 (continued) Predefined dbx Variables Variable Default Description $hexchars 0 If nonzero, outputs characters in hexadecimal, using C format “%x”. This affects char type variables, including those in structures. It does not affect arrays of characters, which are printed using the “%.*s” format. $hexdoubles 0 If nonzero, float and double values print as normal, with a trailing output of hex ffffffff and hex ffffffff 00000000, respectively.
Appendix C: Predefined dbx Variables Table C-1 (continued) 140 Predefined dbx Variables Variable Default Description $mp_program 0 If 0, dbx treats calls to sproc in the same way as it treats calls to fork. If 1, child processes created by calls to sproc are allowed to run; they block on multiprocessor synchronization code emitted by mp Fortran code. When you set $mp_program to 1, mp Fortran code is easier to debug.
Table C-1 (continued) Predefined dbx Variables Variable Default Description $pendingtraps 0 Uses no pending traps. If nonzero, allows traps that cannot be satisfied immediately to pend until they can be satisfied. This is useful for debugging programs that use dlopen() to load symbols as it allows setting breakpoints before the dlopen() call. Similar to $debugrld, but $pendingtraps does not allow setting breakpoints in rld. When set to nonzero, mistyped procedure names cause a pending trap to be set.
Appendix C: Predefined dbx Variables Table C-1 (continued) Variable Predefined dbx Variables Default $procaddr Description This variable applies only if you invoke dbx with the -k option (that is, it is not available unless you are doing kernel debugging). Whenever $pid is set, dbx sets $procaddr to the address of the process table entry for that process. $prompt dbx The prompt for dbx. $promptonfork 0 If 0, dbx does not add the child process to the process pool.
Table C-1 (continued) Predefined dbx Variables Variable Default Description $showbreakaddrs 0 If nonzero, show the address of each breakpoint placed in the code each time it is placed. Removal of the breakpoints is not shown. If multiple breakpoints are placed at one location, only one of the placements is shown. Since breakpoints are frequently placed and removed by dbx, the volume of output can be annoying when tracing. $stacktracelimit $stepintoall Limits to the depth of the stack trace.
Index Symbols !! command, 22, 112 !-integer command, 22, 112 !integer command, 22, 112 !string command, 22, 112 # characters, 7, 32, 35 #define declarations, 36 // (division) operator, 35, 36 ; (command separator), 11, 111 ? command, 17, 18, 85, 111, 112 \ (command continuation), 11, 111 Numbers 16-bit word, 86 32-bit word, 86 64-bit word, 86 active process wait for, 103, 129 adding processes to the process group list, 107, 112 addpgrp command, 107, 112 addproc command, 100, 112 add processes to process
Index breakpoints process groups, 108 setting, 3, 60, 121, 122 status, 71, 121 test clause, 63 unconditional, 2, 59 variable clause, 61, 62, 63, 64, 89, 122 C C++ considerations, 56 global functions, 57 member functions, 57 member variables, 56 non-C++ functions, 57 overloaded functions, 57 static member variables, 56 $casesense, 45, 137 case sensitivity of program variable names, 45, 137 casts, 27 catch command, 113 catching signals, 74, 113 catching system calls, 76, 126 ccall command, 53, 113 -c flag,
Index commands printf, 39, 41, 119 printo, 37, 41, 119 printregs, 83, 119 printx, 37, 41, 119 quit, 12, 119 record, 31, 119 record input, 29, 30, 119, 138 record output, 30, 120, 137 rerun, 3, 9, 10, 120 resume, 65, 102, 120 return, 80, 120 run, 3, 9, 120 search backward (?), 17, 18, 111 search forward (/), 17, 111 set, 20, 21, 37, 121 sh, 12, 121 showpgrp, 108, 121 showproc, 99, 121 status, 30, 71, 121 step, 3, 78, 79, 121 stepi, 94, 95, 121 stop, 3, 60, 61, 62, 63, 121 stopi, 88, 123 suspend, 101, 125 sy
Index crashes, diagnosing, 1 creating aliases, 25, 113 $ctypenames, 44, 137 $curevent, 137 $curline, 137 $curpc, 138 current directory, 13 current source file, 15, 49, 111, 117 $cursrcline, 138 D dbx -c flag, 7 command scripts, 32 -e flag, 7 -I flag, 7, 13 -i flag, 7 invoking, 2, 6 -k flag, 7 -P flag, 7 -p flag, 7 quitting, 12, 119 -r flag, 7 dbx aliases. See aliases .dbxinit file, 7, 10 dbx variables, 19, 33 listing, 21, 121 predefined.
Index down command, 49, 116 DSOs, 6 dump command, 52, 116 E edit command, 18, 116, 138 edit history list, 24, 117 editing files, 18, 116 $editor, 18, 24, 116, 138 EDITOR environment variable, 18, 24, 116, 137 -e flag, 7 enable command, 60, 65, 72, 88, 92, 116 enabling breakpoints, 72, 116 conditional commands, 72, 116 tracing, 72, 116 ending recording, 29, 129 environment variables EDITOR, 18, 24, 116, 137 HOME, 10 evaluation stack, increasing, 7 examining a new program, 3 examining arrays, 42 examining c
Index history list, 22 editing, 24, 117 print, 22 HOME environment variable, 10 I -I flag, 7, 13 -i flag, 7 ignore command, 73, 74, 118 ignoring signals, 74, 118 ignoring system calls, 77, 126 include files, 4 input playing back, 28, 30, 119 recording, 28, 119 input base decimal, 36 hexadecimal, 36, 137 octal, 36, 140 interactive function calls, 37, 53 breakpoints, 55 calling, 53, 113 clearing, 54, 113 nesting, 55 unstacking, 54 invoking a shell, 12, 121 invoking dbx, 2, 6 L $lastchild, 99, 139 line numb
Index nexti command, 94, 95, 119 numeric constants, 36 O object files, 13 specifying, 8, 117 octal input, 36, 140 octal output, 36, 83, 140 $octin, 36, 140 $octints, 36, 83, 140 on-line help, 11, 117, 140 operators, 33 # operator, 32, 34, 35 // (division), 35, 36 precedence, 34 output playing back, 28, 119 recording, 28, 30, 120 output base decimal, 36 hexadecimal, 36, 83, 137 octal, 36, 83, 140 overloaded C++ functions, 57 P $page, 140 $pager, 11, 117, 118, 140 $pagewidth, 140 $pagewindow, 140 pathnames
Index predefined dbx aliases S, 135 s, 135 Si, 135 si, 135 source, 121, 135 t, 135 u, 135 W, 136 w, 136 wi, 136 predefined dbx variables, 19, 137 $addrfmt, 137 $addrfmt64, 137 $assignverify, 137 $casesense, 45, 137 $ctypenames, 44, 137 $curevent, 137 $curline, 137 $curpc, 138 $cursrcline, 138 $debugrld, 138 $defaultin, 29, 119, 138 $defaultout, 31, 120, 138 $editor, 18, 24, 116, 138 $fp_precise, 138 $framereg, 85, 138 $groupforktoo, 107, 138 $hexchars, 139, 141 $hexdoubles, 139 $hexin, 36, 139, 140 $hexint
Index printo command, 37, 41, 119 printregs command, 83, 119 $printwhilestep, 141 $printwide, 141 printx command, 37, 41, 119 problems confused listing, 4 include files, 4 macros, 4 source and code do not match, 4 variables do not display, 4 $procaddr, 142 procedures, tracing, 4 processes wait for, 103, 129 process group list adding processes, 107, 112 deleting processes, 108, 115 showing processes, 108, 121 process groups, 107 breakpoints, 108 group history, 108 tracing, 108 process identification number
Index run command, 3, 9, 120 running process, wait for, 103, 129 running programs, 7, 9, 10, 120 S scope of program variables, 41, 46, 49, 51 scripts, 32 search backward (?) command, 17, 18, 111 search forward (/) command, 17, 111 searching source code, 17, 111 select active process from process pool, 101, 112 sending signals, 65, 91, 102, 120 set command, 20, 21, 37, 121 setting breakpoints, 3 setting conditional breakpoints, 60 setting conditional commands, 68 setting dbx variables, 20, 121 setting unco
Index system calls catching, 76, 126 displaying caught, 77, 126 displaying ignored, 77, 126 exec, 106 execv, 77 execve, 77 exit, 77 fork, 77, 97, 104, 107, 137 ignoring, 77, 126 sproc, 77, 97, 107, 137 T tag command, 126 $tagfile, 143 trace command, 4, 66, 126 tracei command, 92, 93, 127 tracing deleting, 73, 115 disabling, 72, 116 enabling, 72, 116 procedures, 4, 66, 126, 127 process groups, 108 source lines, 4 status, 71, 121 variables, 4, 66, 92, 93, 126, 127, 128 troubleshooting, 4 type casting, 39 ty
Index whatis command, 45, 129 when command, 68, 129 wheni command, 93, 94, 131 where command, 2, 47, 90, 131 which command, 45, 131 whichobj command, 6, 131 156
We'd Like to Hear From You As a user of Silicon Graphics documentation, your comments are important to us. They help us to better understand your needs and to improve the quality of our documentation. Any information that you provide will be useful.