diff --git a/components/fpdebug/fpdbgclasses.pp b/components/fpdebug/fpdbgclasses.pp index eb7b97b230..a8844e81fd 100644 --- a/components/fpdebug/fpdbgclasses.pp +++ b/components/fpdebug/fpdbgclasses.pp @@ -671,6 +671,7 @@ type function GetConsoleOutput: string; virtual; procedure SendConsoleInput(AString: string); virtual; + procedure ClearAddedAndRemovedLibraries; function AddThread(AThreadIdentifier: THandle): TDbgThread; function GetThreadArray: TFPDThreadArray; procedure ThreadsBeforeContinue; @@ -967,7 +968,11 @@ begin end; procedure TLibraryMap.ClearAddedAndRemovedLibraries; +var + lib: TDbgLibrary; begin + for lib in FLibrariesRemoved do + lib.Free; FLibrariesAdded := []; FLibrariesRemoved := []; end; @@ -1839,6 +1844,7 @@ begin //FreeItemsInMap(FBreakMap); FreeItemsInMap(FThreadMap); FreeItemsInMap(FLibMap); + FLibMap.ClearAddedAndRemovedLibraries; FreeAndNil(FWatchPointData); FreeAndNil(FBreakMap); @@ -2091,6 +2097,12 @@ begin // Do nothing end; +procedure TDbgProcess.ClearAddedAndRemovedLibraries; +begin + {$IFDEF FPDEBUG_THREAD_CHECK}AssertFpDebugThreadIdNotMain('TBreakLocationMap.AddLocotion');{$ENDIF} + FLibMap.ClearAddedAndRemovedLibraries; +end; + function TDbgProcess.AddThread(AThreadIdentifier: THandle): TDbgThread; var IsMainThread: boolean; diff --git a/components/fpdebug/fpdbgcontroller.pas b/components/fpdebug/fpdbgcontroller.pas index 1a884c941a..92ce2901e4 100644 --- a/components/fpdebug/fpdbgcontroller.pas +++ b/components/fpdebug/fpdbgcontroller.pas @@ -1591,6 +1591,8 @@ begin end; FreeAndNil(FCommandToBeFreed); + FCurrentProcess.ClearAddedAndRemovedLibraries; + if FCommand <> nil then FCommand.DoBeforeLoopStart; diff --git a/components/fpdebug/fpdbgwinclasses.pas b/components/fpdebug/fpdbgwinclasses.pas index 68dcb88ea6..83fc74a243 100644 --- a/components/fpdebug/fpdbgwinclasses.pas +++ b/components/fpdebug/fpdbgwinclasses.pas @@ -1391,7 +1391,6 @@ var begin Result := TDbgWinLibrary.Create(Self, HexValue(AInfo.lpBaseOfDll, SizeOf(Pointer), [hvfIncludeHexchar]), AInfo.hFile, TDbgPtr(AInfo.lpBaseOfDll), AInfo); ID := TDbgPtr(AInfo.lpBaseOfDll); - FLibMap.ClearAddedAndRemovedLibraries; FLibMap.Add(ID, Result); if (Result.DbgInfo.HasInfo) or (Result.SymbolTableInfo.HasInfo) then FSymInstances.Add(Result); @@ -1406,7 +1405,6 @@ begin ID := TDbgPtr(AInfo.lpBaseOfDll); if not FLibMap.GetData(ID, Lib) then Exit; FSymInstances.Remove(Lib); - FLibMap.ClearAddedAndRemovedLibraries; FLibMap.Delete(ID); end;