[PATCH] D126010: Make sure the AsmPrinter doesn't emit any zero-sized symbols to `.debug_aranges`.

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 16:40:15 PDT 2022


ayermolo added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:3052-3054
-        if (Size == 0)
-          Size = 1;
-
----------------
pcwalton wrote:
> pcwalton wrote:
> > dblaikie wrote:
> > > pcwalton wrote:
> > > > dblaikie wrote:
> > > > > This might actually be a more suitable direction for zero-length entries.
> > > > > 
> > > > > Otherwise: What's a consumer going to do if they query for the address and it's not in aranges? (They then need to scan all the DWARF to find the zero-length entry at that address, losing the benefit of aranges?)
> > > > > 
> > > > > (also: what are you using aranges for? They've been off-by-default in Clang for many years now & I don't know of any particular value they have compared to using the ranges on the CUs in .debug_info directly (well, LLVM's aranges include data/non-code symbols, but GCC's don't, so it's hard for a consumer to rely on that extra data anyway) - I hope one day we can remove the support entirely)
> > > > > This might actually be a more suitable direction for zero-length entries.
> > > > > 
> > > > > Otherwise: What's a consumer going to do if they query for the address and it's not in aranges? (They then need to scan all the DWARF to find the zero-length entry at that address, losing the benefit of aranges?)
> > > > > 
> > > > > (also: what are you using aranges for? They've been off-by-default in Clang for many years now & I don't know of any particular value they have compared to using the ranges on the CUs in .debug_info directly (well, LLVM's aranges include data/non-code symbols, but GCC's don't, so it's hard for a consumer to rely on that extra data anyway) - I hope one day we can remove the support entirely)
> > > > 
> > > > We actually aren't using them for anything. The problem is that some tools don't cope well with invalid `.debug_aranges` tables with premature terminators, so we have to emit *something* valid. It doesn't matter what it is.
> > > Sorry, I meant: how did you come across this bug? Aranges are disabled by default - so even if they're broken, I wouldn't expect that to be a problem, because they're not turned on anyway.
> > rustc generates `.debug_aranges`, and we're compiling Rust code. [[https://github.com/rust-lang/rust/issues/45246|The relevant Rust issue]] explains the rationale as far as I'm aware (and it looks like you commented there).
> Here's a new version of the patch that takes the approach you suggested of rounding sizes up to 1. https://reviews.llvm.org/D126257
Doesn't lldb use .debug_aranges to speed up loading of debug info?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126010



More information about the llvm-commits mailing list