From fd1a09a254edd18eaa752fc34d7aa13424992974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1roly=20Balogh?= Date: Mon, 14 Jan 2019 11:47:54 +0000 Subject: [PATCH] morphos/lineinfo: updated the address adjustment comment added in r40857, no functional change git-svn-id: trunk@40860 - --- rtl/morphos/lineinfo.pp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rtl/morphos/lineinfo.pp b/rtl/morphos/lineinfo.pp index 83f8cfae94..76635b6b86 100644 --- a/rtl/morphos/lineinfo.pp +++ b/rtl/morphos/lineinfo.pp @@ -434,11 +434,12 @@ begin Store:=BackTraceStrFunc; BackTraceStrFunc:=@SysBackTraceStr; - { for valid stacktraces at least you have to substract sizeof(pointer) - from the trace address otherwise the lineinfo might be off-by-one, - because of course the backtrace addresses don't point to the jump - instructions, but the following address, which might belong to a - different source line entirely (KB) } + { on most architectures, (but not everywhere, Sparc is a notable exception) + for valid stacktraces you have to substract sizeof(pointer), or similar + instruction length from the trace address otherwise the lineinfo might + be off-by-one, because of course the backtrace addresses don't point to + the jump instructions, but the following address, which might belong to + a different source line entirely (KB) } Success:=GetLineInfo(ptruint(addr-sizeof(pointer)),func,source,line); { create string }