[Previous] [Contents] [Next]

Debugger32

Low-level 32-bit system debugger (QNX)

Syntax:

Debugger32 [-b baud] [-d text] [-s port]

Options:

-b baud
If -s is specified, set the baud rate to baud (default is 9600).
-d text
Dial a modem by outputting text. An OR bar (|) in text is mapped to a carriage return. The debugger will wait for an Esc to continue.
-s port
Send output to serial port. (Default: 0x3f8)
-t
Set serial port to 0x3f8 at 9600 baud.
-zconfig_option...
Set the configuration option specified. Valid configuration options are:
u|m
Unix (u or WASM (m assembly format
b|h|l
Dump in bytes (b), halfwords (h) or longs (l).
q|v
Quiet (q) or verbose (v). In verbose mode, Debugger32 will show registers on entry.
s|k
Use serial port (s) or system console/keyboard (k).
e|Q
Use Unix/EMACS line editing (e) or use QNX line editing (Q).

These options may be set from within the debugger through the colon (:) command.

Description:

The Debugger32 utility is a low-level debugger that lets you set breakpoints and single-step through programs, display and edit memory, disassemble code, and examine I/O ports. You can use this debugger for debugging interrupt handlers.


Note:

This debugger will function only with versions of Proc released with QNX 4.23 or later.


The debugger operates below the kernel, thus allows debugging the kernel, interrupt and fault routines.

This debugger must be built into the operating system image; it cannot be started from the command line. You always place Debugger32 in the last line of the build file. For example:

    sys/Debugger32
    $ Debugger32

For more information, see the buildqnx utility.

Unless you specify the -D option to Proc, the debugger will go through two checkpoints when the operating system boots. You'll be prompted:

  1. as soon as Proc can register the debugger
  2. at the point when all built-in processes are scheduled and ready to run-this is just before they start running. Here you may set breakpoints on processes. (You may also wish to use the debugger's l pid command to set the LDT to a specific process.)

You can invoke this debugger with the following key chord: Ctrl-Alt-Esc.


WARNING:

Don't use this debugger in a multiuser environment, because it disables interrupts and freezes the entire system.


The debugger operates in a simple line-edited mode (most familiar editing characters are available) accepting commands of the form

Most commands are single letter, some with modifiers. For example d displays memory, dw display memory in word-length quantities. Most arguments are expressions, which have a common syntax. The expression evaluator is crude, with cryptic error messages, and expressions may not contain space characters.


Note:

The command set supported by the debugger in QNX 4.23 and later is different from the one supplied with QNX versions 4.00 through 4.22.


Command mode

Any the debugger command prompt (), the following are valid:

Command Arguments Description
dsize [expr0 [expr1]] display memory at expr0 for expr1 bytes.
D expr disassemble instructions at the address expr, enter disasm-mode.
isize expr read from I/O location expr.
osize expr0 expr1 write expr1 to I/O location expr0.
esize expr edit memory at location expr.
rregister [expr] display or set register to expr.
a expr show page table entry for address expr.
. expr print segment table entry for selector expr.
/p expr display memory as a process table entry expr.
/P expr display proc table entry for pid expr.
/r expr display memory at expr as a saved register set.
/R expr display saved register set for pid expr.
/m expr0 [expr1] display mxfer_entry at expr0 (for expr1)
? show registers and fault.
" comment till end of line.
! expr print expression expr.
b expr set breakpoint at address expr.
b ? show all breakpoints.
g continue execution
s enter single-step mode.
v continue from fault via "stored" fault vector.
V [expr] trap fault expr (default all)
u [expr] clear breakpoint at address expr, or clear all breakpoints.
U [expr] restore fault expr (default all)
= continuing, keeping breakpoint

Single step mode

In single step mode the prompt is the disassembled opcode to be executed. If the user presses Enter it will not be executed. Space, i or I will execute one opcode and re-enter single-step mode. If the opcode is a "call", the O key will step over the function.

Disassemble mode

Disassemble mode (D) shows each opcode, Space shows the next one. Any other key moves back to command mode.

Debugger expressions

The debugger parses expressions that conform to the following grammar. The precedence of operations are as in C.

expr
  : primary
  | '(' expr ')'
  | expr '*,/,%' expr
  | expr '+,-' expr
  | expr '<<,>>' expr
  | expr '==,!=' expr
  | expr '&' expr
  | expr '^' expr
  | expr '|' expr
  | expr '&&' expr
  | expr '||' expr
  ;
primary
  : value
  | primary ':' primary
  | register
  | '!' primary
  | '~' primary
  | '-' primary
  | '*' primary
  ;
value
  : (0x)?'0-9a-f' + ;
register
  : eax|ebx|ecx|edx|esi|edi|ebp|esp|eip|flags
  |  ax| bx| cx| dx| si| di| bp| sp| ip
  |  cs| ds| es| ss| fs| gs
  | cr[0-3]
  | dr[0-7]
  ;

Line editing

The debugger supports limited line editing. The default behavior is EMACS-mode, but can be switched to QNX-mode by the colon commands. This table summarizes the editing characters.

Edit Cmd EMACS-mode QNX-mode Description
home Ctrl-A Home Move cursor to beginning of line.
end Ctrl-E End Move cursor to end of line.
right Ctrl-F --> Move cursor right one character.
word right ESC f none Move cursor right one word.
left Ctrl-B <-- Move cursor left one character.
word left ESC b none Move cursor left one word.
line kill Ctrl-U none Erase entire line.
eol kill ESC w none Erase from cursor to end of line.
char delete Ctrl-H backspace Delete current char.
word delete Ctrl-H none Delete current word.
previous Ctrl-P /\ Recall previous line.
next Ctrl-N \/ Recall next line.

Examples:

Dial the specified phone number before starting the debug session:

   Debugger32 -s 3f8 -d ATDT5910941

See also:

buildqnx, Proc

WATCOM Debugger User's Guide


[Previous] [Contents] [Next]