[PATCH] D51908: [DebugInfo] Do not generate debug info for removed labels.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 09:29:07 PDT 2018


dblaikie added a subscriber: echristo.
dblaikie added a comment.

In https://reviews.llvm.org/D51908#1232920, @vext01 wrote:

> It seems to me that the correct thing to do with unreachable labels is to emit a label with no `low_pc` attribute and fix gdb to accept such labels. Instead of crashing, it should print a message like "label was optimised out".


Agreed, though producing debug info that's likely to break any GDB in the interim's not ideal either - I'd certainly encourage folks to file the GDB bug and encourage a discussion with GDB folks about whether a label with no low_pc attribute is the right representation (I think it is, but open to other ideas)

> (It also shouldn't crash if a label has a zero `low_pc` value. I guess that zero could (in esoteric scenarios) be a valid code address. Perhaps for raw (headerless) binaries on some system which doesn't relocate code at load time?).

Agreed

> If you guys agree, I don't mind raising the bug, but we'd need an easily reproducible crash case to show them.

*nod* looks like that's been provided elsewhere in this review (though I've not gone through the repro steps myself).

Perhaps we could implement this behavior only if we're tuning for GDB & otherwise produce a label without a low_pc? Not sure how other folks (@aprantl @echristo @probinson @JDevlieghere) feel about this - apply the workaround generally, because it's not super important to have a label for name-lookup porpoises? or is it worth carrying the two codepaths to ensure that slightly more accurate debug info where it's possible (presuming LLDB can cope with it)?


Repository:
  rL LLVM

https://reviews.llvm.org/D51908





More information about the llvm-commits mailing list