From 6ae20a6ef630c4876ba6dfa18e36aa5aa7aa5d52 Mon Sep 17 00:00:00 2001 From: joost Date: Thu, 17 Jul 2014 17:37:10 +0000 Subject: [PATCH] FpDebugger (pure): Fix for showing exception-messages on Linux git-svn-id: trunk@45899 - --- .../lazdebuggerfp/fpdebugdebugger.pas | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index 1cdb5fd818..ffeb7d47ce 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -127,6 +127,7 @@ type function AddBreak(const ALocation: TDbgPtr): FpDbgClasses.TDbgBreakpoint; overload; function AddBreak(const AFileName: String; ALine: Cardinal): FpDbgClasses.TDbgBreakpoint; overload; function ReadData(const AAdress: TDbgPtr; const ASize: Cardinal; out AData): Boolean; + function ReadAddress(const AAdress: TDbgPtr; out AData: TDBGPtr): Boolean; procedure PrepareCallStackEntryList; property DebugInfo: TDbgInfo read GetDebugInfo; @@ -1115,8 +1116,8 @@ var b: byte; begin // Read address of the vmt - FDbgController.CurrentProcess.ReadAddress(AnAddr, VMTAddr); - FDbgController.CurrentProcess.ReadAddress(VMTAddr+3*DBGPTRSIZE[FDbgController.CurrentProcess.Mode], ClassNameAddr); + ReadAddress(AnAddr, VMTAddr); + ReadAddress(VMTAddr+3*DBGPTRSIZE[FDbgController.CurrentProcess.Mode], ClassNameAddr); // read classname (as shortstring) ReadData(ClassNameAddr, 1, b); setlength(result,b); @@ -1129,9 +1130,9 @@ var len: TDBGPtr; begin result := ''; - if not FDbgController.CurrentProcess.ReadAddress(AnAddr, StrAddr) then + if not ReadAddress(AnAddr, StrAddr) then Exit; - FDbgController.CurrentProcess.ReadAddress(StrAddr-DBGPTRSIZE[FDbgController.CurrentProcess.Mode], len); + ReadAddress(StrAddr-DBGPTRSIZE[FDbgController.CurrentProcess.Mode], len); setlength(result, len); if not ReadData(StrAddr, len, result[1]) then result := ''; @@ -1477,6 +1478,25 @@ begin {$endif linux} end; +function TFpDebugDebugger.ReadAddress(const AAdress: TDbgPtr; out AData: TDBGPtr): Boolean; +var + dw: DWord; + qw: QWord; +begin + case FDbgController.CurrentProcess.Mode of + dm32: + begin + result := ReadData(AAdress, sizeof(dw), dw); + AData:=dw; + end; + dm64: + begin + result := ReadData(AAdress, sizeof(qw), qw); + AData:=qw; + end; + end; +end; + procedure TFpDebugDebugger.PrepareCallStackEntryList; begin {$ifdef linux}