<?xml version="1.0"?>
<!DOCTYPE riscos-prm PUBLIC "-//Gerph//DTD PRM documentation 1.03//EN"
                            "http://gerph.org/dtd/103/prm.dtd">

<riscos-prm>
<chapter title="Debugger (Supplement for Pyromaniac)">
<section title="Introduction and overview">
<p>
The Debugger module within RISC OS Pyromaniac uses the
<reference type='link' name="Capstone Engine" href="https://github.com/capstone-engine/capstone"/>
to disassemble ARM code. The resulting output from the debugger is slightly
different to that which with Classic Debugger module produced. The manner in
which the disassembly is presented can be configured through the regular
RISC OS Pyromaniac configuration settings, and system variables.
</p>

<p>
    The RISC OS Pyromaniac version of the Debugger module also includes additional
    *Commands which were previously provided by extension commands.
</p>

</section>

<!--
<section title="Technical details">
<p>
</p>
</section>
-->


<section title="System variables">
<sysvar-definition name="Debugger$Options"
                   description="Configures the operation of *MemoryI">
<use>
<p>The <sysvar>Debugger$Options</sysvar> variable is used to change the way in
which the Debugger's <reference type="command" name="MemoryI"/> and
<reference type="command" name="DumpI"/> commands functions. It is defined as a space
separated list of options, where the leading character defines the option
to set. At the current time, only a single option is defined.</p>

<p>
    <definition-table>
        <definition name="C">Enables colouring of parts of the disassembly.</definition>
    </definition-table>
</p>
</use>

<compatibility>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.40' state='supported'/>
</compatibility>

<related>
    <reference type="command" name="MemoryI" />
</related>
</sysvar-definition>
</section>



<section title="SWI calls">


<swi-definition name="Debugger_Disassemble"
                number="40380"
                description="Disassemble an instruction for the current system"
                irqs="undefined"
                fiqs="enabled"
                processor-mode="SVC"
                re-entrant="undefined"
                >

<entry>

<register-use number="0">instruction to disassemble</register-use>
<register-use number="1">address to assume the instruction came from</register-use>
</entry>

<exit>

<register-use number="0" state="preserved" />
<register-use number="1">address of buffer containing null-terminated text</register-use>
<register-use number="2">length of disassembled line</register-use>

</exit>

<use>
<p>R0 contains the instruction to disassemble, for the current system. R1 contains the
address from which to assume the instruction came, which is needed for
instructions such as <code type="asm">B</code>, <code type="asm">BL</code>,
<code type="asm">LDR Rn, [PC...]</code>, and so on. On exit, R1 points to a
buffer which contains a zero terminated string. This string consists of the
instruction mnemonic, and any operands, in the format used by the <reference
type="command" name="MemoryI" /> instruction. The length in R2 excludes the
zero-byte. There may be comments following the operands, indicated by
a semicolon, for example <code type="asm">; Undefined behaviour</code>.</p>

<p>Earlier versions of the reference manuals defined this to be a 32bit value,
    assuming it to be for ARM. The SWI is now defined to disassemble an
    instruction in the current architecture of the system. This allows the SWI
    to be used on any system to decode instructions within the current system.
</p>
</use>

<related>
    <reference type="command" name="MemoryI" />
    <reference type="swi" name="Debugger_DisassembleThumb" />
</related>
</swi-definition>

<swi-definition name="Debugger_DisassembleThumb"
                number="40381"
                description="Disassemble an 16-bit thumb instruction"
                irqs="undefined"
                fiqs="enabled"
                processor-mode="SVC"
                re-entrant="undefined"
                >

<entry>

<register-use number="0">instruction to disassemble</register-use>
<register-use number="1">address to assume the instruction came from</register-use>
</entry>

<exit>

<register-use number="0" state="preserved" />
<register-use number="1">address of buffer containing null-terminated text</register-use>
<register-use number="2">length of disassembled line</register-use>

</exit>

