Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sdb(1) — UTek W2.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

adb(1)

sh(1sh)



SDB(1)                  COMMAND REFERENCE                  SDB(1)



NAME
     sdb - symbolic debugger

SYNOPSIS
     sdb [ objfil [ corfil [ directory ] ] ]

DESCRIPTION
     Sdb is a symbolic debugger which can be used with C, PASCAL,
     and F77 programs.  It may be used to examine their files and
     to provide a controlled environment for their execution.

     Objfil is an executable program file which has been compiled
     with the -go (debug) on the C and F77 compilers or the -g
     (debug) option on the Pascal compiler.  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. If objfil and
     corfil are both present, then directory may be used to
     specify the directory containing the source files for objfil
     . Otherwise the source files are assumed to be in the
     current directory.

     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 or stopped.
     Otherwise, they are set to the first line in main.  The
     current line and file may be changed with the source file
     examination commands.

     Names of variables are written just as they are in C,
     PASCAL, or F77.  Note that the F77 compiler converts names
     to lower case.  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].
     Combinations of these forms may also be used.

     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
     filename:number or procedure:number.  In either case the
     number is relative to the beginning of the file.  If no
     procedure or filename 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.




Printed 10/17/86                                                1





SDB(1)                  COMMAND REFERENCE                  SDB(1)



     COMMANDS:

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

     T   Print the top line of the stack trace.

     variable/lm
         Print the value of variable according to length l and
         format m. If l and m are omitted, sdb chooses a length
         and format suitable for the variable's type as declared
         in the program.  The length specifiers are:

         b   one byte
         h   two bytes (half word)
         l   four bytes (long word)
         number
             string length for formats s and a

     Legal values for
         m are:

         c   character
         d   decimal
         u   decimal, unsigned
         o   octal
         x   hexadecimal
         f   32 bit single precision floating point
         g   64 bit double precision floating point
         i   machine instruction with symbolic information
             (constant address only)
         I   machine instruction without symbolic information
             (constant address only)
         s   Assume variable is a string pointer and print
             characters until a null is reached.
         a   Print characters starting at the variable's address
             until a null is reached.
         p   pointer to procedure

     The length specifiers are only effective with the formats d,
     u, o and x.  If one of these formats is specified and l is
     omitted, the length defaults to the word length of the host
     machine.  The last variable may be redisplayed with the
     command  dot-slash (./).  <CTRL-D> will display the next 10
     addresses following the address of the last variable
     displayed.  This option is useful for dumping arrays and
     stacks.

     Registers may also be dislayed by placing the register name
     followed by a % in place of variable.





Printed 10/17/86                                                2





SDB(1)                  COMMAND REFERENCE                  SDB(1)



     The sh(1sh) metacharacters * and ? may be used within
     procedure and variable names, providing a limited form of
     pattern matching.  If no procedure name is given, both
     variables local to the current procedure and global (common
     for F77) variables are matched, while if a procedure name is
     specified then only variables local to that procedure and
     matched.  To match only global variables (or blank common
     for F77), the form :pattern is used.  The name of a common
     block may be specified instead of a procedure name for F77
     programs.

     variable=lm
     linenumber=lm
     number=lm
     procedure:=lm
         Print the address of the variable,procedure or line
         number, or the value of the number in the specified
         format.  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.  If
         the variable is of type register the register number
         will be printed.

     variable!value
         Set the variable to the given value.  The value may be a
         number, character constant, or a variable.  If the
         variable is of type float or double, the value may also
         be a floating constant.

     linenumber?
         Disassemble the first machine instruction associated
         with linenumber.  <CTRL-D> will disassemble the next 10
         instructions following the last one disassembled.


     COMMANDS FOR EXAMINING SOURCE FILES:

     eprocedure
     efilename.c
         Set the current file to the file containing the named
         procedure or the filename.  Set the current line to the
         first line in the named procedure or file.  All source
         files are assumed to be in directory. The default for
         directory is the working directory.  If no procedure or
         filename is given, the current procedure and filenames
         are reported.

     /regular expression/
         Search forward from the current line for a line
         containing a string matching the regular expression as
         in ed(1).  The trailing slash (/) may be elided.




Printed 10/17/86                                                3





SDB(1)                  COMMAND REFERENCE                  SDB(1)



     ?regular expression?
         Search backward from the current line for a line
         containing a string matching the regular expression as
         in ed(1).  The trailing ? may be elided.

     p   Print the current line.

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

     <CTRL-D>
         Scroll.  Print the next 10 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 linenumber.  Print the
         new current line.

     count +
         Advance the current line by count lines.  Print the new
         current line.

     count -
         Retreat the current line by count lines.  Print the new
         current line.


     COMMANDS FOR CONTROLLLING THE  EXECUTION OF THE SOURCE
     PROGRAM:

     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, it specifies the number of breakpoints to be
         ignored.  C continues with the signal which caused the
         program to stop and c ignores it.
         If a linenumber is specified then a temporary breakpoint
         is placed at the line and execution is continued.  The
         breakpoint is deleted when the command finishes.




