[PATCH] [dwarfdump] Print the name for referenced specification of abstract_origin DIEs.

Alexey Samsonov vonosmas at gmail.com
Wed Sep 24 18:58:06 PDT 2014


================
Comment at: lib/DebugInfo/DWARFDebugInfoEntry.cpp:129
@@ +128,3 @@
+      formValue.getForm() != DW_FORM_ref_sig8) {
+    uint32_t Ref = formValue.getAsReference(u).getValue();
+    DWARFDebugInfoEntryMinimal DIE;
----------------
friss wrote:
> samsonov wrote:
> > instead of manually checking for DW_FORM_ref_sig8, can you check it like
> >   formValue.getAsReference(u).hasValue()
> > ?
> I'm not exactly sure what you're suggesting, but the issue is not that there might be no value, but that the value returned for DW_FORM_ref_sig8 attributes is non-sensical in this context (For ref_sig8 attributes, the returned value is a hash of the referenced DIE tree).
> I've in fact been through a few iterations about this, because I don't find this check very elegant. In one of these, I created a new FormClass - FC_Signature - and thus I had the sig8 attributes return None for getAsReference(). This made the code above a bit nicer, but I didn't like that something that's explicitly named a reference (*ref*_sig8) would not be in the FC_Reference FormClass.
Yes, supporting DW_FORM_ref_sig8 is tricky, and we have a FIXME in getAsReference(). Can valid subprogram DIE actually have DW_FORM_ref_sig8 in its DW_AT_specification/DW_AT_abstract_origin? I thought that ref_sig8 is now used only for type units.

It makes sense to have DW_FORM_ref_sig8 be FC_Reference to be consistent with what's written in DWARF standard. But we can improve out getAsReference() method - instead of just returning uint64_t it may return a pair: <Unit containing a referenced DIE, Offset of referenced DIE in a corresponding section>.

Anyway, all this is about future improvement. I think the patch is fine to go in as is, once you agree with David about the amount of changes to the test cases.

http://reviews.llvm.org/D5466






More information about the llvm-commits mailing list