m68k-amiga: print offsets during stacktraces, instead of absolute addresses, which are not really helpful in a single address space

This commit is contained in:
Karoly Balogh 2022-08-26 12:46:58 +02:00
parent 832b566097
commit ecbd5840ce
2 changed files with 22 additions and 0 deletions

View File

@ -259,3 +259,13 @@ Procedure DoThreadExitProcChain;
Begin
DoThreadProcChain(threadExitProcList);
End;
{$ifdef FPC_SYSTEM_HAS_BACKTRACESTR}
function SysBackTraceStr (Addr: CodePointer): ShortString;
begin
if (addr<codestart) or (addr>codeend) then
SysBackTraceStr:=' Addr $'+hexstr(addr)
else
SysBackTraceStr:=' Offs $'+hexstr(pointer(addr-codestart));
end;
{$endif FPC_SYSTEM_HAS_BACKTRACESTR}

View File

@ -22,6 +22,7 @@ interface
{$define FPC_IS_SYSTEM}
{$define FPC_ANSI_TEXTFILEREC}
{$define FPC_SYSTEM_HAS_BACKTRACESTR}
{$if defined(AMIGA_V1_0_ONLY) or defined(AMIGA_V1_2_ONLY)}
{$define AMIGA_LEGACY}
@ -147,6 +148,15 @@ implementation
{$define FPC_SYSTEM_HAS_extractFloat32Sign}
{$endif defined(cpum68k) and defined(fpusoft)}
var
_start: byte; external name '_start';
{ __text_size is provided by the linker }
__text_size: ptruint; external name '___text_size';
var
codestart: pointer;
codeend: pointer;
{$I system.inc}
{$ifdef FPC_AMIGA_USE_OSHEAP}
{$i osheap.inc}
@ -351,6 +361,8 @@ begin
IsConsole := TRUE;
StackLength := CheckInitialStkLen(InitialStkLen);
StackBottom := StackTop - StackLength;
codestart := @_start;
codeend := pointer(ptruint(@_start) + ptruint(@__text_size));
{ OS specific startup }
AOS_wbMsg:=nil;
ASYS_origDir:=0;