gimli icon indicating copy to clipboard operation
gimli copied to clipboard

Support GNU-style DWZ multi-file extension

Open rocallahan opened this issue 6 years ago • 8 comments

Fedora's packaged debuginfo are using these extensively. http://www.dwarfstd.org/ShowIssue.php?issue=120604.1 is the standardized version. I can't find real documentation for the GNU flavour that Fedora is using, but here is some information: https://gcc.gnu.org/ml/gcc-patches/2012-06/msg00513.html

rocallahan avatar Mar 20 '18 00:03 rocallahan

The addition of DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt mean that gimli can't parse these debug binaries at all.

rocallahan avatar Mar 20 '18 00:03 rocallahan

It looks like this hasn't actually been standardized in DWARF5 yet. I thought perhaps DWARF5 DWO would cover these use-cases but as far as I can tell it doesn't.

rocallahan avatar Mar 20 '18 01:03 rocallahan

I think this is 7.3.6 DWARF Supplementary Object Files.

philipc avatar Mar 20 '18 01:03 philipc

Aha, so it is.

rocallahan avatar Mar 20 '18 01:03 rocallahan

I guess the main thing we need to do for gimli is to extend AttributeValue to support alt-references for DebugStrRef and DebugInfoRef. We could add new AttributeValue cases, e.g. DebugStrRefAlt/DebugInfoRefAlt, or we could add a field to DebugStrRef and DebugInfoRef to indicate which file is referenced. Any preference?

Aside, do you have any thoughts about how to handle split DWARF? I guess gimli is just going to provide parsing for skeleton compilation units and other split-DWARF-related syntax and leave it up to the consumer to actually reassemble the debuginfo.

rocallahan avatar Mar 20 '18 02:03 rocallahan

I filed #288 to add DebugStrRefSup and DebugInfoRefSup to AttributeValue.

rocallahan avatar Mar 20 '18 03:03 rocallahan

For split DWARF, initially it'll be up to the consumer to reassemble the debuginfo. Adding higher level handling would be nice, but it might be hard to make that independent of the object file parser.

philipc avatar Mar 20 '18 04:03 philipc

For split DWARF, initially it'll be up to the consumer to reassemble the debuginfo. Adding higher level handling would be nice, but it might be hard to make that independent of the object file parser.

It feels like there's probably room for a slightly higher-level interface atop gimli that could handle things like this nicely. I've found myself cribbing code from addr2line a few times because it's got quite a few things like that. Honestly that might not be a bad place to start, just refactoring the higher-level APIs out of addr2line into a separate crate. Things like read_ranges and name_attr might feel too high-level to fit into gimli itself, but they're pretty necessary for anyone writing tools to handle DWARF.

luser avatar Sep 11 '18 13:09 luser