📄 adb.1
字号:
.ds TW \v'.25m'\s+2~\s-2\v'-.25m'.ds ST \v'.25m'*\v'-.25m'.ds IM \v'.1m'=\v'-.1m'\s-2\h'-.1m'>\h'.1m'\s+2.ds LE \(<=.ds LT \s-2<\s+2.ds GT \s-2>\s+2.TH ADB 1 .SH NAMEadb \- debugger.SH SYNOPSIS.B adb[\fB\-w\fR] [ objfil [ corfil ] ].SH DESCRIPTION.I Adbis a general purpose debugging program.It may be used to examine files and to providea controlled environment for the executionof UNIX programs..PP.I Objfilis normally an executable program file, preferablycontaining a symbol table;if not then thesymbolic features of.I adbcannot be used although the file can stillbe examined.The default for.I objfilis.B a.out..I Corfilis assumed to be a core image file produced afterexecuting.IR objfil ;the default for.I corfilis.B core..PPRequests to.I adbare read from the standard input andresponses are to the standard output.If the.B \-wflag is present then both.I objfiland.I corfilarecreated if necessary andopened for reading and writingso that files can be modified using.IR adb ..I Adbignores QUIT; INTERRUPTcauses return to the next.I adbcommand..PPIn general requests to.I adbare of the form.PP.if n .ti 16.if t .ti 1.6i[\|\fIaddress\fR\|] [\|,.IR count \|][\|\fIcommand\fR\|] [\|;\|].PPIf.I addressis present then.I dotis set to.IR address .Initially.I dotis set to 0.For most commands.I countspecifies how many timesthe command will be executed.The default.I countis 1..I Addressand.I countare expressions..PPThe interpretation of an address dependson the context it is used in.If a subprocess is being debugged thenaddresses are interpretedin the usual way in the address space of the subprocess.For further details of address mapping see.SM ADDRESSES..SH EXPRESSIONS.TP 7.2n.B .The value of.IR dot ..TP 7.2n+The value of.I dotincremented by the current increment..TP 7.2n^The value of.I dotdecremented by the current increment..TP 7.2n"The last.I addresstyped..TP 7.2n.I integerAn octal number if.I integerbegins with a 0;a hexadecimal number if preceded by.BR # ;otherwise a decimal number..TP 7.2n.IB integer . fractionA 32 bit floating point number..TP 7.2n.I \'cccc\|\'The ASCII value of up to 4 characters.\\ may be used to escape a \'..TP 7.2n.I \*(LT nameThe value of.IR name ,which is either a variable name or a register name..I Adbmaintains a number of variables(see.SM VARIABLES\*S)named by single letters or digits.If.I nameis a register name thenthe value of the register is obtained fromthe system header in.IR corfil .The register names are.BR "r0 ... r5 sp pc ps" ".".TP 7.2n.I symbolA.I symbolis a sequenceof upper or lower case letters, underscores ordigits, not starting with a digit..BR \\ " may be used to escape other characters."The value of the.I symbolis taken from the symbol tablein.IR objfil .An initial \_ or \*(TW will be prepended to.I symbolif needed..TP.I _ symbolIn C, the `true name' of an external symbol begins with _.It may be necessary to utter this name to disinguish itfrom internal or hidden variables of a program..TP 7.2n.IB routine . nameThe address of the variable.I namein the specifiedC routine.Both.I routineand.I nameare.IR symbols .If.I nameis omitted the value is the address of themost recently activated C stack framecorresponding to.IR routine ..TP 7.2n.RI ( exp \|)The value of the expression.IR exp ..LP.SM.B "Monadic\ operators".TP 7.2n.RI \*(ST expThe contents of the location addressedby.I expin.IR corfil ..TP 7.2n.RI @ expThe contents of the location addressed by.I expin.IR objfil ..TP 7.2n.RI \- expInteger negation..TP 7.2n.RI \*(TW expBitwise complement..LP.B "Dyadic\ operators"are left associativeand are less binding than monadic operators..TP 7.2n.IR e1 + e2Integer addition..TP 7.2n.IR e1 \- e2Integer subtraction..TP 7.2n.IR e1 \*(ST e2Integer multiplication..TP 7.2n.IR e1 % e2Integer division..TP 7.2n.IR e1 & e2Bitwise conjunction..TP 7.2n.IR e1 \(bv e2Bitwise disjunction..TP 7.2n.IR e1 # e2.I E1rounded up to the next multiple of.IR e2 ..DT.SH COMMANDSMost commands consist of a verb followed by a modifier or listof modifiers.The following verbs are available.(The commands `?' and `/' may be followed by `\*(ST';see.SM ADDRESSESfor further details.).TP .5i.RI ? fLocations starting at.I addressin.I objfilare printed according to the format.IR f ..TP.RI / fLocations starting at.I addressin.I corfilare printed according to the format.IR f ..TP.RI = fThe value of.I addressitself is printed in thestyles indicated by the format.IR f .(For.B i format `?' is printed for the parts of the instruction that referencesubsequent words.).PPA.I formatconsists of one or more characters that specify a styleof printing.Each format character may be preceded by a decimal integerthat is a repeat count for the format character.While stepping through a format.I dotis incremented temporarilyby the amount given for each format letter.If no format is given then the last format is used.The format letters available are as follows..ta 2.5n .5i.RS.TP.BR o " 2"Print 2 bytes in octal.All octal numbers output by.I adbare preceded by 0..br.ns.TP.BR O " 4"Print 4 bytes in octal..br.ns.TP.BR q " 2"Print in signed octal..br.ns.TP.BR Q " 4"Print long signed octal..br.ns.TP.BR d " 2"Print in decimal..br.ns.TP.BR D " 4"Print long decimal..br.ns.TP.BR x " 2"Print 2 bytes in hexadecimal..br.ns.TP.BR X " 4"Print 4 bytes in hexadecimal..br.ns.TP.BR u " 2"Print as an unsigned decimal number..br.ns.TP.BR U " 4"Print long unsigned decimal..br.ns.TP.BR f " 4"Print the 32 bit valueas a floating point number..br.ns.TP.BR F " 8"Print double floating point..br.ns.TP.BR b " 1"Print the addressed byte in octal..br.ns.TP.BR c " 1"Print the addressed character..br.ns.TP.BR C " 1"Print the addressed character usingthe following escape convention.Character values 000 to 040 are printed as @ followed by the correspondingcharacter in the range 0100 to 0140.The character @ is printed as @@..br.ns.TP.BI s " n"Print the addressed characters until a zero characteris reached..br.ns.TP.BI S " n"Print a string using the @ escape convention..I nis the length of the string including its zero terminator..br.ns.TP.BR Y " 4"Print 4 bytes in date format (see.IR ctime (3))..br.ns.TP.BR i " n"Print as PDP11 instructions..I nis the number of bytes occupied by the instruction.This style of printing causes variables 1 and 2 to be setto the offset parts of the source and destination respectively..br.ns.TP.BR a " 0"Print the value of.I dotin symbolic form.Symbols are checked to ensure that they have an appropriatetype as indicated below..LP / local or global data symbol.br ? local or global text symbol.br = local or global absolute symbol.TP.BR p " 2"Print the addressed value in symbolic form usingthe same rules for symbol lookup as.BR a ..br.ns.TP.BR t " 0"When preceded by an integer tabs to the nextappropriate tab stop.For example,.B 8t moves to the next 8-space tab stop..br.ns.TP.BR r " 0"Print a space..br.ns.TP.BR n " 0"Print a newline..br.ns.tr '".TP.BR '...' " 0"Print the enclosed string..br.tr ''.br.ns.TP.B ^.I Dotis decremented by the current increment.Nothing is printed..br.ns.TP+.I Dotis incremented by 1.Nothing is printed..br.ns.TP\-.I Dotis decremented by 1.Nothing is printed..RE.TPnewlineIf the previous command temporarily incremented.IR dot ,make the increment permanent.Repeat the previous command with a.I countof 1..TP.RB [ ?/ ] l "\fI value mask\fR"Words starting at.I dotare masked with.I maskand compared with.I valueuntila match is found.If.B Lis used then the match is for 4 bytes at a time instead of 2.If no match is found then.I dotis unchanged; otherwise.I dotis set to the matched location.If.I maskis omitted then \-1 is used..TP.RB [ ?/ ] w "\fI value ...\fR"Write the 2-byte.I valueinto the addressedlocation.If the command is.BR W ,write 4 bytes.Odd addresses are not allowed when writing to the subprocessaddress space..TP[\fB?/\fR]\fBm\fI b1 e1 f1\fR[\fB?/\fR].brNew values for.RI ( b1,\ e1,\ f1 )are recorded.If less than three expressions are given thenthe remaining map parameters are left unchanged.If the `?' or `/' is followed by `\*(ST' thenthe second segment (\fIb2\fR\|,\|\fIe2\fR\|,\|\fIf2\fR)of the mapping is changed.If the list is terminated by `?' or `/' then the file(\fIobjfil\fR or.I corfilrespectively) is usedfor subsequent requests.(So that, for example, `/m?' will cause `/' to refer to.IR objfil .).TP.BI \*(GT name.I Dotis assigned to the variable or register named..TP.B !A shell is called to read therest of the line following `!'..TP.RI $ modifierMiscellaneous commands.The available .I modifiers are:.RS.TP.BI < fRead commands from the file.I fand return..br.ns.TP.BI > fSend output to the file.I f,which is created if it does not exist..br.ns.TP.B rPrint the general registers andthe instruction addressed by.BR pc ..I Dotis set to \fBpc\fR..br.ns.TP.B fPrint the floating registers insingle or double length.If the floating point status of.B psis set to double (0200 bit)then double length is used anyway..br.ns.TP.B bPrint all breakpointsand their associated counts and commands..br.ns.TP.B aALGOL 68 stack backtrace.If.I addressis given then it is taken to be theaddress of the current frame (instead of.BR r4 ).If.I countis given then only the first.I countframes are printed..br.ns.TP.B cC stack backtrace.If.I addressis given then it is taken as theaddress of the current frame (instead of.BR r5 ).If.B C is used then the names and (16 bit) values of all automaticand static variables are printed for each active function.If.I countis given then only the first.I countframes are printed..br.ns.TP.B eThe names and values ofexternal variables are printed..br.ns.TP.B wSet the page width for output to.I address(default 80)..br.ns.TP.B sSet the limit for symbol matches to.I address(default 255)..br.ns.TP.B oAll integers input are regarded as octal..br.ns.TP.B dReset integer input as described in.SM EXPRESSIONS..br.ns.TP.B qExit from.IR adb ..br.ns.TP.B vPrint all non zero variables in octal..br.ns.TP.B mPrint the address map..RE.TP.BI : modifierManage a subprocess.Available modifiers are:.RS.TP.BI b cSet breakpoint at.IR address .The breakpoint is executed.IR count \-1times beforecausing a stop.Each time the breakpoint is encounteredthe command.I cis executed.If this command sets.I dotto zerothen the breakpoint causes a stop..TP.B dDelete breakpoint at.IR address ..TP.B rRun.I objfilas a subprocess.If.I addressis given explicitly then theprogram is entered at this point; otherwisethe program is entered at its standard entry point..I countspecifies how many breakpoints are to beignored before stopping.Arguments to the subprocess may be supplied on thesame line as the command.An argument starting with < or > causes the standardinput or output to be established for the command.All signals are turned on on entry to the subprocess..TP.BI c sThe subprocess is continuedwith signal.I sc.I s,see.IR signal (2).If.I addressis given then the subprocessis continued at this address.If no signal is specified then the signalthat caused the subprocess to stop is sent.Breakpoint skipping is the sameas for.BR r ..TP.BI s sAs for.B c except thatthe subprocess is single stepped.I counttimes.If there is no current subprocess then.I objfilis runas a subprocess as for.BR r .In this case no signal can be sent; the remainder of the lineis treated as arguments to the subprocess..TP.B kThe current subprocess, if any, is terminated..RE.SH VARIABLES.I Adbprovides a number of variables.Named variables are set initially by.I adbbut are not used subsequently.Numbered variables are reserved for communicationas follows..TP0The last value printed..br.ns.TP1The last offset part of an instruction source..br.ns.TP2The previous value of variable 1..PPOn entry the following are setfrom the system header in the.IR corfil .If.I corfildoes not appear to be a.B core file thenthese values are set from.IR objfil ..TPbThe base address of the data segment..br.ns.TPdThe data segment size..br.ns.TPeThe entry point..br.ns.TPmThe `magic' number (0405, 0407, 0410 or 0411)..br.ns.TPsThe stack segment size..br.ns.TPtThe text segment size..SH ADDRESSESThe address in a file associated witha written address is determined by a mappingassociated with that file.Each mapping is represented by two triples.RI ( "b1, e1, f1" )and.RI ( "b2, e2, f2" )and the.I file addresscorresponding to a written.I addressis calculated as follows..PP.if t .ti 1.5i.if n .ti 8.IR b1 \*(LE address < e1\*(IM.IR "file address" = address + f1\-b1,otherwise,.PP.if t .ti 1.5i.if n .ti 8.IR b2 \*(LE address < e2\*(IM.IR "file address" = address + f2\-b2,.PPotherwise, the requested.I addressis not legal.In some cases (e.g. for programs with separated I and Dspace) the two segments for a file may overlap.If a.B ? or.B / is followed by an.B \*(ST then only the secondtriple is used..PPThe initial setting of both mappings is suitable fornormal.B a.out and.B core files.If either file is not of the kind expected then, for that file,.I b1is set to 0,.I e1is set tothe maximum file sizeand.I f1is set to 0; in this way the wholefile can be examined with no address translation..PPSo that.I adbmay be used on large filesall appropriate values are kept as signed 32 bit integers..SH FILES/dev/mem.br/dev/swap.bra.out.brcore.SH SEE\ ALSOptrace(2),a.out(5),core(5).SH DIAGNOSTICS`Adb' when there is no current command or format.Comments about inaccessible files, syntax errors,abnormal termination of commands, etc.Exit status is 0, unless last command failed orreturned nonzero status..SH BUGSA breakpoint set at the entry point is not effectiveon initial entry to the program..brWhen single stepping, system calls do not count as anexecuted instruction..brLocal variables whose names are the same as an externalvariable may foul up the accessing of the external.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -