

SDB(I)                      12/14/76                       SDB(I)


NAME
     sdb - super debugger
SYNOPSIS
     sdb	 [ a.out [ core ] ]
DESCRIPTION
     Sdb is a general purpose debugger. It may be  ued  for  both
     post-mortem and interactive debugging of programs written in
     c, Fortran, Bliss11 and macro.  An inportant feature of  sdb
     is  that even in the interactive case no advance planning is
     necessary to use it; in particular it is  not  necessary  to
     compile  or  load  the program in any special way nor to in-
     clude any special routine in the object file.

     The first argument to sdb is an object  program,  preferably
     containing  a  symbol table; if not given ``a.out'' is used.
     The second argument is the name of a core image file; if  it
     is  not  given,  ``core'' is used. The core file need not be
     present.

     Commands to sdb consist of an address, followed by a  single
     command character, possibly followed by a one or two charac-
     ter command modifier. Usually if no  address  is  given  the
     last-printed  address is used. An address may be followed by
     a comma and a number, in which case the command  applies  to
     the appropriate number of successive addresses.

     Addresses  are  expressions  composed  of   names,   decimal
     numbers,  and  octal  numbers  (which  begin with ``0'') and
     seperated by ``+'', ``-'' and ``*''.   Evaluation  proceedes
     left-to-right.

     Names of variables are written just as they are  defined  in
     the  source program. In C programs if an external symbol (IE
     one with a ``_'' prepended to it) cannot be found;  then  an
     attempt is to find the symbol without the ``_''.

     In C variables which are local  to  a  function  (automatic,
     static, and arguments) are accessable by writing the name of
     the function, a colon ``:'', and the name of the local vari-
     able  (e.g.  ``main:argc'').   There  is  no  notion  of the
     ``current'' function; its name must always be written expli-
     citly.

     A number  which begins with a ``0'' is taken  to  be  octal;
     otherwise  numbers  are  decimal,  just as in C. There is no
     provision for the input of floating point numbers.

     The construction ``name[expression]'' assumes that name is a
     pointer  to  an integer and is equivalent to the contents of
     the named cell plus twice the expression. Notice  that  name
     has to be a genuine pointer and that arrays are not accessi-
     ble in this way. This is a  consequence  of  the  fact  that
     types  of  variables  are  not currently saved in the symbol
     table.


     The command characters are:

     /m  Print the addressed words.  m indicates the mode of  the
         printout;  specifying  a  mode sets the mode until it is
         explicitly changed again.


SDB(I)                      12/14/76                       SDB(I)


         b   byte octal
         c   character
         d   decimal
         e   single precision scientific notation (two words)
         f   single precision floating-point notation (two words)
         h   hexadecimal
         i   instruction
         io  instruction space octal
         ld  long decimal (two words)
         le  double precision scientific notation (four words)
         lf  double  precision  floating-point   notation   (four
             words)
         lo  long octal (two words)
         lh  long hexadecimal (two words)
         lr  long rad50 (two words) (not imp)
         lu  long unsigned decimal (two words) (not imp)
         o   octal
         r   rad50 (not imp)
         s   string (up to a null)
         u   unsigned decimal

     \   Print out the specified bytes in octal.

     =m  Print out the value of the given  expression.   m  indi-
         cates the mode of the printout (see above).

     '   Print the addressed bytes  as  characters.  Control  and
         non-ASCII characters are escaped in octal.

     "   take the contents of the address as a pointer to  a  se-
         quence of characters, and print out the characters up to
         a null byte.   Control  and  non-ASSCII  characters  are
         escaped in octal.

     &   Try to print the address symbolically. The typeout  con-
         tains  the  name  of an external symbol and the smallest
         possible positive offset.

     ?   Print out the last signal that the program received  and
         attempt  to  print  a  stack  trace of the terminated or
         stopped program. The last call made is listed first; the
         actual arguments to each routine are given in octal. (If
         this is inappropriate, the arguments may be examined  by
         name in the desired format using ``/''.)

     %m Print out the contents of the pdp-11 registers.  m speci-
         fies  which registers will be printed out and the method
         of printout.
         r   print out the normal registers r0-r5, sp, pc and ps.
             Print them out in octal as well as symbolically.
         e   Print out the floating point registers in  scietific
             notation.
         f   Print out the floating point registers in  floating-
             point format.

     ;m  According to m, perform one of the following functions:

         b   A breakpoint is set at the address given, or at  the
             current  location  if no address is specified. Ordi-
             narily breakpoints will be set at the  entry  points
             of  functions,  but any location is possible as long


SDB(I)                      12/14/76                       SDB(I)


             as it is the first word of an instruction.  Stopping
             at  the  actual  first  instruction of a function is
             undesirable because to make symbolic printouts work,
             the  functions register save sequence has to be com-
             pleted; therefore  sdb  automatically  moves  break-
             points  at  the start of functions down to the first
             real code.

         c   Continue execution of a  program.  This  command  is
             used  to  resume execution of a program after it has
             stopped at a breakpoint or has been running in  sin-
             gle instruction mode.

         d   Display the locations of all  currently  set  break-
             points and the continuation count if any.

         e   Force the currently traced child to exit.

         f   Print out the  header  information  for  the  symbol
             file.   If  a  core file or child process is present
             then print out the text, data and stack sizes of the
             core image.

         g   Run  the  program  being  debugged.  Following   the
             ``;g'',  arguments to the program may be given; how-
             ever they may not specify  I/O  redirection  (``>'',
             ``<'')  or filters. Breakpoints should have been set
             if any were desired. The program will  stop  if  any
             signal  is  generated,  such  as illegal instruction
             (including simulated floating point), bus error,  or
             interrupt  (see signal (II)); it will also stop when
             a breakpoint occurs and in  any  case  announce  the
             reason.  Then  a  stack  trace can be printed, named
             locations examined, etc.

         gs  This command functions exactly like the ``;g''  com-
             mand  except  that only the first instruction of the
             program is executed when control is returned to  the
             user.

         l   This command expects to be followed by  a  filename.
             It  cause  the symbols from that file to replace any
             currently loaded symbols and is useful for debugginn
             programs across an exec.

         p   Proceed from a signal. This is  used  to  force  the
             system to resume the execution of a signal which had
             been diverted to sdb.  If the program  has  signaled
             for  the  signal then the system will call that code
             otherwise the system default action will take place.

         q   Quit cdb.

         r   An address must be specified; the breakpoint at that
             address is removed.

         s   Execute a single instruction. This allows a user  to
             single  step through a program. A ``;c'' will resume
             normal execution.

         u   allow sdb to debug unix core files by performing the


SDB(I)                      12/14/76                       SDB(I)


             proper address relocation.

         z   Zip around jsr's. This command executes a subroutine
             and returns control to the user upon return from the
             subroutine. The command is used when sdb has stopped
             at a jsr instruction either via a breakpoint or from
             single stepping. When the command is given cdb  sets
             a temporary breakpoint after the jsr instruction and
             proceeds to ececute the jsr.  Control returns to the
             user  when another breakpoint is encountered, a sig-
             nal occurs or when the subroutine returns.

SEE ALSO
     cc (I), db(I), C Reference Manual, Bliss-11 Reference  Manu-
     al, Fortran Language Referance Manual
BUGS
     The local variables of the lowest routine on the call  stack
     are  not  always  properly referenced. There are a number of
     problems performing stack traces in Bliss and  Fortran  pro-
     grams.









































