[PATCH] D44200: [DWARF] Don't attempt to parse line tables at invalid offsets

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 04:06:35 PST 2018


jhenderson created this revision.
jhenderson added reviewers: JDevlieghere, dblaikie, aprantl, probinson, labath.
Herald added a subscriber: mgorny.

Whilst working on improvements to the error handling of the debug line parsing code, I noticed that if an invalid offset were to be specified in a call to getOrParseLineTable(), an entry in the LineTableMap would still be created, even if the offset was not within the section range. The immediate parsing attempt afterwards would fail (it would end up getting a version of 0), and thereafter, any subsequent calls to getOrParseLineTable or getLineTable would return the default-constructed, invalid line table. In reality, we shouldn't even attempt to parse this table, and we should always return a nullptr from these two functions for this situation.

I have tested this via a unit test, which required some new framework for unit testing debug line. My plan is to add quite a few more unit tests for the new error reporting mechanism that will follow shortly, hence the reason why the supporting code for the tests are written the way they are - I intend to extend the DwarfGenerator class to support generating debug line.


Repository:
  rL LLVM

https://reviews.llvm.org/D44200

Files:
  lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  unittests/DebugInfo/DWARF/CMakeLists.txt
  unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
  unittests/DebugInfo/DWARF/DwarfUtils.cpp
  unittests/DebugInfo/DWARF/DwarfUtils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44200.137359.patch
Type: text/x-patch
Size: 7367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180307/834e9721/attachment.bin>


More information about the llvm-commits mailing list