dbx.1
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 1 代码 · 共 1,322 行 · 第 1/3 页
1
1,322 行
.TH dbx 1 RISC.SH Namedbx \- source level debugger.SH Syntax\fBdbx \fR[\fB\-I \fIdir\fR] [\fB\-c \fIfile\fR] [\fB\-k\fR] [\fB\-i] [\fB\-r] [\fB\-pixie\fR] [\fIobject\fR [\fIcore\fR]].SH DescriptionThe .PN dbxcommand invokes a source-level debugger. Once you invoke .PN dbx ,you issue.PN dbxcommands that control the debugger. These commands allow you to examine source files, controlprogram execution, display the state of the program, and debug at themachine level..PP.NXR "dbx command (RISC only)".NXR "debugger" "dbx command".NXR "debugger" "source-level".PPYou can use command options to modify some steps that .PN dbxperforms during startup. (For information on the available options, seeOptions.) Unless you specify the .B \-roption, .PN dbxprompts you for a command before it begins executing your program. The.PN dbxprompt appears as follows:.EX(dbx).EETo leave .PN dbxissue the.B quit command..SS ArgumentsOn the command line, the \fIobject\fP argument names the object filethat you want.PN dbxto read as input. For complete .PN dbxsupport, the object file must contain extended symbol table information.The supported compilers each have a .B \-goption that produces the symbol table information in the object file..PPThe extended symbol table contains the name of allthe source files translated by the compiler to create the object file.This information allows you to look at all the source code that wentinto creating an object file during your debugging session. (Theextended symbol table also contains other information.).PPIf your object file does not contain the extended symbol tableinformation, use the commands described in Debugging at the MachineLevel to debug your program..PPIf you omit the \fIobject\fP argument, .PN dbxprompts you for the name of an object file. If you press the Return key,.PN dbxattempts to read a file named.PN a.outfrom the current directory. If no.PN a.outfile exists, .PN dbx exits..PPThe \fIcore\fP argument names a core dump file. You can examine thecore dump file to determine the state of the program when it failed. .SS Initialization FileDuring its startup,.PN dbxreads and executes the commands in an initialization file, if one ispresent. By default,.PN dbx searches for the file.PN \&.dbxinitin the current directory. If no.PN \&.dbxinitfile exists in the current directory,.PN dbxsearches your home directory for the file. You can use theinitialization file to issue setup commands automatically whenyou begin a .PN dbxsession..PP.SS Debugger ExpressionsYou specify.PN dbxexpressions using the C or Pascal syntax for expressions. The debuggersupports a subset of the expression syntax for both languages; that is,it supports the syntax that is common between the two languages..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). .PPYou must enclose array expressions in brackets ([ ]). .PP You can also specify a register name in an expression.You denote registers by \fB$r\fIN\fR where \fIN\fR is the number of the register..SS Debugger Name ResolutionThe debugger resolves names by searching for the name in thestatic scope of the current 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 namedfrom the filename without .PN .c ..SH Options.PP.TP 15.B "\-c \fIfile\fR"Selects a command file other than .PN \&.dbxinit ..TP 15.B "\-i"Invokes .PN dbxin interactive mode. This option causes the debugger to not treatsource lines beginning with number signs (#) as comments..TP 15\fB\-I \fIdir\fR Adds \fIdir\fP to the list of directories that.PN dbxsearches for source files. By default, .PN dbxsearches the current directory and the directory where \fIobject\fP is located.You can specify multiple directories by using multiple.B \-Ioptions. .TP 15.B \-kMaps memory addresses. This option is useful for kernel debugging..TP 15.B \-pixieReads in output from the.PN pixieutility. The.PN pixieutility is a code profiler..IPFor this option to work, you must have executable .PN pixieoutput and the .PN nonpixieexecutable file in the same directory. The .PN pixieoutput must be named.I filename.pixie,where \fIfilename\fP is the name of the executable file..TP 15.B \-rExecutes the object file immediately. If program execution terminates with an error,.PN dbxdisplays the message that describes the error. You can then either invokethe debugger or let the program continue exiting. The.PN dbxdebugger reads from.PN /dev/ttywhen you specify the .B \-roption and standard input is not a terminal. If the program executessuccessfully,.PN dbxprompts you for input. .SH dbx CommandsThe debugger supplies a number of commands that you can issue at thedbx prompt. This section describes each command..SS The MonitorThe following commands control the .PN dbxmonitor:.TP 15\fB!\fIstring\fR.ns.TP 15\fB!\fIinteger\fR.ns.TP 15\fB!\fI\-integer\fRExecutes a command from the history list. You can specify the commandname in the \fIstring\fP argument. If you specify an integer, .PN dbxexecutes the command having that number in the history list. If you specify\fI-integer\fP, the debugger executes the command that you issued\fIinteger\fP commands ago. For example, if you specify -3, thedebugger issues the command you issued three commands ago. The debuggerechoes the command on standard output before executing it. .TP 15\fBhelp\fR [\fItopic\fR]With no argument, displays a list of topics for which help information is available. Ifyou name a topic, the debugger displays help information on that topic..TP 15.B historyDisplays a list of the previous commands you issued. By default, the debuggerdisplays the previous 20 commands. You can change the number of commands.PN dbxkeeps in the history list by using the.B setcommand to modify the .B $lines debugger variable..TP 15\fBquit\fRExit .PN dbx . .ne 4.SS Controlling dbxYou can use the following commands to control the operation of the.PN dbxdebugger:.TP 15\fBalias \fR[\fIname[(arg1,arg2,...)] "string"\fR]Lists all existing aliases or defines an alias. If you omit all argumentsto the \fBalias\fP command, .PN dbxdisplays a list of the existing aliases. .IPYou can supply arguments to define a new alias. If you specifya .PN dbxcommand for \fIstring\fP, the debugger assigns \fIname\fP as an aliasfor that command. For example, to define an alias rr for the command\fBrerun\fP, issue the following command:.EX(dbx) \f(CBalias rr "rerun"\fR.EEIf you specify parameters in the.B aliascommand, the debugger substitutes the values you supply on the commandline when it executes the command. For example, to define halt as analias that sets a stop at a particular line, issue the followingcommand:.EX(dbx) \f(CBalias halt(x) "stop at x"\fR.EEOnce you issue this command, .PN dbxinterprets the following commands the same:.EX(dbx) \f(CBhalt(12)\fP(dbx) \f(CBstop at 12\fP.EEBoth commands set a breakpoint at source line 12..IPTo remove an alias, use the .B unalias command, as shown:.EX(dbx) \f(CBunalias halt\fP.EE.TP 15\fBdelete \fIevent-number, ...\fR .ns.TP 15\fBdelete all\fR.ns.TP 15\fBdelete *\fRDeletes the specified breakpoint, trace event, or record event from the status list. The argument .B alland the argument.B *delete all events from the status list..TP 15\fBplayback input \fR[\fIfile\fR]Replays commands that were saved with the \fBrecord input\fR command in a text file. If you omit \fIfile\fR, the debugger reads commands from thetemporary file it creates by default when you issue the \fBrecordinput\fR command..TP 15\fBplayback output \fR[\fIfile\fR]Replays debugger output that was saved with the \fBrecord output\fR command. If you omit \fIfile\fR, the debugger displays output stored ina temporary file it creates by default when you issue the \fBrecordoutput\fP command..TP 15\fBrecord input \fR[\fIfile\fR]Records all commands you enter at the .PN dbxprompt. If you omit \fIfile\fR, the debugger creates a temporary filethat it deletes when you exit from the debugger..IPThe debugger associates an event number with each.B recordcommand you issue. You use the event number to turn off recording, asdescribed with the.B delete command..TP 15\fBrecord output \fR[\fIfile\fR]Records all .PN dbxoutput. If you omit \fIfile\fR, the debugger creates a temporary filethat it deletes when you exit from the debugger..IPThe debugger associates an event number with each.B recordcommand you issue. You use the event number to turn off recording, asdescribed with the.B delete command..TP 15\fBsource\fR \fIfile\fRExecutes the .PN dbxcommands from the specified file. This command is an alias for the.B playback inputcommand..TP 15\fBstatus\fRLists current breakpoints, record events, and trace events..TP 15\fBset \fR[\fIvariable\fR \fB= \fIexpression\fR]Lists existing debugger variables and their values or defines a valuefor the named debugger variable. .IPSome debugger variables contain eithera zero or nonzero value that controls.PN dbxbehavior. For example, when set to a nonzero value, the .B $hexstrings variablecauses the debugger to display all strings in hexadecimal format. Whenset to zero, this variable causes the debugger to display strings in characterformat. You can set a variable like .B $hexstrings to a nonzero value as shown:.EX(dbx) \f(CBset $hexstrings = 1\fP.EEYou can disable the variable using the .B unsetcommand, as shown:.EX(dbx) \f(CBunset $hexstrings\fP.EE.IPYou can create a debugger variable usinga name of your own. A debugger variable name you create must notconflict with the name of any variable in the program you aredebugging, and it must not begin with a dollar sign ($).For information on existingdebugger variables, see Predefined DebuggerVariables. (Use the.B assigncommand to change the value of variables in your program.).TP 15\fBsetenv \fIname\fR \fB"\fIstring\fR\fB"\fRSets the environment variable \fIname\fR to \fIstring\fR by changingthe value of an existing environment variable or creating a new one.To reset the environment variable, specify a null string. Thefollowing example shows how to reset the EDITOR environment variable:.EX(dbx) \f(CBsetenv EDITOR ""\fP.EE.TP 15\fBsh \fR[\fIshell command\fR]\fICalls a shell from .PN dbx or executes the specified shell command. .TP 15\fBtagvalue \fR(\fItagname\fR)Returns the value of \fItagname\fR, where \fItagname\fP is a tag thatmarks a function ortype definition in your program. If the tag extends to more thanone line or if it contains arguments, the debugger issues an errormessage. You can use \fBtagvalue\fR in commands where you specify a procedure or functionname. .\"ADD BACK IN EXAMPLE WHEN TAGVALUE IS FIXED!!!.\"For.\"example, if a tag getline is associated with a function, the following.\"command is valid:.\".EX.\"(dbx) call tagvalue(getline) ().\".EE.\"This command causes execution to begin at the location associated with.\"the getline tag..IPYou create tags using the.PN ctagscommand. See the.MS ctags 1reference page for information. The debugger uses the file named inthe .B $tagfile variable when resolving references to tags. .TP 15\fBunalias \fIname\fRRemoves the specified alias..TP 15\fBunset \fIvariable\fRRemoves the setting of a specified debugger variable..SS Examining Source CodeThe following commands allow you to examine your source files during adebugging session:.TP 15.B "/\fIregular expression\fR".ns.TP 15.B "?\fIregular expression\fR"Searches forward or backward in the source code for the regular expression.For information on forming regular expressions, see \fIThe Big GrayBook: The Next Step with ULTRIX\fP..TP 15\fBedit \fR[\fIfile\fR]Invokes an editor on \fIfile\fP or the current source file if none isspecified. By default,.PN dbxinvokes the.PN vieditor. You can override the default setting by modifying theEDITOR environment variable..TP 15\fBfile \fR[\fIfile\fR]Changes the current file to \fIfile\fP, or, if you omit \fIfile\fP,displays the name of the current file..TP 15\fBfunc \fR[\fIexpression\fR]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?