mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:29:25 +02:00
FpDebug, LazDebuggerFp: Improve workaround for FPC issue 37658 / Check both: full-path, and no-path.
(cherry picked from commit 6c006a3e8e
)
This commit is contained in:
parent
9216824214
commit
4c02d59d4d
@ -5243,7 +5243,7 @@ constructor TDwarfCompilationUnit.Create(AOwner: TFpDwarfInfo; ADebugFile: PDwar
|
||||
begin
|
||||
S := String(Name);
|
||||
Inc(pb, Length(S)+1);
|
||||
FLineInfo.Directories.Add(S + DirectorySeparator);
|
||||
FLineInfo.Directories.Add(S + DirectorySeparator); // AppendPathDelim();
|
||||
end;
|
||||
Inc(Name);
|
||||
|
||||
|
@ -2562,8 +2562,10 @@ end;
|
||||
function TFpLineInfo.HasAddress(const AIndex: Integer; const ALine: Integer
|
||||
): Boolean;
|
||||
var
|
||||
Map: PDWarfLineMap;
|
||||
Map, Map2: PDWarfLineMap;
|
||||
dummy: TDBGPtrArray;
|
||||
FullName, BaseName: String;
|
||||
i: Integer;
|
||||
begin
|
||||
Result := False;
|
||||
if not((FpDebugger.DebugInfo <> nil) and (FpDebugger.DebugInfo is TFpDwarfInfo)) then
|
||||
@ -2574,6 +2576,21 @@ begin
|
||||
dummy:=nil;
|
||||
Result := Map^.GetAddressesForLine(ALine, dummy, True);
|
||||
end;
|
||||
|
||||
if map = nil then begin
|
||||
FullName := FRequestedSources[AIndex];
|
||||
BaseName := ExtractFileName(FullName);
|
||||
if (FullName <> BaseName) then begin
|
||||
i := FRequestedSources.IndexOf(BaseName);
|
||||
if i >= 0 then begin
|
||||
Map2 := PDWarfLineMap(FRequestedSources.Objects[i]);
|
||||
if (Map2 <> nil) and (Map2 <> Map) then begin
|
||||
dummy:=nil;
|
||||
Result := Map2^.GetAddressesForLine(ALine, dummy, True);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFpLineInfo.GetInfo(AAddress: TDbgPtr; out ASource, ALine,
|
||||
@ -2599,24 +2616,37 @@ end;
|
||||
|
||||
procedure TFpLineInfo.Request(const ASource: String);
|
||||
var
|
||||
lmap: PDWarfLineMap;
|
||||
lmap, lmap2: PDWarfLineMap;
|
||||
lib: TDbgLibrary;
|
||||
BaseName: String;
|
||||
begin
|
||||
lmap := nil;
|
||||
lmap2 := nil;
|
||||
|
||||
if (FpDebugger.DebugInfo <> nil) and (FpDebugger.DebugInfo is TFpDwarfInfo) then
|
||||
BaseName := ExtractFileName(ASource);
|
||||
if IndexOf(BaseName) >= 0 then
|
||||
BaseName := ASource; // already got the basename
|
||||
if (FpDebugger.DebugInfo <> nil) and (FpDebugger.DebugInfo is TFpDwarfInfo) then begin
|
||||
lmap := TFpDwarfInfo(FpDebugger.DebugInfo).GetLineAddressMap(ASource);
|
||||
if (ASource <> BaseName) and (lmap <> nil) then
|
||||
lmap2 := TFpDwarfInfo(FpDebugger.DebugInfo).GetLineAddressMap(BaseName);
|
||||
end;
|
||||
|
||||
if (lmap = nil) and (FpDebugger.DbgController <> nil) and (FpDebugger.DbgController.CurrentProcess <> nil) then begin
|
||||
for lib in FpDebugger.DbgController.CurrentProcess.LibMap do begin
|
||||
if (lib.DbgInfo <> nil) and (lib.DbgInfo is TFpDwarfInfo) then begin
|
||||
lmap := TFpDwarfInfo(lib.DbgInfo).GetLineAddressMap(ASource);
|
||||
if lmap <> nil then
|
||||
if lmap <> nil then begin
|
||||
if (ASource <> BaseName) then
|
||||
lmap2 := TFpDwarfInfo(lib.DbgInfo).GetLineAddressMap(BaseName);
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (ASource <> BaseName) then
|
||||
FRequestedSources.AddObject(BaseName, TObject(lmap2));
|
||||
FRequestedSources.AddObject(ASource, TObject(lmap));
|
||||
if lmap <> nil then
|
||||
DoChange(ASource);
|
||||
|
Loading…
Reference in New Issue
Block a user