Commit be5b800a authored by Robert Sprowson's avatar Robert Sprowson

Add *Where to debugger's armoury

Largely inspired/ripped off from the DebugTools module, but using OS_DynamicArea 20 for the bulk of area searching. The address to lookup goes through the usual parser for Debugger commands so can be a hex address/register/implied exception PC if no arguments given.
Removed limited lookup from *ShowRegs command; this wasn't especially useful being hardwired to PC since only data aborts have a valid PC, normally the other registers are more interesting.
Fix miscapitalisation of ShowVFPRegs syntax (presumably to avoid it using Token0) by adding a DictTokens directive, since the syntax is used by code in the module which doesn't work with Token0.
Split German messages out into CmdHelp/Messages.

Tested in an IOMD ROM build with various edge cases.

Version 1.90. Tagged as 'Debugger-1_90'
parent 34aa3112
......@@ -101,6 +101,14 @@ ShowVFPRegs_Help
ShowVFPRegs_Syntax
= "Syntax: *",TokenEscapeChar,Token0
= " [A <addr>|C|E|]", 0
Where_Help
= "*",TokenEscapeChar,Token0
= " describes the region in memory of an address or register."
= 13
Where_Syntax
= "Syntax: *",TokenEscapeChar,Token0
= " [<addr|reg>]", 0
|
BreakClr_Help DCB "HDBGBCL", 0
BreakClr_Syntax DCB "SDBGBCL", 0
......@@ -137,6 +145,9 @@ ShowFPRegs_Syntax DCB "SDBGSFR", 0
ShowVFPRegs_Help DCB "HDBGSVR", 0
ShowVFPRegs_Syntax DCB "SDBGSVR", 0
Where_Help DCB "HDBGWHR", 0
Where_Syntax DCB "SDBGWHR", 0
]
ALIGN
......
No preview for this file type
......@@ -85,9 +85,16 @@ M50:Bad breakpoint
M65:Unpredictable instruction
M75:Half-word at &
M76:Double-word at &
M95:Not in a module
M96:At offset
M97: in module
M15:Address &
M21:is at offset &
M28:is unknown RAM
M30:is nowhere in RAM
M96:is system workspace
M34:in ROM
M47:in module
M88:in application memory
M89:in dynamic area
M95:in the Kernel
F00:infinity
F01:quiet NaN
......
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.89"
Module_Version SETA 189
Module_MajorVersion SETS "1.90"
Module_Version SETA 190
Module_MinorVersion SETS ""
Module_Date SETS "08 Feb 2015"
Module_ApplicationDate SETS "08-Feb-15"
Module_Date SETS "22 Jul 2015"
Module_ApplicationDate SETS "22-Jul-15"
Module_ComponentName SETS "Debugger"
Module_ComponentPath SETS "castle/RiscOS/Sources/Programmer/Debugger"
Module_FullVersion SETS "1.89"
Module_HelpVersion SETS "1.89 (08 Feb 2015)"
Module_FullVersion SETS "1.90"
Module_HelpVersion SETS "1.90 (22 Jul 2015)"
END
/* (1.89)
/* (1.90)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.89
#define Module_MajorVersion_CMHG 1.90
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Feb 2015
#define Module_Date_CMHG 22 Jul 2015
#define Module_MajorVersion "1.89"
#define Module_Version 189
#define Module_MajorVersion "1.90"
#define Module_Version 190
#define Module_MinorVersion ""
#define Module_Date "08 Feb 2015"
#define Module_Date "22 Jul 2015"
#define Module_ApplicationDate "08-Feb-15"
#define Module_ApplicationDate "22-Jul-15"
#define Module_ComponentName "Debugger"
#define Module_ComponentPath "castle/RiscOS/Sources/Programmer/Debugger"
#define Module_FullVersion "1.89"
#define Module_HelpVersion "1.89 (08 Feb 2015)"
#define Module_LibraryVersionInfo "1:89"
#define Module_FullVersion "1.90"
#define Module_HelpVersion "1.90 (22 Jul 2015)"
#define Module_LibraryVersionInfo "1:90"
......@@ -23,7 +23,6 @@
; Kevin Bracey (ARMv4+5, Thumb, fixes/enhancements, 32-bit)
; Steve Revill (Slight changes to ADR and SWI disassembly)
; Ben Avison (halfword, doubleword and unaligned word support)
; John Ballance (module location added to showregs command output)
; 1.18 SKS Fixed disassembly of #xx,yy operands
; 1.19 SKS Fixed disassembly of LSR #32, ASR #32
......@@ -826,6 +825,7 @@ ihflag * 0
Command ShowRegs, 0, 0, ihflag
Command ShowFPRegs, 0, 0, ihflag
Command ShowVFPRegs, 2, 0, ihflag
Command Where, 1, 0, ihflag
DCB 0 ; end of table
GET TokHelpSrc
......@@ -3403,8 +3403,6 @@ InitStore_Error
ALIGN
UserMemStart * &8000
InitStore_Code Entry "r6-r11"
LDR wp, [r12]
......@@ -3420,7 +3418,7 @@ InitStore_Code Entry "r6-r11"
LDREQ r7, =&E7FFFFFF ; A nice invalid instruction
SWI XOS_GetEnv ; r1 -> end of user memory
MOV r14, #UserMemStart
MOV r14, #AppSpaceStart
10 TEQ r14, r1 ; Might have zero apl space
STRNE r7, [r14], #4
BNE %BT10
......@@ -3583,11 +3581,8 @@ ShowRegs_Code_Common Entry "r6-r11"
BL message_writes
DCB "M14", 0 ; " PSR = "
BLVC DisplayHexWord
SWIVC XOS_NewLine
; display module title if available
BLVC ModuleWhere
SWIVC XOS_NewLine
EXIT
ShowRegs_Mode_26
......@@ -3631,48 +3626,9 @@ ShowRegs_Mode_26
BLVC DoFlagBit
SWIVC XOS_NewLine
EXIT
; display module title if available
BLVC ModuleWhere
EXIT
; wp already setup
ModuleWhere
Entry "r0 - r3, r10"
adr r10, Registers
ldr r10, [r10, #15<<2] ; get PC
mov r1, #0
mov r2, #0
MW1
mov r0, #ModHandReason_GetNames
swi XOS_Module
bvs MW2
subs r0, r10, r3 ; check address still ahead of us
blt MW2 ; no .. gone too far
ldr r4, [r3,#-4] ; get module rma length
cmp r0, r4 ; check if in this module
bgt MW1 ; no.. still ahead of us
; got the module address
BL message_writes
DCB "M96", 0 ; "At offset "
ALIGN
mov r10, r0 ; offset
bl DisplayHexWord
BL message_writes
DCB "M97", 0 ; " in module "
ALIGN
ldr r0, [r3, #16] ; module name pointer
add r0, r0, r3
swi XOS_Write0
b MW3
; not in a module
MW2
BL message_writes
DCB "M95", 0 ; "Not in a module"
ALIGN
MW3
swi XOS_NewLine
EXIT
ARM_Modes
DCB "USR", 0
DCB "FIQ", 0
......@@ -6388,6 +6344,166 @@ fpinst DCB "FPINST = ", 0
fpinst2 DCB "FPINST2 = ", 0
ALIGN
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Where_Error
DCD ErrorNumber_Syntax
DCB "SDBGWHR", 0
Where_UMod
DCB "UtilityModule", 0
ALIGN
Where_Code Entry "r6-r11"
LDR wp, [r12]
MOV r1, r0
ADR r0, Where_Error
MOV r10, #0 ; arguments can only be 32-bit
BL ReadOneParm ; r7 := parm, r8 state
BLVS CopyError
EXIT VS
TST r8, #hasparm
LDREQ r7, pc_register ; Use exception PC if no parms
LDREQB r0, SysIs32bit
TEQEQ r0, #0
BICEQ r7, r7, #ARM_CC_Mask
MOV r8, #0 ; No details
BL message_writes
DCB "M15", 0 ; "Address &"
ALIGN
MOVVC r10, r7
BLVC DisplayHexWord
SWIVC XOS_WriteI+space
EXIT VS
; Applications sometimes go pop
MOV r0, #-1
SWI XOS_ReadDynamicArea
ADD r2, r2, r0
CMP r7, r0
CMPCS r2, r7
SUBHI r7, r7, r0 ; Offset
ADRHI r0, Where_AppSlot ; In the app slot
BHI %FT85
; Anything in the MB below UtilityModule is Kernel (might include HAL)
MOV r0, #ModHandReason_LookupName
ADR r1, Where_UMod
SWI XOS_Module
MOV r9, r3, LSR #20
CMP r7, r9, LSL #20
CMPCS r3, r7
SUBHI r7, r7, r9, LSL #20
ADRHI r0, Where_Kernel ; In the kernel
BHI %FT85
; Scan the module chain
MOV r1, #0
MOV r2, #0
10
MOV r0, #ModHandReason_GetNames
SWI XOS_Module
BVS %FT20
LDR r0, [r3, #-4] ; Load the module size word
SUB r0, r0, #4 ; Size word includes itself. Remove that.
ADD r0, r3, r0
CMP r7, r3
CMPCS r0, r7
ADRHI r0, Where_Module ; Is within that module
SUBHI r7, r7, r3 ; Offset
LDRHI r8, [r3, #Module_Title]
ADDHI r8, r8, r3 ; Detail
BHI %FT85
B %BT10
20
; Perhaps in ROM in a gap not occupied by a module
MOV r3, #8
ORR r0, r3, #3:SHL:8 ; ROM
SWI XOS_Memory
TEQ r1, #0
ORREQ r0, r3, #5:SHL:8 ; else Soft ROM
SWIEQ XOS_Memory
MUL r3, r1, r2 ; Amount of ROM
ADD r3, r3, r9, LSL #20 ; End of ROM
CMP r7, r9, LSL #20
CMPCS r3, r7
SUBHI r7, r7, r9, LSL #20
ADRHI r0, Where_ROM ; Somewhere in ROM
BHI %FT85
30
; Dynamic and system areas
MOV r0, #20 ; If this subreason's not supported then
MOV r1, r7 ; it's just a more vague report
SWI XOS_DynamicArea
BVS %FT40
CMP r0, #1 ; Dynamic area or system area?
BHI %FT40
ADREQ r0, Where_SysWksp ; In some system workspace
BEQ %FT80
MOV r10, r7
MOV r0, #2
SWI XOS_DynamicArea
EXIT VS
SUB r7, r10, r3 ; Offset
; Detail in r8 already
ADR r0, Where_DynArea ; In a dynamic area
B %FT85
40
; Does is exist at all?
MOV r0, r7
ADD r1, r7, #4
SWI XOS_ValidateAddress
ADRCS r0, Where_NotMapped ; C set, is not RAM
ADRCC r0, Where_Unknown ; Somewhere, but not sure where
80
; Say "is <somewhere vague>"
BL message_write0
B %FT88
85
; Say "is at offset &xx in <some area> 'detail'"
; => r0 -> area name token
; r7 = offset
; r8 -> detail string
BL message_writes
DCB "M21", 0
ALIGN
MOVVC r10, r7
BLVC DisplayHexWord
SWIVC OS_WriteI+space
BLVC message_write0
TEQ r8, #0 ; NULL details? V preserved
BEQ %FT88
SWIVC OS_WriteI+space
SWIVC OS_WriteI+"'"
MOVVC r0, r8
SWIVC OS_Write0
SWIVC OS_WriteI+"'"
88
SWIVC OS_NewLine
EXIT
Where_Unknown DCB "M28", 0
Where_NotMapped DCB "M30", 0
Where_ROM DCB "M34", 0
Where_Module DCB "M47", 0
Where_AppSlot DCB "M88", 0
Where_DynArea DCB "M89", 0
Where_Kernel DCB "M95", 0
Where_SysWksp DCB "M96", 0
ALIGN
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -6409,14 +6525,14 @@ declareresourcefsfiles
InsertDebugRoutines
]
GET s.ARMv6
GET s.FP
GET ARMv6.s
GET FP.s
[ UseCVFPNEON
GET s.CGlue
GET CGlue.s
|
GET s.VFP
GET VFP.s
]
GET s.Thumb
GET s.CodeVar
GET Thumb.s
GET CodeVar.s
END
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment