[PATCH] D28095: [ELF] - Use information available from DW_AT_comp_dir attribute when doing error reporting.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 05:53:27 PST 2017
grimar added inline comments.
================
Comment at: ELF/InputFiles.cpp:57
template <class ELFT> void elf::ObjectFile<ELFT>::initializeDwarfLine() {
std::unique_ptr<object::ObjectFile> Obj =
----------------
ruiu wrote:
> This function does more than its name says -- you are now initializing not only `DwarfLine` but `CompilationDir`. You probably should save `Dwarf` instead of `DwarfLine` and `CompilationDir`.
There is a problem with saving just DWARFContextInMemory (Dwarf).
LLVM DWARF parsers currently wants to see CU as argument for parsing LineTable:
Example:
```
DWARFCompileUnit *CU = getCompileUnitForAddress(Address);
if (!CU)
return Result;
...
if (const DWARFLineTable *LineTable = getLineTableForUnit(CU))
```
CU are taken from .debug_info section. Our LLD implementation works differently,
allowing us to show location for objects like undef-debug.s, that does not have .debug_info:
```
.file 1 "dir/undef-debug.s"
.loc 1 3
.quad zed3
...
```
As far I know our current logic consistent with gold/bfd, which afaik can live without .debug_info, like we do.
At the same time, DWARF Debugging Information Format, Version 4 says:
> "Line number information generated for a compilation unit is represented in the .debug_line
> section of an object file and is referenced by a corresponding compilation unit debugging
> information entry (see Section 3.1.1) in the .debug_info section."
> For each compilation unit compiled with a DWARF producer, a contribution is made to the
> .debug_info section of the object file.
What makes me wonder if it is correct to work with .debug_line when there is not .debug_info section
and so no info about CUs.
So there seems to be 2 ways:
1) Store both DwarfLine and CompilationDir like now. That way we still have extended messages for case when there is no .debug_section,
though it is not clear for me if we really should care about that cases. It seems our testcases are a bit too synthetic, looks there
should not be real producer that emits .debug_line without .debug_info ?
2) Store only Dwarf (DWARFContextInMemory) and ignore cases when object has no .debug_info section. That probably can simplifiy implementation.
Looks we can go with 2 ?
https://reviews.llvm.org/D28095
More information about the llvm-commits
mailing list