[PATCH] D46628: [ELF] Add --strip-debug-non-line option
Paul Robinson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 10:55:07 PDT 2019
probinson added a comment.
In D46628#1559322 <https://reviews.llvm.org/D46628#1559322>, @dblaikie wrote:
> While all this (the behavior of gmlt) seems unrelated to this patch, really (I agree/understand your description - if you really want to be able to compile things once and link them into debug-ish and non-debug-ish forms, something like the --strip-debug-non-line sounds nice though I can also understand some push-back against it, since it's necessarily going to make broken DWARF, well, except in DWARFv5 where there's an intentional way to support line-table-only debug info (the line table has its own string table, so you can strip /everything/ (including debug_info) except debug_line and debug_line_str, I believe) - perahps that'd be a good way to implement this in a more principled way - work for DWARFv5 only (it wouldn't necessarily need/want to check DWARF version, but be designed to work correctly for DWARFv5 & be weird/bad/problematic before that))
Preserving ".debug_line*" should be fully usable for DWARFv5, and the idea is that ".debug_line*" should be sufficient in future DWARF versions that might invent other new sections related to the line table. For DWARFv4, preserving just .debug_line would lose the explicit address-size (likely you can infer that from other characteristics of the object file) and the compilation directory/root file, which might or might not be referenced within the line table.
Given that part of the use-case is pre-built 3rd party objects with full debug info, you probably can't assume everything is DWARFv5, however, so a solution that works for prior versions is probably the right way to go. It should be comparatively easy to trim a .debug_info compilation unit down to just the DW_TAG_compile_unit DIE, which gets back the missing info I mentioned in the previous paragraph,
For a traceback, this gets you source attributions but not nice subprogram names, which would require the additional inlined subprogram information that David was talking about.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D46628/new/
https://reviews.llvm.org/D46628
More information about the llvm-commits
mailing list