Charles.Forsyth20080116-1340f4bb33e18 years agoHistory
251 lines · 3.7 KB · Text
RawDownload
.TH MDB 1.SH NAMEmdb - binary file editor.SH SYNOPSIS.B mdb[.B -w].I file[.I command].SH DESCRIPTION.I Mdballows inspection of the contentsof.IR file .If the.B -woption is given, then modification of the contents is alsoallowed..I Mdbaccepts commands of the form.IP.RI [ address ].RB [ ,.IR count ].RI [ command ].PPIf a.I commandis given as an argument, then.I mdbwill execute that command, otherwiseit will read and execute commands from the standard input.If.I addressis present then the current position, called `dot', isset to.IR address.Initially dot is set to 0. .I Commandis repeated.I counttimes with dot advancing between repetitions. The defaultcount is 1..I Addressand.I countare expressions..SS ExpressionsExpressions take one of the following forms:.TP 10\&.The value of dot..TP+The value of dot..TP^The value of dot..TP"The value of the last address typed..TP.I integerA number, decimal by default. A .RB ` 0 'prefix causesit to be interpreted as octal; a.RB ` 0x 'prefix causes it to be interpreted as hexadecimal..TP.BI ( expr )The value of the expression.IR expr ..PP.I Operators.RS.TP.IB e1 + e2Integer addition..TP.IB e1 - e2Integer subtraction..TP.IB e1 * e2Integer multiplication..TP.IB e1 % e2Integer division. (N.B..I notmodulus)..TP.IB e1 | e2Bitwise disjunction..TP.IB e1 & e2Bitwise conjunction..RE.SS CommandsCommands have the following syntax:.TP.BI / fLocations starting at.I addressin.I fileare printed according to the format.IR f ..TP.BI ? fSame as.RB ` / '..TP.BI = fThe value of.I addressitself is printed according to the format.IR f ..PPA.I formatconsists of one or more characters that specifya style of printing. Each.I formatfetches some data, prints it, and if the.I commandis not.RB ` = ',advances dot by the amount of data fetched.All data is assumed to be held in little-endianform (least significant byte first)..RS.TP.PD 0.B oPrint a two-byte integer in octal..TP.B OPrint a four-byte integer in octal..TP.B dPrint a two-byte integer in decimal..TP.B DPrint a four-byte integer in decimal..TP.B uPrint a two-byte integer in unsigned decimal..TP.B UPrint a four-byte integer in unsigned decimal..TP.B bPrint a single byte in hexadecimal..TP.B xPrint a two-byte integer in hexadecimal..TP.B XPrint a four-byte integer in hexadecimal..TP.B nPrints a newline. No data is fetched..TP.B +Increments dot by 1. No data is printed..TP.B -Decrements dot by 1. No data is printed..TP.B ^Increments dot by the size of the last format encountered..TP.B cPrints a single byte as a character..TP.B CPrints a single byte as a printable character, convertingit to backslash escaped hex if necessary..RE.PDOther commands include:.TP 10.RB [ ?/ ] w\ \fIvalue\fPWrite the two-byte.I valueto the addressed location..TP.RB [ ?/ ] W\ \fIvalue\fPWrite the four-byte.I valueto the addressed location..TP.RB [ ?/ ] iDisassemble.I countinstructions starting at.I address.RI ( dotby default)..TP.BI $ modifier.I Filemust be a.IR dis (6)file..I Modifieris one of the following subcommands:.RS.TP.PD 0.B DPrint the descriptor section..TP.B hPrint the file header..TP.B lPrint the links section..TP.B iPrint the import section..TP.B dPrint the data section..TP.B HPrint exception handler tables..TP.B sPrint the name of the source file..PD.RE.SH SOURCE.B /appl/cmd/mdb.b.SH SEE ALSO.IR dis (6).SH BUGSMost of the more useful features of.IR mdb 'santecedent.I dbare unimplemented..PPIt is not possible to print strings or UTF-8 characters..PPAs there is no ``native'' word format in Inferno,the assumption that all words are little-endian is hardto justify.