From 9b2f44b8c8c40d175e4fdbc75c1075046df2f29c Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 3 Nov 2018 22:45:16 +0000 Subject: [PATCH] Lldb/Gdb - FpDebug: fix crash in pretty printer when called from lldb/gdb mixed debugger (MemManager not set) git-svn-id: trunk@59443 - --- components/fpdebug/fppascalbuilder.pas | 8 ++++++-- .../lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp | 1 + .../lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/fpdebug/fppascalbuilder.pas b/components/fpdebug/fppascalbuilder.pas index 164e20c18c..c9b7490090 100644 --- a/components/fpdebug/fppascalbuilder.pas +++ b/components/fpdebug/fppascalbuilder.pas @@ -680,7 +680,10 @@ function TFpPascalPrettyPrinter.InternalPrintValue(out APrintedValue: String; exit; end; - Cache := MemManager.CacheManager.AddCache(AValue.DataAddress.Address, AValue.DataSize); + if (MemManager <> nil) and (MemManager.CacheManager <> nil) then + Cache := MemManager.CacheManager.AddCache(AValue.DataAddress.Address, AValue.DataSize) + else + Cache := nil; try if (ppvCreateDbgType in AFlags) then begin @@ -764,7 +767,8 @@ function TFpPascalPrettyPrinter.InternalPrintValue(out APrintedValue: String; APrintedValue := '(' + APrintedValue + ')'; Result := True; finally - MemManager.CacheManager.RemoveCache(Cache) + if Cache <> nil then + MemManager.CacheManager.RemoveCache(Cache) end; end; diff --git a/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp b/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp index da3c05471c..4eba69dd6e 100644 --- a/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp +++ b/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp @@ -276,6 +276,7 @@ begin exit; end; FpDebugger.FPrettyPrinter.AddressSize := ctx.SizeOfAddress; + FpDebugger.FPrettyPrinter.MemManager := ctx.MemManager; ALocals.Clear; for i := 0 to ProcVal.MemberCount - 1 do begin diff --git a/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas b/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas index 6fc97f164f..7db745ad61 100644 --- a/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas @@ -285,6 +285,7 @@ begin exit; end; FpDebugger.FPrettyPrinter.AddressSize := ctx.SizeOfAddress; + FpDebugger.FPrettyPrinter.MemManager := ctx.MemManager; ALocals.Clear; for i := 0 to ProcVal.MemberCount - 1 do begin