Printed 10/17/86                                                4





SDB(1)                  COMMAND REFERENCE                  SDB(1)



     count s
         Single step.  Run the program through count lines.  If
         no count is given then the program is run for one line.

     count S
         Single step, but step through subroutine calls.

     count i
     count I
         Single step machine instruction.  Run the program
         through count machine instructions.  If no count is
         given then the program is run for one instruction.  I
         reactivates the signal the program is stopped with and i
         ignores it.

     k   Kill the debugged program.

     procedure(arg1,arg2,...)
     procedure(arg1,arg2,...)/m
         Execute the named procedure with the given arguments.
         Arguments can be integer, character or string constants
         or names of variables accessible from the current
         procedure.  The second form causes the value returned by
         the procedure to be printed according to format m.  If
         no format is given, it defaults to d.

     linenumber b commands
         Set a breakpoint at the given line.  If a procedure name
         without a linenumber is given (for example, proc:), a
         breakpoint is placed at the first line in the procedure
         even if it was not compiled with the debug flag.  If no
         linenumber is given, a breakpoint is placed at the
         current line.
         If no commands are given then 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.

     constant #
         (Pound sign) Set memory breakpoint at address and break
         if the memory read/write has occured. Constant is an
         integer constant representing an address. If r appears
         after the #, as in #r, then the memory breakpoint is set
         at the address specified and the break occurs on a
         memory read. If w appears after the #, then the memory
         breakpoint is set at the address and the break occurs on
         a memory write. If d appears after the # then the
         breakpoint (specified by address) is deleted.

     linenumber d



Printed 10/17/86                                                5





SDB(1)                  COMMAND REFERENCE                  SDB(1)



         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.

     B   Print a list of the currently active breakpoints.

     D   Delete all breakpoints.

     l   Print the last executed line.

     linenumber a
         Announce.  If linenumber is of the form proc:number, the
         command effectively does a linenumber b l.  If
         linenumber is of the form proc:, the command effectively
         does a proc: b T.


     MISCELLANEOUS COMMANDS:

     variable$ m
         Single step until variable changes. Variable can be in
         any specified active procedure. This will not work with
         register variables.  It is also very, very slow.

     v   Toggle verbose mode. This causes the machine
         instructions to be printed as they are executed when
         single stepping with s or S.

     n   Toggle National-32000/Compiler disassembler format. This
         causes the assembler code to be displayed in National-
         32000 format (default) or Compiler format.

     x   Display contents of all machine registers.

     X   Display current value of pc and disassemble current
         instruction.

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

     <newline>
         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 core
         location then display the next core location.

     " string
         Print the given string.

     q   Exit the debugger.



Printed 10/17/86                                                6





SDB(1)                  COMMAND REFERENCE                  SDB(1)



     The following commands also exist and are intended only for
     debugging the debugger:

     V   Print the version number.

     Q   Print a list of procedures and files being debugged.

     Y   Toggle debug output.

     M   Print locations of text and data segments in object and
         core files.

FILES
     a.out                    Default binary file

     core                     Default core image file

DIAGNOSTICS
     Error reports are either identical to those of adb(1) or are
     self-explanatory.

CAVEATS
     If a procedure is called when the program is not stopped at
     a breakpoint (such as when a core image is being debugged),
     all variables are initialized before the procedure is
     started.  This makes it impossible to use a procedure which
     formats data from a core image.

     Arrays must be of one dimension and of zero origin to be
     correctly addressed by sdb.

     The default type for printing F77 parameters is incorrect.
     Their address is printed instead of their value.

     Tracebacks containing F77 subprograms with multiple entry
     points may print too many arguments in the wrong order, but
     their values are correct.

     Sdb understands Pascal, but not its types.

     If your C program has two structures with elements that have
     the same name but different types or offsets, sdb will be
     unable to distinguish which element belongs to which
     structure.

SEE ALSO
     adb(1), sh(1sh).








Printed 10/17/86                                                7





































































%%index%%
na:72,59;
sy:131,163;
de:294,2789;3227,2106;5477,2766;8387,2445;10976,2805;13925,2251;16320,356;
fi:16676,158;
di:16834,176;
ca:17010,1030;
se:18040,96;
%%index%%000000000186

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