Команда Описание
$b Печатают текущие контрольные точки.
$c Печать располагает в стеке след.
$d Основание системы счисления значения по умолчанию Набора, чтобы адресовать параметр.
$e Печатают внешние переменные.
$f Регистраторы С плавающей точкой как единственная(отдельная) точность.
$F Регистраторы С плавающей точкой как двойная точность.
$m Печатают карты сегмента ADB.
$r Печатают общих регистраторов.
$s Смещение Набора для соответствия символа.
$v Печатают ADB переменные.
$w Вывод Набора выравнивает ширину.
Рекомендуеться также посмтотреть на лучший Отладчик под Unix:
http://www.kiarchive.ru/pub/gnu/gnu-mirror/Manuals/ddd/html_mono/ddd.html
Отладчик XDB
XDB – отладчик для отлаживания програм написаных на языках C, HP FORTRAN, HP Pascal, and C++ и понимает следующие команды:
xdb [-d dir] [-r file] [-R file] [-p file] [-P process_ID] [-L] [-l library]
[-i file] [-o file] [-e file] [-S num] [-s] [objectfile [corefile]]
где
-d dir определяет дополнительный каталог где размещены исходный коды
-r file определяет рекордный файл
-R file определяет файл restore, который был определен перед –p но после –r опции
-p file определяет файл воспоизведения действий (playback)
-P process_ID Определяет process_ID до которого желаем «присоедениться» чтоб отправить в
режим отладки
-L определяет строчно-ориентированный интерфейс.
-l library определяет библиотеку (общедоступную) до которой желаете подсоедениться
-i file переопределяет поток ввода в файл или в устройство
-o file переопределяет поток вывода в файл или в устройство
-e file переопределяет поток вывода ошибок в файл или в устройство
-S num устанавливает размер кеширования строки (по умолчанию 1024 что есть минимальный) –s определяет все библиотеки (общедоступный) которые использует програма
Размер екрана будет в зависимости от переменой окружения TERM или можно установить используя переменный LINES и COLUMNS.
При запуске xdb имеет 3 окна:
· Окно кода (содержит исходный код)
· Окно информации (содержит значения параметров и прочее)
· Командное окно, окно упраления
Примеры команд
r запускает програму с параметрами
R запускет програму без параметров
s пошаговый запусr (входит в функции)
S пошаговый запусr (не входить в функции)
к убить процесс
q выйти из отладчика
с продолжить выполнения програмы (continue)
v 11 посмотреть 11 строку кода
+5 посмотрить на 5 строк ниже
-5 ---------------------------- выше
v my_function показать функцию
v test1.c просмотреть файл test1.c
v test1.c:40 просмотреть файл test1.c на 40 строке
V посмотреть текущуй стек (сотояний вызовов)
V 2 посмотреть текущей стек на 2 уровня глубже
w 12 установить размер окна кода на 12
td показать код на asssembly языке (что б возвратиться к коду то еще раз нужно набрать td)
ts показать код и asssembly
s 6 запустить 6 шагов
/ n=4 ищет код n=4 (снизу)
? n=4 ищет код n=4 (сверху)
b 42 устанавливает точку останова в 42 строке
b 32 \4 в 32 строке будет останавливаться програма 4 раза
bp устанавливает точку останова на точке входа в програму
bp my_funс устанавливает точку останова на точке входа в процедуру my_func
lb просмотреть точки останова
db 2 удалить 2ю точку остнаова
db * удалить все точки останова
p count просмотреть значение count
p count\x просмотреть в шестнацатиричном виде
p num\D просмотреть переменую в long типе как десятеричную
p. показать преведущее значение
p *(&.+42) показать значение на 42 байта дальше от преведуще-показаного значения
p my_struct показывает даные в структуре
p my_struct.name показывает значение в структуры поля name
p *ptr значения указателя
p+ (p-) показывет следущий(преведущий) елемент
p num=num+20 увеличить значения на 20
t показывает стек
Справочная таблица команд и флагов XDB
h [topic] Print commands/syntaxes related to this topic.
Help without a topic prints the complete help text. Available topics
include command names (short form) which print the syntax for and a
terse description of the command. Other topics are:
assert assertions; macro macros;
bpset set breakpoints; misc other commands, etc.;
bpstat view & modify breakpoints; options xdb command line;
C++ C++ features; proc procedure related;
cmdlist command list features; record write & use log files;
control process control; register registers;
data view & modify data; screen window modes;
disasm disassembly mode; signal signal handling;
formats format specifiers; state global state switches;
help this description; source view source;
list list various items; trace trace stack or proc(s);
locations location syntax; variables variable syntax.
Process control:
r [arguments] Run child process with arguments.
R Run child process with no arguments.
c [location] Continue from breakpoint with no signal, set temporary breakpoint at location.
C [location] Continue with current signal, set temporary breakpoint at location.
s [number] Single step, follow procedure calls.
S [number] Single step, step over procedure calls.
g (line | #label) Go to line in current procedure.
g (+|-) [lines] Go forward/back 1 or given number of lines.
k Kill child process, if any.
Setting breakpoints:
b [location] [\count] [commands] Set breakpoint.
ba [address] [\count] [commands] Set breakpoint at code address.
bb [depth] [\count] [commands] Set breakpoint at procedure beginning.
bi expr.proc [\count] [commands] Set an instance breakpoint.
bi [-c|-C] expr [commands] Set an instance breakpoint.
bp [commands] Set procedure breakpoints.
bpc [-c|-C] class [commands] Set a class breakpoint.
bpo [[class]::]proc [commands] Set breakpoints on overloaded functions.
bpt [commands] Set procedure trace breakpoints.
bpx [commands] Set procedure exit breakpoints.
bt [(depth | proc)] [\count] [commands] Trace procedure.
bu [depth] [\count] [commands] Set up-level breakpoint.
bx [depth] [\count] [commands] Set breakpoint at procedure exit.
bpg [commands] Set paragraph breakpoints. (MPE-only)
tpg [commands] Set paragraph trace breakpoints. (MPE-only)
txc Toggle the exception stop-on-catch state.
txt Toggle the exception stop-on-throw state.
View and modify breakpoint status:
lb List all breakpoints.
lx List exception stop-on-throw and -catch state.
db [number | *] Delete one or all breakpoints.
dp Delete procedure breakpoints.
Dpx Delete procedure exit breakpoints.
Dpt Delete procedure trace breakpoints.
dpg Delete paragraph [trace] breakpoints.(MPE-only)
ab [number | *] Activate one or all breakpoints.
sb [number | *] Suspend one or all breakpoints.
tb Toggle overall breakpoints state.
abc commands Global breakpoint commands.
dbc Delete global breakpoint commands.
bc number expr Set a breakpoint count.
xcc commands Define the stop-on-catch command-list.
xtc commands Define the stop-on-throw command-list.
i expr {commands} [{commands}] Conditionally execute commands. (Also: if)
{ } Group commands.
; Separate commands.
Q Quiet breakpoint reporting.
"any string" Print string.
Source viewing:
L Show current location and its source line.
v [location] View source at location in source window.
va [address] View address in disassembly window.
V [depth] View procedure at depth in source window.
top View procedure at top of stack.
up [number] View procedure number levels higher in stack.
down [number] View procedure number levels lower in stack.
+[number] Move forward in sourcefile.
-[number] Move backward in sourcefile.
/[string] Search forwards in sourcefile for string.
?[string] Search backwards for string.
n Repeat previous search.
N Repeat previous search in opposite direction.
apm old_path [new_path] Add (prefix) path map for source files.
dpm [index | *] Delete path map(s) for source files.
lpm List path maps in order of precedence.
D "dir" Add a directory search path for source files.
ld List all directories.
lf [string] List all (or matching) files.
lsl List all shared libraries.
lp [[class]::][string] List all (or matching) procedures.
lo [[class]::][string] List all (or matching) overloaded functions.
lcl [string] List all (or matching) classes.
lct [string] List all (or matching) class templates.
ltf [string] List all (or matching) function expansions.
lft [string] List all (or matching) function templates.
View and modify data:
p expr [\format] Print value of expression using format.
p expr?format Print address of expression using format.
p -[\format] Print value of prev memory location using format.
p +[\format] Print value of next memory location using format.
p class:: Print static members of class.
l [[class]::][proc[:depth]] List all parameters and locals of proc.
t [depth] Trace stack.
T [depth] Trace stack and show local variables.
tst Toggle stub visibility. (PA-RISC only)
lr [string] List all (or matching) registers.
lc [string] List all (or matching) commons. (PA-RISC only)
lg [string] List all (or matching) globals.
ls [string] List all (or matching) special variables.
mm [string] Show memory-map of all (or matching) loaded shared -libraries.
f ["printf-style-format"] Set address printing format.
disp item [\format] Display Cobol data item value using format.(MPE-only)
move val to item Move value "val" to cobol data item "item" (MPE-only)
pq <<same as p>> Print quietly. Evaluate without printing.
ll [string] List all (or matching) labels.
lz List all signals.
z [number] [i][r][s][Q] Toggle flags (ignore, report, stop, Quiet) for signal.
Screen modes:
am Activate more (turn on pagination).
sm Suspend more (turn off pagination).
w number Set size of source window.
td Toggle disassembly mode.
ts Toggle split-screen mode.
fr Display floating point registers.
gr Display general registers.
tf Toggle float register display precision (PA-RISC only).
sr Display special registers. (PA-RISC only)
u Update screen.
U Refresh source & location windows on screen.
+r Scroll floating point registers forward.
-r Scroll floating point registers backward.
Assertions:
a commands Create a new assertion with a command list.
aa (number | *) Activate one or all assertions.
da (number | *) Delete one or all assertions.
la List all assertions.
sa (number | *) Suspend one or all assertions.
ta Toggle overall assertions state.
x [expr] Exit assertion mode, possibly aborting the assertion command list.
Macros:
def name [replacement-text] Define a macro name.
lm [string] List all (or matching) macros.
tm Toggle the macro substitution mechanism.
undef (name | *) Remove the macro definition for name or all.
Record and playback:
tr [@] Toggle the record [record-all] mechanism.
< file Playback from file.
<< file Playback from file with single stepping.
> file Record commands to file.
>> file Append commands to file.
>@ file Record-all debugger commands & output to file.
>>@ file Append all debugger commands & output to file.
">>" is equivalent to ">" for the next four commands.
> Show status of current recording file.
>@ Show status of current record-all file.
>(t | f | c) Turn recording on (t), or off (f), or close the recording file (c).
>@(t | f | c) Turn record-all on (t), or off (f), or close the record-all file (c).
Misc:
ss file Save (breakpoint, macro, assertion) state.
tc Toggle case sensitivity in searches.
<carriage-return> Repeat previous command.
~ Repeat previous command.
! [command-line] Execute shell (with or without commands).
q Quit debugger.
$addr Unary operator, address of object.
$sizeof Unary operator, size of object.
$in Unary boolean operator, execution in procedure.
# [text] A comment.
I Print debugger status.
M [(t | c) [expr [; expr...]]] Print or set (text or core) maps.
tM Toggle between default and modifiable core maps.
VARIABLES
var Search current procedure and globals.
class::var Search class for variable.
[[class]::]proc:[class::]var Search procedure for variable.
[[class]::]proc:depth:[class::]var Search procedure at depth on stack.
:var or::var Search for global variable only.
. Shorthand for last thing you looked at.
$var Define or use special variable.
$result Return value of last cmd line procedure call.
$signal Current child process signal number.
$lang Current language for expression evaluation.
$depth Default stack depth for local variables.
$print Display mode for character data.
$line Current source line number.
$malloc Debugger memory allocation (bytes).
$step Instr. count in non-debug before free-run.
$cplusplus C++ feature control flags.
$regname Hardware registers.
$fpa Treat fpa sequence as one instruction.(S300 only)
$fpa_reg Address register for fpa sequences. (S300 only)
LOCATIONS
line source line & code address (if any)
#label "
file[:line] "
[file:]proc[:proc[...]][:line|#label] "
[class]::proc[:line|#label] "
proc#line code address (if any)
[class]::proc#line "
name@shared_lib Address of name in shared library
FORMATS
A format has the form [count]formchar[size]. formchar's are:
a String at address.
(b | B) Byte in decimal (either way).
(c | C) (Wide) character.
(d | D) (Long) decimal.
(e | E) E floating point notation (as double).
(f | F) F floating point notation (as double).
(g | G) G floating point notation (as double).
i Machine instruction (disassembly).
(k | K) Formatted structure display (with base classes).
n "Normal" format, based on type.
(o | O) (Long) octal.
p Print name of procedure containing address.
(r | R) Print template of object (with base classes).
s String from pointer.
S Formatted structure display.
(t | T) Print type of object (with base classes).
(u | U) (Long) unsigned decimal.
(w | W) Wide character string (at address).
(x | X) (Long) hexadecimal.
(z | Z) (Long) binary.
Size can be a number or one of the following:
b 1 byte (char)
s 2 bytes (short)
l 4 bytes (long)
D 8 bytes (double - floating point formats only)
L 16 bytes (long double - floating point only)