[PATCH] D74773: [LLD][Debuginfo] create DWARFContext only once for the same object file.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 02:53:26 PST 2020


avl marked an inline comment as done.
avl added inline comments.


================
Comment at: lld/test/ELF/gdb-index-parse-fail.s:5
 
-# CHECK: error: {{.*}}:(.debug_info): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
+# CHECK: warning: {{.*}}:{{(\(\.debug_info\):)?}} invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
 
----------------
MaskRay wrote:
> Why did the debug_info regex become complex now?
Without this patch the error was reported from lld/ELF/SyntheticSections.cpp : 

```
    if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
      error(toString(sec) + ": " + toString(std::move(e)));
    }
```

lld knows the section name and prints it in error message :

ld.lld: error: gdb-index-parse-fail.s.tmp1.o:(**.debug_info**): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix

With this patch the error could be reported not from lld/ELF/SyntheticSections.cpp but from DWARFUnit.cpp, using error handler provided to DWARFContext in  InputFiles.cpp:


```
[&](Error Err) { warn(getName() + ": " + toString(std::move(Err))); }
```

In that case section name is not printed(DWARFUnit.cpp does not print section name). So the error looks like this(without section name):

ld.lld: error: gdb-index-parse-fail.s.tmp1.o: invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix

Thus regex become more comlpex to accept both variants: with/without section name. 




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74773/new/

https://reviews.llvm.org/D74773





More information about the llvm-commits mailing list