Skip to content

Commit 0c27bc2

Browse files
committedApr 3, 2019
[DWARF] check whether the DIE is valid before querying for information
Differential Revision: https://reviews.llvm.org/D60147 llvm-svn: 357607
1 parent 1de15f6 commit 0c27bc2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
 

‎llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ DWARFContext::DIEsForAddress DWARFContext::getDIEsForAddress(uint64_t Address) {
925925
DWARFDie DIE = Worklist.back();
926926
Worklist.pop_back();
927927

928+
if (!DIE.isValid())
929+
continue;
930+
928931
if (DIE.getTag() == DW_TAG_lexical_block &&
929932
DIE.addressRangeContainsAddress(Address)) {
930933
Result.BlockDIE = DIE;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#RUN: llvm-dwarfdump -lookup 1161 %p/Inputs/dwarfdump-test.macho-i386.o | FileCheck %s
2+
3+
// When we pass an address to getDIEsFromAddress that doesn't belong to any DIE
4+
// (only to a CU), this function is triggering an assert, which is not the
5+
// intended behavior (as the address still belongs to a CU).
6+
7+
#CHECK: DW_TAG_compile_unit
8+
#CHECK-NEXT: DW_AT_producer{{.*}}"clang version 3.6.2 (tags/RELEASE_362/final)"
9+
#CHECK-NEXT: DW_AT_language{{.*}}DW_LANG_C_plus_plus
10+
#CHECK-NEXT: DW_AT_name{{.*}}"dwarfdump-test.cc"
11+
#CHECK-NOT: DW_TAG

0 commit comments

Comments
 (0)
Please sign in to comment.