<use>
<p>R0 contains the instruction to disassemble, for the current system. R1 contains the
address from which to assume the instruction came, which is needed for
instructions such as <code type="asm">B</code>, <code type="asm">BL</code>,
<code type="asm">LDR Rn, [PC...]</code>, and so on. On exit, R1 points to a
buffer which contains a zero terminated string. This string consists of the
instruction mnemonic, and any operands, in the format used by the <reference
type="command" name="MemoryI" /> instruction. The length in R2 excludes the
zero-byte. There may be comments following the operands, indicated by
a semicolon, for example <code type="asm">; Undefined behaviour</code>.</p>
</use>

<compatibility>
    <version riscos-lt='4' state='unsupported'/>
    <version riscos-ge='4' state='supported'/>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.55' state='supported'/>
</compatibility>

<related>
    <reference type="command" name="MemoryI" />
    <reference type="swi" name="Debugger_Disassemble" />
</related>
</swi-definition>

<swi-definition name="Debugger_Flags"
                number="40382"
                description="Change the default disassembly flags"
                irqs="undefined"
                fiqs="enabled"
                processor-mode="SVC"
                re-entrant="undefined"
                >

<entry>

<register-use number="0">BIC mask (flags to clear)</register-use>
<register-use number="1">EOR mask (flags to invert)</register-use>
</entry>

<exit>

<register-use number="0">old flags state before changes</register-use>
<register-use number="1">new flags state</register-use>

</exit>

<use>
<p>Debugger_Flags changes the default format that the disasssembly uses
    for instructions, operands and comments. The flags control individual
    features of the disassembly. Flags are architecture specific. The flags
    will be modified by applying the BIC mask to clear bits, and then the
    EOR mask to invert flags.
</p>
<p>The
    flags may also be controlled from the command line with
    <reference type='command' name='DisassembleFlags'/>, which uses the
    names of the flags to control their state.</p>

<p>For the ARM architecture, the flags may take the following values:</p>
<p>
    <bitfield-table>
        <bit number="0" name="FDwithR13">
            Use FD with R13, eg. STMDB R13 becomes STMFD R13.
        </bit>

        <bit number="1" name="APCS">
            Use APCS-R register set and recognise C function entry.
        </bit>

        <bit number="2" name="LFMstack">
            Use stack notation with LFM and SFM where possible.
        </bit>

        <bit number="3" name="LFS">
            Use LFS and SFS in preference to LFM &amp; SFM.
        </bit>

        <bit number="4" name="QuoteSWIs">
            Put quotes around SWI names.
        </bit>

        <bit number="5" name="UseDCD">
            Use DCD instead of 'Undefined instruction', and BRK where DCD &amp;x6000010 would be used.
        </bit>

        <bit number="6" name="UseVDU">
            Use VDU x instead of SWI OS_WriteI+x.
        </bit>

        <bit number="7" name="ANDEQasDCD">
            Use DCD instead of ANDEQ, MOV Rn,Rn (same register) etc.
        </bit>

        <bit number="8" name="UseADRL">
            Use ADRL/ADRX instead of ADR then ADD/SUB on same reg.
        </bit>

        <bit number="9" name="UseADRW">
            Use ADRW instead of ADD/SUB Rn,R12,#m and LDRW, STRW, LDRBW, STRBW instead of xxxx Rn,[R12,#m].
        </bit>

        <bit number="10" name="LongMul">
            Append L to UMUL, UMLA, SMUL, SMLA (thus using the 'official' forms).
        </bit>

        <bit number="11" name="UseLDRL">
            Use LDRL instead of ADD/SUB Rn,Rm,#o + LDR Rn,[Rn,#p] and ADD/SUB Rm,Ra,#o + LDR Rn,[Ra,#p]! and STR instead of equivalent STRs. (The LDRWL form is enabled by this *and* UseADRW)
        </bit>

        <bit number="12" name="UseNOP">
            Use NOP instead of MOV R0,R0.
        </bit>

        <bit number="13" name="OldPSR">
            Use the old PSR suffixes _ctl, _flg, _all.
        </bit>

        <bit number="14" name="Wide">
            Disassemble for wide display.
        </bit>

        <bit number="15" name="HSLO">
            Use HS and LO instead of CS and CC.
        </bit>

        <bit number="16" name="Shift">
            Use x&lsl;y comments where possible for numbers &ge; 8192. This affects arithmetic and logic instructions.
            y is restricted to multiples of 4 if possible, unless x=1.
        </bit>

        <bit number="17" name="Lower">
            Force all register names to lower case.
        </bit>

        <bit number="18" name="ConstShift">
            <p>
            Display non-standard constant (x ROR y) as #x,y. This flag affects certain instructions in which the
            constant is not stored in the standard way, possibly having unexpected effects if you try to reassemble
            the code.<br/>
            Affects: ANDS, ORRS, EORS, BICS, TEQ, TST (CMP and CMN are also affected).
            16 encoded as 64&lsr;2 will be displayed as '#64,2'.
            </p>
        </bit>

        <bit number="19" name="ConstShiftAll">
            Display non-standard constant (x ROR y) as #x,y.
        </bit>
        <bit number="20-31" name="-">
            Reserved for future expansion.
        </bit>
    </bitfield-table>
</p>
</use>

<compatibility>
    <version riscos-lt='4' state='unsupported'/>
    <version riscos-ge='4' state='unsupported'/>
    <version supplier="Darren Salt">All disassembly flags are supported.</version>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.55'>
        <p>
        Supports a limited set of the flags:
        </p>
        <p>APCS, Lower, UseDCD, ANDEQasDCD, UseNOP, QuoteSWIs, UseVDU
        </p>
    </version>
</compatibility>

<related>
    <reference type="command" name="MemoryI" />
    <reference type="swi" name="Debugger_Disassemble" />
</related>
</swi-definition>



<swi-definition name="Debugger_DisassemblePlus"
                number="40384"
                description="Disassemble an instruction for the current system with flags"
                irqs="undefined"
                fiqs="enabled"
                processor-mode="SVC"
                re-entrant="undefined"
                >

<entry>

<register-use number="0">instruction to disassemble</register-use>
<register-use number="1">address to assume the instruction came from</register-use>
<register-use number="2">disassembly flags to use</register-use>
</entry>

<exit>

<register-use number="0" state="preserved" />
<register-use number="1">address of buffer containing null-terminated text</register-use>
<register-use number="2">length of disassembled line</register-use>

</exit>

<use>
    <p>Debugger_DisassemblePlus takes the same parameters as
        <reference type="swi" name="Debugger_Disassemble"/>, but overrides the default
        disassembly flags with explicit flags to use for this call. See
        <reference type="swi" name="Debugger_Flags"/> for details of the flags.
    </p>
</use>

<related>
    <reference type="command" name="MemoryI" />
    <reference type="swi" name="Debugger_Disassemble" />
    <reference type="swi" name="Debugger_DisassembleThumb" />
    <reference type="swi" name="Debugger_Flags" />
</related>
</swi-definition>

<swi-definition name="Debugger_DisassembleArch"
                number="40385"
                description="Disassemble an instruction for different architectures"
                irqs="undefined"
                fiqs="enabled"
                processor-mode="SVC"
                re-entrant="undefined"
                >

<entry>

<register-use number="0"><p>architecture identifier for disassembly, or -1 for current architecture</p>
        <p>
            <value-table>
                <value number="-1">Current architecture</value>
                <value number="0">ARM 32 bit (A32)</value>
                <value number="1">ARM 64 bit (A64)</value>
                <value number="2">x86 64 bit (x86-64)</value>
                <value number="3">Thumb</value>
                <value number="other">Reserved for future expansion</value>
            </value-table>
        </p>
</register-use>
<register-use number="1">pointer to instruction bytes</register-use>
<register-use number="2">number of instruction bytes supplied</register-use>
<register-use number="3">address to assume the instruction came from</register-use>
<register-use number="4">pointer to output buffer, or 0 to use internal buffer</register-use>
<register-use number="5">size of output buffer, or 0 to read size required</register-use>
<register-use number="6">flags to apply to disassembly (architecture specific), or &hex;FFFFFFFF for default flags</register-use>
</entry>

<exit>

<register-use number="0">architecture identifier used</register-use>
<register-use number="1">pointer to next instruction byte</register-use>
<register-use number="2">number of instruction bytes remaining in buffer, or a negative value to indicate the number of bytes that are required</register-use>
<register-use number="3" state="preserved"/>
<register-use number="4">address of buffer containing null-terminated text, in either the supplied or internal buffer</register-use>
<register-use number="5">number of bytes remaining in buffer, or negative number of bytes needed if buffer too short</register-use>
<register-use number="6">length of disassembled text</register-use>

