This is an archive of the discontinued LLVM Phabricator instance.

DWARF64 Fixes
ClosedPublic

Authored by endlessroad on Sep 10 2014, 6:30 PM.

Details

Summary
  1. DW_FORM_strp and DW_FORM_sec_offset are 64bits for DWARF64 / 32bits for DWARF32

They are different from DW_FORM_addr, whose size is specified in .debug_info

  1. Bump DWARF version support form [2,3] to [2,4] in DWARFDebugLine.cpp
  1. Fix DWARFDebugLine to support DWARF64

Diff Detail

Event Timeline

endlessroad retitled this revision from to DWARF64 Fixes.
endlessroad updated this object.
endlessroad edited the test plan for this revision. (Show Details)
endlessroad added reviewers: tfiala, jasonmolenda.
endlessroad added a subscriber: Unknown Object (MLST).
endlessroad edited subscribers, added: Unknown Object (MLST); removed: Unknown Object (MLST).
jasonmolenda edited edge metadata.Sep 10 2014, 6:51 PM

Greg has done most of the DWARF parser work, he should comment.

In DWARFDebugInfoEntry.cpp DW_FORM_ref_addr you use cu->GetAddressByteSize() for the size (or cu_addr_size, used in a different part of the file) -- but if this is a 64-bit binary using DWARF32, that would be wrong - this is a reference to another part of the DWARF. Or a 32-bit binary using DWARF64. Don't you want to do cu->IsDWARF64() (like you do for DW_FORM_strp / DW_FORM_sec_offset)?

(or more accurately, for DWARF2, the DW_FORM_ref_addr is apparently the word size of the program; with DWARF3+, it's 4 for DWARF32, 8 for DWARF64)

I see what you're doing in DWARFFormValue::GetFixedFormSizesForAddressSize -- you assume that 32-bit-program + DWARF64 is not a possible combination. That's fine, I don't really think any producer would generate it.

Greg might not want to see this change to DWARFAbbreviationDeclaration::Dump() ;) but I don't have an opinion on that.

Otherwise it looks fine to me.

emaste added a subscriber: emaste.Sep 10 2014, 6:54 PM
endlessroad edited edge metadata.

Address Jason's comments

tfiala accepted this revision.Sep 11 2014, 10:38 AM
tfiala edited edge metadata.
This revision is now accepted and ready to land.Sep 11 2014, 10:38 AM
tfiala closed this revision.Sep 11 2014, 10:39 AM

svn commit
Sending source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
Sending source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
Sending source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
Sending source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
Sending source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
Sending source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
Sending source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
Sending source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
Sending source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
Sending source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Transmitting file data ..........
Committed revision 217607.