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
Instead of the console, use the specified serial port for keyboard input and for display. The port will typically be 3f8 (COM1) or 2f8 (COM2).

Examples:

Dial the specified phone number before starting the debug session:

   Debugger32 -s 3f8 -d ATDT5910941

Description:

The Debugger32 utility is an absolute (hex) 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.

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 the -D option to Proc is specified, the debugger will go through two checkpoints when the operating system boots. You'll be prompted:

  1. immediately after the system enters protected mode
  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.

Don't use this debugger in a multiuser environment, as 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.

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

The debugger prompts for a command by printing .

Any of the following are valid at this prompt:

Command Arguments Description
dsize[expr0 [expr1]]display memory at expr0 for expr1 bytes.
Dexprdisassemble instructions at the address expr, enter disasm-mode.
isizeexprread from I/O location expr.
osizeexpr0 expr1write expr1 to I/O location expr0.
esizeexpredit memory at location expr.
rregister [expr]display or set register to expr.
aexprshow page table entry for address expr.
.exprprint segment table entry for selector expr.
/pexprdisplay memory as a process table entry expr.
/Pexprdisplay proc table entry for pid expr.
/rexprdisplay memory at expr as a saved register set.
/Rexprdisplay saved register set for pid expr.
/mexpr0 [expr1]display mxfer_entry at expr0 (for expr1)
?show registers and fault.
"comment till end of line.
!exprprint expression expr.
bexprset breakpoint at address expr.
b?show all breakpoints.
gcontinue execution
senter single-step-mode.
vcontinue 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 with 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 CmdEMACS-modeQNX-modeDescription
homeCtrl-AHomeMove cursor to beginning of line.
end Ctrl-EEndMove cursor to end of line.
rightCtrl-F-->Move cursor right one character.
word rightESC fnoneMove cursor right one word.
leftCtrl-B<--Move cursor left one character.
word leftESC bnoneMove cursor left one word.
line killCtrl-UnoneErase entire line.
eol killESC wnoneErase from cursor to end of line.
char deleteCtrl-HbackspaceDelete current char.
word deleteCtrl-HnoneDelete current word.
previousCtrl-P/\Recall previous line.
nextCtrl-N\/Recall next line.

See also: