📄 db.1
字号:
.th DB I 8/20/73.sh NAMEdb \*- debug.sh SYNOPSIS.bd db[ core [ namelist ] ] [.bd \*-].sh DESCRIPTIONUnlikemany debugging packages (including DEC's ODT, onwhich.it dbis loosely based),.it dbis not loaded as part of thecore image which it is used to examine; instead it examines files.Typically, the file will be either a core image producedafter a fault or the binary output ofthe assembler..it Coreis the file being debugged; if omitted \fBcore\fR is assumed..it Namelistis a file containing a symbol table.If it is omitted,the symbol table is obtained from thefile being debugged,or if not there from.bd a.out.If no appropriate name list filecan be found,.it dbcan still be used but some of its symbolicfacilities become unavailable..s3For the meaning of the optional third argument, seethe last paragraph below..s3The format for most.it dbrequests is an address followedby a one character command.Addresses are expressions built up as follows:.s3.lp +4 31. A name has the value assigned to itwhen the input file was assembled.It may be relocatable or not dependingon the use of the name during the assembly..s3.lp +4 32. An octal number is an absolute quantity with the appropriatevalue..s3.lp +4 33. A decimal number immediately followed by `\fB.\fR' isan absolute quantity with the appropriate value..s3.lp +4 34. An octal number immediately followed by \fBr\fR is a relocatablequantity with the appropriate value..s3.lp +4 35. The symbol \fB.\fR indicates the current pointerof \fIdb\fR.The current pointer is set by many\fIdb\fRrequests..s3.lp +4 36. A \fB*\fR beforean expression forms an expression whose value is thenumber in the word addressed by the first expression.A \fB*\fR alone is equivalent to `\fB*.\fR'..s3.lp +4 37. Expressions separated by \fB+\fR or blank are expressionswith value equal to the sum of the components. At mostone of the components may be relocatable..s3.lp +4 38. Expressions separated by \fB\*-\fR form an expressionwith value equal to the difference to the components.If the right component is relocatable, the left componentmust be relocatable..s3.lp +4 39. Expressions are evaluated left to right..s3.in \n(inuNames for registers arebuilt in:.s3.bd " r0 ... r5".bd " sp".bd " pc".bd " fr0 ... fr5".s3These may be examined.Their values are deduced from the contentsof the stack in a core image file. They are meaninglessin a file that is not a core image..s3If no address is given for a command, the current address(also specified by ``\fB.\fR'') is assumed. In general, ``\fB.\fR''points to the last word or byte printed by.it db..s3There are.it dbcommands for examining locationsinterpreted as numbers, machine instructions,ASCII characters, and addresses.For numbers and characters, either bytesor words may be examined.The following commands are used to examine the specified file..s3.lp +4 3/ The addressed word is printed in octal..s3.lp +4 3\\ The addressed byte is printed in octal..s3.lp +4 3" The addressed word is printed as two ASCII characters..s3.lp +4 3.tr |\*a| The addressed byte is printed as an ASCII character..s3.tr ||.lp +4 3\*g The addressed word is printed in decimal..s3.lp +4 3? The addressed word is interpreted as a machineinstruction and a symbolic form of the instruction,including symbolic addresses, is printed.Often, the result will appear exactly as it was writtenin the source program..s3.lp +4 3& The addressed word is interpreted as a symbolic addressand is printed as the name of the symbol whose value is closestto the addressed word, possibly followed by a signed offset..s3.lp +4 3<nl> (i. e., the character ``new line'') This command advancesthe current location counter ``\fB.\fR'' and prints the resultinglocation in the mode last specified byone of the above requests..s3.lp +4 3^ This character decrements ``\fB.\fR'' and prints theresulting location in the mode last selectedone of the above requests. It is a converse to <nl>..s3.lp +4 3% Exit..s3.in \n(inuOdd addresses to word-oriented commands are roundeddown.The incrementing and decrementingof ``\fB.\fR'' done by the.bd <nl>and.bd ^requests is by one ortwo depending on whether the last commandwas word or byte oriented..s3The address portion of any of the above commandsmay be followed by a comma and then by anexpression. In this case that number of sequentialwords or bytes specified by the expression is printed.``\fB.\fR'' is advanced so that it points at thelast thing printed..s3There are two commands to interpret the valueof expressions..s3.lp +4 3= When preceded by an expression, the value of the expressionis typed in octal.When not preceded by an expression, the value of ``\fB.\fR'' isindicated.This command does not change the value of ``\fB.\fR''..s3.lp +4 3: An attempt is made to print the given expressionas a symbolic address. If the expression is relocatable,that symbol is found whose value is nearestthat of the expression, and the symbol is typed, followed bya sign and the appropriate offset.If the value of the expression is absolute, a symbolwith exactly the indicated value is sought andprinted if found; if no matching symbol is discovered, theoctal value of the expression is given..s3.in \n(inuThe following command may be used to patch the file being debugged..s3.lp +4 3! This command must be preceded by an expression.The value of the expression is stored at the locationaddressed by the current value of ``\fB.\fR''.The opcodes do not appear in the symboltable, so the user must assemble them by hand..s3.in \n(inuThe following command is used after a fault has causeda core image file to be produced..s3.lp +4 3$ causes the fault type andthe contents of the general registers andseveral other registers to be printed both in octal and symbolicformat.The values are as they were at the time of the fault..s3.in \n(inuFor some purposes, it is important to know how addressestyped by the user correspond withlocations in the file being debugged.The mapping algorithm employed by.it dbis non-trivialfor two reasons:First, in an.bd a.outfile, there is a 20(8) byte headerwhich will not appear when the file is loaded intocore for execution.Therefore, apparent location 0 should correspondwith actual file offset 20.Second, addressesin core images do not correspond with theaddresses used by the program because in a core imagethere is a header containing thesystem's per-processdata for the dumped process, and also because thestack is stored contiguously with the text and datapart of the core image rather than at the highest possiblelocations..it Dbobeys the following rules:.s3If exactly one argument is given, and if it appearsto be an.bd a.outfile, the 20-byte header is skippedduring addressing, i.e., 20 is added to all addresses typed.As a consequence, the header can be examinedbeginning at location \*-20..s3If exactly one argument is given and if the file doesnot appear to be an.bd a.outfile, no mapping is done..s3If zero or two arguments are given,the mapping appropriate to a core image file is employed.This means that locations above the program breakand below the stackeffectively do not exist (and are not, in fact, recordedin the core file).Locations above the user's stack pointer are mapped,in looking at the core file, tothe place where they are really stored.The per-process data kept by thesystem, which is stored in the first partof the core file,cannot currently be examined (except by \fB$\fR)..s3If one wants to examinea file which has an associated name list,but is not a core image file, the last argument ``\fB\*-\fR''can be used (actually the only purpose of thelast argument is to make the number ofarguments not equal to two).This feature is used most frequently inexamining the memory file /dev/mem..sh "SEE ALSO"as (I), core (V), a.out (V), od (I).sh DIAGNOSTICS``File not found'' if the first argumentcannot be read; otherwise ``\fB?\fR''..sh BUGSThere should be some way to examine the registersand other per-process data in a core image;also there should be some way of specifyingdouble-precision addresses.It does not know yet about shared text segments.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -