[PATCH] D58698: [DWARFFormValue] Don't consider DW_FORM_data4/8 to be section offsets.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 26 14:17:08 PST 2019


JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, probinson, dblaikie.
Herald added subscribers: jdoerfert, hiraditya.
Herald added a project: LLVM.

When dumping ToT clan's debug info with dwarfdump, we were seeing an error
saying that that the location list overflows the debug_loc section. After
reducing the testcase we figured out that we were interpreting the
DW_FORM_data4 as a section offset.

In DWARF3 DW_FORM_data4 and DW_FORM_data8 served also as a section offset.
Until now we didn't check check for the DWARF version, because some producers
(read old versions of clang) were still emitting this. The relevant
code/comment was added in 2013, and I believe it's now reasonable to start
checking the version.

The FormValue class is a little bit of a mess because it cashes the DWARF unit
and context when it extracted the value itself. Several methods of the class
rely on it being present, or return an Optional for the code path that needs
it. At the same time the FormValue class also used in places where there's no
DWARF unit.

For this patch I went with the least invasive change: checking the version from
the CU when it's available. Possible other (more correct?) alternatives are
storing the DWARF version in the FormValue class, or making it a required
argument to the isFormClass method. Neither are particularly attractive. Please
let me know what you think is best.


Repository:
  rL LLVM

https://reviews.llvm.org/D58698

Files:
  llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
  llvm/test/tools/llvm-dwarfdump/X86/formclass2.s
  llvm/test/tools/llvm-dwarfdump/X86/formclass4.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58698.188456.patch
Type: text/x-patch
Size: 43354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190226/12ae3f49/attachment.bin>


More information about the llvm-commits mailing list