dbx.1

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 1 代码 · 共 1,043 行 · 第 1/3 页

1
1,043
字号
quotation marks, as shown:.EX(dbx) trace "source_file.c":17 .EEThe example specifies tracing line 17 in .PN source_file.c..IP If you specify an expression at a source line number, .PN dbxdisplays the value of the expression when it executes the source line..IP Specifying a variable name causes.PN dbxto display the name and value of the variable each time it changes.Program execution is substantially slower during this form of tracing..IP The \fIcondition\fP argument is a Boolean expression that.PN dbxevaluates prior to displaying any tracing information;if the condition is false,.PN dbxdoes not display the information.  .IPIf you omit the arguments to the.B tracecommand, .PN dbxdisplays each source line before executing it.Program execution is substantially slower during this form of tracing..SS Printing Variables and Expressions.NXR "variable" "displaying the value of with dbx"The.PN dbxdebugger allows you to display the value of your program's variables andexpressions.  This section describes how the debugger resolves ambiguousnames, how you specify expressions, and the commands that you use todisplay the value of variables and expressions..PPThe debugger resolves names by first searching for the name in thestatic scope of the current procedure or function.  If no name is defined in thestatic scope, the debugger searches the dynamic scope. If neither scopeyields a defined name, the debugger chooses an arbitrary symbol anddisplays the following message:.EX[using\ \fIqualified\.name\fP].EEThe debugger substitutes the qualified name of the arbitrary symbol for\fIqualified.name\fP in the message..PPYou can override this name resolution procedure by qualifying identifiers with a block name, as in \fImodule\fP.\fIvariable\fP. For the C language, the debugger treats a source file as a module namedfor the filename without the.PN .c suffix..PPYou specify.PN dbxexpressions using the C or Pascal syntax for expressions. The debuggersupports a subset of the expression syntax for both languages; that is,the debugger supports the syntax that is common between the twolanguages..PPIn some cases, the debugger supports the syntax of either C or Pascal.For example, you can denote indirection using either an asterisk (*)as a prefix or a circumflex (^) as a suffix.You can use the field reference operator (.) with pointersas well as records or structures, making the C operator (->) unnecessary(although it is supported). To specify a hexadecimal value, precede thevalue with the "0x" characters..PPYou must enclose array expressions in brackets ([ ]). .PPThe debugger checks the type of each expression;you can override the type of an expression by using (\fIexpression\fR)\\\fItype-name\fP. .PP You can also specify a register name in an expression..NX R "vector register" You denote registers by \fB$r\fIN\fR where \fIN\fR is the number of the register.You denote vector registers as follows:.IP "\fB$v\fIN\fR[\fIK\fR]"Denotes a vector data register where \fIN\fR is the register number and \fIK\fR is an index. The debugger treats each data register as adouble-precision floating point array of 64elements, indexed from 0 to 63..IP "\fB$vaer\fR"Denotes the vector arithmetic error register, which .PN dbxtreats as a longword..IP "\fB$vcr\fR"Denotes the longword vector count register..IP "\fB$vlr\fR"Denotes the longword vector length register.IP "\fB$vmr\fR"Denotes the vector mask register. The debugger treats the \fB$vmr\fR as a Booleanarray of 64 elements, indexed from 0 to 63..PPFor more information about VAX registers, see the \fIVAX ArchitectureManual\fP..PPThe following list describes the debugger commands for printingvariables and expressions:.IP "\fBassign\fP \fIvariable\fP \fB=\fP \fIexpression\fP" .ns.IP "\fBassign\fP \fIvector-register\fP \fB= ""\fIvalue\fP [\fB,\fIvalue\fP]""".NX R "assign command (dbx)"Assigns the value of the expression to the variable or stores thespecified value in the specified vector register..IPThe.B assigncommand allows you to assign a value to one element of a vectorregister. (You cannot use the command to assign a value to a nonvectorregister.) You can change only one element in a register in a singlecommand. If you omit the second \fIvalue\fP, .PN dbxdecodes the first \fIvalue\fP into the first half of the register. If youspecify both values, the debugger decodes the first \fIvalue\fP into the firsthalf of the register and the second \fIvalue\fP into the second half of theregister..IPThe \fIvalue\fP can be an integer, floating point, or hexadecimalvalue..IP "\fBdump\fP [\fIprocedure\fR] [\fB>\fP \fIfilename\fP]".NX R "dump command (dbx)"Displays the names and values of variables in the given procedureor the current one if none is specified.If you specify the dot (.),the debugger prints the values of all active variables..IP "\fBprint\fP \fIexpression\fP [\fB,\fP \fIexpression\fP ...]".NX R "print command (dbx)"Displays the values of the specified expressions..IP "\fBwhatis\fP \fIname\fP".NX R "whatis command (dbx)"Displays the declaration of the given name, which you can qualify using a block name. .IP "\fBup\fP [\fIcount\fP]".ns.IP "\fBdown\fP [\fIcount\fP]".NX R "up command (dbx)".NX R "down command (dbx)"Moves the current procedure or function, which is used for resolving names,up or down the stack \fIcount\fP levels.The default for \fIcount\fP is 1..IP \fBwhere\fP.NX R "where command (dbx)"Displays a list of the active procedures and functions..IP "\fBwhereis\fP \fIidentifier\fP".NX R "whereis command (dbx)"Displays the full qualification of all the symbols whosename matches the given identifier.The order in which .PN dbxdisplays the symbols is not meaningful..IP "\fBwhich\fP \fIidentifier\fP".NX R "which command (dbx)"Displays the full qualification of the given identifier; that is, displaythe outer blocks that are associated with the identifier..SS Accessing Source FilesYou can use the following.PN dbxcommands to access source files during a debugging session:.IP "/\fIregular\ expression\fP[/]" .ns.IP "?\fIregular\ expression\fP[?]"Searches forward or backward in the current source filefor the given pattern. For information on specifying a regularexpression, see \fIThe Big Gray Book: The Next Step with ULTRIX\fP..IP "\fBcd\fP [\fIdirname\fP]".NX R "cd command (dbx)"Changes the current directory to the directory you specify. If you omitthe \fIdirname\fP argument,.PN dbxuses the directory specified in the HOME environment variable as thecurrent directory..IP "\fBedit\fP [\fIfilename\fP]".ns.IP "\fBedit\fP \fIprocedure/function\fP".NX R "edit command (dbx)"Invokes an editor on \fIfilename\fP or the current source file if noneis specified.If you specify a procedure or function name,the editor reads in the file that contains that procedure or function.Which editor is invoked by default depends on the installation.You can override the default setting by modifying the EDITOR environmentvariable..IP "\fBfile\fP [\fIfilename\fP]".NX R "file command (dbx)"Changes the current source file name to \fIfilename\fP.If you omit \fIfilename\fP, .PN dbxdisplays the name of the current source file..IP "\fBfunc\fP [\fIprocedure/function\fP]"Changes the current procedure or function.If you omit \fIprocedure/function\fP, .PN dbxdisplays the current procedure or function.Changing the current procedure or function implicitly changes the current source fileto the one that contains the procedure or function; it also changes the current scopeused for name resolution..IP "\fBlist\fP [\fIsource-line-number\fP [\fB,\fP \fIsource-line-number\fP]]".ns.IP "\fBlist\fP [\fIsource-line-number\fP : \fIinteger\fP].ns.IP "\fBlist\fP [\fIprocedure/function\fP]".NX R "list command (dbx)"Lists the lines in the current source file from the first line number youspecify to the second one you specify, inclusive.If you omit the second \fIsource-line-number\fP argument, .PN dbxbegins at the first line number and displays the next 10 lines. If you omit both arguments, .PN dbxbegins the display at the current source line and displays 10 lines..IP If you specify a source line number, a colon, and an integer, .PN dbx lists lines in the current source file starting from \fIsource-line-number\fPand continuing for \fIinteger\fP number of lines..IPIf you specify the name of a procedure or function,lines \fIn-k\fP to \fIn+k\fP are listed, where \fIn\fP is the first statementin the procedure or function and \fIk\fP is equal to the .B $listwindowvariable. The default value of .B $listwindow is 10..IP "\fBpwd\fP".NX R "pwd command (dbx)"Displays the pathname of the current directory..IP "\fBuse\fP \fIpathname pathname...\fP".NX R "use command (dbx)"Sets the list of directories that .PN dbxsearches when looking for source files. You can specify either a full orrelative pathname for \fIpathname\fR..SS Command Aliases and VariablesThe debugger allows you to define aliases and set variables to make yourdebugging sessions more efficient. The following list describes the commandsyou use to perform these tasks:.IP "\fBalias\fP \fIname\fP \fIcommand\fP".ns.IP "\fBalias\fP \fIname\fP \fR[\fB(\fIparameters\fB)\fR] \fIstring\fP".NX R "alias command (dbx)"Lists existing aliases or defines an alias for a .PN dbxcommand or a string. Specify the alias name in the \fIname\fR argumentand the .PN dbxcommand or string in the \fIcommand\fR or \fIstring\fR argument. You candefine an alias that accepts parameters by specifying the\fIparameters\fR argument.For example,to define an alias rr for the command .BR rerun ,enter the following command:.EX (dbx) alias rr rerun.EE To define halt as an alias that sets a stop at a particular line,issue the following command:.EX (dbx) alias halt(x) "stop at x".EE Once you issue this command,.PN dbxinterprets the following commands as equivalent:.EX(dbx) halt(12)(dbx) stop at 12.EEBoth commands create a stop event at line 12..IP "\fBgetenv \fIname\fP".NX R "getenv command (dbx)"Displays the value of the environment variable, \fIname\fP..IP "\fBsetenv \fIname value\fP".NX R "setenv command (dbx)"Sets the environment variable \fIname\fP to \fIvalue\fP by changing thevalue of an existing environment variable or creating a new one..IP "\fBset\fP \fR[\fIname\fP [= \fIexpression\fP]\fR]".NX R "set command (dbx)"Lists existing debugger variables and their values or defines a valuefor the named variable. .IPSome debugger variables contain either a zero or nonzero value thatcontrols.PN dbxbehavior. For example, when set to a nonzero value, the .B $hexstringsvariable causes the debugger to display all strings in hexadecimalformat. When set to zero, the variable causes the debugger to displaystrings in character format. You can set a variable like the .B $hexstringsvariable to a nonzero value as shown:.EX(dbx) set $hexstrings .EEYou can disable the variable using the.B unsetcommand, as shown:.EX(dbx) unset $hexstrings.EE.IPYou can use the .B setcommand to create variables using a name of your own. Variables you create mustnot begin with a dollar sign ($), and the name of the variable must notconflict with names in the programyou are debugging. When you create a variable, the.B setcommandtreats \fIexpression\fR as an address and creates a variable at thespecified address. You can use the variable name in .B traceand.B stopcommands to control program execution..IPThe following list describes the debugger variables: .RS.IP "$frame" If you set this variable to an address, .PN dbxuses the stack frame at that address for stack traces and for accessing local variables.This variable is particularly useful for kernel debugging..IP "$hexchars" .ns.IP "$hexints".ns.IP "$hexoffsets".ns.IP "$hexstrings"You can set these variables to cause .PN dbxto display character strings, integers, offsets from registers, or character pointers,respectively, in hexadecimal format..IP "$historywindow"The value of this variable determines the number of commands .PN dbxstores in the history list.  By default, the history list contains 20commands..IP "$listwindow"The value of this variable determines the number

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?