[llvm] r357607 - [DWARF] check whether the DIE is valid before querying for information
Paul Semel via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 10:13:45 PDT 2019
Author: paulsemel
Date: Wed Apr 3 10:13:45 2019
New Revision: 357607
URL: http://llvm.org/viewvc/llvm-project?rev=357607&view=rev
Log:
[DWARF] check whether the DIE is valid before querying for information
Differential Revision: https://reviews.llvm.org/D60147
Added:
llvm/trunk/test/DebugInfo/dwarfdump-bad-lookup-address.test
Modified:
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=357607&r1=357606&r2=357607&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Wed Apr 3 10:13:45 2019
@@ -925,6 +925,9 @@ DWARFContext::DIEsForAddress DWARFContex
DWARFDie DIE = Worklist.back();
Worklist.pop_back();
+ if (!DIE.isValid())
+ continue;
+
if (DIE.getTag() == DW_TAG_lexical_block &&
DIE.addressRangeContainsAddress(Address)) {
Result.BlockDIE = DIE;
Added: llvm/trunk/test/DebugInfo/dwarfdump-bad-lookup-address.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-bad-lookup-address.test?rev=357607&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-bad-lookup-address.test (added)
+++ llvm/trunk/test/DebugInfo/dwarfdump-bad-lookup-address.test Wed Apr 3 10:13:45 2019
@@ -0,0 +1,11 @@
+#RUN: llvm-dwarfdump -lookup 1161 %p/Inputs/dwarfdump-test.macho-i386.o | FileCheck %s
+
+// When we pass an address to getDIEsFromAddress that doesn't belong to any DIE
+// (only to a CU), this function is triggering an assert, which is not the
+// intended behavior (as the address still belongs to a CU).
+
+#CHECK: DW_TAG_compile_unit
+#CHECK-NEXT: DW_AT_producer{{.*}}"clang version 3.6.2 (tags/RELEASE_362/final)"
+#CHECK-NEXT: DW_AT_language{{.*}}DW_LANG_C_plus_plus
+#CHECK-NEXT: DW_AT_name{{.*}}"dwarfdump-test.cc"
+#CHECK-NOT: DW_TAG
More information about the llvm-commits
mailing list