</exit>

<use>
<p>This SWI is used to disassemble instructions in an architecture agnostic manner.
    Whilst <reference type="swi" name="Debugger_Disassemble" /> can disassemble the
    current architecture, it does not provide the ability to decode in a thread
    safe manner, and does not support variable length instruction sequences. This
    SWI supports both these features, and allows greater control over the disassembly
    with flags.
</p>
<p>
    The architecture identifier supplied is the same as that used by the module
    format, and OS_PlatformFeatures 64 interface.
</p>
<p>
    To support variable length instructions, R1 contains the pointer to an instruction
    sequence to disassemble, and R2 contains the number of bytes which are available
    at the pointer. If insufficient bytes have been supplied, an error will be returned
    and R2 will be the negative number of bytes required.
</p>

<p>
    If R5 is 0, or the value supplied is less than the size required for disassembly,
    an buffer overflow error (&hex;1E4) will be returned with R5 set to the negative
    size required. If R4 is set to 0 an internal buffer will be used (R5 must be set
    to a non-0 value).
</p>

<p>
    The disassembly format will use a semi-colon to delimit any additional commentary,
    as in standard ARM disassembly format.
</p>

</use>

<compatibility>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.55' state='supported'/>
</compatibility>

<related>
    <reference type="command" name="MemoryI" />
    <reference type="swi" name="Debugger_Disassemble" />
    <reference type="swi" name="Debugger_DisassembleThumb" />
</related>
</swi-definition>

</section>

<section title="*Commands">

<command-definition name="MemoryI"
                    description="Disassembles memory into instructions"
                    >



<syntax>
    <optional><userreplace>architecture</userreplace></optional>
    <userreplace>addr_or_reg1</userreplace>
    <userreplace>addr_or_reg1</userreplace>
</syntax>

<syntax>
    <optional><userreplace>architecture</userreplace></optional>
    <userreplace>addr_or_reg1</userreplace>
    <optional><text>+|-</text></optional>
    <userreplace>addr_or_reg2</userreplace>
</syntax>

<syntax>
    <optional><userreplace>architecture</userreplace></optional>
    <userreplace>addr_or_reg1</userreplace>
    <text>+|-</text><userreplace>addr_or_reg2</userreplace>
    <text>+</text><userreplace>addr_or_reg3</userreplace>
</syntax>

<!-- parameters -->
<parameter name="architecture"><p>architecture to disassemble with:</p>
<p>
    <definition-table>
        <definition name="A">ARM 32 bit instructions</definition>
        <definition name="T">Thumb 16 bit instructions</definition>
        <definition name="6">ARM 64 bit instructions</definition>
    </definition-table>
</p>
</parameter>
<parameter name="addr_or_reg1">hexadecimal address, module name, or register containing address for start of display</parameter>
<parameter name="addr_or_reg2">hexadecimal offset, or register containing offset</parameter>
<parameter name="addr_or_reg3">hexadecimal offset, or register containing offset</parameter>

<use>
<p>*MemoryI disassembles memory into ARM instructions.</p>

<p>If only one address is given, 24 instructions are disassembled starting
from addr_or_reg1. If two addresses are given, addr_or_reg2 specifies the
end of the range to be disassembled (as an absolute address or, if '+' or
'-' is present, as an offset from addr_or_reg1). If three addresses are
given, addr_or_reg2 specifies an offset for the start from addr_or_reg1, and
addr_or_reg3 specifies the end of the range to be disassembled (as an offset
from the combined address given by addr_or_reg1 and addr_or_reg2).</p>

<p>If a module is supplied as the first address, the base address of the module
    will be used.
    These options are particularly useful for disassembling modules, which
contain offsets, not addresses.</p>

<p>When ARM or Thumb are decoded, the allowed register names are
    r0 - r15, sp (equivalent to r13), lr (r14 without the psr bits) and
    pc (r15 without the psr bits). These are taken from the current
    ExceptionDumpArea. For non-ARM/Thumb architectures the register
    names are decoded using
    <reference type="swi" name="OS_PlatformFeatures" reason="64" href="?"/>.
    </p>

