diff options
author | 2021-10-14 08:00:04 +1100 | |
---|---|---|
committer | 2021-10-14 08:00:04 +1100 | |
commit | 96ca1dbd965df08ed4ab1f23053690c9ce540f94 (patch) | |
tree | 7c357aa9efe72e7e9c8b6e7084cec9fa859e214a /docs/source/debugger | |
parent | 75f9660fa29d3d68a522fa96dbc92ef02baff2b8 (diff) |
More user experience improvements:
frontend: Allow clicking the adjuster arrows on menu items. This allows
things like video options and DIP switches to be configured using a
mouse only. Also fixed a bug preventing paging menus with a mouse if
the first item scrolled off the bottom is not selectable.
debugger: Allow wplist and bplist to accept a CPU argument to list
breakpoints/watchpoints for a single CPU only.
debugger: Fixed some corner cases in address space syntax in memory
accesses, and allowed memory region accesses to use tags relative to the
visible CPU.
emu/softlist.cpp: Ignore notes elements when loading software lists.
It's effectively a comment that isn't a comment syntactically, it's
being used for things that are not useful to display in the internal UI,
and it slows down startup.
docs: Updated three more pages of debugger documentation. Also updated
more of the built-in debugger help.
minimaws: Fixed up schema for software list notes, made sofware list
notes display initially collapsed.
Diffstat (limited to 'docs/source/debugger')
-rw-r--r-- | docs/source/debugger/breakpoint.rst | 237 | ||||
-rw-r--r-- | docs/source/debugger/execution.rst | 676 | ||||
-rw-r--r-- | docs/source/debugger/general.rst | 26 | ||||
-rw-r--r-- | docs/source/debugger/index.rst | 8 | ||||
-rw-r--r-- | docs/source/debugger/watchpoint.rst | 250 |
5 files changed, 702 insertions, 495 deletions
diff --git a/docs/source/debugger/breakpoint.rst b/docs/source/debugger/breakpoint.rst index 7dede5475be..1e61157c854 100644 --- a/docs/source/debugger/breakpoint.rst +++ b/docs/source/debugger/breakpoint.rst @@ -3,126 +3,163 @@ Breakpoint Debugger Commands ============================ +:ref:`debugger-command-bpset` + sets a breakpoint at <address> +:ref:`debugger-command-bpclear` + clears a specific breakpoint or all breakpoints +:ref:`debugger-command-bpdisable` + disables a specific breakpoint or all breakpoints +:ref:`debugger-command-bpenable` + enables a specific breakpoint or all breakpoints +:ref:`debugger-command-bplist` + lists breakpoints -You can also type **help <command>** for further details on each command in the MAME Debugger interface. -| :ref:`debugger-command-bpset` -- sets breakpoint at <address> -| :ref:`debugger-command-bpclear` -- clears a given breakpoint or all if no <bpnum> specified -| :ref:`debugger-command-bpdisable` -- disables a given breakpoint or all if no <bpnum> specified -| :ref:`debugger-command-bpenable` -- enables a given breakpoint or all if no <bpnum> specified -| :ref:`debugger-command-bplist` -- lists all the breakpoints - - - .. _debugger-command-bpset: +.. _debugger-command-bpset: bpset ----- -| **bp[set] <address>[,<condition>[,<action>]]** -| -| Sets a new execution breakpoint at the specified <address>. -| The optional <condition> parameter lets you specify an expression that will be evaluated each time the breakpoint is hit. If the result of the expression is true (non-zero), the breakpoint will actually halt execution; otherwise, execution will continue with no notification. -| The optional <action> parameter provides a command that is executed whenever the breakpoint is hit and the <condition> is true. Note that you may need to embed the action within braces { } in order to prevent commas and semicolons from being interpreted as applying to the bpset command itself. Each breakpoint that is set is assigned an index which can be used in other breakpoint commands to reference this breakpoint. -| -| Examples: -| -| bp 1234 -| -| Set a breakpoint that will halt execution whenever the PC is equal to 1234. -| -| bp 23456,a0 == 0 && a1 == 0 -| -| Set a breakpoint that will halt execution whenever the PC is equal to 23456 AND the expression (a0 == 0 && a1 == 0) is true. -| -| bp 3456,1,{printf "A0=%08X\\n",a0; g} -| -| Set a breakpoint that will halt execution whenever the PC is equal to 3456. When this happens, print A0=<a0val> and continue executing. -| -| bp 45678,a0==100,{a0 = ff; g} -| -| Set a breakpoint that will halt execution whenever the PC is equal to 45678 AND the expression (a0 == 100) is true. When that happens, set a0 to ff and resume execution. -| -| temp0 = 0; bp 567890,++temp0 >= 10 -| -| Set a breakpoint that will halt execution whenever the PC is equal to 567890 AND the expression (++temp0 >= 10) is true. This effectively breaks only after the breakpoint has been hit 16 times. -| -| Back to :ref:`debugger-breakpoint-list` - - - .. _debugger-command-bpclear: +**bp[set] <address>[:<CPU>][,<condition>[,<action>]]** + +Sets a new execution breakpoint at the specified **<address>**. The +**<address>** may optionally be followed by a colon and a tag or +debugger CPU number to set a breakpoint for a specific CPU. If no CPU +is specified, the breakpoint will be set for the CPU currently visible +in the debugger. + +The optional **<condition>** parameter lets you specify an expression +that will be evaluated each time the breakpoint address is hit. If the +result of the expression is true (non-zero), the breakpoint will halt +execution; otherwise, execution will continue with no notification. The +optional **<action>** parameter provides a command to be executed +whenever the breakpoint is hit and the **<condition>** is true. Note +that you may need to surround the action with braces ``{ }`` to ensure +commas and semicolons within the command are not interpreted in the +context of the ``bpset`` command itself. + +Each breakpoint that is set is assigned a numeric index which can be +used to refer to it in other breakpoint commands. Breakpoint indices +are unique throughout a session. + +Examples: + +``bp 1234`` + Set a breakpoint for the visible CPU that will halt execution + whenever the PC is equal to 1234. +``bp 23456,a0 == 0 && a1 == 0`` + Set a breakpoint for the visible CPU that will halt execution + whenever the PC is equal to 23456 *and* the expression + ``a0 == 0 && a1 == 0`` is true. +``bp 3456:audiocpu,1,{ printf "A0=%08X\n",a0 ; g }`` + Set a breakpoint for the CPU with the absolute tag path + ``:audiocpu`` that will halt execution whenever the PC is equal to + 3456. When this happens, print **A0=<a0val>** to the debugger + console and resume execution. +``bp 45678:2,a0==100,{ a0 = ff ; g }`` + Set a breakpoint on the third CPU in the system (zero-based index) + that will halt execution whenever the PC is equal to 45678 and the + expression ``a0 == 100`` is true. When that happens, set **a0** to + ff and resume execution. +``temp0 = 0 ; bp 567890,++temp0 >= 10`` + Set a breakpoint for the visible CPU that will halt execution + whenever the PC is equal to 567890 and the expression + ``++temp0 >= 10`` is true. This effectively breaks only after the + breakpoint has been hit sixteen times. + +Back to :ref:`debugger-breakpoint-list` + + +.. _debugger-command-bpclear: bpclear ------- -| **bpclear [<bpnum>]** -| -| The bpclear command clears a breakpoint. If <bpnum> is specified, only the requested breakpoint is cleared, otherwise all breakpoints are cleared. -| -| Examples: -| -| bpclear 3 -| -| Clear breakpoint index 3. -| -| bpclear -| -| Clear all breakpoints. -| -| Back to :ref:`debugger-breakpoint-list` - - - .. _debugger-command-bpdisable: +**bpclear [<bpnum>]** + +Clear breakpoints. If **<bpnum>** is specified, the breakpoint it +refers to will be cleared. If **<bpnum>** is not specified, all +breakpoints will be cleared. + +Examples: + +``bpclear 3`` + Clear the breakpoint with index 3. +``bpclear`` + Clear all breakpoints. + +Back to :ref:`debugger-breakpoint-list` + + +.. _debugger-command-bpdisable: bpdisable --------- -| **bpdisable [<bpnum>]** -| -| The bpdisable command disables a breakpoint. If <bpnum> is specified, only the requested breakpoint is disabled, otherwise all breakpoints are disabled. Note that disabling a breakpoint does not delete it, it just temporarily marks the breakpoint as inactive. -| -| Examples: -| -| bpdisable 3 -| -| Disable breakpoint index 3. -| -| bpdisable -| -| Disable all breakpoints. -| -| Back to :ref:`debugger-breakpoint-list` - - - .. _debugger-command-bpenable: +**bpdisable [<bpnum>]** + +Disable breakpoints. If **<bpnum>** is specified, the breakpoint it +refers to will be disabled. If **<bpnum>** is not specified, all +breakpoints will be disabled. + +Note that disabling a breakpoint does not delete it, it just temporarily +marks the breakpoint as inactive. Disabled breakpoints will not cause +execution to halt, their associated condition expressions will not be +evaluated, and their associated commands will not be executed. + +Examples: + +``bpdisable 3`` + Disable the breakpoint with index 3. +``bpdisable`` + Disable all breakpoints. + +Back to :ref:`debugger-breakpoint-list` + + +.. _debugger-command-bpenable: bpenable -------- -| **bpenable [<bpnum>]** -| -| The bpenable command enables a breakpoint. If <bpnum> is specified, only the requested breakpoint is enabled, otherwise all breakpoints are enabled. -| -| Examples: -| -| bpenable 3 -| -| Enable breakpoint index 3. -| -| bpenable -| -| Enable all breakpoints. -| -| Back to :ref:`debugger-breakpoint-list` - - - .. _debugger-command-bplist: +**bpenable [<bpnum>]** + +Enable breakpoints. If **<bpnum>** is specified, the breakpoint it +refers to will be enabled. If **<bpnum>** is not specified, all +breakpoints will be enabled. + +Examples: + +``bpenable 3`` + Enable the breakpoint with index 3. +``bpenable`` + Enable all breakpoints. + +Back to :ref:`debugger-breakpoint-list` + + +.. _debugger-command-bplist: bplist ------ -| **bplist** -| -| The bplist command lists all the current breakpoints, along with their index and any conditions or actions attached to them. -| -| Back to :ref:`debugger-breakpoint-list` +**bplist [<CPU>]** + +List current breakpoints, along with their indices and any associated +conditions or actions. If no **<CPU>** is specified, breakpoints for +all CPUs in the system will be listed; if a **<CPU>** is specified, only +breakpoints for that CPU will be listed. The **<CPU>** can be specified +by tag or by debugger CPU number (see :ref:`debugger-devicespec` for +details). + +Examples: + +``bplist`` + List all breakpoints. +``bplist .`` + List all breakpoints for the visible CPU. +``bplist maincpu`` + List all breakpoints for the CPU with the absolute tag path + ``:maincpu``. +Back to :ref:`debugger-breakpoint-list` diff --git a/docs/source/debugger/execution.rst b/docs/source/debugger/execution.rst index fd2cc597f26..cfcfede1c87 100644 --- a/docs/source/debugger/execution.rst +++ b/docs/source/debugger/execution.rst @@ -3,358 +3,456 @@ Execution Debugger Commands =========================== +:ref:`debugger-command-step` + single step for <count> instructions (F11) +:ref:`debugger-command-over` + single step over <count> instructions (F10) +:ref:`debugger-command-out` + single step until the current subroutine/exception handler returns + (Shift-F11) +:ref:`debugger-command-go` + resume execution (F5) +:ref:`debugger-command-gex` + resume execution until exception is raised +:ref:`debugger-command-gint` + resume execution until interrupt is taken (F7) +:ref:`debugger-command-gtime` + resume execution until the given delay has elapsed +:ref:`debugger-command-gvblank` + resume execution until next vertical blanking interval (F8) +:ref:`debugger-command-next` + resume execution until the next CPU switch (F6) +:ref:`debugger-command-focus` + focus debugger only on <CPU> +:ref:`debugger-command-ignore` + stop debugging on <CPU> +:ref:`debugger-command-observe` + resume debugging on <CPU> +:ref:`debugger-command-trace` + trace the specified CPU to a file +:ref:`debugger-command-traceover` + trace the specified CPU to a file skipping subroutines +:ref:`debugger-command-traceflush` + flush all open trace files. + + +.. _debugger-command-step: -You can also type **help <command>** for further details on each command in the MAME Debugger interface. +step +---- -| :ref:`debugger-command-step` -- single steps for <count> instructions (F11) -| :ref:`debugger-command-over` -- single steps over <count> instructions (F10) -| :ref:`debugger-command-out` -- single steps until the current subroutine/exception handler is exited (Shift-F11) -| :ref:`debugger-command-go` -- resumes execution, sets temp breakpoint at <address> (F5) -| :ref:`debugger-command-gint` -- resumes execution, setting temp breakpoint if <irqline> is taken (F7) -| :ref:`debugger-command-gtime` -- resumes execution until the given delay has elapsed -| :ref:`debugger-command-gvblank` -- resumes execution, setting temp breakpoint on the next VBLANK (F8) -| :ref:`debugger-command-next` -- executes until the next CPU switch (F6) -| :ref:`debugger-command-focus` -- focuses debugger only on <cpu> -| :ref:`debugger-command-ignore` -- stops debugging on <cpu> -| :ref:`debugger-command-observe` -- resumes debugging on <cpu> -| :ref:`debugger-command-trace` -- trace the given CPU to a file (defaults to active CPU) -| :ref:`debugger-command-traceover` -- trace the given CPU to a file, but skip subroutines (defaults to active CPU) -| :ref:`debugger-command-traceflush` -- flushes all open trace files. +**s[tep] [<count>]** +Single steps one or more instructions on the currently executing CPU. +Executes one instruction if **<count>** is omitted, or steps **<count>** +instructions if it is supplied. - .. _debugger-command-step: +Examples: + +``s`` + Steps forward one instruction on the current CPU. +``step 4`` + Steps forward four instructions on the current CPU. + +Back to :ref:`debugger-execution-list` -step ----- -| **s[tep] [<count>=1]** -| -| The step command single steps one or more instructions in the currently executing CPU. By default, step executes one instruction each time it is issued. You can also tell step to step multiple instructions by including the optional <count> parameter. -| -| Examples: -| -| s -| -| Steps forward one instruction on the current CPU. -| -| step 4 -| -| Steps forward four instructions on the current CPU. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-over: +.. _debugger-command-over: over ---- -| **o[ver] [<count>=1]** -| -| The over command single steps "over" one or more instructions in the currently executing CPU, stepping over subroutine calls and exception handler traps and counting them as a single instruction. Note that when stepping over a subroutine call, code may execute on other CPUs before the subroutine call completes. By default, over executes one instruction each time it is issued. You can also tell step to step multiple instructions by including the optional <count> parameter. -| -| Note that the step over functionality may not be implemented on all CPU types. If it is not implemented, then 'over' will behave exactly like 'step'. -| -| Examples: -| -| o -| -| Steps forward over one instruction on the current CPU. -| -| over 4 -| -| Steps forward over four instructions on the current CPU. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-out: +**o[ver] [<count>]** + +The over command single steps “over” one or more instructions on the +currently executing CPU, stepping over subroutine calls and exception +handler traps and counting them as a single instruction. Note that when +stepping over a subroutine call, code may execute on other CPUs before +the subroutine returns. + +Steps over one instruction if **<count>** is omitted, or steps over +**<count>** instructions if it is supplied. + +Note that the step over functionality may not be implemented for all CPU +types. If it is not implemented, then ``over`` will behave exactly like +:ref:`debugger-command-step`. + +Examples: + +``o`` + Steps forward over one instruction on the current CPU. +``over 4`` + Steps forward over four instructions on the current CPU. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-out: out --- -| **out** -| -| The out command single steps until it encounters a return from subroutine or return from exception instruction. Note that because it detects return from exception conditions, if you attempt to step out of a subroutine and an interrupt/exception occurs before you hit the end, then you may stop prematurely at the end of the exception handler. -| -| Note that the step out functionality may not be implemented on all CPU types. If it is not implemented, then 'out' will behave exactly like 'step'. -| -| Examples: -| -| out -| -| Steps until the current subroutine or exception handler returns. -| -| Back to :ref:`debugger-execution-list` +**out** + +Single steps until a return from subroutine or return from exception +instruction is encountered. Note that because it detects return from +exception conditions, if you attempt to step out of a subroutine and an +interrupt/exception occurs before the subroutine completes, execution +may stop prematurely at the end of the exception handler. + +Note that the step out functionality may not be implemented for all CPU +types. If it is not implemented, then ``out`` will behave exactly like +:ref:`debugger-command-step`. + +Example: +``out`` + Steps until a subroutine or exception handler returns. - .. _debugger-command-go: +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-go: go -- -| **g[o] [<address>]** -| -| The go command resumes execution of the current code. Control will not be returned to the debugger until a breakpoint or watchpoint is hit, or until you manually break in using the assigned key. The go command takes an optional <address> parameter which is a temporary unconditional breakpoint that is set before executing, and automatically removed when hit. -| -| Examples: -| -| g -| -| Resume execution until the next break/watchpoint or until a manual break. -| -| g 1234 -| -| Resume execution, stopping at address 1234 unless something else stops us first. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-gvblank: +**g[o] [<address>]** -gvblank -------- +Resumes execution. Control will not be returned to the debugger until a +breakpoint or watchpoint is triggered, or a debugger break is manually +requested. If the optional **<address>** is supplied, a temporary +unconditional breakpoint will be set for the visible CPU at the +specified address. It will be cleared automatically when triggered. + +Examples: -| **gv[blank]** -| -| The gvblank command resumes execution of the current code. Control will not be returned to the debugger until a breakpoint or watchpoint is hit, or until the next VBLANK occurs in the emulator. -| -| Examples: -| -| gv -| -| Resume execution until the next break/watchpoint or until the next VBLANK. -| -| Back to :ref:`debugger-execution-list` +``g`` + Resume execution until a breakpoint/watchpoint is triggered, or a + break is manually requested. +``g 1234`` + Resume execution, stopping at address 1234, unless another condition + causes execution to stop before then. +Back to :ref:`debugger-execution-list` - .. _debugger-command-gint: + +.. _debugger-command-gex: + +gex +--- + +**ge[x] [<exception>,[<condition>]]** + +Resumes execution. Control will not be returned to the debugger until +a breakpoint or watchpoint is triggered, or until an exception condition +is raised on the current CPU. Use the optional **<exception>** +parameter to stop execution only for a specific exception condition. If +**<exception>** is omitted, execution will stop for any exception +condition. + +The optional **<condition>** parameter lets you specify an expression +that will be evaluated each time the specified exception condition +is raised. If the result of the expression is true (non-zero), the +exception will halt execution; otherwise, execution will continue with +no notification. + +Examples: + +``gex`` + Resume execution until a breakpoint/watchpoint is triggered, or + until any exception condition is raised on the current CPU. +``ge 2`` + Resume execution until a breakpoint/watchpoint is triggered, or + until exception condition 2 is raised on the current CPU. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-gint: gint ---- -| **gi[nt] [<irqline>]** -| -| The gint command resumes execution of the current code. Control will not be returned to the debugger until a breakpoint or watchpoint is hit, or until an IRQ is asserted and acknowledged on the current CPU. You can specify <irqline> if you wish to stop execution only on a particular IRQ line being asserted and acknowledged. If <irqline> is omitted, then any IRQ line will stop execution. -| -| Examples: -| -| gi -| -| Resume execution until the next break/watchpoint or until any IRQ is asserted and acknowledged on the current CPU. -| -| gint 4 -| -| Resume execution until the next break/watchpoint or until IRQ line 4 is asserted and acknowledged on the current CPU. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-gtime: +**gi[nt] [<irqline>]** + +Resumes execution. Control will not be returned to the debugger until a +breakpoint or watchpoint is triggered, or until an interrupt is asserted +and acknowledged on the current CPU. Use the optional **<irqline>** +parameter to stop execution only for a specific interrupt line being +asserted and acknowledged. If **<irqline>** is omitted, execution will +stop when any interrupt is acknowledged. + +Examples: + +``gi`` + Resume execution until a breakpoint/watchpoint is triggered, or + any interrupt is asserted and acknowledged on the current CPU. +``gint 4`` + Resume execution until a breakpoint/watchpoint is triggered, or + interrupt request line 4 is asserted and acknowledged on the current + CPU. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-gtime: gtime ----- -| **gt[ime] <milliseconds>** -| -| The gtime command resumes execution of the current code. Control will not be returned to the debugger until a specified delay has elapsed. The delay is in milliseconds. -| -| Example: -| -| gtime #10000 -| -| Resume execution for ten seconds -| -| Back to :ref:`debugger-execution-list` +**gt[ime] <milliseconds>** + +Resumes execution. Control will not be returned to the debugger until a +specified interval of emulated time has elapsed. The interval is +specified in milliseconds. + +Example: + +``gtime #10000``` + Resume execution for ten seconds of emulated time. + +Back to :ref:`debugger-execution-list` - .. _debugger-command-next: +.. _debugger-command-gvblank: + +gvblank +------- + +**gv[blank]** + +Resumes execution. Control will not be returned to the debugger until a +breakpoint or watchpoint is triggered, or until the beginning of the +vertical blanking interval for an emulated screen. + +Example: + +``gv`` + Resume execution until a breakpoint/watchpoint is triggered, or a + vertical blanking interval starts. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-next: next ---- -| **n[ext]** -| -| The next command resumes execution and continues executing until the next time a different CPU is scheduled. Note that if you have used 'ignore' to ignore certain CPUs, you will not stop until a non-'ignore'd CPU is scheduled. -| -| Back to :ref:`debugger-execution-list` +**n[ext]** + +Resumes execution until a different CPU is scheduled. Execution will +not stop when a CPU is scheduled if it is ignored due to the use of +:ref:`debugger-command-ignore` or :ref:`debugger-command-focus`. +Example: - .. _debugger-command-focus: +``n`` + Resume execution, stopping when a different CPU that is not ignored + is scheduled. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-focus: focus ----- -| **focus <cpu>** -| -| Sets the debugger focus exclusively to the given <cpu>. This is equivalent to specifying 'ignore' on all other CPUs. -| -| Example: -| -| focus 1 -| -| Focus exclusively CPU #1 while ignoring all other CPUs when using the debugger. -| -| Back to :ref:`debugger-execution-list` +**focus <CPU>** + +Focus exclusively on to the specified **<CPU>**, ignoring all other +CPUs. The **<CPU>** argument can be a device tag or debugger CPU number +(see :ref:`debugger-devicespec` for details). This is equivalent to +using the :ref:`debugger-command-ignore` command to ignore all CPUs +besides the specified CPU. + +Examples: +``focus 1`` + Focus exclusively on the second CPU in the system (zero-based + index), ignoring all other CPUs. +``focus audiopcb:melodycpu`` + Focus exclusively on the CPU with the absolute tag path + ``:audiopcb:melodycpu``. - .. _debugger-command-ignore: +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-ignore: ignore ------ -| **ignore [<cpu>[,<cpu>[,...]]]** -| -| Ignores the specified <cpu> in the debugger. This means that you won't ever see execution on that CPU, nor will you be able to set breakpoints on that CPU. To undo this change use the 'observe' command. You can specify multiple <cpu>s in a single command. Note also that you are not permitted to ignore all CPUs; at least one must be active at all times. -| -| Examples: -| -| ignore 1 -| -| Ignore CPU #1 when using the debugger. -| -| ignore 2,3,4 -| -| Ignore CPU #2, #3 and #4 when using the debugger. -| -| ignore -| -| List the CPUs that are currently ignored. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-observe: +**ignore [<CPU>[,<CPU>[,...]]]** + +Ignores the specified CPUs in the debugger. CPUs can be specified by +tag or debugger CPU number (see :ref:`debugger-devicespec` for details). +The debugger never shows execution for ignored CPUs, and breakpoints or +watchpoints on ignored CPUs have no effect. If no CPUs are specified, +currently ignored CPUs will be listed. Use the +:ref:`debugger-command-observe` command to stop ignoring a CPU. + +Note that you cannot ignore all CPUs; at least CPU must be observed at +all times. + +Examples: + +``ignore audiocpu`` + Ignore the CPU with the absolute tag path ``:audiocpu`` when using + the debugger. +``ignore 2,3,4`` + Ignore the third, fourth and fifth CPUs in the system (zero-based + indices) when using the debugger. +``ignore`` + List the CPUs that are currently being ignored by the debugger. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-observe: observe ------- -| **observe [<cpu>[,<cpu>[,...]]]** -| -| Re-enables interaction with the specified <cpu> in the debugger. This command undoes the effects of the 'ignore' command. You can specify multiple <cpu>s in a single command. -| -| Examples: -| -| observe 1 -| -| Stop ignoring CPU #1 when using the debugger. -| -| observe 2,3,4 -| -| Stop ignoring CPU #2, #3 and #4 when using the debugger. -| -| observe -| -| List the CPUs that are currently observed. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-trace: +**observe [<CPU>[,<CPU>[,...]]]** + +Allow interaction with the specified CPUs in the debugger. CPUs can be +specified by tag or debugger CPU number (see :ref:`debugger-devicespec` +for details). This command reverses the effects of the +:ref:`debugger-command-ignore` command. If no CPUs are specified, +currently observed CPUs will be listed. + +Examples: + +``observe audiocpu`` + Stop ignoring the CPU with the absolute tag path ``:audiocpu`` when + using the debugger. +``observe 2,3,4`` + Stop ignoring the third, fourth and fifth CPUs in the system + (zero-based indices) when using the debugger. +``observe`` + List the CPUs that are currently being observed by the debugger. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-trace: trace ----- -| **trace {<filename>|OFF}[,<cpu>[,[noloop|logerror][,<action>]]]** -| -| Starts or stops tracing of the execution of the specified <cpu>. If <cpu> is omitted, the currently active CPU is specified. -| -| When enabling tracing, specify the filename in the <filename> parameter. To disable tracing, substitute the keyword 'off' for <filename>. -| -| <detectloops> should be either true or false. -| -| If 'noloop' is omitted, the trace will have loops detected and condensed to a single line. If 'noloop' is specified, the trace will contain every opcode as it is executed. -| -| If 'logerror' is specified, logerror output will augment the trace. If you wish to log additional information on each trace, you can append an <action> parameter which is a command that is executed before each trace is logged. Generally, this is used to include a 'tracelog' command. Note that you may need to embed the action within braces { } in order to prevent commas and semicolons from being interpreted as applying to the trace command itself. -| -| -| Examples: -| -| trace joust.tr -| -| Begin tracing the currently active CPU, logging output to joust.tr. -| -| trace dribling.tr,0 -| -| Begin tracing the execution of CPU #0, logging output to dribling.tr. -| -| trace starswep.tr,0,noloop -| -| Begin tracing the execution of CPU #0, logging output to starswep.tr, with loop detection disabled. -| -| trace starswep.tr,0,logerror -| -| Begin tracing the execution of CPU #0, logging output (along with logerror output) to starswep.tr. -| -| trace starswep.tr,0,logerror|noloop -| -| Begin tracing the execution of CPU #0, logging output (along with logerror output) to starswep.tr, with loop detection disabled. -| -| trace >>pigskin.tr -| -| Begin tracing the currently active CPU, appending log output to pigskin.tr. -| -| trace off,0 -| -| Turn off tracing on CPU #0. -| -| trace asteroid.tr,0,,{tracelog "A=%02X ",a} -| -| Begin tracing the execution of CPU #0, logging output to asteroid.tr. Before each line, output A=<aval> to the tracelog. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-traceover: +**trace {<filename>|off}[,<CPU>[,[noloop|logerror][,<action>]]]** + +Starts or stops tracing for execution of the specified **<CPU>**, or the +currently visible CPU if no CPU is specified. To enable tracing, +specify the trace log file name in the **<filename>** parameter. To +disable tracing, use the keyword ``off`` for for the **<filename>** +parameter. If the **<filename>** argument begins with two right angle +brackets (**>>**), it is treated as a directive to open the file for +appending rather than overwriting. + +The optional third parameter is a flags field. The supported flags are +``noloop`` and ``logerror``. Multiple flags must be separated by ``|`` +(pipe) characters. By default, loops are detected and condensed to a +single line. If the ``noloop`` flag is specified, loops will not be +detected and every instruction will be logged as executed. If the +``logerror`` flag is specified, error log output will be included in the +trace log. + +The optional **<action>** parameter is a debugger command to execute +before each trace message is logged. Generally, this will include a +:ref:`debugger-command-tracelog` or :ref:`debugger-command-tracesym` +command to include additional information in the trace log. Note that +you may need to surround the action within braces ``{ }`` to ensure +commas and semicolons within the command are not interpreted in the +context of the ``trace`` command itself. + +Examples: + +``trace joust.tr`` + Begin tracing the execution of the currently visible CPU, logging + output to the file **joust.tr**. +``trace dribling.tr,maincpu`` + Begin tracing the execution of the CPU with the absolute tag path + ``:maincpu:``, logging output to the file **dribling.tr**. +``trace starswep.tr,,noloop`` + Begin tracing the execution of the currently visible CPU, logging + output to the file **starswep.tr**, with loop detection disabled. +``trace starswep.tr,1,logerror`` + Begin tracing the execution of the second CPU in the system + (zero-based index), logging output along with error log output to + the file **starswep.tr**. +``trace starswep.tr,0,logerror|noloop`` + Begin tracing the execution of the first CPU in the system + (zero-based index), logging output along with error log output to + the file **starswep.tr**, with loop detection disabled. +``trace >>pigskin.tr`` + Begin tracing execution of the currently visible CPU, appending log + output to the file **pigskin.tr**. +``trace off,0`` + Turn off tracing for the first CPU in the system (zero-based index). +``trace asteroid.tr,,,{tracelog "A=%02X ",a}`` + Begin tracing the execution of the currently visible CPU, logging + output to the file **asteroid.tr**. Before each line, output + **A=<aval>** to the trace log. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-traceover: traceover --------- -| **traceover {<filename>|OFF}[,<cpu>[,<detectloops>[,<action>]]]** -| -| Starts or stops tracing of the execution of the specified <cpu>. -| -| When tracing reaches a subroutine or call, tracing will skip over the subroutine. The same algorithm is used as is used in the step over command. This means that traceover will not work properly when calls are recursive or the return address is not immediately following the call instruction. -| -| <detectloops> should be either true or false. If <detectloops> is *true or omitted*, the trace will have loops detected and condensed to a single line. If it is false, the trace will contain every opcode as it is executed. -| If <cpu> is omitted, the currently active CPU is specified. -| When enabling tracing, specify the filename in the <filename> parameter. -| To disable tracing, substitute the keyword 'off' for <filename>. -| If you wish to log additional information on each trace, you can append an <action> parameter which is a command that is executed before each trace is logged. Generally, this is used to include a 'tracelog' command. Note that you may need to embed the action within braces { } in order to prevent commas and semicolons from being interpreted as applying to the trace command itself. -| -| -| Examples: -| -| traceover joust.tr -| -| Begin tracing the currently active CPU, logging output to joust.tr. -| -| traceover dribling.tr,0 -| -| Begin tracing the execution of CPU #0, logging output to dribling.tr. -| -| traceover starswep.tr,0,false -| -| Begin tracing the execution of CPU #0, logging output to starswep.tr, with loop detection disabled. -| -| traceover off,0 -| -| Turn off tracing on CPU #0. -| -| traceover asteroid.tr,0,true,{tracelog "A=%02X ",a} -| -| Begin tracing the execution of CPU #0, logging output to asteroid.tr. Before each line, output A=<aval> to the tracelog. -| -| Back to :ref:`debugger-execution-list` - - - .. _debugger-command-traceflush: +**traceover {<filename>|off}[,<CPU>[,[noloop|logerror][,<action>]]]** + +Starts or stops tracing for execution of the specified **<CPU>**, or the +currently visible CPU if no CPU is specified. When a subroutine call is +encountered, tracing will skip over the subroutine. The same algorithm +is used as is used in the :ref:`step over <debugger-command-over>` +command. It will not work properly with recursive functions, or if the +return address does not immediately follow the call instruction. + +This command accepts the same parameters as the +:ref:`debugger-command-trace` command. Please refer to the +corresponding section for a detailed description of options and more +examples. + +Examples: + +``traceover joust.tr`` + Begin tracing the execution of the currently visible CPU, logging + output to the file **joust.tr**. +``traceover dribling.tr,maincpu`` + Begin tracing the execution of the CPU with the absolute tag path + ``:maincpu:``, logging output to the file **dribling.tr**. +``traceover starswep.tr,,noloop`` + Begin tracing the execution of the currently visible CPU, logging + output to the file **starswep.tr**, with loop detection disabled. +``traceover off,0`` + Turn off tracing for the first CPU in the system (zero-based index). +``traceover asteroid.tr,,,{tracelog "A=%02X ",a}`` + Begin tracing the execution of the currently visible CPU, logging + output to the file **asteroid.tr**. Before each line, output + **A=<aval>** to the trace log. + +Back to :ref:`debugger-execution-list` + + +.. _debugger-command-traceflush: traceflush ---------- -| **traceflush** -| -| Flushes all open trace files. -| -| Back to :ref:`debugger-execution-list` +**traceflush** + +Flushes all open trace log files to disk. + +Example: + +``traceflush`` + Flush trace log files. + +Back to :ref:`debugger-execution-list` diff --git a/docs/source/debugger/general.rst b/docs/source/debugger/general.rst index db1a1933149..9d7d206117e 100644 --- a/docs/source/debugger/general.rst +++ b/docs/source/debugger/general.rst @@ -3,6 +3,8 @@ General Debugger Commands ========================= +:ref:`debugger-command-help` + displays built-in help in the console :ref:`debugger-command-do` evaluates the given expression :ref:`debugger-command-symlist` @@ -43,6 +45,30 @@ General Debugger Commands exit the debugger and end the emulation session +.. _debugger-command-help: + +help +---- + +**help [<topic>]** + +Displays built-in debugger help in the debugger console. If no +**<topic>** is specified, top-level topics are listed. Most debugger +commands have correspondingly named help topics. + +Examples: + +``help`` + Lists top-level help topics. +``help expressions`` + Displays built-in help for debugger expression syntax. +``help wpiset`` + Displays built-in help for the + :ref:`wpiset <debugger-command-wpset>` command. + +Back to :ref:`debugger-general-list` + + .. _debugger-command-do: do diff --git a/docs/source/debugger/index.rst b/docs/source/debugger/index.rst index 639a1d1d535..c7503e8d678 100644 --- a/docs/source/debugger/index.rst +++ b/docs/source/debugger/index.rst @@ -274,14 +274,14 @@ The size may optionally be preceded by an access type specification: (program) * ``d`` or ``ld`` specifies a logical address defaulting to space 1 (data) -* ``i`` or ``li`` specifies a logical address defaulting to space 1 +* ``i`` or ``li`` specifies a logical address defaulting to space 2 (I/O) -* ``3`` or ``l3`` specifies a logical address defaulting to space 1 +* ``3`` or ``l3`` specifies a logical address defaulting to space 3 (opcodes) * ``pp`` specifies a physical address defaulting to space 0 (program) * ``pd`` specifies a physical address defaulting to space 1 (data) -* ``pi`` specifies a physical address defaulting to space 1 (I/O) -* ``p3`` specifies a physical address defaulting to space 1 (opcodes) +* ``pi`` specifies a physical address defaulting to space 2 (I/O) +* ``p3`` specifies a physical address defaulting to space 3 (opcodes) * ``r`` specifies direct read/write pointer access defaulting to space 0 (program) * ``o`` specifies direct read/write pointer access defaulting to space 3 diff --git a/docs/source/debugger/watchpoint.rst b/docs/source/debugger/watchpoint.rst index 6bce92fd6c9..d9270f13699 100644 --- a/docs/source/debugger/watchpoint.rst +++ b/docs/source/debugger/watchpoint.rst @@ -3,126 +3,172 @@ Watchpoint Debugger Commands ============================ - -You can also type **help <command>** for further details on each command in the MAME Debugger interface. - -| :ref:`debugger-command-wpset` -- sets program, data, or I/O space watchpoint -| :ref:`debugger-command-wpclear` -- clears a given watchpoint or all if no <wpnum> specified -| :ref:`debugger-command-wpdisable` -- disables a given watchpoint or all if no <wpnum> specified -| :ref:`debugger-command-wpenable` -- enables a given watchpoint or all if no <wpnum> specified -| :ref:`debugger-command-wplist` -- lists all the watchpoints - - .. _debugger-command-wpset: +:ref:`debugger-command-wpset` + sets memory access watchpoints +:ref:`debugger-command-wpclear` + clears watchpoints +:ref:`debugger-command-wpdisable` + disables watchpoints +:ref:`debugger-command-wpenable` + enables enables watchpoints +:ref:`debugger-command-wplist` + lists watchpoints + +.. _debugger-command-wpset: wpset ----- -| **wp[{d|i}][set] <address>,<length>,<type>[,<condition>[,<action>]]** -| -| Sets a new watchpoint starting at the specified <address> and extending for <length>. The inclusive range of the watchpoint is <address> through <address> + <length> - 1. -| The 'wpset' command sets a watchpoint on program memory; the 'wpdset' command sets a watchpoint on data memory; and the 'wpiset' sets a watchpoint on I/O memory. -| The <type> parameter specifies which sort of accesses to trap on. It can be one of three values: 'r' for a read watchpoint 'w' for a write watchpoint, and 'rw' for a read/write watchpoint. -| -| The optional <condition> parameter lets you specify an expression that will be evaluated each time the watchpoint is hit. If the result of the expression is true (non-zero), the watchpoint will actually halt execution; otherwise, execution will continue with no notification. -| The optional <action> parameter provides a command that is executed whenever the watchpoint is hit and the <condition> is true. Note that you may need to embed the action within braces { } in order to prevent commas and semicolons from being interpreted as applying to the wpset command itself. -| Each watchpoint that is set is assigned an index which can be used in other watchpoint commands to reference this watchpoint. -| In order to help <condition> expressions, two variables are available. The variable 'wpaddr' is set to the address that actually triggered the watchpoint, the variable 'wpdata' is set to the data that is being read or written, and the variable 'wpsize' is set to the size of the data in bytes. -| -| Examples: -| -| wp 1234,6,rw -| -| Set a watchpoint that will halt execution whenever a read or write occurs in the address range 1234-1239 inclusive. -| -| wp 23456,a,w,wpdata == 1 -| -| Set a watchpoint that will halt execution whenever a write occurs in the address range 23456-2345f AND the data written is equal to 1. -| -| wp 3456,20,r,1,{printf "Read @ %08X\\n",wpaddr; g} -| -| Set a watchpoint that will halt execution whenever a read occurs in the address range 3456-3475. When this happens, print Read @ <wpaddr> and continue executing. -| -| temp0 = 0; wp 45678,1,w,wpdata==f0,{temp0++; g} -| -| Set a watchpoint that will halt execution whenever a write occurs to the address 45678 AND the value being written is equal to f0. When that happens, increment the variable temp0 and resume execution. -| -| Back to :ref:`debugger-watchpoints-list` - - - .. _debugger-command-wpclear: +**wp[{d|i|o}][set] <address>[:<space>],<length>,<type>[,<condition>[,<action>]]** + +Sets a new watchpoint starting at the specified **<address>** and +extending for **<length>**. The range of the watchpoint is +**<address>** through **<address>+<length>-1**, inclusive. The +**<address>** may optionally be followed by a CPU and/or address space +(see :ref:`debugger-devicespec` for details). If an address space is +not specified, the command suffix sets the address space: ``wpset`` +defaults to the first address space exposed by the CPU, ``wpdset`` +defaults to the space with index 1 (data), ``wpiset`` defaults to the +space with index 2 (I/O), and ``wposet`` defaults to the space with +index 3 (opcodes). The **<type>** parameter specifies the access types +to trap on – it can be one of three values: ``r`` for read accesses, +``w`` for write accesses, or ``rw`` for both read and write accesses. + +The optional **<condition>** parameter lets you specify an expression +that will be evaluated each time the watchpoint is triggered. If the +result of the expression is true (non-zero), the watchpoint will halt +execution; otherwise, execution will continue with no notification. The +optional **<action>** parameter provides a command to be executed +whenever the watchpoint is triggered and the **<condition>** is true. +Note that you may need to surround the action with braces ``{ }`` to +ensure commas and semicolons within the command are not interpreted in +the context of the ``wpset`` command itself. + +Each watchpoint that is set is assigned a numeric index which can be +used to refer to it in other watchpoint commands. Watchpoint indices +are unique throughout a session. + +To make **<condition>** expressions more useful, two variables are +available: for all watchpoints, the variable **wpaddr** is set to the +access address that triggered the watchpoint; for write watchpoints, the +variable **wpdata** is set to the data being written. + +Examples: + +``wp 1234,6,rw`` + Set a watchpoint for the visible CPU that will halt execution + whenever a read or write to the first address space occurs in the + address range 1234-1239, inclusive. +``wp 23456:data,a,w,wpdata == 1`` + Set a watchpoint for the visible CPU that will halt execution + whenever a write to the ``data`` space occurs in the address range + 23456-2345f and the data written is equal to 1. +``wp 3456:maincpu,20,r,1,{ printf "Read @ %08X\n",wpaddr ; g }`` + Set a watchpoint for the CPU with the absolute tag path ``:maincpu`` + that will halt execution whenever a read from the first address + space occurs in the address range 3456-3475. When this happens, + print **Read @ <wpaddr>** to the debugger console and resume + execution. +``temp0 = 0 ; wp 45678,1,w,wpdata==f0,{ temp0++ ; g }`` + Set a watchpoint for the visible CPU that will halt execution + whenever a write do the first address space occurs at address 45678 + where the value being written is equal to f0. When this happens, + increment the variable **temp0** and resume execution. + +Back to :ref:`debugger-watchpoints-list` + + +.. _debugger-command-wpclear: wpclear ------- -| **wpclear [<wpnum>]** -| -| The wpclear command clears a watchpoint. If <wpnum> is specified, only the requested watchpoint is cleared, otherwise all watchpoints are cleared. -| -| Examples: -| -| wpclear 3 -| -| Clear watchpoint index 3. -| -| wpclear -| -| Clear all watchpoints. -| -| Back to :ref:`debugger-watchpoints-list` - - - .. _debugger-command-wpdisable: +**wpclear [<wpnum>]** + +Clear watchpoints. If **<wpnum>** is specified, the watchpoint it +refers to will be cleared. If **<wpnum>** is not specified, all +watchpoints will be cleared. + +Examples: + +``wpclear 3`` + Clear the watchpoint with index 3. +``wpclear`` + Clear all watchpoints. + +Back to :ref:`debugger-watchpoints-list` + + +.. _debugger-command-wpdisable: wpdisable --------- -| **wpdisable [<wpnum>]** -| -| The wpdisable command disables a watchpoint. If <wpnum> is specified, only the requested watchpoint is disabled, otherwise all watchpoints are disabled. Note that disabling a watchpoint does not delete it, it just temporarily marks the watchpoint as inactive. -| -| Examples: -| -| wpdisable 3 -| -| Disable watchpoint index 3. -| -| wpdisable -| -| Disable all watchpoints. -| -| Back to :ref:`debugger-watchpoints-list` - - - .. _debugger-command-wpenable: +**wpdisable [<wpnum>]** + +Disable watchpoints. If **<wpnum>** is specified, the watchpoint it +refers to will be disabled. If **<wpnum>** is not specified, all +watchpoints will be disabled. + +Note that disabling a watchpoint does not delete it, it just temporarily +marks the watchpoint as inactive. Disabled watchpoints will not cause +execution to halt, their associated condition expressions will not be +evaluated, and their associated commands will not be executed. + +Examples: + +``wpdisable 3`` + Disable the watchpoint with index 3. +``wpdisable`` + Disable all watchpoints. + +Back to :ref:`debugger-watchpoints-list` + + +.. _debugger-command-wpenable: wpenable -------- -| **wpenable [<wpnum>]** -| -| The wpenable command enables a watchpoint. If <wpnum> is specified, only the requested watchpoint is enabled, otherwise all watchpoints are enabled. -| -| Examples: -| -| wpenable 3 -| -| Enable watchpoint index 3. -| -| wpenable -| -| Enable all watchpoints. -| -| Back to :ref:`debugger-watchpoints-list` - - - .. _debugger-command-wplist: +**wpenable [<wpnum>]** + +Enable watchpoints. If **<wpnum>** is specified, the watchpoint it +refers to will be enabled. If **<wpnum>** is not specified, all +watchpoints will be enabled. + +Examples: + +``wpenable 3`` + Enable the watchpoint with index 3. +``wpenable`` + Enable all watchpoints. + +Back to :ref:`debugger-watchpoints-list` + + +.. _debugger-command-wplist: wplist ------ -| **wplist** -| -| The wplist command lists all the current watchpoints, along with their index and any conditions or actions attached to them. -| -| Back to :ref:`debugger-watchpoints-list` +**wplist [<CPU>]** + +List current watchpoints, along with their indices and any associated +conditions or actions. If no **<CPU>** is specified, watchpoints for +all CPUs in the system will be listed; if a **<CPU>** is specified, only +watchpoints for that CPU will be listed. The **<CPU>** can be specified +by tag or by debugger CPU number (see :ref:`debugger-devicespec` for +details). + +Examples: + +``wplist`` + List all watchpoints. +``wplist .`` + List all watchpoints for the visible CPU. +``wplist maincpu`` + List all watchpoints for the CPU with the absolute tag path + ``:maincpu``. + +Back to :ref:`debugger-watchpoints-list` |