diff --git a/components/fpdebug/fpdbgdwarfdataclasses.pas b/components/fpdebug/fpdbgdwarfdataclasses.pas index c79519292a..2f1cfecaee 100644 --- a/components/fpdebug/fpdbgdwarfdataclasses.pas +++ b/components/fpdebug/fpdbgdwarfdataclasses.pas @@ -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); diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index cdf32f9658..36792e1aa7 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -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;