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