[llvm] Aggregate errors from llvm-dwarfutil --verify (PR #79648)

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 18:15:04 PST 2024


clayborg wrote:


> > BTW: Here's the bottom of that --verify log. 123 ranges aren't contained by parent ranges. I hope to improve the diagnostics so the output is a bit more opinionated/informative. I believe that overlapping DW_AT_ranges, for example, just aren't that big of a deal...
> > ```
> > error: Aggregated error counts:
> > error: DIE address ranges are not contained by parent ranges occurred 123 time(s).
> > error: DIE has overlapping DW_AT_ranges occurred 119212 time(s).
> > error: DIEs have overlapping address ranges occurred 118323 time(s).
> > Errors detected.
> > ```
> 
> These are mostly bugs that should be fixed in the verifier related to address tombstoning. (three CUs with a copy of an inline function - one gets picked, the other two get marked as "dead" usually by setting the starting address to 0 (depends on the linker) and then you have two CUs with functions that start at 0, so they're "overlapping" - or, if the inline functions happen to be truly identical, both CUs might point to the one copy, again, overlapping)

We should fix the DWARFVerifier to do what llvm-gsymutil does: it gets the list of valid ".text" ranges. It does this by scanning the sections and making a set of address ranges that have read + execute permissions, and only checking addresses for any DIEs if they fall into these ranges. This keeps the GSYM file from having extra invalid addresses in the output file. Code is easy:

```
  AddressRanges TextRanges;
  for (const object::SectionRef &Sect : Obj.sections()) {
    if (!Sect.isText())
      continue;
    const uint64_t Size = Sect.getSize();
    if (Size == 0)
      continue;
    const uint64_t StartAddr = Sect.getAddress();
    TextRanges.insert(AddressRange(StartAddr, StartAddr + Size));
  }
```

> 
> It might just not be the most useful tool to use for what you're trying to do without further work to fix these false positives.

Yes, I can work with Kevin to fix these if you are ok with the above text ranges solution? I works really well for GSYM.



https://github.com/llvm/llvm-project/pull/79648


More information about the llvm-commits mailing list