[Lldb-commits] [PATCH] D55991: DWARF: Fix a bug in array size computation

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 21 02:10:19 PST 2018


labath created this revision.
labath added reviewers: aprantl, clayborg.
Herald added a subscriber: JDevlieghere.

r346165 introduced a bug, where we would fail to parse the size of an
array if that size happened to match an existing die offset.

The logic was:
if (DWARFDIE count = die.GetReferencedDie(DW_AT_count))

  num_elements = compute_vla_size(count);

else

  num_elements = die.GetUsigned(DW_AT_count); // a fixed-size array

The problem with this logic was that GetReferencedDie did not take the
form class of the attribute into account, and would happily return a die
reference for any form, if its value happened to match some die.

As this behavior is inconsistent with how llvm's DWARFFormValue class
operates, I chose to fix the problem by making our version of this class
match the llvm behavior. For this to work, I had to add an explicit form
class check to the .apple_XXX tables parsing code, because they do
(incorrectly?) use data forms as die references.


https://reviews.llvm.org/D55991

Files:
  lit/SymbolFile/DWARF/array-sizes.s
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55991.179254.patch
Type: text/x-patch
Size: 8674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181221/5bd2af2c/attachment-0001.bin>


More information about the lldb-commits mailing list