|
|
1.1 root 1: .TH ADB 1 4/1/81
2: .UC 4
3: .SH NAME
4: adb \- debugger
5: .SH SYNOPSIS
6: .B adb
7: [\fB\-w\fR] [ \fB\-k\fR ] [ objfil [ corfil ] ]
8: .ds TW \v'.25m'\s+2~\s-2\v'-.25m'
9: .ds ST \v'.25m'*\v'-.25m'
10: .ds IM \v'.1m'=\v'-.1m'\s-2\h'-.1m'>\h'.1m'\s+2
11: .ds LE \(<=
12: .ds LT \s-2<\s+2
13: .ds GT \s-2>\s+2
14: .SH DESCRIPTION
15: .I Adb
16: is a general purpose debugging program.
17: It may be used to examine files and to provide
18: a controlled environment for the execution
19: of UNIX programs.
20: .PP
21: .I Objfil
22: is normally an executable program file, preferably
23: containing a symbol table;
24: if not then the
25: symbolic features of
26: .I adb
27: cannot be used although the file can still
28: be examined.
29: The default for
30: .I objfil
31: is
32: .B a.out.
33: .I Corfil
34: is assumed to be a core image file produced after
35: executing
36: .IR objfil ;
37: the default for
38: .I corfil
39: is
40: .B core.
41: .PP
42: Requests to
43: .I adb
44: are read from the standard input and
45: responses are to the standard output.
46: If the
47: .B \-w
48: flag is present then both
49: .I objfil
50: and
51: .I corfil
52: are
53: created if necessary and
54: opened for reading and writing
55: so that files can be modified using
56: .IR adb .
57: .PP
58: The \fB\-k\fP option makes \fIadb\fP do UNIX kernel memory
59: mapping; it should be used when \fIcore\fP is a UNIX crash dump.
60: .PP
61: .I Adb
62: ignores QUIT; INTERRUPT
63: causes return to the next
64: .I adb
65: command.
66: .PP
67: In general requests to
68: .I adb
69: are of the form
70: .PP
71: .if n .ti 16
72: .if t .ti 1.6i
73: [\|\fIaddress\fR\|] [\|,
74: .IR count \|]
75: [\|\fIcommand\fR\|] [\|;\|]
76: .PP
77: If
78: .I address
79: is present then
80: .I dot
81: is set to
82: .IR address .
83: Initially
84: .I dot
85: is set to 0.
86: For most commands
87: .I count
88: specifies how many times
89: the command will be executed.
90: The default
91: .I count
92: is 1.
93: .I Address
94: and
95: .I count
96: are expressions.
97: .PP
98: The interpretation of an address depends
99: on the context it is used in.
100: If a subprocess is being debugged then
101: addresses are interpreted
102: in the usual way in the address space of the subprocess.
103: If the operating system is being debugged either post-mortem or using
104: the special file
105: .B /dev/kmem
1.1.1.2 ! root 106: to interactively examine and/or modify memory, the maps are set to map
1.1 root 107: the kernel virtual addresses which start at 0xC0000000.
108: For further details of address mapping see
109: .SM ADDRESSES.
110: .SH EXPRESSIONS
111: .TP 7.2n
112: .B .
113: The value of
114: .IR dot .
115: .TP 7.2n
116: +
117: The value of
118: .I dot
119: incremented by the current increment.
120: .TP 7.2n
121: ^
122: The value of
123: .I dot
124: decremented by the current increment.
125: .TP 7.2n
126: "
127: The last
128: .I address
129: typed.
130: .TP 7.2n
131: .I integer
132: A number. The prefixes 0o and 0O (\*(lqzero oh\*(rq) force interpretation
133: in octal radix; the prefixes 0t and 0T force interpretation in
134: decimal radix; the prefixes 0x and 0X force interpretation in
135: hexadecimal radix. Thus 0o20 = 0t16 = 0x10 = sixteen.
136: If no prefix appears, then the
137: .I default\ radix
138: is used; see the $d command. The default radix is initially hexadecimal.
139: The hexadecimal digits are 0123456789abcdefABCDEF with the obvious
140: values. Note that a hexadecimal number whose most significant
141: digit would otherwise be an alphabetic character must have a 0x
142: (or 0X) prefix (or a leading zero if the default radix is hexadecimal).
143: .TP 7.2n
144: .IB integer . fraction
1.1.1.2 ! root 145: A 32-bit floating point number.
1.1 root 146: .TP 7.2n
147: .I \'cccc\|\'
148: The ASCII value of up to 4 characters.
149: \\ may be used to escape a \'.
150: .TP 7.2n
151: .I \*(LT name
152: The value of
153: .IR name ,
154: which is either a variable name or a register name.
155: .I Adb
156: maintains a number of variables
157: (see
158: .SM VARIABLES\*S)
159: named by single letters or digits.
160: If
161: .I name
162: is a register name then
163: the value of the register is obtained from
164: the system header in
165: .IR corfil .
166: The register names are
167: those printed by the $r command.
168: .TP 7.2n
169: .I symbol
170: A
171: .I symbol
172: is a sequence
173: of upper or lower case letters, underscores or
174: digits, not starting with a digit.
175: .BR \\ " may be used to escape other characters."
176: The value of the
177: .I symbol
178: is taken from the symbol table
179: in
180: .IR objfil .
181: An initial \_ or \*(TW will be prepended to
182: .I symbol
183: if needed.
184: .TP
185: .I _ symbol
186: In C, the `true name' of an external symbol begins with _.
187: It may be necessary to utter this name to distinguish it
188: from internal or hidden variables of a program.
189: .TP 7.2n
190: .IB routine . name
191: The address of the variable
192: .I name
193: in the specified
194: C routine.
195: Both
196: .I routine
197: and
198: .I name
199: are
200: .IR symbols .
201: If
202: .I name
203: is omitted the value is the address of the
204: most recently activated C stack frame
205: corresponding to
206: .IR routine .
207: (This form is currently broken on the TAHOE; local variables can be examined
208: only with
209: .IR sdb (1).)
210: .TP 7.2n
211: .RI ( exp \|)
212: The value of the expression
213: .IR exp .
214: .LP
215: .SM
216: .B "Monadic\ operators"
217: .TP 7.2n
218: .RI \*(ST exp
219: The contents of the location addressed
220: by
221: .I exp
222: in
223: .IR corfil .
224: .TP 7.2n
225: .RI @ exp
226: The contents of the location addressed by
227: .I exp
228: in
229: .IR objfil .
230: .TP 7.2n
231: .RI \- exp
232: Integer negation.
233: .TP 7.2n
234: .RI \*(TW exp
235: Bitwise complement.
236: .TP 7.2n
237: .RI # exp
238: Logical negation.
239: .LP
240: .B "Dyadic\ operators"
241: are left associative
242: and are less binding than monadic operators.
243: .TP 7.2n
244: .IR e1 + e2
245: Integer addition.
246: .TP 7.2n
247: .IR e1 \- e2
248: Integer subtraction.
249: .TP 7.2n
250: .IR e1 \*(ST e2
251: Integer multiplication.
252: .TP 7.2n
253: .IR e1 % e2
254: Integer division.
255: .TP 7.2n
256: .IR e1 & e2
257: Bitwise conjunction.
258: .TP 7.2n
259: .IR e1 \(bv e2
260: Bitwise disjunction.
261: .TP 7.2n
262: .IR e1 # e2
263: .I E1
264: rounded up to the next multiple of
265: .IR e2 .
266: .DT
267: .SH COMMANDS
268: Most commands consist of a verb followed by a modifier or list
269: of modifiers.
270: The following verbs are available.
271: (The commands `?' and `/' may be followed by `\*(ST';
272: see
273: .SM ADDRESSES
274: for further details.)
275: .TP .5i
276: .RI ? f
277: Locations starting at
278: .I address
279: in
280: .I objfil
281: are printed according to the format
282: .IR f .
283: .I dot
284: is incremented by the sum of the increments for each format letter (q.v.).
285: .TP
286: .RI / f
287: Locations starting at
288: .I address
289: in
290: .I corfil
291: are printed according to the format
292: .I f
293: and
294: .I dot
295: is incremented as for `?'.
296: .TP
297: .RI = f
298: The value of
299: .I address
300: itself is printed in the
301: styles indicated by the format
302: .IR f .
303: (For
304: .B i
305: format `?' is printed for the parts of the instruction that reference
306: subsequent words.)
307: .PP
308: A
309: .I format
310: consists of one or more characters that specify a style
311: of printing.
312: Each format character may be preceded by a decimal integer
313: that is a repeat count for the format character.
314: While stepping through a format
315: .I dot
316: is incremented
317: by the amount given for each format letter.
318: If no format is given then the last format is used.
319: The format letters available are as follows.
320: .ta 2.5n .5i
321: .RS
322: .TP
323: .BR o " 2"
324: Print 2 bytes in octal.
325: All octal numbers output by
326: .I adb
327: are preceded by 0.
328: .br
329: .ns
330: .TP
331: .BR O " 4"
332: Print 4 bytes in octal.
333: .br
334: .ns
335: .TP
336: .BR q " 2"
337: Print in signed octal.
338: .br
339: .ns
340: .TP
341: .BR Q " 4"
342: Print long signed octal.
343: .br
344: .ns
345: .TP
346: .BR d " 2"
347: Print in decimal.
348: .br
349: .ns
350: .TP
351: .BR D " 4"
352: Print long decimal.
353: .br
354: .ns
355: .TP
356: .BR x " 2"
357: Print 2 bytes in hexadecimal.
358: .br
359: .ns
360: .TP
361: .BR X " 4"
362: Print 4 bytes in hexadecimal.
363: .br
364: .ns
365: .TP
366: .BR z " 2"
367: Print 2 bytes in signed hexadecimal.
368: .br
369: .ns
370: .TP
371: .BR Z " 4"
372: Print 4 bytes in signed hexadecimal.
373: .br
374: .ns
375: .TP
376: .BR u " 2"
377: Print as an unsigned decimal number.
378: .br
379: .ns
380: .TP
381: .BR U " 4"
382: Print long unsigned decimal.
383: .br
384: .ns
385: .TP
386: .BR f " 4"
1.1.1.2 ! root 387: Print the 32-bit value
1.1 root 388: as a floating point number.
389: .br
390: .ns
391: .TP
392: .BR F " 8"
393: Print double floating point.
394: .br
395: .ns
396: .TP
397: .BR b " 1"
398: Print the addressed byte in octal.
399: .br
400: .ns
401: .TP
402: .BR c " 1"
403: Print the addressed character.
404: .br
405: .ns
406: .TP
407: .BR C " 1"
408: Print the addressed character using
409: the standard escape convention where control characters
410: are printed as ^X and the delete character is printed as ^?.
411: .br
412: .ns
413: .TP
414: .BI s " n"
415: Print the addressed characters until a zero character
416: is reached.
417: .br
418: .ns
419: .TP
420: .BI S " n"
421: Print a string using
422: the ^\fIX\fR escape convention (see \fBC\fR above).
423: .I n
424: is the length of the string including its zero terminator.
425: .br
426: .ns
427: .TP
428: .BR Y " 4"
429: Print 4 bytes in date format (see
430: .IR ctime (3)).
431: .br
432: .ns
433: .TP
434: .BR I " n"
435: Print as TAHOE instructions.
436: .I n
437: is the number of bytes occupied by the instruction.
438: This style of printing causes variables 1 and 2 to be set
439: to the offset parts of the source and destination respectively.
440: .br
441: .ns
442: .TP
443: .BR i " n"
444: Same as `I' format, but a location labeled by a global symbol
445: is considered a procedure's entry mask, and printed in `x' format.
446: .br
447: .ns
448: .TP
449: .BR a " 0"
450: Print the value of
451: .I dot
452: in symbolic form.
453: Symbols are checked to ensure that they have an appropriate
454: type as indicated below.
455: .LP
456: / local or global data symbol
457: .br
458: ? local or global text symbol
459: .br
460: = local or global absolute symbol
461: .TP
462: .BR p " 4"
463: Print the addressed value in symbolic form using
464: the same rules for symbol lookup as
465: .BR a .
466: .br
467: .ns
468: .TP
469: .BR t " 0"
470: When preceded by an integer tabs to the next
471: appropriate tab stop.
472: For example,
473: .B 8t
474: moves to the next 8-space tab stop.
475: .br
476: .ns
477: .TP
478: .BR r " 0"
479: Print a space.
480: .br
481: .ns
482: .TP
483: .BR n " 0"
484: Print a newline.
485: .br
486: .ns
487: .tr '"
488: .TP
489: .BR '...' " 0"
490: Print the enclosed string.
491: .br
492: .tr ''
493: .br
494: .ns
495: .TP
496: .B ^
497: .I Dot
498: is decremented by the current increment.
499: Nothing is printed.
500: .br
501: .ns
502: .TP
503: +
504: .I Dot
505: is incremented by 1.
506: Nothing is printed.
507: .br
508: .ns
509: .TP
510: \-
511: .I Dot
512: is decremented by 1.
513: Nothing is printed.
514: .RE
515: .TP
516: newline
517: Repeat the previous command with a
518: .I count
519: of 1.
520: .TP
521: .RB [ ?/ ] l "\fI value mask\fR"
522: Words starting at
523: .I dot
524: are masked with
525: .I mask
526: and compared with
527: .I value
528: until
529: a match is found.
530: If
531: .B L
532: is used then the match is for 4 bytes at a time instead of 2.
533: If no match is found then
534: .I dot
535: is unchanged; otherwise
536: .I dot
537: is set to the matched location.
538: If
539: .I mask
540: is omitted then \-1 is used.
541: .TP
542: .RB [ ?/ ] w "\fI value ...\fR"
543: Write the 2-byte
544: .I value
545: into the addressed
546: location.
547: If the command is
548: .BR W ,
549: write 4 bytes.
550: Odd addresses are not allowed when writing to the subprocess
551: address space.
552: .TP
553: [\fB?/\fR]\fBm\fI b1 e1 f1\fR[\fB?/\fR]
554: .br
555: New values for
556: .RI ( b1,\ e1,\ f1 )
557: are recorded.
558: If less than three expressions are given then
559: the remaining map parameters are left unchanged.
560: If the `?' or `/' is followed by `\*(ST' then
561: the second segment (\fIb2\fR\|,\|\fIe2\fR\|,\|\fIf2\fR)
562: of the mapping is changed.
563: If the list is terminated by `?' or `/' then the file
564: (\fIobjfil\fR or
565: .I corfil
566: respectively) is used
567: for subsequent requests.
568: (So that, for example, `/m?' will cause `/' to refer to
569: .IR objfil .)
570: .TP
571: .BI \*(GT name
572: .I Dot
573: is assigned to the variable or register named.
574: .TP
575: .B !
576: A shell is called to read the
577: rest of the line following `!'.
578: .TP
579: .RI $ modifier
580: Miscellaneous commands.
581: The available
582: .I modifiers
583: are:
584: .RS
585: .TP
586: .BI < f
587: Read commands from the file
588: .IR f .
589: If this command is executed in a file, further commands
590: in the file are not seen.
591: If
592: .I f
593: is omitted, the current input stream is terminated.
594: If a
595: .I count
596: is given, and is zero, the command will be ignored.
597: The value of the count will be placed in variable
598: .I 9
599: before the first command in
600: .I f
601: is executed.
602: .br
603: .ns
604: .TP
605: .BI << f
606: Similar to
607: .B <
608: except it can be used in a file of commands without
609: causing the file to be closed.
610: Variable
611: .I 9
612: is saved during the execution of this command, and restored
613: when it completes.
614: There is a (small) finite limit to the number of
615: .B <<
616: files that can be open at once.
617: .br
618: .ns
619: .TP
620: .BI > f
621: Append output to the file
622: .IR f ,
623: which is created if it does not exist.
624: If
625: .I f
626: is omitted, output is returned to the terminal.
627: .br
628: .ns
629: .TP
630: .B ?
631: Print process id, the signal which caused stoppage or termination,
632: as well as the registers as \fB$r\fR. This is the default if
633: \fImodifier\fR is omitted.
634: .br
635: .ns
636: .TP
637: .B r
638: Print the general registers and
639: the instruction addressed by
640: .BR pc .
641: .br
642: .ns
643: .TP
644: .B R
645: Print the general and special registers and
646: the instruction addressed by
647: .BR pc .
648: .br
649: .ns
650: .TP
651: .B b
652: Print all breakpoints
653: and their associated counts and commands.
654: .br
655: .ns
656: .TP
657: .B c
658: C stack backtrace.
659: If
660: .I address
661: is given then it is taken as the
662: address of the current frame (instead of
663: .BR fp ).
664: If
665: .B C
1.1.1.2 ! root 666: is used then the names and (32-bit) values of all automatic
1.1 root 667: and static variables are printed for each active function.
668: If
669: .I count
670: is given then only the first
671: .I count
672: frames are printed.
673: .br
674: .ns
675: .TP
676: .B d
677: Set the default radix to
678: .I address
679: and report the new value.
680: Negative value is signed, positive - unsigned. If no
681: .I address
682: is given, just print the current radix (in signed decimal).
683: Note that
684: .I address
685: is interpreted in the (old) current radix.
686: Thus \*(lq10$d\*(rq never changes the default radix.
687: To make decimal the default radix, use \*(lq0t10$d\*(rq.
688: .br
689: .ns
690: .TP
691: .B e
692: The names and values of
693: external variables are printed.
694: .br
695: .ns
696: .TP
697: .B w
698: Set the page width for output to
699: .I address
700: (default 80).
701: .br
702: .ns
703: .TP
704: .B s
705: Set the limit for symbol matches to
706: .I address
707: (default 255).
708: .br
709: .ns
710: .TP
711: .B o
712: All integers input are regarded as octal.
713: .br
714: .ns
715: .TP
716: .B d
717: Reset integer input as described in
718: .SM EXPRESSIONS.
719: .br
720: .ns
721: .TP
722: .B q
723: Exit from
724: .IR adb .
725: .br
726: .ns
727: .TP
728: .B v
729: Print all non zero variables in octal.
730: .br
731: .ns
732: .TP
733: .B m
734: Print the address map.
735: .RE
736: .TP
737: .BI : modifier
738: Manage a subprocess.
739: Available modifiers are:
740: .RS
741: .TP
742: .BI b c
743: Set breakpoint at
744: .IR address .
745: The breakpoint is executed
746: .IR count \-1
747: times before
748: causing a stop.
749: Each time the breakpoint is encountered
750: the command
751: .I c
752: is executed.
753: If this command is omitted or sets
754: .I dot
755: to zero
756: then the breakpoint causes a stop.
757: .TP
758: .B d
759: Delete breakpoint at
760: .IR address .
761: .TP
762: .B r
763: Run
764: .I objfil
765: as a subprocess.
766: If
767: .I address
768: is given explicitly then the
769: program is entered at this point; otherwise
770: the program is entered at its standard entry point.
771: .I count
772: specifies how many breakpoints are to be
773: ignored before stopping.
774: Arguments to the subprocess may be supplied on the
775: same line as the command.
776: An argument starting with < or > causes the standard
777: input or output to be established for the command.
778: All signals are turned on on entry to the subprocess.
779: .TP
780: .BI c s
781: The subprocess is continued
782: with signal
783: .I s
784: c
785: .I s,
786: see
787: .IR signal (2).
788: If
789: .I address
790: is given then the subprocess
791: is continued at this address.
792: If no signal is specified then the signal
793: that caused the subprocess to stop is sent.
794: Breakpoint skipping is the same
795: as for
796: .BR r .
797: .TP
798: .BI s s
799: As for
800: .B c
801: except that
802: the subprocess is single stepped
803: .I count
804: times.
805: If there is no current subprocess then
806: .I objfil
807: is run
808: as a subprocess as for
809: .BR r .
810: In this case no signal can be sent; the remainder of the line
811: is treated as arguments to the subprocess.
812: .TP
813: .B k
814: The current subprocess, if any, is terminated.
815: .RE
816: .SH VARIABLES
817: .I Adb
818: provides a number of variables.
819: Named variables are set initially by
820: .I adb
821: but are not used subsequently.
822: Numbered variables are reserved for communication
823: as follows.
824: .TP
825: 0
826: The last value printed.
827: .br
828: .ns
829: .TP
830: 1
831: The last offset part of an instruction source.
832: .br
833: .ns
834: .TP
835: 2
836: The previous value of variable 1.
837: .br
838: .ns
839: .TP
840: 9
841: The count on the last $< or $<< command.
842: .PP
843: On entry the following are set
844: from the system header in the
845: .IR corfil .
846: If
847: .I corfil
848: does not appear to be a
849: .B core
850: file then
851: these values are set from
852: .IR objfil .
853: .TP
854: b
855: The base address of the data segment.
856: .br
857: .ns
858: .TP
859: d
860: The data segment size.
861: .br
862: .ns
863: .TP
864: e
865: The entry point.
866: .br
867: .ns
868: .TP
869: m
870: The `magic' number (0407, 0410 or 0413).
871: .br
872: .ns
873: .TP
874: s
875: The stack segment size.
876: .br
877: .ns
878: .TP
879: t
880: The text segment size.
881: .SH ADDRESSES
882: The address in a file associated with
883: a written address is determined by a mapping
884: associated with that file.
885: Each mapping is represented by two triples
886: .RI ( "b1, e1, f1" )
887: and
888: .RI ( "b2, e2, f2" )
889: and the
890: .I file address
891: corresponding to a written
892: .I address
893: is calculated as follows.
894: .PP
895: .if t .ti 1.5i
896: .if n .ti 8
897: .IR b1 \*(LE address < e1
898: \*(IM
899: .IR "file address" = address + f1\-b1,
900: otherwise,
901: .PP
902: .if t .ti 1.5i
903: .if n .ti 8
904: .IR b2 \*(LE address < e2
905: \*(IM
906: .IR "file address" = address + f2\-b2,
907: .PP
908: otherwise, the requested
909: .I address
910: is not legal.
911: In some cases (e.g. for programs with separated I and D
912: space) the two segments for a file may overlap.
913: If a
914: .B ?
915: or
916: .B /
917: is followed by an
918: .B \*(ST
919: then only the second
920: triple is used.
921: .PP
922: The initial setting of both mappings is suitable for
923: normal
924: .B a.out
925: and
926: .B core
927: files.
928: If either file is not of the kind expected then, for that file,
929: .I b1
930: is set to 0,
931: .I e1
932: is set to
933: the maximum file size
934: and
935: .I f1
936: is set to 0; in this way the whole
937: file can be examined with no address translation.
938: .PP
939: So that
940: .I adb
941: may be used on large files
1.1.1.2 ! root 942: all appropriate values are kept as unsigned 32-bit integers.
1.1 root 943: .SH FILES
944: a.out
945: .br
946: core
947: .SH SEE\ ALSO
948: sdb(1),
949: ptrace(2),
950: a.out(5),
951: core(5)
952: .SH DIAGNOSTICS
953: `Adb' when there is no current command or format.
954: Comments about inaccessible files, syntax errors,
955: abnormal termination of commands, etc.
956: Exit status is 0, unless last command failed or
957: returned nonzero status.
958: .SH BUGS
959: Local variable addresses and names are recorded in the
960: .I a.out
961: file in a format known only to
962: .IR sdb (1).
963: .PP
964: Use of # for the unary logical negation operator is
965: peculiar.
966: .PP
967: There doesn't seem to be any way to clear all breakpoints.
968: .PP
969: The $<<f function doesn't work (and never did).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.