Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ adb(1) — UTek 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

sdb(1)

ptrace(2)

a.out(5)

core(5)

savecore(8)



ADB(1)                  COMMAND REFERENCE                  ADB(1)



NAME
     adb - debugger

SYNOPSIS
     adb [-p prompt] [-w] [-Idir] [-k] [objfil [corfil]]

DESCRIPTION
     Adb is a general purpose debugging program.  It may be used
     to examine files and to provide a controlled environment for
     the execution of UTek programs.

     Objfil is normally an executable program file, preferably
     containing a symbol table; if not, then the symbolic
     features of adb cannot be used although the file can still
     be examined.  The default for objfil is a.out.  Corfil is
     assumed to be a core image file produced after executing
     objfil; the default for corfil is core .

     Requests to adb are read from the standard input and
     responses are to the standard output.

     Adb ignores QUIT; INTERRUPT causes return to the next adb
     command.

     In general, requests to adb are of the form:

       [address] [, count] [command] [;]

     If address is present then dot is set to address.  Initially
     dot is set to 0. For most commands count specifies how many
     times the command will be executed. The default count is 1.
     Address and count are expressions.

     The interpretation of an address depends on the context in
     which it is used. If a subprocess is being debugged, then
     addresses are interpreted in the usual way in the address
     space of the subprocess.

     Expressions

     .  The value of dot.

     +  The value of dot incremented by the current increment.

     ^  The value of dot decremented by the current increment.

     "  The last address typed.

     integer
        A number. The prefixes 0o and 0O ("zero oh") force
        interpretation in octal radix; the prefixes 0t and 0T
        force interpretation in decimal radix; the prefixes 0x



Printed 5/12/88                                                 1





