From fda010dfd1514d9dae0f2d475a3c89bb4e8be46f Mon Sep 17 00:00:00 2001 From: joost Date: Mon, 9 Jun 2014 14:26:59 +0000 Subject: [PATCH] FpDebugger (pure): The dx-register is used to obtain the location of an exception. Fix for the difference in the dwarf-index of the dx-register on i386 and x86_64. git-svn-id: trunk@45429 - --- .../lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index cc1056766d..5fdb443f3d 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -1080,9 +1080,17 @@ var AnExceptionObjectLocation: TDBGPtr; ExceptionClass: string; ExceptionMessage: string; + RegDxDwarfIndex: byte; begin // Using regvar: - AnExceptionLocation:=GetLocationRec(FDbgController.CurrentProcess.MainThread.RegisterValueList.FindRegisterByDwarfIndex(2).NumValue); + // In all their wisdom, people decided to give the (r)dx register dwarf index + // 1 on for x86_64 and index 2 for i386. + if FDbgController.CurrentProcess.Mode=dm32 then + RegDxDwarfIndex:=2 + else + RegDxDwarfIndex:=1; + + AnExceptionLocation:=GetLocationRec(FDbgController.CurrentProcess.MainThread.RegisterValueList.FindRegisterByDwarfIndex(RegDxDwarfIndex).NumValue); AnExceptionObjectLocation:=FDbgController.CurrentProcess.MainThread.RegisterValueList.FindRegisterByDwarfIndex(0).NumValue; ExceptionClass := GetClassInstanceName(AnExceptionObjectLocation); ExceptionMessage := ReadAnsiString(AnExceptionObjectLocation+DBGPTRSIZE[FDbgController.CurrentProcess.Mode]);