[llvm] [llvm-debuginfo-analyzer] Incorrect directory path (.debug_line) (PR #143849)
Javier Lopez-Gomez via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 07:07:48 PDT 2025
================
@@ -522,14 +522,16 @@ void LVDWARFReader::createLineAndFileRecords(
for (const DWARFDebugLine::FileNameEntry &Entry :
Lines->Prologue.FileNames) {
std::string Directory;
- if (Lines->getDirectoryForEntry(Entry, Directory))
- Directory = transformPath(Directory);
+ Lines->getDirectoryForEntry(Entry, Directory);
if (Directory.empty())
Directory = std::string(CompileUnit->getCompilationDirectory());
- std::string File = transformPath(dwarf::toStringRef(Entry.Name));
+ // Take just the filename component, as it may be contain the full
+ // path that would be added to the already existing path in Directory.
+ StringRef File =
+ llvm::sys::path::filename(dwarf::toStringRef(Entry.Name));
----------------
jalopezg-git wrote:
Could it happen that the `filename` part of a [!DIFile](https://github.com/llvm/llvm-project/pull/143849/files#diff-80d19cd858d5d7977a6402ccebb6017941eef3489377857d2d0b0680af76903bR28) does not have the `directory` part as a prefix? E.g.
```
!1 = !DIFile(filename: "foo/test.cpp", directory: "bar")
```
Should this be interpreted as `bar/foo/test.cpp` instead?
https://github.com/llvm/llvm-project/pull/143849
More information about the llvm-commits
mailing list