Commit adb4bab6 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Exception dump fixes & improvements

Detail:
  c/ExceptionDump - Disable unused ExcLooksLikePSR() function. Fix DescribeBlocks() printing the wrong indices for OS_Memory 16 items. Make AnnotateAll() attempt to unwind the ABT/UND stack if the abort came from that mode. Fix some cases where empty lines used for formatting were missing.
  Resources/UK/Messages, Resources/Germany/Messages, s/ExceptionDump, h/exc - Add message tokens X25 & X26 for the ABT & UND stack headers.
Admin:
  Tested on BB-xM
  German messages in need of translation


Version 2.01. Tagged as 'Debugger-2_01'
No preview for this file type
No preview for this file type
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.00"
Module_Version SETA 200
Module_MajorVersion SETS "2.01"
Module_Version SETA 201
Module_MinorVersion SETS ""
Module_Date SETS "15 Aug 2017"
Module_ApplicationDate SETS "15-Aug-17"
Module_Date SETS "21 Feb 2018"
Module_ApplicationDate SETS "21-Feb-18"
Module_ComponentName SETS "Debugger"
Module_ComponentPath SETS "castle/RiscOS/Sources/Programmer/Debugger"
Module_FullVersion SETS "2.00"
Module_HelpVersion SETS "2.00 (15 Aug 2017)"
Module_FullVersion SETS "2.01"
Module_HelpVersion SETS "2.01 (21 Feb 2018)"
END
/* (2.00)
/* (2.01)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.00
#define Module_MajorVersion_CMHG 2.01
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 15 Aug 2017
#define Module_Date_CMHG 21 Feb 2018
#define Module_MajorVersion "2.00"
#define Module_Version 200
#define Module_MajorVersion "2.01"
#define Module_Version 201
#define Module_MinorVersion ""
#define Module_Date "15 Aug 2017"
#define Module_Date "21 Feb 2018"
#define Module_ApplicationDate "15-Aug-17"
#define Module_ApplicationDate "21-Feb-18"
#define Module_ComponentName "Debugger"
#define Module_ComponentPath "castle/RiscOS/Sources/Programmer/Debugger"
#define Module_FullVersion "2.00"
#define Module_HelpVersion "2.00 (15 Aug 2017)"
#define Module_LibraryVersionInfo "2:0"
#define Module_FullVersion "2.01"
#define Module_HelpVersion "2.01 (21 Feb 2018)"
#define Module_LibraryVersionInfo "2:1"
......@@ -632,10 +632,12 @@ void ExcDescribeAddr(exc_context_t *ctx, uint32_t addr, char *buf, size_t len)
}
#endif
#if 0
static bool ExcLooksLikePSR(uint32_t val)
{
return ((val & 0x0ffff010) == 0x10);
}
#endif
static bool ExcLooksLikeSWINum(uint32_t val)
{
......@@ -945,9 +947,10 @@ static bool DescribeBlocks(exc_context_t *ctx)
ctx->print(ctx->print_param,"\n");
break;
case ExcDump_Chunk_OSMem16:
for(int i=0;i<((blocklen-12)/4);i+=3)
for(int i=0;(i*12)<(blocklen-12);i++)
{
snprintf(temp,sizeof(temp),ExcGetMsg(ctx,EXC_MSG_BLOCK_OSMEM16), pos[2]+i, pos[i+3], pos[i+4], pos[i+5]);
int j=i*3;
snprintf(temp,sizeof(temp),ExcGetMsg(ctx,EXC_MSG_BLOCK_OSMEM16), pos[2]+i, pos[j+3], pos[j+4], pos[j+5]);
ctx->print(ctx->print_param,temp);
}
break;
......@@ -1010,15 +1013,51 @@ static bool AnnotateReg(exc_context_t *ctx, uint32_t regno)
static void AnnotateAll(exc_context_t *ctx)
{
AnnotateReg(ctx, ExcDump_Reg_R15);
excresult r13 = ExcPeekReg(ctx, ExcDump_Reg_R13_irq);
eprocmode mode = (eprocmode) (ExcPeekReg(ctx, ExcDump_Reg_CPSR).val & 0x1f);
excresult r13;
uint32_t mem16[3];
bool mem16_ok = ExcPeekOSMem16(ctx, 2, mem16);
uint32_t low = mem16[0];
uint32_t high = mem16[0] + mem16[2];
bool mem16_ok;
uint32_t low,high;
bool nl = true;
/* The kernel doesn't tell us the original ABT/UND SP/R14, except for the case where the abort came from ABT/UND mode itself. So only attempt an ABT/UND stack dump if the abort came from that mode (otherwise we'll just be confusing the user by showing whatever junk the kernel has on the stack) */
if ((mode == ABT32) || (mode == UND32))
{
r13 = ExcPeekReg(ctx, ExcDump_Reg_R13);
mem16_ok = ExcPeekOSMem16(ctx, (mode == ABT32 ? 4 : 5), mem16);
low = mem16[0];
high = mem16[0] + mem16[2];
if (r13.ok && mem16_ok && (r13.val < high))
{
/* R14 may be &DEADDEAD if the CPU corrupted it in the process of raising the exception */
excresult r14 = ExcPeekReg(ctx, ExcDump_Reg_R14);
if ((r14.ok && (r14.val != 0xDEADDEAD) && AnnotateReg(ctx, ExcDump_Reg_R14)) || nl)
{
nl = false;
ctx->print(ctx->print_param, "\n");
}
if (r13.val < low)
{
r13.val = low;
}
ctx->print(ctx->print_param, ExcGetMsg(ctx, (mode == ABT32 ? EXC_MSG_ABT_STACK : EXC_MSG_UND_STACK)));
Annotate(ctx,r13.val,high,mode,0);
DumpAnnotations(ctx, r13.val, high-4);
ClearAnnotations(ctx);
ctx->print(ctx->print_param,"\n");
}
}
r13 = ExcPeekReg(ctx, ExcDump_Reg_R13_irq);
mem16_ok = ExcPeekOSMem16(ctx, 2, mem16);
low = mem16[0];
high = mem16[0] + mem16[2];
if (r13.ok && mem16_ok && (r13.val < high))
{
if (AnnotateReg(ctx, ExcDump_Reg_R14_irq))
if (AnnotateReg(ctx, ExcDump_Reg_R14_irq) || nl)
{
nl = false;
ctx->print(ctx->print_param, "\n");
}
if (r13.val < low)
......@@ -1043,8 +1082,9 @@ static void AnnotateAll(exc_context_t *ctx)
high = mem16[0] + mem16[2];
if (r13.ok && mem16_ok && (r13.val < high))
{
if (AnnotateReg(ctx, ExcDump_Reg_R14_svc))
if (AnnotateReg(ctx, ExcDump_Reg_R14_svc) || nl)
{
nl = false;
ctx->print(ctx->print_param, "\n");
}
if (r13.val < low)
......@@ -1061,8 +1101,9 @@ static void AnnotateAll(exc_context_t *ctx)
r13 = ExcPeekReg(ctx, ExcDump_Reg_R13_usr);
if (r13.ok)
{
if (AnnotateReg(ctx, ExcDump_Reg_R14_usr))
if (AnnotateReg(ctx, ExcDump_Reg_R14_usr) || nl)
{
nl = false;
ctx->print(ctx->print_param, "\n");
}
high = r13.val + 1024;
......
......@@ -63,6 +63,8 @@ typedef enum {
EXC_MSG_USR_STACK,
EXC_MSG_END,
EXC_MSG_CALLTO,
EXC_MSG_ABT_STACK,
EXC_MSG_UND_STACK,
} exc_msg;
/* This represents a single annotation block/column (e.g. decoded stack frame) */
......
......@@ -253,7 +253,7 @@ ExcDump_Init ROUT
; We need space for the following:
; * Error block (256 + 8)
; * Register dump (ExcDump_Reg_Count*4 + 8)
; * SVC, IRQ, ABT, UND stacks (??? + 12)*4
; * SVC, IRQ, ABT, UND stacks (???*4)
; * OS_Memory 16 items for the above (12 + 12*4)
; * IRQsema value (16)
; * IRQsema OS_RSI6 item (16)
......@@ -824,5 +824,7 @@ ExceptionMsgs
= "X22", 0 ; EXC_MSG_USR_STACK
= "X23", 0 ; EXC_MSG_END
= "X24", 0 ; EXC_MSG_CALLTO
= "X25", 0 ; EXC_MSG_ABT_STACK
= "X26", 0 ; EXC_MSG_UND_STACK
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