This is an archive of the discontinued LLVM Phabricator instance.

DWARFContext: Return empty data extractors instead of null pointers
ClosedPublic

Authored by labath on May 15 2019, 6:27 AM.

Details

Summary

There are several reasons for doing this:

  • generally, there's no reason to differentiate between a section being absent and it being present, but empty
  • it matches more closely what llvm DWARF parser is doing (which also doesn't differentiate the two cases)
  • SymbolFileDWARF also doesn't differentiate the two cases, which makes porting the rest of sections easier
  • it fixes a bug in how the return-null-if-empty logic was implemented (it returned nullptr only the second time we tried to get the debug_aranges section), which meant that we hit an assert when trying to parse an empty-but-present section

Diff Detail

Repository
rLLDB LLDB

Event Timeline

labath created this revision.May 15 2019, 6:27 AM
aprantl accepted this revision.May 15 2019, 9:00 AM
aprantl added inline comments.
source/Plugins/SymbolFile/DWARF/DWARFContext.h
26

lgtm

source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
44–45

lgtm

source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
49–50

ltgm

This revision is now accepted and ready to land.May 15 2019, 9:00 AM
clayborg accepted this revision.May 15 2019, 9:02 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2019, 4:16 AM