[DWARF parser] Make DWARF parser more robust against missing compile/type units.
authorAlexey Samsonov <vonosmas@gmail.com>
Tue, 19 May 2015 21:54:32 +0000 (21:54 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Tue, 19 May 2015 21:54:32 +0000 (21:54 +0000)
commit05f725eb674636cf98ea640cb03bed6615b3f23c
treef20c67ec3f45d94a1b86e59264c12e728e56e598
parentb9b3fb261eb61e5613032e5c13dfadde870d2cab
[DWARF parser] Make DWARF parser more robust against missing compile/type units.

DWARF standard claims that each compilation/type unit header in
.debug_info/.debug_types section must be followed by corresponding
compile/type unit DIE, possibly with its children. Two situations
are possible:

 * compile/type unit DIE is missing because DWARF producer failed to
   emit it.
 * DWARF parser failed to parse unit DIE correctly, for instance if it
   contains some unsupported attributes (see r237721, for instance).

In either of these cases, the library, and the tools that use it
(llvm-dwarfdump, llvm-symbolizer) should not crash. Insert appropriate
checks to protect against this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237733 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/DebugInfo/DWARF/DWARFUnit.h
lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
lib/DebugInfo/DWARF/DWARFContext.cpp
lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
lib/DebugInfo/DWARF/DWARFUnit.cpp
tools/dsymutil/DwarfLinker.cpp