Dbx 1024 User's Guide Page 1

Browse online or download User's Guide for Audio amplifiers Dbx 1024. dbx 1024 User`s guide User Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 158
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews

Summary of Contents

Page 1 - Document Number 007-0906-090

dbx User’s GuideDocument Number 007-0906-090

Page 3 - Contents

86Chapter 7: Debugging Machine Language Codeaddress / count L value maskExaminescount 32-bit words in increasing addresses; printsthose 32-bit words w

Page 4

Examining Memory and Disassembling Code87For example, to display 10 disassembled machine instructions starting at thecurrent address of the program co

Page 5

88Chapter 7: Debugging Machine Language CodeConsider a single-precision floating point array named array. You canexamine the six consecutive elements,

Page 6

Setting Machine-Level Breakpoints89stopi [expression|variable]Inspects the value before executing each machineinstruction and stops if the value has c

Page 7

90Chapter 7: Debugging Machine Language CodeIf expression1 is of type pointer, look at the data pointed toand watch until it changes. If expression1 i

Page 8

Continuing Execution After a Machine-Level Breakpoint91To avoid this problem, use the stopi in command:dbx() stopi in functionxIf you really want to u

Page 9 - List of Tables

92Chapter 7: Debugging Machine Language CodeTracing Execution at the Machine LevelThe tracei command allows you to observe the progress of your progra

Page 10

Writing Conditional Commands at the Machine Level93tracei [expression|variable] in procedureWhenever the variable changes within the procedure thatyou

Page 11 - About This Guide

