Moved internal debugger sections to a new chapter with two main sections:
command line debugger and debugger gui. Improved gui debugger section a little bit. TODO: use some parts of docs-html/enh_dbg_user_man.txt and remove this file when ready.
This commit is contained in:
parent
1e4157a7f6
commit
512d54cc5d
@ -6323,6 +6323,425 @@ write to bochs-announce-request or bochs-developers-request. Don't forget the
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
<chapter id="internal-debugger"><title>The Bochs internal debugger</title>
|
||||
<section id="command-line-debugger"><title>Using the command line debugger</title>
|
||||
|
||||
<para>
|
||||
You can now conditionally compile in a GDB like command line debugger, that
|
||||
allows you to set breakpoints, step through instructions, and other
|
||||
useful functions. If there isn't a command for something you believe
|
||||
is generally useful for the debugger, let me know and I'll implement
|
||||
it if possible.
|
||||
</para>
|
||||
|
||||
<note><para>
|
||||
This section describes how to enable and use the Bochs command line debugger.
|
||||
For it's builtin graphical front-end please see the <link linkend="debugger-gui">debugger gui</link>
|
||||
section how to enable it.
|
||||
</para></note>
|
||||
|
||||
<para>
|
||||
To use the debugger, you must configure Bochs with the
|
||||
<option>--enable-debugger</option> and <option>--enable-disasm</option> flags.
|
||||
For example:
|
||||
<screen>
|
||||
./configure --enable-debugger --enable-disasm
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<note><para>
|
||||
You must use flex version 2.5.4 or greater. I have heard that
|
||||
version 2.5.2 will not work.
|
||||
</para></note>
|
||||
|
||||
<para>
|
||||
When you first start up Bochs, you will see the command line prompt
|
||||
|
||||
<screen>
|
||||
bochs:1>
|
||||
</screen>
|
||||
|
||||
From here, you may use the following commands:
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Execution Control</title>
|
||||
<para>
|
||||
<screen>
|
||||
c continue executing
|
||||
cont
|
||||
continue
|
||||
|
||||
s [count] execute count instructions, default is 1
|
||||
step [count]
|
||||
|
||||
s [cpu] [count] for SMP simulation, execute count instructions on cpu, default is 1
|
||||
step [cpu] [count]
|
||||
|
||||
s all [count] for SMP simulation, execute count instructions on all cpus
|
||||
step all [count]
|
||||
|
||||
Ctrl-C stop execution, and return to command line prompt
|
||||
Ctrl-D if at empty line on command line, exit
|
||||
|
||||
q quit debugger and execution
|
||||
quit
|
||||
exit
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>BreakPoints</title>
|
||||
<para>
|
||||
<screen>
|
||||
NOTE: The format of 'seg', 'off', and 'addr' in these descriptions,
|
||||
are as follows. I don't have any way to set the current radix.
|
||||
|
||||
hexidecimal: 0xcdef0123
|
||||
decimal: 123456789
|
||||
octal: 01234567
|
||||
|
||||
vbreak seg:off Set a virtual address instruction breakpoint
|
||||
vb seg:off
|
||||
|
||||
vbreak seg:off if "expr" Set a conditional virtual address instruction breakpoint
|
||||
vb seg:off if "expr"
|
||||
|
||||
lbreak addr Set a linear address instruction breakpoint
|
||||
lb addr
|
||||
|
||||
lbreak addr if "expr" Set a conditional linear address instruction breakpoint
|
||||
lb addr if "expr"
|
||||
|
||||
pbreak [*] addr Set a physical address instruction breakpoint
|
||||
pb [*] addr (the '*' is optional for GDB compatibility)
|
||||
break [*] addr
|
||||
b [*] addr
|
||||
|
||||
pbreak [*] addr if "expr" Set a conditional physical address instruction breakpoint
|
||||
pb [*] addr if "expr" (the '*' is optional for GDB compatibility)
|
||||
break [*] addr if "expr"
|
||||
b [*] addr if "expr"
|
||||
|
||||
info break Display state of all current breakpoints
|
||||
bpe n Enable a breakpoint
|
||||
bpd n Disable a breakpoint
|
||||
delete n Delete a breakpoint
|
||||
del n
|
||||
d n
|
||||
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Memory WatchPoints</title>
|
||||
<para>
|
||||
<screen>
|
||||
|
||||
watch read addr Insert a read watch point at physical address <varname>addr</varname>
|
||||
watch r addr Insert a read watch point at physical address <varname>addr</varname>
|
||||
|
||||
watch write addr Insert a write watch point at physical address <varname>addr</varname>
|
||||
watch w addr Insert a write watch point at physical address <varname>addr</varname>
|
||||
|
||||
watch Display state of current memory watchpoints
|
||||
|
||||
watch stop Stop simulation when a watchpoint is encountered (default)
|
||||
watch continue Do not stop simulation when a watchpoint is encountered
|
||||
|
||||
unwatch addr Remove watchpoint to specific physical address
|
||||
unwatch Remove all watch points
|
||||
|
||||
trace-mem on/off Enable/Disable memory access tracing
|
||||
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Manipulating Memory</title>
|
||||
<para>
|
||||
<screen>
|
||||
x /nuf addr Examine memory at linear address addr
|
||||
xp /nuf addr Examine memory at physical address addr
|
||||
n Count of how many units to display
|
||||
u Unit size; one of
|
||||
b Individual bytes
|
||||
h Halfwords (2 bytes)
|
||||
w Words (4 bytes)
|
||||
g Giant words (8 bytes)
|
||||
NOTE: these are *not* typical Intel nomenclature sizes,
|
||||
but they are consistent with GDB convention.
|
||||
f Printing format. one of
|
||||
x Print in hexadecimal
|
||||
d Print in decimal
|
||||
u Print in unsigned decimal
|
||||
o Print in octal
|
||||
t Print in binary
|
||||
|
||||
n, f, and u are optional parameters. u and f default to the last values
|
||||
you used, or to w(words) and x(hex) if none have been supplied.
|
||||
n currently defaults to 1. If none of these optional parameters are
|
||||
used, no slash should be typed. addr is also optional. If you don't
|
||||
specify it, it will be the value the next address (as if you had
|
||||
specified n+1 in the last x command).
|
||||
|
||||
setpmem addr datasize val Set physical memory location of size
|
||||
datasize to value val.
|
||||
|
||||
writemem dump a number of bytes of virtual memory starting from
|
||||
the specified linear address into a file
|
||||
|
||||
crc addr1 addr2 Show CRC32 for physical memory range addr1..addr2
|
||||
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Info commands</title>
|
||||
<para>
|
||||
<screen>
|
||||
r|reg|regs|registers List of CPU integer registers and their contents
|
||||
fp|fpu List of all FPU registers and their contents
|
||||
mmx List of all MMX registers and their contents
|
||||
sse|xmm List of all SSE registers and their contents
|
||||
ymm List of all AVX registers and their contents
|
||||
sreg Show segment registers and their contents
|
||||
dreg Show debug registers and their contents
|
||||
creg Show control registers and their contents
|
||||
|
||||
info cpu List of all CPU registers and their contents
|
||||
info eflags Show decoded EFLAGS register
|
||||
info break Information about current breakpoint status
|
||||
info tab Show paging address translation
|
||||
info device Show state of the specified device
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Manipulating CPU Registers</title>
|
||||
<para>
|
||||
<screen>
|
||||
set reg = expr Change a CPU register to value of expression.
|
||||
Currently only general purpose registers and instruction pointer
|
||||
are supported. You may not change eflags, segment registers,
|
||||
floating point or SIMD registers.
|
||||
|
||||
Examples: set eax = 2+2/2
|
||||
set esi = 2*eax+ebx
|
||||
|
||||
registers List of CPU registers and their contents
|
||||
regs
|
||||
reg
|
||||
r
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Disassembly commands</title>
|
||||
<para>
|
||||
<screen>
|
||||
disassemble start end Disassemble instructions in given linear address
|
||||
range, inclusive of start, exclusive of end.
|
||||
Use "set $disassemble_size =" to tell
|
||||
debugger desired segment size. Use a value for
|
||||
end of less than start (or zero) if you only
|
||||
want the first instruction disassembled.
|
||||
|
||||
disassemble switch-mode Switch between Intel and AT&T disassebly styles
|
||||
for debugger disassembler.
|
||||
|
||||
disassemble size = n Tell debugger what segment size to use when
|
||||
the "disassemble" command is used. Use values
|
||||
of 0, 16 or 32 for n. Value of 0 means
|
||||
"use segment size specified by current CS
|
||||
segment". Default is 0.
|
||||
|
||||
set $auto_disassemble = n Cause debugger to disassemble current instruction
|
||||
every time execution stops if n=1. Default is 0.
|
||||
Segment size of current CPU context is used for
|
||||
disassembly, so the "disassemble size" variable is
|
||||
ignored.
|
||||
|
||||
set disassemble on The same as 'set $auto_disassemble = 1'
|
||||
set disassemble off The same as 'set $auto_disassemble = 0'
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Instruction tracing</title>
|
||||
<para>
|
||||
<screen>
|
||||
trace on Disassemble every executed instruction. Note
|
||||
that instructions which caused exceptions are
|
||||
not really executed, and therefore not traced.
|
||||
|
||||
trace off Disable instruction tracing.
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Instrumentation</title>
|
||||
<para>
|
||||
|
||||
To use instrumentation features in bochs, you must compile in support for it.
|
||||
You should build a custom instrumentation library in a separate directory in
|
||||
the "instrument/" directory. To tell configure which instrumentation library
|
||||
you want to use, use the <option>--enable-instrumentation</option> option.
|
||||
|
||||
The default library consists of a set of stubs, and the following are
|
||||
equivalent:
|
||||
|
||||
<screen>
|
||||
./configure [...] --enable-instrumentation
|
||||
./configure [...] --enable-instrumentation="instrument/stubs"
|
||||
</screen>
|
||||
|
||||
You could make a separate directory with your custom library,
|
||||
for example "instrument/myinstrument", copy the contents of
|
||||
the "instrument/stubs" directory to it, then customize it. Use:
|
||||
|
||||
<screen>
|
||||
./configure [...] --enable-instrumentation="instrument/myinstrument"
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Instrumentation commands</title>
|
||||
<para>
|
||||
<screen>
|
||||
instrument [command] calls BX_INSTR_DEBUG_CMD instrumentation callback with [command]
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Other Commands</title>
|
||||
<para>
|
||||
|
||||
<screen>ptime</screen>
|
||||
|
||||
Print the current time (number of ticks since start of simulation).
|
||||
|
||||
<screen>sb <varname>delta</varname></screen>
|
||||
|
||||
Insert a time break point "delta" instructions into the future ("delta" is a 64-bit integer followed by "L", for example 1000L).
|
||||
|
||||
<screen>sba <varname>time</varname></screen>
|
||||
|
||||
Insert a time break point at "time" ("time" is a 64-bit integer followed by "L", for example 1000L).
|
||||
|
||||
<screen>print-stack [<varname>num words</varname>]</screen>
|
||||
|
||||
Print the <varname>num words</varname> top 16-bit words on the stack. <varname>Num
|
||||
words</varname> defaults to 16. Only works reliably in protected mode when
|
||||
the base address of the stack segment is zero.
|
||||
|
||||
<screen>modebp</screen>
|
||||
|
||||
Toggles CPU mode switch breakpoint.
|
||||
|
||||
<screen>ldsym [global] <varname>filename</varname> [<varname>offset</varname>]</screen>
|
||||
|
||||
Load symbols from file <varname>filename</varname>. If the global keyword is
|
||||
added, then the the symbols will be visible in all contexts for which
|
||||
symbols have not been loaded. <varname>Offset</varname> (default is 0) is added to
|
||||
every symbol entry. The symbols are loaded in the current (executing)
|
||||
context.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The symbol file consists of zero or more lines of the format <screen>"%x %s"</screen>.
|
||||
|
||||
<screen>show [<varname>string</varname>]</screen>
|
||||
|
||||
<screen>
|
||||
Toggles show symbolic info (calls to begin with).
|
||||
show - shows current show mode
|
||||
show mode - show, when processor switch mode
|
||||
show int - show, when interrupt is happens
|
||||
show call - show, when call is happens
|
||||
show ret - show, when iret is happens
|
||||
show off - toggles off symbolic info
|
||||
show dbg-all - turn on all show flags
|
||||
show dbg-none - turn off all show flags
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>
|
||||
Related links
|
||||
</title>
|
||||
<para>
|
||||
&FIXME; For information on advanced debugger usage see the <ulink url="../development/debugger-advanced.html">developer documentation</ulink>
|
||||
(under construction).
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="debugger-gui">
|
||||
<title>
|
||||
The Bochs debugger gui
|
||||
</title>
|
||||
<para>
|
||||
The graphical front-end for the Bochs command line debugger
|
||||
is available for Windows and GTK2/GTK3 hosts.
|
||||
</para>
|
||||
<para>
|
||||
To use the gui debugger, you must configure Bochs with the
|
||||
default debugger switches and the <option>--enable-debugger-gui</option> flag.
|
||||
For example:
|
||||
<screen>
|
||||
./configure --enable-debugger --enable-disasm --enable-debugger-gui
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
At runtime you need to add the value <option>gui_debug</option> to the
|
||||
<link linkend="bochsopt-displaylibrary">display_library</link> options parameter
|
||||
in order to use the gui instead of the command line debugger. This example shows
|
||||
how to use it with the 'x' gui:
|
||||
<screen>
|
||||
display_library: x, options="gui_debug"
|
||||
</screen>
|
||||
</para>
|
||||
<note><para>The wxWidgets port of Bochs always uses this debugger gui. Passing
|
||||
the option to the display library is not necessary, since the command line
|
||||
interface is not available then.
|
||||
</para></note>
|
||||
<para>
|
||||
The gui debugger consists of a gui window with a menu bar, a button bar and some
|
||||
child windows for different purposes. Not all windows are visible at the same time.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>Register window</para></listitem>
|
||||
<listitem><para>Disassembly window</para></listitem>
|
||||
<listitem><para>MemDump window</para></listitem>
|
||||
<listitem><para>Output window: display internal debugger output / log output</para></listitem>
|
||||
<listitem><para>Input window: command prompt for entering debugger commands</para></listitem>
|
||||
<listitem><para>Param tree window: show the Bochs parameter tree (CPU / hardware state)</para></listitem>
|
||||
<listitem><para>Stack window</para></listitem>
|
||||
<listitem><para>Breakpoint / watchpoint window</para></listitem>
|
||||
<listitem><para>Command button row</para></listitem>
|
||||
<listitem><para>CPU button row: only available for SMP emulation</para></listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
&FIXME; List the features here.
|
||||
</para>
|
||||
<para>
|
||||
Most of the gui debugger settings are now saved to an INI file on exit and
|
||||
restored at the next run.
|
||||
</para>
|
||||
</section>
|
||||
</chapter><!-- end: Using Bochs internal debugger -->
|
||||
|
||||
<chapter id="howto"><title>Tips and Techniques</title>
|
||||
|
||||
<section id="logopts-by-device"><title>Specify log options by device</title>
|
||||
@ -7760,410 +8179,6 @@ Supported options:
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
<section id="internal-debugger">
|
||||
<title>Using Bochs internal debugger</title>
|
||||
|
||||
<para>
|
||||
You can now conditionally compile in a GDB like command line debugger, that
|
||||
allows you to set breakpoints, step through instructions, and other
|
||||
useful functions. If there isn't a command for something you believe
|
||||
is generally useful for the debugger, let me know and I'll implement
|
||||
it if possible.
|
||||
</para>
|
||||
|
||||
<note><para>
|
||||
This section describes how to enable and use the Bochs command line debugger.
|
||||
For it's builtin graphical front-end please see the <link linkend="debugger-gui">debugger gui</link>
|
||||
section how to enable it.
|
||||
</para></note>
|
||||
|
||||
<para>
|
||||
To use the debugger, you must configure Bochs with the
|
||||
<option>--enable-debugger</option> and <option>--enable-disasm</option> flags.
|
||||
For example:
|
||||
<screen>
|
||||
./configure --enable-debugger --enable-disasm
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<note><para>
|
||||
You must use flex version 2.5.4 or greater. I have heard that
|
||||
version 2.5.2 will not work.
|
||||
</para></note>
|
||||
|
||||
<para>
|
||||
When you first start up Bochs, you will see the command line prompt
|
||||
|
||||
<screen>
|
||||
bochs:1>
|
||||
</screen>
|
||||
|
||||
From here, you may use the following commands:
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Execution Control</title>
|
||||
<para>
|
||||
<screen>
|
||||
c continue executing
|
||||
cont
|
||||
continue
|
||||
|
||||
s [count] execute count instructions, default is 1
|
||||
step [count]
|
||||
|
||||
s [cpu] [count] for SMP simulation, execute count instructions on cpu, default is 1
|
||||
step [cpu] [count]
|
||||
|
||||
s all [count] for SMP simulation, execute count instructions on all cpus
|
||||
step all [count]
|
||||
|
||||
Ctrl-C stop execution, and return to command line prompt
|
||||
Ctrl-D if at empty line on command line, exit
|
||||
|
||||
q quit debugger and execution
|
||||
quit
|
||||
exit
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>BreakPoints</title>
|
||||
<para>
|
||||
<screen>
|
||||
NOTE: The format of 'seg', 'off', and 'addr' in these descriptions,
|
||||
are as follows. I don't have any way to set the current radix.
|
||||
|
||||
hexidecimal: 0xcdef0123
|
||||
decimal: 123456789
|
||||
octal: 01234567
|
||||
|
||||
vbreak seg:off Set a virtual address instruction breakpoint
|
||||
vb seg:off
|
||||
|
||||
vbreak seg:off if "expr" Set a conditional virtual address instruction breakpoint
|
||||
vb seg:off if "expr"
|
||||
|
||||
lbreak addr Set a linear address instruction breakpoint
|
||||
lb addr
|
||||
|
||||
lbreak addr if "expr" Set a conditional linear address instruction breakpoint
|
||||
lb addr if "expr"
|
||||
|
||||
pbreak [*] addr Set a physical address instruction breakpoint
|
||||
pb [*] addr (the '*' is optional for GDB compatibility)
|
||||
break [*] addr
|
||||
b [*] addr
|
||||
|
||||
pbreak [*] addr if "expr" Set a conditional physical address instruction breakpoint
|
||||
pb [*] addr if "expr" (the '*' is optional for GDB compatibility)
|
||||
break [*] addr if "expr"
|
||||
b [*] addr if "expr"
|
||||
|
||||
info break Display state of all current breakpoints
|
||||
bpe n Enable a breakpoint
|
||||
bpd n Disable a breakpoint
|
||||
delete n Delete a breakpoint
|
||||
del n
|
||||
d n
|
||||
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Memory WatchPoints</title>
|
||||
<para>
|
||||
<screen>
|
||||
|
||||
watch read addr Insert a read watch point at physical address <varname>addr</varname>
|
||||
watch r addr Insert a read watch point at physical address <varname>addr</varname>
|
||||
|
||||
watch write addr Insert a write watch point at physical address <varname>addr</varname>
|
||||
watch w addr Insert a write watch point at physical address <varname>addr</varname>
|
||||
|
||||
watch Display state of current memory watchpoints
|
||||
|
||||
watch stop Stop simulation when a watchpoint is encountered (default)
|
||||
watch continue Do not stop simulation when a watchpoint is encountered
|
||||
|
||||
unwatch addr Remove watchpoint to specific physical address
|
||||
unwatch Remove all watch points
|
||||
|
||||
trace-mem on/off Enable/Disable memory access tracing
|
||||
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Manipulating Memory</title>
|
||||
<para>
|
||||
<screen>
|
||||
x /nuf addr Examine memory at linear address addr
|
||||
xp /nuf addr Examine memory at physical address addr
|
||||
n Count of how many units to display
|
||||
u Unit size; one of
|
||||
b Individual bytes
|
||||
h Halfwords (2 bytes)
|
||||
w Words (4 bytes)
|
||||
g Giant words (8 bytes)
|
||||
NOTE: these are *not* typical Intel nomenclature sizes,
|
||||
but they are consistent with GDB convention.
|
||||
f Printing format. one of
|
||||
x Print in hexadecimal
|
||||
d Print in decimal
|
||||
u Print in unsigned decimal
|
||||
o Print in octal
|
||||
t Print in binary
|
||||
|
||||
n, f, and u are optional parameters. u and f default to the last values
|
||||
you used, or to w(words) and x(hex) if none have been supplied.
|
||||
n currently defaults to 1. If none of these optional parameters are
|
||||
used, no slash should be typed. addr is also optional. If you don't
|
||||
specify it, it will be the value the next address (as if you had
|
||||
specified n+1 in the last x command).
|
||||
|
||||
setpmem addr datasize val Set physical memory location of size
|
||||
datasize to value val.
|
||||
|
||||
writemem dump a number of bytes of virtual memory starting from
|
||||
the specified linear address into a file
|
||||
|
||||
crc addr1 addr2 Show CRC32 for physical memory range addr1..addr2
|
||||
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Info commands</title>
|
||||
<para>
|
||||
<screen>
|
||||
r|reg|regs|registers List of CPU integer registers and their contents
|
||||
fp|fpu List of all FPU registers and their contents
|
||||
mmx List of all MMX registers and their contents
|
||||
sse|xmm List of all SSE registers and their contents
|
||||
ymm List of all AVX registers and their contents
|
||||
sreg Show segment registers and their contents
|
||||
dreg Show debug registers and their contents
|
||||
creg Show control registers and their contents
|
||||
|
||||
info cpu List of all CPU registers and their contents
|
||||
info eflags Show decoded EFLAGS register
|
||||
info break Information about current breakpoint status
|
||||
info tab Show paging address translation
|
||||
info device Show state of the specified device
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Manipulating CPU Registers</title>
|
||||
<para>
|
||||
<screen>
|
||||
set reg = expr Change a CPU register to value of expression.
|
||||
Currently only general purpose registers and instruction pointer
|
||||
are supported. You may not change eflags, segment registers,
|
||||
floating point or SIMD registers.
|
||||
|
||||
Examples: set eax = 2+2/2
|
||||
set esi = 2*eax+ebx
|
||||
|
||||
registers List of CPU registers and their contents
|
||||
regs
|
||||
reg
|
||||
r
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Disassembly commands</title>
|
||||
<para>
|
||||
<screen>
|
||||
disassemble start end Disassemble instructions in given linear address
|
||||
range, inclusive of start, exclusive of end.
|
||||
Use "set $disassemble_size =" to tell
|
||||
debugger desired segment size. Use a value for
|
||||
end of less than start (or zero) if you only
|
||||
want the first instruction disassembled.
|
||||
|
||||
disassemble switch-mode Switch between Intel and AT&T disassebly styles
|
||||
for debugger disassembler.
|
||||
|
||||
disassemble size = n Tell debugger what segment size to use when
|
||||
the "disassemble" command is used. Use values
|
||||
of 0, 16 or 32 for n. Value of 0 means
|
||||
"use segment size specified by current CS
|
||||
segment". Default is 0.
|
||||
|
||||
set $auto_disassemble = n Cause debugger to disassemble current instruction
|
||||
every time execution stops if n=1. Default is 0.
|
||||
Segment size of current CPU context is used for
|
||||
disassembly, so the "disassemble size" variable is
|
||||
ignored.
|
||||
|
||||
set disassemble on The same as 'set $auto_disassemble = 1'
|
||||
set disassemble off The same as 'set $auto_disassemble = 0'
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Instruction tracing</title>
|
||||
<para>
|
||||
<screen>
|
||||
trace on Disassemble every executed instruction. Note
|
||||
that instructions which caused exceptions are
|
||||
not really executed, and therefore not traced.
|
||||
|
||||
trace off Disable instruction tracing.
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Instrumentation</title>
|
||||
<para>
|
||||
|
||||
To use instrumentation features in bochs, you must compile in support for it.
|
||||
You should build a custom instrumentation library in a separate directory in
|
||||
the "instrument/" directory. To tell configure which instrumentation library
|
||||
you want to use, use the <option>--enable-instrumentation</option> option.
|
||||
|
||||
The default library consists of a set of stubs, and the following are
|
||||
equivalent:
|
||||
|
||||
<screen>
|
||||
./configure [...] --enable-instrumentation
|
||||
./configure [...] --enable-instrumentation="instrument/stubs"
|
||||
</screen>
|
||||
|
||||
You could make a separate directory with your custom library,
|
||||
for example "instrument/myinstrument", copy the contents of
|
||||
the "instrument/stubs" directory to it, then customize it. Use:
|
||||
|
||||
<screen>
|
||||
./configure [...] --enable-instrumentation="instrument/myinstrument"
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Instrumentation commands</title>
|
||||
<para>
|
||||
<screen>
|
||||
instrument [command] calls BX_INSTR_DEBUG_CMD instrumentation callback with [command]
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Other Commands</title>
|
||||
<para>
|
||||
|
||||
<screen>ptime</screen>
|
||||
|
||||
Print the current time (number of ticks since start of simulation).
|
||||
|
||||
<screen>sb <varname>delta</varname></screen>
|
||||
|
||||
Insert a time break point "delta" instructions into the future ("delta" is a 64-bit integer followed by "L", for example 1000L).
|
||||
|
||||
<screen>sba <varname>time</varname></screen>
|
||||
|
||||
Insert a time break point at "time" ("time" is a 64-bit integer followed by "L", for example 1000L).
|
||||
|
||||
<screen>print-stack [<varname>num words</varname>]</screen>
|
||||
|
||||
Print the <varname>num words</varname> top 16-bit words on the stack. <varname>Num
|
||||
words</varname> defaults to 16. Only works reliably in protected mode when
|
||||
the base address of the stack segment is zero.
|
||||
|
||||
<screen>modebp</screen>
|
||||
|
||||
Toggles CPU mode switch breakpoint.
|
||||
|
||||
<screen>ldsym [global] <varname>filename</varname> [<varname>offset</varname>]</screen>
|
||||
|
||||
Load symbols from file <varname>filename</varname>. If the global keyword is
|
||||
added, then the the symbols will be visible in all contexts for which
|
||||
symbols have not been loaded. <varname>Offset</varname> (default is 0) is added to
|
||||
every symbol entry. The symbols are loaded in the current (executing)
|
||||
context.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The symbol file consists of zero or more lines of the format <screen>"%x %s"</screen>.
|
||||
|
||||
<screen>show [<varname>string</varname>]</screen>
|
||||
|
||||
<screen>
|
||||
Toggles show symbolic info (calls to begin with).
|
||||
show - shows current show mode
|
||||
show mode - show, when processor switch mode
|
||||
show int - show, when interrupt is happens
|
||||
show call - show, when call is happens
|
||||
show ret - show, when iret is happens
|
||||
show off - toggles off symbolic info
|
||||
show dbg-all - turn on all show flags
|
||||
show dbg-none - turn off all show flags
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="debugger-gui">
|
||||
<title>
|
||||
The Bochs debugger gui
|
||||
</title>
|
||||
<para>
|
||||
The graphical front-end for the Bochs command line debugger
|
||||
is available for Windows and GTK2 hosts.
|
||||
</para>
|
||||
<para>
|
||||
To use the gui debugger, you must configure Bochs with the
|
||||
default debugger switches and the <option>--enable-debugger-gui</option> flag.
|
||||
For example:
|
||||
<screen>
|
||||
./configure --enable-debugger --enable-disasm --enable-debugger-gui
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
At runtime you need to add the value <option>gui_debug</option> to the
|
||||
<link linkend="bochsopt-displaylibrary">display_library</link> options parameter
|
||||
in order to use the gui instead of the command line debugger. This example shows how to
|
||||
use it with the 'x' gui:
|
||||
<screen>
|
||||
display_library: x, options="gui_debug"
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
The gui debugger consists of a gui window with a menu bar, a button bar and some
|
||||
child windows that show the cpu registers, disassembler output, memory dump and
|
||||
the internal debugger output. A command prompt for entering debugger commands is
|
||||
also available.
|
||||
</para>
|
||||
<para>
|
||||
&FIXME; List the features here.
|
||||
</para>
|
||||
<para>
|
||||
Most of the gui debugger settings are now saved to an INI file on exit and
|
||||
restored at the next run.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>
|
||||
Related links
|
||||
</title>
|
||||
<para>
|
||||
&FIXME; For information on advanced debugger usage see the <ulink url="../development/debugger-advanced.html">developer documentation</ulink>
|
||||
(under construction).
|
||||
</para>
|
||||
</section>
|
||||
</section><!-- end: Using Bochs internal debugger -->
|
||||
|
||||
<section id="debugging-with-gdb">
|
||||
<title>Using Bochs and the remote GDB stub</title>
|
||||
|
Loading…
x
Reference in New Issue
Block a user