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