ADB(1)                  COMMAND REFERENCE                  ADB(1)



        and 0X force interpretation in hexadecimal radix. Thus,
        0o20 = 0t16 = 0x10 = sixteen. If no prefix appears, then
        the default radix is used (see the $d command.) The
        default radix is initially hexadecimal.  The hexadecimal
        digits are 0123456789abcdefABCDEF with the obvious
        values. Note that a hexadecimal number whose most
        significant digit would otherwise be an alphabetic
        character must have a 0x (or 0X) prefix (or a leading
        zero if the default radix is hexadecimal).

     integer.[fraction][{e|E}exponent]
        A floating point number, generaly 32 bits. The radix must
        be set to decimal. See the section on Floating Point
        Numbers in this document.

     'cccc'
        The ASCII value of up to four characters.  The backslash
        character ( \ ) may be used to escape an apostrophe
        character ( ' ).

     < name
        The value of name, which is either a variable name, a
        register name or a pseudo-register name.  Adb maintains a
        number of variables named by single letters or digits.
        (See the section Variables in this document.) If name is
        a register name then the value of the register is
        obtained from the system header in corfil.  The register
        names are those printed by the $r command.  Accessing a
        floating point register will return the 32 bits of a
        single and set the floating point pseudo-registers.
        Pseudo-registers are covered under the section Floating
        Point Numbers.

     symbol
        A symbol is a sequence of uppercase or lowercase letters,
        underscores or digits, not starting with a digit. The
        backslash ( \ ) may be used to escape other characters.
        The value of symbol is taken from the symbol table in
        objfil.  An initial underscore character
        ( _ ) will be prepended to symbol if needed.

     _ symbol
        In C, the true name of an external symbol begins with an
        underscore ( _ ). It may be necessary to utter this name
        to distinguish it from internal or hidden variables of a
        program.

     routine.name
        The address of the variable name in the specified C
        routine. Both routine and name are symbols.  If name is
        omitted the value is the address of the most recently
        activated C stack frame corresponding to routine.



Printed 5/12/88                                                 2





ADB(1)                  COMMAND REFERENCE                  ADB(1)



     (exp)
        The value of the expression exp.

     Monadic Operators

     *exp   The contents of the location addressed by exp in
            corfil.  This can also be used to accessed floating
            point numbers.  See Floating Point Numbers in this
            document.

     @exp   The contents of the location addressed by exp in
            objfil.  This can also be used to accessed floating
            point numbers.  See Floating Point Numbers in this
            document.

     -exp   Integer negation.

     ~exp   Bitwise complement.

     #exp   Logical negation.

     Dyadic Operators

     These are left associative and are less binding than monadic
     operators.

     e1+e2  Integer addition.

     e1-e2  Integer subtraction.

     e1*e2  Integer multiplication.

     e1%e2  Integer division.

     e1&e2  Bitwise conjunction.

     e1|e2  Bitwise disjunction.

     e1#e2  E1 rounded up to the next multiple of e2.

     Commands

     Most commands consist of a verb followed by a modifier or
     list of modifiers.  The following verbs are available (the
     commands ? and / may be followed by *; see the section
     Addresses for further details):

     ?f Locations starting at address in objfil are printed
        according to the format f.  Dot is incremented by the sum
        of the increments for each format letter (q.v.).

     /f Locations starting at address in corfil are printed



Printed 5/12/88                                                 3





ADB(1)                  COMMAND REFERENCE                  ADB(1)



        according to the format f and dot is incremented as for ?
        (question mark).

     =f The value of address itself is printed in the styles
        indicated by the format f.  (For i format, ? is printed
        for the parts of the instruction that reference
        subsequent words.)

     A format consists of one or more characters that specify a
     style of printing.  Each format character may be preceded by
     a decimal integer that is a repeat count for the format
     character.  While stepping through, a format dot is
     incremented by the amount given for each format letter.  If
     no format is given then the last format is used.  The format
     letters available are as follows:

     o 2  Print two bytes in octal. All octal numbers output by
          adb are preceded by 0.

     O 4  Print four bytes in octal.

     q 2  Print in signed octal.

     Q 4  Print long signed octal.

     d 2  Print in decimal.

     D 4  Print long decimal.

     x 2  Print two bytes in hexadecimal.

     X 4  Print four bytes in hexadecimal.

     u 2  Print as an unsigned decimal number.

     U 4  Print long unsigned decimal.

     f 4  Print the 32 bit value as a floating point number.  See
          the section Floating Point Numbers.

     F 8  Print the double floating point value contained in the
          pseudo-registers d_h and d_l. See the section Floating
          Point Numbers.

     g 4  Print the contents of the pseudo-registers x_h, x_m,
          and x_l.  See the section Floating Point Numbers.

     G 8  Print extended floating point value contained in the
          pseudo-registers x_h, x_m, and x_l.  See the section
          Floating Point Numbers.

     b 1  Print the addressed byte in octal.



Printed 5/12/88                                                 4





ADB(1)                  COMMAND REFERENCE                  ADB(1)



     c 1  Print the addressed character.

     C 1  Print the addressed character using the standard escape
          convention where control characters are printed as
          <CTRL-X> and the delete character is printed as <CTRL-
          ?>

     s n  Print the addressed characters until a zero character
          is reached.

     S n  Print a string using the <CTRL-X> escape convention
          (see the section describing the format letter C).  The
          n is the length of the string including its zero
          terminator.

     Y 4  Print four bytes in date format. See ctime(3c).

     i n  Print as machine instructions.  The n is the number of
          bytes occupied by the instruction.  This style of
          printing sets variable 1 to the offset parts of the
          source and sets variable 2 to the offset parts of the
          destination.

     a 0  Print the value of dot in symbolic form.  Symbols are
          checked to ensure that they have an appropriate type as
          indicated:

             / Local or global data symbol.
             ? Local or global text symbol.
             = Local or global absolute symbol.

     p 4  Print the addressed value in symbolic form using the
          same rules for symbol lookup
          as a.

     t 0  When preceded by an integer, tab to the next
          appropriate tab stop.  For example, 8t moves to the
          next eight-space tab stop.

     r 0  Print a space.

     n 0  Print a newline.

     "..." 0
          Print the enclosed string.

     ^    Dot is decremented by the current increment. Nothing is
          printed.

     +    Dot is incremented by 1. Nothing is printed.

     -    Dot is decremented by 1. Nothing is printed.



Printed 5/12/88                                                 5





ADB(1)                  COMMAND REFERENCE                  ADB(1)



     newline
        Repeat the previous command with a count of 1.

     [?/]l value [mask]
        Words starting at dot are masked with mask and compared
        with value until a match is found.  If L is used then the
        match is for four bytes at a time instead of two.  If no
        match is found then dot is unchanged; otherwise, dot is
        set to the matched location.  If mask is omitted then -1
        is used.

     [?/]w value ...
        Write the two-byte value into the addressed location. If
        the command is W, write four bytes.  Odd addresses are
        not allowed when writing to the subprocess address space.

     [?/]m b1 e1 f1[?/]
        New values for (b1, e1, f1) are recorded. If less than
        three expressions are given, then the remaining map
        parameters are left unchanged.  If the ? or / is followed
        by *, then the second segment (b2,e2,f2) of the mapping
        is changed.  If the list is terminated by ? or / then the
        file (objfil or corfil respectively) is used for
        subsequent requests.  For example, /m? causes / to refer
        to objfil.

     >name
        Dot is assigned to the variable, register, or pseudo-
        register named.  The only pseudo-register allowed is iat.
        If name is a floating point register, the extended
        floating point value in the pseudo-registers x_h, x_m,
        and x_l are moved to that register.  See the section
        Floating Point Numbers.

     !  A shell ( /bin/sh ) is called to read the rest of the
        line following the exclamation point (!).

     $modifier
        Miscellaneous commands. The available modifiers are:

        <f  Read commands from the file f.  If this command is
            executed in a file, further commands in the file are
            not seen.  If f is omitted, the current input stream
            is terminated. If a count is given, and is zero, the
            command is ignored.  The value of the count is placed
            in variable 9 before the first command in f is
            executed.

        <<f Similar to < except it can be used in a file of
            commands without closing the file. Variable 9 is
            saved during the execution of this command, and
            restored when it completes. There is a (small) finite



Printed 5/12/88                                                 6





ADB(1)                  COMMAND REFERENCE                  ADB(1)



            limit to the number of << files that can be open at
            once.

        >f  Append output to the file f, which is created if it
            does not exist. If f is omitted, output is returned
            to the terminal.

        ?   Print process ID, the signal which causes stoppage or
            termination, as well as the registers (such as) $r;
            this is the default if modifier is omitted.

        r   Print the general registers and the instruction
            addressed by pc.  Dot is set to pc.

        b   Print all breakpoints and their associated counts and
            commands.

        c   C stack backtrace. If address is given it is taken as
            the address of the current frame instead of the
            contents of the frame-pointer register.  If count is
            given, only the first count frames are printed.

        d   Set the default radix to address and report the new
            value. Note that address is interpreted in the (old)
            current radix.  Thus 10$d never changes the default
            radix.  To make decimal the default radix, use
            0t10$d.

        e   The names and values of external variables are
            printed.

        w   Set the page width for output to address (default
            80).

        s   Set the limit for symbol matches to address (default
            255).

        o   All integers input are regarded as octal.

        q   Exit from adb.

        v   Print all nonzero variables in the current radix.

        m   Print the address map.

        t   Toggle the virtual to physical trace output.  Only
            useful if -k command line option is also specified.

     :modifier
        Manage a subprocess. Available modifiers are:

        bc  Set breakpoint at address.  The breakpoint is



Printed 5/12/88                                                 7





ADB(1)                  COMMAND REFERENCE                  ADB(1)



            executed count -1 times before causing a stop.  Each
            time the breakpoint is encountered, the command c is
            executed. If this command is omitted or sets dot to
            zero, then breakpoint causes a stop.

        d   Delete breakpoint at address.

        D   Delete all breakpoints.

        r   Run objfil as a subprocess. If address is given
            explicitly the program is entered at this point;
            otherwise the program is entered at its standard
            entry point.  Count specifies how many breakpoints
            are to be ignored before stopping.  Arguments to the
            subprocess may be supplied on the same line as the
            command.  An argument starting with < or >
            establishes the standard input or output for the
            command.

        ic  Set or clear special signal handling.  Take address
            as the signal number (see the command sigvec(2) ),
            and set (if c is one) or clear (if c is zero) special
            signal handling for all signals with that number.  If
            special signal handling is set for a given signal
            number, any signal with a matching number is not
            trapped by adb , but sent immediately to the sub-
            process.  If special signal handling is not set for a
            given signal number, adb will halt on receipt of a
            signal with that number.  The default for special
            signal handling for all signals is the cleared state.
            This command is required by programs which make heavy
            use of signals as real-time events (such as up and
            down clicks of a mouse key).  Since signals are not
            queued by the operating system, if a subprocess is
            halted by reception of a signal, all signals of that
            number which are sent to the subprocess before it is
            continued would not be detected.  To avoid this, if,
            for example, the subprocess expects to receive SIGEMT
            (signal number 7) signals for each click (both up and
            down) of a mouse key, the command 7:i1 would set
            special signal handling for all SIGEMT signals, and
            all such signals would immediately be forwarded to
            the subprocess.

        cs  The subprocess is continued with signal s (see the
            command sigvec(2) ).  If address is given, the
            subprocess is continued at this address.  If no
            signal is specified, the signal that stopped the
            subprocess is sent. Breakpoint skipping is the same
            as
            for r.




Printed 5/12/88                                                 8





ADB(1)                  COMMAND REFERENCE                  ADB(1)



        ss  Same as for c except that the subprocess is single-
            stepped, count times. If there is no current
            subprocess, objfil is run as a subprocess as for r.
            In this case no signal can be sent; the remainder of
            the line is treated as arguments to the subprocess.

        Ss  Same as for s, except that if the instruction to be
            stepped is a call to a subroutine, the entire
            subroutine is executed.

        k   The current subprocess, if any, is terminated.

     Addresses

     The address in a file, associated with a written address, is
     determined by a mapping associated with that file.  Each
     mapping is represented by two triples: (b1, e1, f1) and (b2,
     e2, f2); the filename address corresponding to a written
     address is calculated as follows:

          b1 < address < e1
             => filename address = address + f1-b1,

     or

          b2 < address < e2
             => filename address = address + f2-b2

     If not in this form, the requested address is not legal. In
     some cases, such as for programs with separated I and D
     space, the two segments for a file may overlap. If a ? or /
     is followed by an * then only the second triple is used.

     The initial setting of both mappings is suitable for normal
     a.out and core files. If either file is not of the kind
     expected, then, for that file, b1 is set to 0, e1 is set to
     the maximum file size, and f1 is set to 0; in this way the
     whole file can be examined with no address translation.

     Variables

     Adb provides a number of variables.  Named variables are set
     initially by adb but are not used subsequently.  Numbered
     variables are reserved for communication as follows:

     0  The last value printed.

     1  The last offset part of an instruction source.

     2  The previous value of variable 1.

     9  The count on the last $< or $<< command.



Printed 5/12/88                                                 9





ADB(1)                  COMMAND REFERENCE                  ADB(1)



     On entry, the following are set from the system header in
     the corfil (if corfil does not appear to be a core file
     these values are set from objfil):

     b  The base address of the data segment.

     d  The data segment size.

     e  The entry point.

     m  The magic number (0407, 0410 or 0413).

     s  The stack segment size.

     t  The text segment size.

     Floating Point Numbers

     Adb provides support for three types of floating point
     numbers: single (32 bits), double (64 bits), and extended
     (80 bits, stored and accessed and 96 bits).  Singles are
     treated just like any other 32 bit object.  Doubles and
     extendeds, however, require the use of special read-only
     "pseudo-registers", two to hold a double and three to hold
     an extended. The registers d_h and d_l hold the high-order
     and low-order 32-bits of a double. The registers x_h, x_m,
     and x_l hold the high, middle, and low parts of an extended.

     These registers can be loaded with values in three different
     ways: via a constant entered by the user in the address
     portion of a command, via an indirect reverence, or by
     accessing a floating point register with the < operator. In
     all three cases, the same value is loaded into both sets of
     registers.  When this is not possible, note will be made of
     that fact in yet another pseudo-register.

     When a constant is used, the input radix should normally be
     decimal and the floating point format previously described
     would be used.  The only restriction is that the integer
     part of the number must fit in a 32 bit integer.

     If the constant is entered in hexadecimal or octal, the
     number of bits entered determines how the constant is
     handled.  If 32 bits or less, the constant is taken as a
     single and is converted to a double and an extended.  If 64
     bits or less, the constant is taken as a double and is
     converted to a single (if possible) and an extended.  If
     more than 64 bits are entered, the constant is taken as an
     extended and is converted to a double and single.  If the
     constant is entered in any other radix, it is converted to a
     32 bit object in the normal way.  That 32 bit object is then
     taken as a single and converted to a double and an extended.



Printed 5/12/88                                                10





ADB(1)                  COMMAND REFERENCE                  ADB(1)



     The second way to load the floating point pseudo-registers
     is by using the indirect operators * and @.  Normally these
     operators will access a 32 bit object, in which case the
     object is treated as a single and converted to a double and
     an extended.  But if the read-write pseudo-register iat has
     been set to 1, a double is accessed. The double is then
     converted to a single and an extended. If iat has the value
     2, an extended is accessed, and it is converted to a single
     and a double.  In any case, the "value" of the operation is
     the 32 bits of the single and iat is reset to a value of 0,
     indicating a normal 32 bit access.

     The third way to load the floating point pseudo-register is
     by accessing one of the hardware floating point registers
     using the < operator as described under the section
     Expressions.

     For each type of floating point number (single, double or
     extended), there is a pseudo-register ( s_c, d_c, and x_c
     respectively), that contains an integer specifying the class
     of the floating point number:

     -1 Could not form a floating point number.

     0  A normal floating point number.

     1  A denormalized floating point number.

     2  A NAN.

     3  A signaling NAN.

     4  A positive infinity.

     5  A negative infinity.

     6  A positive zero.

     7  A negative zero.

OPTIONS
     -p Makes adb interpret the string following -p as the prompt
        to use when it is ready to accept commands from your
        terminal.

     -w Both objfil and corfil are created if necessary and
        opened for reading and writing so that files can be
        modified using adb.

     -I Specifies a directory where files read with $< or $<<
        will be sought; the default is /usr/lib/adb.




Printed 5/12/88                                                11





ADB(1)                  COMMAND REFERENCE                  ADB(1)



     -k Specifies that corfil represents physical memory of a
        UTek kernel: either /dev/mem or the vmcore.? file
        generated by savecore(8).  Enables virtual-to-physical
        address translation when looking in corfil .

FILES
     a.out
          Default binary filename

     core Default core image filename

DIAGNOSTICS
     adb  This is given when there is no current command or
          format.

     This command comments about inaccessible files, syntax
     errors, abnormal termination of commands, and so forth.

     Exit status is 0, unless the last command failed or returned
     nonzero status.

CAVEATS
     Since no shell is invoked to interpret the arguments of the
     :r command, the customary wild-card and variable expansions
     cannot occur.

SEE ALSO
     cc(1), sdb(1), ptrace(2), a.out(5), core(5), and
     savecore(8).


























Printed 5/12/88                                                12





































































%%index%%
na:216,66;
sy:282,299;
de:581,2326;3195,2908;6391,2294;8973,2208;11469,2017;13774,2824;16886,2184;19358,2966;22612,2388;25288,2713;28289,1462;
op:29751,653;30692,323;
fi:31015,157;
di:31172,441;
ca:31613,230;
se:31843,240;
%%index%%000000000256

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026