From 801ce13eb69dd7ed2e2f254f2664ecbe54061b8c Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 6 Dec 2018 20:20:23 +0000 Subject: [PATCH] LazDebuggerFp: fix getting exception class/msg for 64bit targets git-svn-id: trunk@59742 - --- .../lazdebuggerfp/fpdebugdebugger.pas | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index 2a6c2834b7..a54fcd74a8 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -1647,19 +1647,27 @@ var AnExceptionObjectLocation: TDBGPtr; ExceptionClass: string; ExceptionMessage: string; - RegDxDwarfIndex: byte; + RegDxDwarfIndex, RegFirstArg: Cardinal; ExceptItem: TBaseException; begin // Using regvar: // 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 + if FDbgController.CurrentProcess.Mode=dm32 then begin + RegDxDwarfIndex:=2; + RegFirstArg := 0; // AX + end else begin RegDxDwarfIndex:=1; + {$IFDEF windows} + // Must be Win64 + RegFirstArg := 2; // RCX + {$ELSE} + RegFirstArg := 5; // RDI + {$ENDIF} + end; AnExceptionLocation:=GetLocationRec(FDbgController.CurrentThread.RegisterValueList.FindRegisterByDwarfIndex(RegDxDwarfIndex).NumValue); - AnExceptionObjectLocation:=FDbgController.CurrentThread.RegisterValueList.FindRegisterByDwarfIndex(0).NumValue; + AnExceptionObjectLocation:=FDbgController.CurrentThread.RegisterValueList.FindRegisterByDwarfIndex(RegFirstArg).NumValue; ExceptionClass := ''; ExceptionMessage := ''; if AnExceptionObjectLocation <> 0 then begin