Oberon || Compiler & Tools || Library || Module Index || Search Engine


Ulm's Oberon System:
odb


NAME

odb - Oberon debugger

SYNOPSIS

odb [a.out [core]]

DESCRIPTION

odb allows the examination of core files that result from a crash of an Oberon program. It expects the executable file (default a.out) and its associated core file (default core) to be given as command line arguments. After successful loading both files, a command shell is offered.

Commands

Commands consist of an optional integer count, an optional command name (default is next), and optional arguments, separated by white space. Arguments may be integer or hexidecimal numbers (in Oberon syntax), non-qualified Oberon identifiers, strings (enclosed in double quotes), or texts (anything else that does not include white space, quotes, backslashes, semicolons and comment marks). Commands are separated by line terminators or semicolons. Commands may be extended over multiple lines if a backslash is given at the end of the lines to be continued. Comments are introduced by a hash mark ('#') and extend to the end of the line. Detection of EOF terminates the debugger.

Command line input is processed by the GNU readline library that supports a history and commandline editing in a configurable way. By default, editing is similar to emacs(1). Friends of vi(1) should add ``set editing-mode vi'' to the file ~/.inputrc.

Views

Views present selected informations and work like read-only buffers in editors. There is always a current view, the initial one presenting the backtrace of the current coroutine, and a current position within a view. Following commands allow to move within a view and to print selected lines of a view:
move
move forward (or backward) the number of lines given by the count (default 1) without printing anything.
next
move forward (or backward) the number of lines given by the count (default 1) and print them.
prev
works like next but in the opposite direction.
rewind
move to the first line in the current view.
n
works like next but takes 23 as default count.
u
prints the number of lines specified by the count surrounding the current line.
b
prints the number of lines specified by the count backward from the current position without changing it.

Switching Views

Following commands allow to switch to another view:
cr
switches to a view showing all coroutines.
d
descend from the current position and switch to an associated view (works similar to a hyperlink in the worldwide web). This is a data view from other data views, module views, and backtraces.
module
switches to a view presenting a module whose name has to be specified by the first argument.
modules
switches to a view presenting all modules.
p
switches to the backtrace of the current coroutine.
t
switches to a view presenting the current source.
vi
invokes an editor (vi by default) on the current source position.

Marks

The views are connected like a web. There are some global entry points (the backtrace views of the coroutines and the modules) from where hyperlinks may be followed using the ``d'' command. To allow to return to views seen earlier it is possible to mark views (and a position within a view):
mark
marks the current position in the current view with the given name (first argument).
goto
switches to the position marked earlier under the given name.
marks
switches to a window presenting all marks defined earlier.

Miscellaneous Commands

gpl
presents the GNU General Public License in a separate view.
help
switches to a view presenting a help text.

EXAMPLE

Following example examines the backtrace, moves to the local variables of the procedure that caused the crash and shows the associated program text:
oberon$ odb Example core     
Oberon Debugger for SPARCv8 / Solaris 2.x platform
Copyright 2000 Andreas Borchert
ODB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "gpl" to see the conditions.  There is absolutely no warranty for ODB.

Try "help" for an initial help page and use RETURNs or "n" to browse forward.

module                   procedure      base     top      pc       line

SysProcess               Kill           00131a10 001319b0 00078c6c  143
odb> 6 move;u
module                   procedure      base     top      pc       line

SysProcess               Kill           00131a10 001319b0 00078c6c  143
SysProcess               Abort          00131a70 00131a10 00079654  334
UnixProcess              Abort          00131ab0 00131a70 0002ee10   40
Process                  Abort          00131b08 00131ab0 000164d4  120
SysSignals               SignalHandler  00131c10 00131b08 00073b34  194
<< interrupted by signal SIGSEGV >>
-------------------------------------------------------------------------------
Example                  PrintList      bfffdc60 bfffdc18 0001042c   31
-------------------------------------------------------------------------------
Example                  PrintList      bfffdca8 bfffdc60 00010434   31
Example                  PrintList      bfffdcf0 bfffdca8 00010434   31
Example                  PrintList      bfffdd38 bfffdcf0 00010434   31
Example                  Example        bfffdd88 bfffdd38 00010500   37
SysMain                  InitAllModules bfffdde8 bfffdd88 0002f4c0   65
odb> mark crash; d
   * VAR  list           Example.Object -> NIL
odb> goto crash
Example                  PrintList      bfffdc60 bfffdc18 0001042c   31
odb> t
      Write.Int(list.info, 1); Write.Ln;
odb> 2 u
   BEGIN
      PrintList(list.next);
-------------------------------------------------------------------------------
      Write.Int(list.info, 1); Write.Ln;
-------------------------------------------------------------------------------
   END PrintList;

Note that the source lines shown are not always accurate. In this example, the crash happened on the former line on retrieving list.next with list having a value of NIL. References through NIL cause a segmentation violation (signal SIGSEGV, see siginfo(3HEAD)), which in turn is handled by SysSignals that, being unable to resolve that problem in this case, decides to abort the process (see Process).

Linear lists (like in this case) and dynamic data structures in general may be easily navigated through using ``d'' commands:

odb> module Example
   * VAR  list           Example.Object -> Example.ObjectRec at 0EEE40H
odb> d
   * FIELD  info           INTEGER  1
odb> 
   * FIELD  next           Example.Object -> Example.ObjectRec at 0EEE30H
odb> d;n
   * FIELD  info           INTEGER  2
   * FIELD  next           Example.Object -> Example.ObjectRec at 0EEE20H
odb> d;n
   * FIELD  info           INTEGER  3
   * FIELD  next           Example.Object -> NIL
odb> 

SEE ALSO

adb(1)
another debugger
oc
Oberon compiler
reffile(5)
format of reference files
truss(1)
trace utility for system calls

FILES

*.r
reference files
REF
archive with reference files
/usr/local/lib/oberon/REF
Oberon library reference files
a.out
default object file
core
default core file

ENVIRONMENT

EDITOR
preferred editor of the ``vi'' command, is overridden by VISUAL if defined.
OBLIB
location of Oberon library, default is /usr/local/lib/oberon.
OBPATH
colon-separated list of directories containing, sources, reference files and archives of reference files (REF).
VISUAL
preferred editor of the ``vi'' command, defaults to vi.

BUGS

Debugging at runtime is not supported yet.

There is no support for the examination of registers or other low-level informations (use adb(1) instead).

There is no ``-l'' option in conformance to oc and mmo. Instead OBPATH has to be extended with (equally named) subdirectories of OBLIB for additional libraries.


Edited by: borchert, last change: 2001/12/06, revision: 1.13, converted to HTML: 2001/12/06

Oberon || Compiler & Tools || Library || Module Index || Search Engine