View Issue Details

IDProjectCategoryView StatusLast Update
0034657LazarusDebuggerpublic2018-12-07 20:38
ReporterDavid JenkinsAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformMacosOSOS Versionany
Product Version2.0RC2Product Build 
Target Version2.0Fixed in Version2.0 
Summary0034657: FpDebugLLDB crashes on Mac with bad access after rev 59729
DescriptionWhen starting up the FpDebugLLDB debugger on Mac it now closes the FileLoader in gpdbgdwarfdataclasses.pas:2951. This ends up in a call to TDbgImageLoader.CloseFileLoader when FFileLoader is NIL. I assume because the GetImageReader() function failed in TDbgImageLoader.Create. Because FFileLoader is nil, the call to FFileLoader.Close crashes.

Should FFileLoader be checked for nil before calling Close? I have attached a patch that does that.
Steps To ReproduceFor me just starting my project in FpDebugLLDB
TagsNo tags attached.
Fixed in Revision59745
LazTarget2.0
WidgetsetCocoa
Attached Files
  • DebugLoaderClose.patch (502 bytes)
    Index: Lazarus/laz-src/components/fpdebug/fpdbgloader.pp
    ===================================================================
    --- Lazarus/laz-src/components/fpdebug/fpdbgloader.pp	(revision 23542)
    +++ Lazarus/laz-src/components/fpdebug/fpdbgloader.pp	(revision 23543)
    @@ -223,7 +223,8 @@
     
     procedure TDbgImageLoader.CloseFileLoader;
     begin
    -  FFileLoader.Close;
    +  if FFileLoader <> nil then
    +    FFileLoader.Close;
     end;
     
     procedure TDbgImageLoader.AddToLoaderList(ALoaderList: TDbgImageLoaderList);
    

Activities

David Jenkins

2018-12-06 23:21

reporter  

DebugLoaderClose.patch (502 bytes)
Index: Lazarus/laz-src/components/fpdebug/fpdbgloader.pp
===================================================================
--- Lazarus/laz-src/components/fpdebug/fpdbgloader.pp	(revision 23542)
+++ Lazarus/laz-src/components/fpdebug/fpdbgloader.pp	(revision 23543)
@@ -223,7 +223,8 @@
 
 procedure TDbgImageLoader.CloseFileLoader;
 begin
-  FFileLoader.Close;
+  if FFileLoader <> nil then
+    FFileLoader.Close;
 end;
 
 procedure TDbgImageLoader.AddToLoaderList(ALoaderList: TDbgImageLoaderList);

Martin Friebe

2018-12-07 00:40

manager   ~0112417

Thanks for the report.

I also changed the image-reader to be created not owning the fileloader.
Otherwise (even though currently not the case) they could destroy the fileloader and leave the ImageLoader with a dangling pointer.

Please test and close if ok.

David Jenkins

2018-12-07 19:39

reporter   ~0112435

Works well. Thanks. Now if you can reduce the time it takes on Mac/lldb to return values for big objects (can take up to 20 seconds) it would be working close to optimal for me.

Martin Friebe

2018-12-07 20:38

manager   ~0112437

About time issues, please go to the forum or mail list. Thanks

Issue History

Date Modified Username Field Change
2018-12-06 23:21 David Jenkins New Issue
2018-12-06 23:21 David Jenkins Status new => assigned
2018-12-06 23:21 David Jenkins Assigned To => Martin Friebe
2018-12-06 23:21 David Jenkins File Added: DebugLoaderClose.patch
2018-12-07 00:40 Martin Friebe Fixed in Revision => 59745
2018-12-07 00:40 Martin Friebe LazTarget => 2.0
2018-12-07 00:40 Martin Friebe Note Added: 0112417
2018-12-07 00:40 Martin Friebe Status assigned => resolved
2018-12-07 00:40 Martin Friebe Fixed in Version => 2.0
2018-12-07 00:40 Martin Friebe Resolution open => fixed
2018-12-07 00:40 Martin Friebe Target Version => 2.0
2018-12-07 19:39 David Jenkins Note Added: 0112435
2018-12-07 19:39 David Jenkins Status resolved => closed
2018-12-07 20:38 Martin Friebe Note Added: 0112437