FpDebug: add workaround to prevent the IDE from creating empty/wrong Dbg-LineMaps (mapping all lines to zero)

This commit is contained in:
Martin 2023-02-16 14:48:43 +01:00
parent 04b384b34d
commit 0278edaea3

View File

@ -2492,8 +2492,20 @@ begin
end;
function TFpLineInfo.IndexOf(const ASource: String): integer;
var
Src: String;
begin
Result := FRequestedSources.IndexOf(ASource);
(* For dsInit, dsPause:
- DebugManager.DebuggerChangeState calls SourceEditorManager.FillExecutionMarks;
- This happens, even if the data is not available.
- TSourceEditor.FillExecutionMarks will call this function ("IndexOf") and create an
empty non-functional map.
(Happens for libraries, loaded with LoadLibrary during dsInit, if the source is open)
- To avoid this => return -1
*)
if (Result >= 0) and (FRequestedSources.Objects[Result] = nil) then
Result := -1;
end;
procedure TFpLineInfo.Request(const ASource: String);