This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Add CIE header fields address_size and segment_size when generating dwarf-4
ClosedPublic

Authored by keith.walker.arm on May 7 2015, 6:38 AM.

Details

Summary

The DWARF-4 specification added 2 new fields in the CIE header called address_size and segment_size.
Create these 2 new fields when generating dwarf-4 CIE entries, print out the new fields when dumping the CIE and update tests

Diff Detail

Repository
rL LLVM

Event Timeline

keith.walker.arm retitled this revision from to [DWARF] Add CIE header fields address_size and segment_size when generating dwarf-4 .
keith.walker.arm updated this object.
keith.walker.arm edited the test plan for this revision. (Show Details)
keith.walker.arm added a subscriber: Unknown Object (MLST).May 7 2015, 6:47 AM

Forgot to subscribe llvm-commits to the phabricator subscriber field, so repeating the initial summary as a comment in the hope this will make it to the mailing list.

The DWARF-4 specification added 2 new fields in the CIE header called address_size and segment_size.
Create these 2 new fields when generating dwarf-4 CIE entries, print out the new fields when dumping the CIE and update tests

Granted DWARF calls the field "segment_size" but actually it's a segment _selector_ size. (Maybe we should fix that name for DWARF 5...)

lib/MC/MCDwarf.cpp
1310 ↗(On Diff #25173)

LLVM doesn't support any targets with segmented addresses?

test/MC/ARM/dwarf-cfi-initial-state.s
17 ↗(On Diff #25173)

It's not clear to me where these extra nops came from.

Paul,

Thanks for review my patch. I agree that segment_descriptor-size does appear to be a more appropriate name.

lib/MC/MCDwarf.cpp
1310 ↗(On Diff #25173)

I believe not. The existing similar field in the header in the .debug_aranges section generated by the function EmitGenDwarfAranges() in the same source file does the same and just puts 0 in the segment (descriptor) size field.

test/MC/ARM/dwarf-cfi-initial-state.s
17 ↗(On Diff #25173)

They are the DW_CFA_nop entries in the "padding" field in the CIE that are added to make the CIE the length specified in the length field. Adding the 2 new fields changed the length of the CIE and as a side-effect this inserts the 2 bytes of padding.

I'll add a comment to the test to make this clearer

Changed SegmentSize to SegmentDescriptorSize.
Added comment to CIE test to explain that the DW_CFA_nop instructions are padding.

One nit in the dump routine and LGTM.

lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
217 ↗(On Diff #25579)

"Segment desc size:" here, or something similar.

This revision is now accepted and ready to land.May 12 2015, 7:40 AM
This revision was automatically updated to reflect the committed changes.