94Chapter 7: Debugging Machine Language Codethe specified conditions are met, the command list is executed. If one of thecommands in the list is stop (

Page 12

Stepping Through Machine Code95The formats of the nexti and stepi commands are:nexti [integer] Executes the specified number of machine instructions,st

Page 13

xiAbout This GuideThis guide explains how to use the source level debugger, dbx. You can usedbx to debug programs in C, C++, Fortran77, and assembly l

Page 15 - 1. Getting Started With dbx

111Appendix AA. dbx CommandsAll dbx commands are listed below along with a brief description. For moreinformation about a command, refer to its descri

Page 16 - Debugging Your Programs

112Appendix A: dbx Commands!! Repeats the previous command. If the value of the dbxvariable $repeatmode is set to 1, then entering a carriagereturn at

Page 17 - Studying a New Program

113alias Lists all existing aliases.alias name Lists the alias definition for name.alias name commandDefines name as an alias for command.alias name “st

Page 18 - Avoiding Common Pitfalls

114Appendix A: dbx Commandscont in procedureSets a temporary breakpoint to stop execution uponentering the specified procedure, then resumes executionw

Page 19 - 2. Running dbx

115If you specify a signal, then dbx sends the signal to yourprogram. If you do not provide a signal, but your programstopped because dbx caught a sig

Page 20 - Invoking

116Appendix A: dbx Commandsdisable item [, item ... ]Disables the item(s) listed. The specified breakpoint(s),trace(s), or conditional command(s) no lo

Page 21 - Options

117file [file] Changes the current source file to file. The new file becomesthe current source file, on which you can search, list, andperform other operat

Page 22 - Commands

118Appendix A: dbx Commandshelp help Explains how to display the help file in your favorite editor.help section Shows this help section. dbx displays t

Page 23 - Running Your Program

119nexti [n] Executes the specified number of machine instructions,stepping over procedures. If you do not provide anargument, nexti executes one line.

Page 24

xiiAbout This GuideAppendix A, “dbx Commands,” lists and describes all dbx commands.Appendix B, “Predefined Aliases,” lists and describes all predefined

Page 25 - Using Online Help

120Appendix A: dbx Commandsrecord output [file]Records all dbx output infile. The default file is a temporarydbx file in the /tmp directory. The name of t

Page 26 - Quitting

121set Displays a list of predefined and user defined variables.set var = exp Defines (or redefines) the specified dbx variable, setting itsvalue to that o

Page 27 - 3. Examining Source Files

122Appendix A: dbx Commandsstop expressionInspects the expression. If the expression is type pointer,checks the data being pointed at. Otherwise, chec

Page 28

123stop at line if expressionEvaluates the expression at the given source line. Stops ifthe expression is true.stop in procedure if expressionEvaluate

Page 29 - Changing Source Files

124Appendix A: dbx Commandsstopi in procedureSets an unconditional breakpoint to stop execution uponentering the specified procedure (for machine-level

Page 30 - Listing Source Code

125stopi [expression1|variable] if expression2Tests both conditions before executing each machineinstruction. Stops if both conditions are true.If exp

Page 31 - Searching Through Source Code

126Appendix A: dbx Commandssyscall catch [{call | return}]Prints a list of all system calls caught upon entry (call) orreturn (return). If you provide

Page 32 - Calling an Editor

127trace [expression|variable] in procedureWhenever the variable changes within the procedure, dbxprints the old and new values of that variable.If th

Page 33 - 4. Controlling dbx

128Appendix A: dbx Commandstracei [expression|variable] at addressPrints the value of the variable whenever your programreaches the specified address.

Page 34 - Variables

129unrecord session1 [, session2 ... ]Turns off the specified recording session(s) and closes thefile(s) involved.unrecord all Turns off all recording s

Page 35 - Removing Variables

Conventions Used in This GuidexiiiSilicon Graphics offers software options to assist in software development.TheCASEVision/Workshop option provides th

Page 36 - Repeating Commands

130Appendix A: dbx Commandswhen [expression|variable] in procedure {command-list}Inspects the value at every source line within a givenprocedure. If i

Page 37

131line of the given procedure. If the value has changed and theexpression is true, executes the command list.If expression1 is of type pointer, look

Page 39 - Creating Command Aliases

133Appendix BB. Predefined AliasesTable B-1 lists all predefined dbx aliases. You can override any predefinedalias by redefining it with the alias command

Page 40

134Appendix B: Predefined Aliasesj status Lists all the currently set stop, trace, and whencommands.l list Lists the next $listwindow lines of source

Page 41 - Alias Example

135ri record input Records to the specified file all the input yougive to dbx. If you do not specify a file, dbxcreates a temporary file. The name of the

Page 42 - Input and Output

136Appendix B: Predefined Aliasesw list $curline-5:10 Lists a window of source code around thecurrent line. This command shows the fourlines before th

Page 43 - Ending a Recording Session

137Appendix CC. Predefined dbx VariablesPredefined dbx variables are listed in Table C-1. The predefined variablenames begin with “$” so that they do not

Page 44 - Recording Output

138Appendix C: Predefined dbx Variables$curpc The current program counter.$cursrcline The current source listing line plus one.$debugrld 0 If the valu

Page 45 - Examining the Record State

139$hexchars 0 If nonzero, outputs characters in hexadecimal,using C format “%x”. This affects char typevariables, including those in structures. Itdo

Page 46 - Scripts

xivAbout This Guide• Mutually exclusive arguments to a command are enclosed in braces({ ... }) and separated by a pipe character (|). In the first exam

Page 47 - Using Expressions

140Appendix C: Predefined dbx Variables$mp_program 0 If 0, dbx treats calls to sproc in the same way asit treats calls to fork. If 1, child processesc

Page 48 - Operator Description

141$pendingtraps 0 Uses no pending traps. If nonzero, allowstraps that cannot be satisfied immediately topend until they can be satisfied. This is usefu

Page 49 - Type Operators

142Appendix C: Predefined dbx Variables$procaddr This variable applies only if you invoke dbxwith the -k option (that is, it is not availableunless yo

Page 50 - Constants

143$showbreakaddrs 0 If nonzero, show the address of eachbreakpoint placed in the code each time it isplaced. Removal of the breakpoints is notshown.

Page 52 - Type Variable Name Value

145active processwait for, 103, 129adding processes to the process group list, 107, 112addpgrp command, 107, 112addproc command, 100, 112add processes

Page 53 - Qualifying Variable Names

146Indexbreakpointsprocess groups, 108setting, 3, 60, 121, 122status, 71, 121test clause, 63unconditional, 2, 59variable clause, 61, 62, 63, 64, 89, 1

Page 54

147Indexcommandsprintf, 39, 41, 119printo, 37, 41, 119printregs, 83, 119printx, 37, 41, 119quit, 12, 119record, 31, 119record input, 29, 30, 119, 138r

Page 55 - Variable Scope

148Indexcrashes, diagnosing, 1creating aliases, 25, 113$ctypenames, 44, 137$curevent, 137$curline, 137$curpc, 138current directory, 13current source fi

Page 56

149Indexdown command, 49, 116DSOs, 6dump command, 52, 116Eedit command, 18, 116, 138edit history list, 24, 117editing files, 18, 116$editor, 18, 24, 11

Page 57

1Chapter 11. Getting Started With dbxYou can use dbx to trace problems in a program at the source code level,rather than at the machine code level. db

Page 58

150Indexhistory list, 22editing, 24, 117print, 22HOME environment variable, 10I-I flag, 7, 13-i flag, 7ignore command, 73, 74, 118ignoring signals, 74,

Page 59 - Displaying Type Declarations

151Indexnexti command, 94, 95, 119numeric constants, 36Oobject files, 13specifying, 8, 117octal input, 36, 140octal output, 36, 83, 140$octin, 36, 140$

Page 60 - Examining the Stack

152Indexpredefined dbx aliasesS, 135s, 135Si, 135si, 135source, 121, 135t, 135u, 135W, 136w, 136wi, 136predefined dbx variables, 19, 137$addrfmt, 137$ad

Page 61 - Printing Stack Traces

153Indexprinto command, 37, 41, 119printregs command, 83, 119$printwhilestep, 141$printwide, 141printx command, 37, 41, 119problemsconfused listing, 4

Page 62

154Indexrun command, 3, 9, 120running process, wait for, 103, 129running programs, 7, 9, 10, 120Sscope of program variables, 41, 46, 49, 51scripts, 32

Page 63 - Moving Within the Stack

155Indexsystem callscatching, 76, 126displaying caught, 77, 126displaying ignored, 77, 126exec, 106execv, 77execve, 77exit, 77fork, 77, 97, 104, 107,

Page 64

156Indexwhatis command, 45, 129when command, 68, 129wheni command, 93, 94, 131where command, 2, 47, 90, 131which command, 45, 131whichobj command, 6,

Page 66

We'd Like to Hear From YouAs a user of Silicon Graphics documentation, your comments are importantto us. They help us to better understand your n

Page 67 - Using ccall

2Chapter 1: Getting Started With dbx2. Invoke dbx for the failed program as described in “Invoking dbx” onpage 6. dbx automatically reads in the local

Page 68 - Using clearcalls

Studying a New Program3problem areas. If your program crashes, first determine which line causes itto crash, then set a breakpoint just before that lin

Page 69

4Chapter 1: Getting Started With dbx• step executes the next line of the program. If the next line is aprocedure call, step steps down into the proced

Page 70 - C++ Considerations

5Chapter 22. Running dbxThis chapter explains how to run dbx—specifically, it covers:• “Compiling a Program for Debugging Under dbx”• “Compiling and Li

Page 71 - Referring to C++ Functions

dbx User’s GuideDocument Number 007-0906-090CONTRIBUTORSWritten by Wendy Ferguson and Ken JonesEdited by Christina CaryProduction by Gloria Ackley, Ka

Page 72

6Chapter 2: Running dbxCompiling and Linking Programs With Dynamic Shared ObjectsThis section summarizes a few things you need to know if you compile

Page 73 - Setting Breakpoints

Invoking dbx7dbx OptionsTable 2-1 lists options you can give to dbx. These options are described indetail later in this chapter.Table 2-1 dbx Command-

Page 74

8Chapter 2: Running dbxSpecifying Object and Core FilesThe object_file is the name of the executable object file that you want todebug. It provides both

Page 75

Running Your Program9givenfile [file]If you provide a filename, dbx kills the currently runningprocesses and loads the executable code and debugginginfo

Page 76 - Using Fast Watchpoints

10Chapter 2: Running dbxrerun [run-arguments]The rerun command, without any arguments, repeats thelast run command if applicable. Otherwise rerun iseq

Page 77

Using Online Help11Using Online HelpThe dbx command help has several options:help shows the supported dbx commandshelp keyword shows information perta

Page 78

12Chapter 2: Running dbxFor example:(dbx) alias foll "print *(struct list *)$p ; \set $p = (int)((struct list *)($p))->next"Hint: You can

Page 79 - Tracing Program Execution

13Chapter 33. Examining Source FilesThis chapter explains how to examine source files under dbx. It describes:• “Specifying Source Directories”• “Chang

Page 80

14Chapter 3: Examining Source FilesFor example, consider debugging a program called look in /usr/local/bin, thesource for which resides in /usr/local/

Page 81

Changing Source Files15If you use the use command instead, the current directory is no longercontained in the source directory list:(dbx) use /usr/loc

Page 82 - Writing Conditional Commands

iiiContentsList of Tables ixAbout This Guide xiWhat This Guide Contains xiWhat You Should Know Before Reading This Guide xiiSuggestions fo

Page 83

16Chapter 3: Examining Source Filesthe current source file to whatever file contains the source for the procedure(see “Examining the Stack” on page 46 f

Page 84

Searching Through Source Code17list func Lists $listwindow lines starting at procedure func.list func,exp Lists all source between func and exp, inclu

Page 85 - Commands

18Chapter 3: Examining Source Files?[reg_exp] Search backward through the current file from the currentline for the regular expression reg_exp. If dbx

Page 86

19Chapter 44. Controlling dbxThis chapter describes features of dbx that affect its operation whiledebugging a program. Specifically, this chapter cove

Page 87 - Using Signal Processing

20Chapter 4: Controlling dbxThe commands described in this section apply only to the manipulations ofdbx variables, not program variables. “Displaying

Page 88

Using the History Feature and the History Editor21Listingdbx VariablesIf you enter the set command without providing any arguments, dbxdisplays (in al

Page 89

22Chapter 4: Controlling dbxExamining the History Listdbx stores all commands that you enter in the history list. The value of thedbx variable $lines

Page 90 - Stopping at System Calls

Using the History Feature and the History Editor23For example:(dbx) next 5Process 22545 (test) stopped at [main:60 ,0x10001150] 60 total += j;(dbx)

Page 91

24Chapter 4: Controlling dbxThe History EditorThe history editor, hed, lets you use your favorite editor on any or all of thecommands in the current d

Page 92 - Stepping Through Your Program

Creating and Removing dbx Aliases25If you find that you often create the same aliases in your debugging sessions,you can include their definitions in yo

Page 93 - Stepping Using the

ivContents3. Examining Source Files 13Specifying Source Directories 13Specifying Source Directories With Arguments 13Specifying Source Direct

Page 94 - Starting at a Specified Line

26Chapter 4: Controlling dbxof these aliases, dbx simply replaces it with the command for which it is analias. Any arguments that you include on the c

Page 95

Creating and Removing dbx Aliases27The “p” alias takes four arguments and prints them surrounded by verticalbars (|). For example:(dbx) p(1,2,3,4)|1|2

Page 96

28Chapter 4: Controlling dbxmember. Because the command is too long to fit onto one line, this exampleuses the backslash character (\) to continue the

Page 97 - Printing Register Values

Recording and Playing Back dbx Input and Output29Recording InputUse the record input command to start an input recording session. Once youstart an inp

Page 98 - Changing Register Values

30Chapter 4: Controlling dbxFor example, to stop recording session 4, enter the dbx command:(dbx) unrecord 4To stop all recording sessions, enter:(dbx

Page 99

Recording and Playing Back dbx Input and Output31review the output file using any IRIX system text viewing command (suchas vi(1)).For example, to recor

Page 100

32Chapter 4: Controlling dbxExecutingdbx ScriptsYou can create dbx command scripts using an external editor and thenexecute these scripts using the pi

Page 101

33Chapter 55. Examining and Changing DataThis chapter describes how to examine and change data in your programwhile running it under dbx. Topics cover

Page 102 - Command

34Chapter 5: Examining and Changing Datalanguage precedence. You can also use parentheses to explicitly determinethe order of evaluation.Table 5-1 lis

Page 103

Using Expressions35To print the address of line 27 in the source file foo.c (assuming that foo.ccontains source that was used to compile the current ob

Page 104 - Linking With DSOs

Contentsv5. Examining and Changing Data 33Using Expressions 33Operators 33Constants 36Numeric Constants 36String Constants 37Printin

Page 105

36Chapter 5: Examining and Changing DataTable 5-4 lists the Fortran 77 language operators recognized by dbx. Note thatdbx does not recognize Fortran l

Page 106

Printing Expressions37the dbx variable $hexints to a nonzero value. If you set both $octints and$hexints to nonzero values, $hexints takes precedence.

Page 107

38Chapter 5: Examining and Changing DataThe variable types are listed in Table 5-5.Examples include:(dbx) pd sc-1(dbx) pd ssh-1(dbx) px sc0xff(dbx) px

Page 108 - Stepping Through Machine Code

Using Data Types and Type Coercion (Casts)39printf string [, exp1 [, exp2, ... ] ]Print the value(s) of the specified expression(s) in the formatspecifi

Page 109

40Chapter 5: Examining and Changing DataUnder dbx, however, you need to be able to distinguish between differentvariables that may have the same name.

Page 110

Displaying and Changing Program Variables41The leading dot is useful when a file and a procedure have the same name.For instance, suppose mrx.c contain

Page 111 - A. dbx Commands

42Chapter 5: Examining and Changing Datadbx prints the value of each element in the array:{ [0] struct list { next = (nil) value = 10

Page 112

Displaying and Changing Program Variables43Suppose a single-precision floating point array is namedfloat_vals. To see thesix consecutive elements beginn

Page 113

44Chapter 5: Examining and Changing DataConflicts Between Variable Names and KeywordsWhen naming variables in your program, avoid using any dbx keyword

Page 114

Determining the Scope of Variables45(the default), then C type keywords are treated as dbx keywords; if$ctypenames is set to 0, they are not.Case Sens

Page 115

viContents6. Controlling Program Execution 59Setting Breakpoints 59Setting Unconditional Breakpoints 60Setting Conditional Breakpoints 60S

Page 116

46Chapter 5: Examining and Changing DataFor example, to display the type declaration for the variable i, enter:(dbx) whatis iint i;The following examp

Page 117

Examining the Stack47Printing Stack TracesThe where command prints stack traces. Stack traces show the currentactivation levels (procedures) of a prog

Page 118

48Chapter 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;

Page 119

Examining the Stack49The debugger reports the integer argument-passing registers because thisinformation may be of some value.For example, for the cod

Page 120

50Chapter 5: Examining and Changing Data(dbx) print i5(dbx) upfoo: 40 r = foo2(i+1);The current activation level is now the procedure foo. As indica

Page 121

Examining the Stack51The syntax for the func command is:func {activation_level | procedure}Changes the current activation level. If you specify anacti

Page 122

52Chapter 5: Examining and Changing DataIf you use the func command to go to a function that is not on the activationstack, dbx changes only the curre

Page 123

Using Interactive Function Calls53To perform a complete dump of the program’s active variables, enter:(dbx) dump .> 0 foo2(i = 5) [“/usr/var/tmp/d

Page 124

54Chapter 5: Examining and Changing DataFunctions called interactively honor breakpoints. Thus you can debug afunction by setting breakpoints and then

Page 125

Using Interactive Function Calls55==== interactive function call ====For example, if the procedure foo() is interactively called from main(), yousee t

Page 126

ContentsviiContinuing Execution After a Machine-Level Breakpoint 91Tracing Execution at the Machine Level 92Writing Conditional Commands at the

Page 127

56Chapter 5: Examining and Changing Data 5 foo(i = 4) [“/usr/var/tmp/dbx_examples/foo.c”:40,0x100011d4] 6 main(argc = 1, argv = 0xffffffad78) [“/u

Page 128

C++ Considerations57Referring to C++ FunctionsFor the purpose of dbx debugging, functions in C++ programs fall into threegeneral categories:Member fun

Page 129

58Chapter 5: Examining and Changing Dataint foo:: bar(int x){ return n + x;}foo::foo(int x){ n = x;}int square(int x){ return x*x;}main(){ foo

Page 130

59Chapter 66. Controlling Program ExecutionA program typically runs until it exits or encounters an unrecoverable error.You can use dbx, however, to s

Page 131

60Chapter 6: Controlling Program ExecutionEach breakpoint is assigned a number when you create it. Use this numberto reference a breakpoint in the var

Page 132

Setting Breakpoints61Stopping If a Variable or Memory Location Has ChangedBy including a variable clause in your stop command, you can cause dbx tosto

Page 133 - B. Predefined Aliases

62Chapter 6: Controlling Program Executionstop [expression|variable] in procedureInspects the value at every source line within a givenprocedure. Stop

Page 134 - Alias Definition Description

Setting Breakpoints63dbx still needs to use the single-step approach if the stop command containsan expression to watch, such as instop if global == 1

Page 135

64Chapter 6: Controlling Program ExecutionThe following forms of the stop command combine both the variable and testclauses:stop [expression1|variable

Page 136

Tracing Program Execution65cont {at | to} lineSets a temporary breakpoint at the specified source line,then resumes execution with the current line. Wh

Page 138 - Variable Default Description

66Chapter 6: Controlling Program ExecutionThe syntax of the trace command is:trace variable Whenever the specified variable changes, dbx prints the old

Page 139

Tracing Program Execution67and watch until it changes. If expression1 is not of typepointer, look at the 32 bits at that address (assume theexpression

Page 140

68Chapter 6: Controlling Program Execution(dbx) trace arg_process.curargProcess 2395: [7] trace .test.arg_process.curarg inarg_processWhen you execute

Page 141

Writing Conditional Commands69If the expression is of type pointer, look at the data pointedto and watch until it changes. If the expression is not of

Page 142

70Chapter 6: Controlling Program Executionand watch until it changes. If expression1 is not of typepointer, look at the 32 bits at that address (assum

Page 143

Managing Breakpoints, Traces, and Conditional Commands71Listing Breakpoints, Traces, and Conditional CommandsThe status command lists all of the break

Page 144

72Chapter 6: Controlling Program ExecutionThe syntax of the disable command is:disable item [, item ... ]Disables the specified breakpoint(s), trace(s)

Page 145

Using Signal Processing73Process 22631: [5] when at “/usr/var/tmp/dbx_examples/test.c”:60 { print i, jDeleting Breakpoints, Traces, and Conditional Co

Page 146

74Chapter 6: Controlling Program ExecutionThe catch and ignore commands have the following syntax:catch {signal | all}Instructsdbx to stop your progra

Page 147

Using Signal Processing75continues to run. Use the showproc command to see whether the processis still running. Then use the suspend command to stop t

Page 148

ixList of TablesTable 2-1 dbx Command-Line Options 7Table 5-1 dbx Language Independent Operators 34Table 5-2 C Language Operators Recognized by

Page 149

76Chapter 6: Controlling Program ExecutionSIGALRM signal to your program. Your program then enters thealarm_handler procedure and stops. You can then

Page 150

Stopping at System Calls77syscall ignore {call | return} {system_call | all}Clears the breakpoint to stop execution upon entering (call)or returning f

Page 151

78Chapter 6: Controlling Program ExecutionStepping Through Your ProgramStepping is a process of executing your program for a fixed number of linesand t

Page 152

Stepping Through Your Program79Stepping Using thestep CommandThe format of the step command is:step [integer] Executes the specified number of lines of

Page 153

80Chapter 6: Controlling Program ExecutionUsing thereturn CommandIf you step into a procedure and then decide you don’t want to step throughthe rest o

Page 154

81Chapter 77. Debugging Machine Language CodeThis chapter explains how to debug machine language code by:• “Examining and Changing Register Values”• “

Page 155

82Chapter 7: Debugging Machine Language CodeFor registers with alternate names, the dbx variable $regstyle controls whichname is displayed when you di

Page 156

Examining and Changing Register Values83Memory and Disassembling Code” on page 85). If $regstyle is set to 0, thendbx uses the alternate form of the r

Page 157

84Chapter 7: Debugging Machine Language Codef6=0.0000000e+00 f7=0.0000000e+00 f8=0.0000000e+00f9=0.0000000e+00 f10=0.0000000e+00

Page 158 - Three Ways to Reach Us

Examining Memory and Disassembling Code85assign register = expressionAssigns the value of expression to register. You must precedethe name of the regi

Comments to this Manuals

No comments