FpDebugger (pure): Patch from Colin Western to resolve relative filenames in Dwarf-debug info.

git-svn-id: trunk@45933 -
This commit is contained in:
joost 2014-07-20 13:27:52 +00:00
parent f7d6fb47ee
commit ac95b9c55d
2 changed files with 14 additions and 2 deletions

View File

@ -474,6 +474,7 @@ type
FInfoData: Pointer;
FFileName: String;
FCompDir: String;
FUnitName: String;
FIdentifierCase: Integer;
FProducer: String;
@ -538,6 +539,7 @@ type
function GetLineAddressMap(const AFileName: String): PDWarfLineMap;
function GetLineAddress(const AFileName: String; ALine: Cardinal): TDbgPtr;
procedure BuildLineInfo(AAddressInfo: PDwarfAddressInfo; ADoAll: Boolean);
function FullFileName(const AFileName:string): String;
property Valid: Boolean read FValid;
property FileName: String read FFileName;
@ -3246,7 +3248,7 @@ end;
procedure TDwarfLineInfoStateMachine.SetFileName(AIndex: Cardinal);
begin
if (Aindex > 0) and (AIndex <= FOwner.FLineInfo.FileNames.Count)
then FFileName := FOwner.FLineInfo.FileNames[AIndex - 1]
then FFileName := FOwner.FullFileName(FOwner.FLineInfo.FileNames[AIndex - 1])
else FFileName := Format('Unknown fileindex(%u)', [AIndex]);
end;
@ -3361,6 +3363,13 @@ begin
Result := FAddressMap;
end;
function TDwarfCompilationUnit.FullFileName(const AFileName: String): String;
begin
Result := AFileName;
if FCompDir = '' then exit;
Result := LazFileUtils.ResolveDots(FCompDir+AFileName);
end;
function TDwarfCompilationUnit.GetUnitName: String;
begin
Result := FUnitName;
@ -3604,6 +3613,9 @@ begin
if LocateAttribute(Scope.Entry, DW_AT_name, AttribList, Attrib, Form)
then ReadValue(Attrib, Form, FFileName);
if LocateAttribute(Scope.Entry, DW_AT_comp_dir, AttribList, Attrib, Form)
then ReadValue(Attrib, Form, FCompDir);
if LocateAttribute(Scope.Entry, DW_AT_producer, AttribList, Attrib, Form)
then ReadValue(Attrib, Form, FProducer);

View File

@ -1614,7 +1614,7 @@ begin
if sym = nil then
Exit;
result.SrcFile := sym.FileName;
result.SrcFile := ExtractFileName(sym.FileName);
result.SrcLine := sym.Line;
result.SrcFullName := sym.FileName;