</use>

<compatibility>
    <version riscos-lt='4'>No support for architecture specification; only ARM disassembly is possible.
                           Module names are not supported. Disassembly flags are not supported.</version>
    <version riscos-ge='4'>ARM and Thumb architectures are supported. Disassembly flags are not supported.</version>
    <version supplier="Darren Salt">No support for architecture specification; only ARM disassembly is possible.
                           Module names are not supported. All disassembly flags are supported.</version>
    <version supplier="RISC OS Pyromaniac" riscos-lt='7.55'>
        No support for architecture specification; only ARM disassembly is possible.</version>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.55'>
        ARM 32bit, Thumb and ARM 64 bit supported.
        Limited support for disassembly flags.
    </version>
</compatibility>

<example>

<p><command>*modules</command>
<systemoutput>
No. Position Workspace Name<br />
...<br />
 22 0184D684 018016B4 Debugger<br />
...<br />
</systemoutput>
<command>*memoryi 184D684 +24</command>
<systemoutput>
0184D684 : .... : 00000000 : ANDEQ R0,R0,R0<br />
0184D688 : \... : 0000005C : ANDEQ R0,R0,R12,ASR R0<br />
0184D68C : (... : 00000128 : ANDEQ R0,R0,R8,LSR #2<br />
0184D690 : .... : 00000104 : ANDEQ R0,R0,R4,LSL #2<br />
0184D694 : (... : 00000028 : ANDEQ R0,R0,R8,LSR #32<br />
0184D698 : &gt;... : 0000003E : ANDEQ R0,R0,R14,LSR R0<br />
0184D69C : h... : 00000168 : ANDEQ R0,R0,R8,ROR #2<br />
0184D6A0 :  ... : 00040380 : ANDEQ R0,R4,R0,LSL #7<br />
0184D6A4 : u... : 000005FC : MULEQ R0,R12,R5
</systemoutput>
</p>

<p>
Offset of SWI handler is &amp;5FC<br />
Disassemble SWI handler<br />

<command>*memoryi 184D684 +5FC +20</command>
<systemoutput>
0184DC80 : .B-e : E92D4200 : STMDB   R13!,{R9,R14}<br />
0184DC84 : .A|u : E49CC000 : LDR     R12,[R12],#0<br />
0184DC88 : ..;a : E33B0000 : TEQ     R11,#0<br />
0184DC8C : .... : 0A000005 : BEQ     &amp;0184DCA8<br />
0184DC90 : ...a : E28F0004 : ADR     R0,&amp;0184DC9C<br />
0184DC94 : _..e : EB00075F : BL      &amp;0184FA18<br />
0184DC98 : . .e : E8BD8200 : LDMIA   R13!,{R9,PC}<br />
0184DC9C : .... : 0000010F : ANDEQ   R0,R0,PC,LSL #2<br />
</systemoutput>
</p>
</example>

<related>
    <reference type="command" name="Memory" href="?"/>
    <reference type="command" name="MemoryA" href="?"/>
    <reference type="swi" name="Debugger_Disassemble" />
    <reference type="swi" name="Debugger_DisassembleThumb" />
    <reference type="swi" name="Debugger_DisassembleArch" />
</related>
</command-definition>

<command-definition name="DumpI"
                    description="Disassembles a file into instructions"
                    >



<syntax>
    <userreplace>filename</userreplace>
    <optional><userreplace>architecture</userreplace></optional>
    <optional>
        <userreplace>file_offset</userreplace>
        <optional><userreplace>base_address</userreplace></optional>
    </optional>
</syntax>

<!-- parameters -->
<parameter name="filename">File to read and display contents of</parameter>
<parameter name="architecture"><p>architecture to disassemble with:</p>
<p>
    <definition-table>
        <definition name="A">ARM 32 bit instructions</definition>
        <definition name="T">Thumb 16 bit instructions</definition>
        <definition name="6">ARM 64 bit instructions</definition>
    </definition-table>
</p>
</parameter>
<parameter name="file_offset">Offset to start displaying file from</parameter>
<parameter name="base_address">Logical address to use as the start of the output</parameter>

<use>
<p>*DumpI displays the contents of a file as a disassembly in a similar way to
    <reference type="command" name="Dump" href="?"/>.</p>

<p>If the architecture is not supplied, the current architecture is used.
    If the file offset is not supplied, the entire file will be shown, from
    the beginning. If the base address is not supplied, the base address will
    be 0, unless the file is an Absolute or Debug image, in which case it will
    use &hex;8000.</p>

</use>

<compatibility>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.55' state='supported'/>
</compatibility>

<related>
    <reference type="command" name="MemoryI"/>
    <reference type="command" name="Dump" href="?"/>
</related>
</command-definition>


<command-definition name="ShowRegs"
                    description="Displays the register contents for the saved state"
                    >

<syntax>
</syntax>

<use>
<p>*ShowRegs displays the register contents for the saved state of the last exception.
    The information displayed is recovered from the program environment Exception Dump
    Area, the Exception Dump Region, and the Last Fault.</p>

<p>The information reported will be updated by the Kernel in the following cases:</p>

<p>
<list>
<item><p>undefined instruction</p></item>
<item><p>address exception</p></item>
<item><p>data abort</p></item>
<item><p>prefetch abort</p></item>
<item><p>break point.</p></item>
</list>
</p>

<p>Additionally, applications may update the state with soft exception information.</p>

<p>The regions referenced by registers are reported if recognisable, together with
    any memory that is currently present (which may differ from the memory at the time
    of the exception). A disassembly of the memory leading up to the failure will be
    displayed using the Exception Dump Region information. This may help when the memory
    in question has been modified before returning to the command line.</p>

<p>Information about the last exception recorded by the Kernel is displayed, togther
    with information about the fault status registers and their addresses.</p>

<p>It also prints the address in memory where the registers are stored, so
you can alter them (for example after a breakpoint) by using *MemoryA on
these locations, before using *Continue.</p>

</use>

<compatibility>
    <version supplier="Acorn">Only register values are shown.</version>
    <version supplier="RISCOS Ltd">Only register values are shown.</version>
    <version supplier="RISC&nbsp;OS Open Ltd">Only register values are shown.</version>

    <version supplier="RISC OS Pyromaniac">
        Information about the exception locations, the fault status and the
        disassembly leading up to the exception is reported.
        The registers reported use the architecture register information to
        display the register details.
    </version>
</compatibility>

<example>
<p><command>*ShowRegs</command></p>
<p>
<systemoutput>
Exception dump information for ARM (stored at &amp;0700035c):<br/>
<br/>
r0  = &amp;070023ec, r1  = &amp;00000000, r2  = &amp;00008700, r3  = &amp;00008201<br/>
r4  = &amp;00107fd8, r5  = &amp;0381f520, r6  = &amp;03817cfc, r7  = &amp;00000000<br/>
r8  = &amp;00008700, r9  = &amp;40000000, r10 = &amp;0000002a, r11 = &amp;03817cfe<br/>
r12 = &amp;00230000, sp  = &amp;04107f8c, lr  = &amp;04107f8c, pc  = &amp;0700235c<br/>
CPSR= &amp;80000013 : SVC-32 ARM fi ae qvczN<br/>
<br/>
Locations:<br/>
  lr:  DA 'SVC Stack'  (area offset &amp;7f8c)<br/>
  pc:  DA 'Module allocations', module 'Aborter'  (area offset &amp;180)<br/>
<br/>
Disassembly before pc (from time of exception):<br/>
  &amp;07002314 : &amp;ea000012 : B       &amp;07002364<br/>
  &amp;07002318 : &amp;ea000023 : B       &amp;070023ac<br/>
  &amp;0700231c : &amp;e28f0000 : ADR     r0, &amp;07002324<br/>
  &amp;07002320 : &amp;ea000005 : B       &amp;0700233c<br/>
  &amp;07002324 : &amp;000001e6 : ANDEQ   r0, r0, r6, ROR #3<br/>
  &amp;07002328 : &amp;726f6241 : ADRVC   r6, &amp;f700232c<br/>
  &amp;0700232c : &amp;20726574 : RSBSHS  r6, r2, r4, ROR r5<br/>
  &amp;07002330 : &amp;20495753 : SUBHS   r5, r9, r3, ASR r7<br/>
  &amp;07002334 : &amp;6e6b6e75 : MCRVS   p14, #3, r6, c11, c5, #3<br/>
  &amp;07002338 : &amp;006e776f : RSBEQ   r7, lr, pc, ROR #14<br/>
  &amp;0700233c : &amp;e1300000 : TEQ     r0, r0<br/>
  &amp;07002340 : &amp;e13f000f : TEQ     pc, pc<br/>
  &amp;07002344 : &amp;139ef201 : ORRSNE  pc, lr, #&amp;10000000        ; #268435456 = bit 28<br/>
  &amp;07002348 : &amp;e328f201 : MSR     apsr_nzcvq, #&amp;10000000    ; #------ --- -- -- qVczn<br/>
  &amp;0700234c : &amp;e1a0f00e : MOV     pc, lr<br/>
  &amp;07002350 : &amp;e3a0c823 : MOV     r12, #&amp;230000             ; #2293760 = 35&lt;&lt;16<br/>
  &amp;07002354 : &amp;e1a0f00e : MOV     pc, lr<br/>
  &amp;07002358 : &amp;e3a0c823 : MOV     r12, #&amp;230000             ; #2293760 = 35&lt;&lt;16<br/>
  &amp;0700235c > &amp;ee123456 > MRC     p4, #0, r3, c2, c6, #2<br/>
  &amp;07002360 : &amp;e1a0f00e : MOV     pc, lr<br/>
  &amp;07002364 : &amp;e1a0a00e : MOV     r10, lr<br/>
  &amp;07002368 : &amp;e3a0c823 : MOV     r12, #&amp;230000             ; #2293760 = 35&lt;&lt;16<br/>
<br/>
Last abort:<br/>
  Fault:  &amp;0700235c  (DA 'Module allocations', module 'Aborter')<br/>
</systemoutput>
</p>

</example>

<related>
</related>
</command-definition>



<command-definition name="DisassembleFlags"
                    description="Change the default flags used to format disassembly"
                    >

<syntax>
    <optional>
        <text>-</text><userreplace>flag_name</userreplace>
        <userreplace>state</userreplace>
    </optional>
</syntax>

<!-- parameters -->
<parameter name="flag_name">Flag to control (see below)</parameter>
<parameter name="state"><p>New state for the flag, which can take the following values:</p>
<p>
    <definition-table>
        <definition name="0">Disable flag</definition>
        <definition name="N">Disable flag</definition>
        <definition name="1">Enable flag</definition>
        <definition name="Y">Enable flag</definition>
    </definition-table>
</p>
</parameter>

<use>
<p>*DisassembleFlags changes the current default flags that are used to
change the disassembly of instructions. The flags are architecture specific.</p>

<p>See <reference type="swi" name="Debugger_Flags"/> for details of the flag
names and their meaning.</p>

</use>

<compatibility>
    <version riscos-lt='4' state='unsupported'/>
    <version riscos-eq='4' state='unsupported'/>
    <version supplier="Darren Salt">All disassembly flags are supported.</version>
    <version supplier="RISC OS Pyromaniac" riscos-lt='7.55' state='unsupported'/>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.55'>
        Limited support for disassembly flags. See Debugger_Flags for details.
    </version>
</compatibility>

<example>
<p><command>*DisassembleFlags -APCS Y</command>
</p>
</example>

<related>
    <reference type="command" name="MemoryI"/>
    <reference type="swi" name="Debugger_Disassemble" />
    <reference type="swi" name="Debugger_DisassembleThumb" />
    <reference type="swi" name="Debugger_DisassembleArch" />
    <reference type="swi" name="Debugger_DisassembleFlags" />
</related>
</command-definition>

<command-definition name="Vector"
                    description="List claimants of software vectors">

<syntax>
  <optional>
    <userreplace>vector</userreplace>
  </optional>
</syntax>

<parameter name="vector">
 Which vector should be listed. May be supplied as a vector number or a vector name.
</parameter>

<use>
<p>The <command>*Vector</command> command will list the software vectors which have been claimed.
    A vector number or name may be supplied to list only that vector.
    When no parameter is supplied, all vectors on the system will be listed.
</p>
</use>

<compatibility>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.14' state='supported'/>
</compatibility>

<example>
<command>*Vector 36</command>
<systemoutput><br/>
Vector 36 (SerialV):<br/>
    INTERNAL  :              : riscos.swis.osserialop.vector_SerialV
</systemoutput>
</example>


<related>
<!-- <reference type="command" name="AnotherCommand" /> -->
</related>

</command-definition>


<command-definition name="Tickers"
                    description="List claimants of ticker events">

<syntax>
</syntax>

<use>
<p>The <command>*Tickers</command> command will list the current ticker
   claimants. Claimants registered with <reference type='swi' name='OS_CallAfter' href='?'/>
   and <reference type='swi' name='OS_CallEvery' href='?'/> will be listed, together
   with the internally registered ticker events.
</p>
</use>

<compatibility>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.34' state='supported'/>
</compatibility>

<example>
<command>*Tickers</command>
<systemoutput><br/>
Tickers:<br/>
  &amp;07001f14/&amp;0700051c {DA 'Module area', module 'Freeway'}     : 9 cs, every 10 cs<br/>
  riscos.pymods.internet.RISCOSSockets.ticker(None)            : 49 cs, every 50 cs
</systemoutput>
</example>

<related>
    <reference type='command' name='TickerStats'/>
    <reference type='swi' name='OS_CallAfter' href='?'/>
    <reference type='swi' name='OS_CallEvery' href='?'/>
</related>

</command-definition>


<command-definition name="TickerStats"
                    description="List statistics about ticker events">

<syntax>
</syntax>

<use>
<p>The <command>*TickerStats</command> command will show statistics about the
Ticker system. If the statistics have been enabled, this will include call statistics
over a period.
</p>
</use>

<compatibility>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.34' state='supported'/>
</compatibility>

<example>
<command>*Tickers</command>
<systemoutput><br/>
Ticker statistics:<br/>
  Current tickers: 2<br/>
  Dispatches:<br/>
    second    : current =     1   last =     2<br/>
    15second  : current =     3   last =     -<br/>
    minute    : current =    29   last =     -<br/>
  Triggers:<br/>
    second    : current =     2   last =     2<br/>
    15second  : current =     4   last =     -<br/>
    minute    : current =    14   last =     -<br/>
  Max queue:<br/>
    second    : current =     2   last =     2<br/>
    15second  : current =     2   last =     -<br/>
    minute    : current =     2   last =     -<br/>
  Calls to CallEvery:<br/>
    second    : current =     -   last =     -<br/>
    15second  : current =     -   last =     -<br/>
    minute    : current =     2   last =     -<br/>
  Calls to CallAfter:<br/>
    second    : current =     -   last =     -
</systemoutput>
</example>


<related>
    <reference type='command' name='Tickers'/>
    <reference type='swi' name='OS_CallAfter' href='?'/>
    <reference type='swi' name='OS_CallEvery' href='?'/>
</related>

</command-definition>

</section>

</chapter>

<!-- MetaData -->
<meta>
 <maintainer>
  <email name="Gerph" address="gerph@gerph.org" />
 </maintainer>
 <disclaimer>
    <p>
        &copy; Gerph, 2022-24.
    </p>
 </disclaimer>

 <history>
  <revision number="1" author="Gerph" date="24 Dec 2022" title="Initial version">
    <change>Initial information about the Debugger module differences.</change>
  </revision>
  <revision number="2" author="Gerph" date="20 Sep 2023" title="Version information">
    <change>Version information added.</change>
  </revision>
  <revision number="3" author="Gerph" date="01 Jan 2024" title="Architectures support">
    <change>Debugger_Disassemble is now defined to decode instructions for the current system.</change>
    <change>Debugger_DisassembleThumb is documented.</change>
    <change>Debugger_DisassembleArch is documented.</change>
    <change>Debugger_Flags is documented.</change>
    <change>Debugger_DisassemblePlus is documented.</change>
    <change>*MemoryI architecture extensions are documented.</change>
    <change>*DumpI is documented.</change>
    <change>*DisassembleFlags is documenteed.</change>
  </revision>
 </history>

</meta>
</riscos-prm>
