Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sdb(1) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                   sdb(1)



        _________________________________________________________________
        sdb                                                       Command
        symbolic debugger
        _________________________________________________________________


        SYNTAX

        sdb [objfil [corfil [directory-list]]]


        DESCRIPTION

        The sdb command calls a symbolic debugger that can be used with C
        and F77 programs.  It may be used to examine their object files
        and core files and to provide a controlled environment for their
        execution.

        Objfil is an executable program file which has been compiled with
        the -g (debug) option.  If it has not been compiled with the -g
        option the symbolic capabilities of sdb will be limited, but the
        file can still be examined and the program debugged.  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.
        The core file need not be present.  A - in place of corfil will
        force sdb to ignore any core image file.  The colon separated
        list of directories (directory-list) is used to locate the source
        files used to build objfil.

        It is useful to know that at any time there is a current line and
        current file.  If corfil exists then they are initially set to
        the line and file containing the source statement at which the
        process terminated.  Otherwise, they are set to the first line in
        main().  The current line and file may be changed with the source
        file examination commands.

        By default, warnings are provided if the source files used in
        producing objfil cannot be found, or are newer than objfil.

        Names of variables are written just as they are in C or F77.  sdb
        does not truncate names.  Variables local to a procedure may be
        accessed using the form procedure:variable.  If no procedure name
        is given, the procedure containing the current line is used by
        default.

        It is also possible to refer to structure members as
        variable.member, pointers to structure members as variable ->
        member and array elements as variable[number].  Pointers may be
        dereferenced by using the form pointer[0].  Combinations of these
        forms may also be used.  F77 common variables may be referenced
        by using the name of the common block instead of the structure



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                   sdb(1)



        name.  Blank common variables may be named by the form .variable.
        A number may be used in place of a structure variable name, in
        which case the number is viewed as the address of the structure,
        and the template used for the structure is that of the last
        structure referenced by sdb. An unqualified structure variable
        may also be used with various commands.  Generally, sdb will
        interpret a structure as a set of variables.  Thus, sdb will
        display the values of all the elements of a structure when it is
        requested to display a structure.  An exception to this
        interpretation occurs when displaying variable addresses.  An
        entire structure does have an address, and it is this value sdb
        displays, not the addresses of individual elements.

        Elements of a multidimensional array may be referenced as
        variable [number][number]..., or as variable [number,number,...].
        In place of number, the form number;number may be used to
        indicate a range of values, * may be used to indicate all
        legitimate values for that subscript, or subscripts may be
        omitted entirely if they are the last subscripts and the full
        range of values is desired.  As with structures, sdb displays all
        the values of an array or of the section of an array if trailing
        subscripts are omitted.  It displays only the address of the
        array itself or of the section specified by the user if
        subscripts are omitted.  A multidimensional parameter in an F77
        program cannot be displayed as an array, but it is actually a
        pointer, whose value is the location of the array.  The array
        itself can be accessed symbolically from the calling function.

        A particular instance of a variable on the stack may be
        referenced by using the form procedure:variable,number. All the
        variations mentioned in naming variables may be used.  Number is
        the occurrence of the specified procedure on the stack, counting
        the top, or most current, as the first.  If no procedure is
        specified, the procedure currently executing is used by default.

        It is also possible to specify a variable by its address.  All
        forms of integer constants which are valid in C may be used, so
        that addresses may be input in decimal, octal or hexadecimal.

        Line numbers in the source program are referred to as file-
        name:number or procedure:number. In either case the number is
        relative to the beginning of the file.  If no procedure or file
        name is given, the current file is used by default.  If no number
        is given, the first line of the named procedure or file is used.

        While a process is running under sdb, all addresses refer to the
        executing program; otherwise they refer to objfil or corfil.


           Commands




        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                   sdb(1)



        The commands for examining data in the program are:

        t    Print a stack trace of the terminated or halted program.

        T    Print the top line of the stack trace.

        variable/clm
             Print the value of variable according to length l and format
             m.  A numeric count c indicates that a region of memory,
             beginning at the address implied by variable, is to be
             displayed.  The length specifiers are:
                  b    one byte
                  h    two bytes (half word)
                  l    four bytes (long word)

             Legal values for m are:
                  c    character
                  d    decimal
                  u    decimal, unsigned
                  o    octal
                  x    hexadecimal
                  s    Assume variable is a string pointer and print
                       characters starting at the address pointed to by
                       the variable.
                  a    Print characters starting at the variable's
                       address.  This format may not be used with
                       register variables.
                  p    pointer to procedure
                  i    disassemble machine-language instruction with
                       addresses printed numerically and symbolically.

             Length specifiers are only effective with the c, d, u, o and
             x formats.  Any of the specifiers, c, l, and m, may be
             omitted.  If all are omitted, sdb chooses a length and a
             format suitable for the variable's type as declared in the
             program.  If m is specified, then this format is used for
             displaying the variable.  A length specifier determines the
             output length of the value to be displayed, sometimes
             resulting in truncation.  A count specifier c tells sdb to
             display that many units of memory, beginning at the address
             of variable.  The number of bytes in one such unit of memory
             is determined by the length specifier l, or if no length is
             given, by the size associated with the variable.  If a count
             specifier is used for the s or a command, then that many
             characters are printed.  Otherwise successive characters are
             printed until either a null byte is reached or 128
             characters are printed.  The last variable may be
             redisplayed with the command ./.

        linenumber?lm
        variable:?lm



        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)





                                                                   sdb(1)



             Print the value at the address from a.out or I space given
             by linenumber or variable (procedure name), according to the
             format lm.  The default format form is `i'.

        variable=lm
        linenumber=lm
        number=lm
             Print the address of variable or linenumber, or the value of
             number, in the format specified by lm.  If no format is
             given, then lx is used.  The last variant of this command
             provides a convenient way to convert between decimal, octal
             and hexadecimal.

        variable!value
             Set variable to the given value.  The value may be a number,
             a character constant or a variable.  The value must be well
             defined; expressions which produce more than one value, such
             as structures, are not allowed.  Character constants are
             denoted 'character.  Numbers are viewed as integers unless a
             decimal point or exponent is used.  In this case, they are
             treated as having the type double.  Registers are viewed as
             integers.  The variable may be an expression which indicates
             more than one variable, such as an array or structure name.
             If the address of a variable is given, it is regarded as the
             address of a variable of type int.  C conventions are used
             in any type conversions necessary to perform the indicated
             assignment.

        x    Print the machine registers and the current machine-language
             instruction.

        The commands for examining source files are:

        e procedure
        e file-name
        e directory/
        e directory file-name
             The first two forms set the current file to the file
             containing procedure or to file-name.  The current line is
             set to the first line in the named procedure or file.
             Source files are assumed to be in directory.  The default is
             the current working directory.  The latter two forms change
             the value of directory.  If no procedure, file name, or
             directory is given, the current procedure name and file name
             are reported.

        /regular expression/
             Search forward from the current line for a line containing a
             string matching regular expression as in ed(1).  The
             trailing / may be deleted.  A / that is part of the regular
             expression must be escaped with a backslash.



        DG/UX 4.00                                                 Page 4
               Licensed material--property of copyright holder(s)





                                                                   sdb(1)



        ?regular expression?
             Search backward from the current line for a line containing
             a string matching regular expression as in ed(1).  The
             trailing ? may be deleted.  A ? that is part of the regular
             expression must be escaped with a backslash.

        p    Print the current line.
              .TP 5 z Print the current line followed by the next 9
             lines.  Set the current line to the last line printed.

        w    Window.  Print the 10 lines around the current line.

        number
             Set the current line to the given line number.  Print the
             new current line.

        The commands for controlling the execution of the source program
        are:

        count r args
        count R
             Run the program with the given arguments.  The r command
             with no arguments reuses the previous arguments to the
             program while the R command runs the program with no
             arguments.  An argument beginning with < or > causes
             redirection for the standard input or output, respectively.
             If count is given, it specifies the number of breakpoints to
             be ignored.

        linenumber c count
        linenumber C count
             Continue after a breakpoint or interrupt.  If count is
             given, the program will stop when count breakpoints have
             been encountered.  The signal which caused the program to
             stop is reactivated with the C command and ignored with the
             c command.  If a line number is specified then a temporary
             breakpoint is placed at the line and execution is continued.
             The breakpoint is deleted when the command finishes.

        linenumber g count
             Continue after a breakpoint with execution resumed at the
             given line.  If count is given, it specifies the number of
             breakpoints to be ignored.

        s count
        S count
             Single step the program through count lines.  If no count is
             given then the program is run for one line.  S is equivalent
             to s except it steps through procedure calls.

        i



        DG/UX 4.00                                                 Page 5
               Licensed material--property of copyright holder(s)





                                                                   sdb(1)



        I    Single step by one machine-language instruction.  The signal
             which caused the program to stop is reactivated with the I
             command and ignored with the i command.

        k    Kill the program being debugged.

        linenumber b commands
             Set a breakpoint at the given line.  If a procedure name
             without a line number is given (e.g., ``proc:''), a
             breakpoint is placed at the first line in the procedure even
             if it was not compiled with the -g option.  If no linenumber
             is given, a breakpoint is placed at the current line.  If no
             commands are given, execution stops just before the
             breakpoint and control is returned to sdb.  Otherwise the
             commands are executed when the breakpoint is encountered and
             execution continues.  Multiple commands are specified by
             separating them with semicolons; a semicolon within a
             command must be escaped with a backslash.  If k is used as a
             command to execute at a breakpoint, control returns to sdb,
             instead of continuing execution.

        B    Print a list of the currently active breakpoints.

        linenumber d
             Delete a breakpoint at the given line.  If no linenumber is
             given then the breakpoints are deleted interactively.  Each
             breakpoint location is printed and a line is read from the
             standard input.  If the line begins with a y or d then the
             breakpoint is deleted.

        D    Delete all breakpoints.

        l    Print the last executed line.

        Miscellaneous commands:

        !command
             The command is interpreted by sh(1).

        new-line
             If the previous command printed a source line, then advance
             the current line by one line and print the new current line.
             If the previous command displayed a memory location, then
             display the next memory location.

        end-of-file character
             Scroll.  Print the next 10 lines of instructions, source or
             data depending on which was printed last.  The end-of-file
             character is usually control-D.

        < filename



        DG/UX 4.00                                                 Page 6
               Licensed material--property of copyright holder(s)





                                                                   sdb(1)



             Read commands from filename until the end of file is
             reached, and then continue to accept commands from standard
             input.  When sdb is told to display a variable by a command
             in such a file, the variable name is displayed along with
             the value.  This command may not be nested; < may not appear
             as a command in a file.

        " string
             Print the given string.  The C escape sequences of the form
             \character are recognized, where character is a nonnumeric
             character.

        q    Exit the debugger.


        FILES

        a.out
        core


        SEE ALSO

        cc(1), a.out(4), core(4), syms(4).
        sh(1) in the User's Reference for the DG/UX System


        WARNINGS

        When sdb prints the value of an external variable for which there
        is no debugging information, a warning is printed before the
        value.  The size is assumed to be int (integer).

        Data which are stored in text sections are indistinguishable from
        functions.

        Line number information in optimized functions is unreliable, and
        some information may be missing.
















        DG/UX 4.00                                                 Page 7
               Licensed material--property of copyright holder(s)



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