<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">0x31a1e561: TAG_compile_unit [1] *<br class=""> AT_producer( "GNU C++ 5.x 20161206 ..." )<br class=""> AT_language( DW_LANG_C_plus_plus )<br class=""> AT_name( "/home/engshare/third-party2/glog/0.3.2_fb/src/glog-0.3.2/src/vlog_is_on.cc" )<br class=""> AT_comp_dir( "/home/engshare/third-party2/glog/0.3.2_fb/src/glog-0.3.2" )<br class=""> AT_ranges( 0x04b59e20<br class=""> [0x0000000002c7c2d0 - 0x0000000002c7c9a5)<br class=""> [0x00000000005e4e90 - 0x00000000005e4ed7)<br class=""> [0x0000000002c7b870 - 0x0000000002c7b89a)<br class=""> [0x000000000056c380 - 0x000000000056c426)<br class=""> [0x0000000002c7c9c0 - 0x0000000002c7c9ea)<br class=""> [0x000000000056c430 - 0x000000000056c5cb)<br class=""> End )<br class=""> AT_low_pc( 0x0000000000000000 )<br class=""> AT_stmt_list( 0x02b87914 )<br class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 16, 2017, at 4:09 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Do you happen to have minimized source & a specific GCC version (unless it's just ubiquitous to all/many GCC versions)?</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Nov 16, 2017 at 4:06 PM Greg Clayton <<a href="mailto:clayborg@gmail.com" class="">clayborg@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Don't ask me. I just have a GCC generated file that does this.</div><div style="word-wrap:break-word" class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 16, 2017, at 4:05 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class="m_7782658449836261251Apple-interchange-newline"><div class=""><div dir="ltr" class="">I don't quite follow - why would there be two levels of abstract origin? (X -abstract_origin-> Y -abstract_origin-> Z) rather than having X refer to Z as its abstract_origin directly?<br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Nov 16, 2017 at 4:01 PM Greg Clayton via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank" class="">reviews@reviews.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">clayborg created this revision.<br class="">
Herald added a subscriber: JDevlieghere.<br class="">
<br class="">
The previous implementation would only look 1 DW_AT_specification or DW_AT_abstract_origin deep. This means DWARFDie::getName() would fail in certain cases. I ran into such a case while creating a tool that used the LLVM DWARF parser to generate a symbolication format so I have seen this in the wild.<br class="">
<br class="">
<br class="">
Repository:<br class="">
rL LLVM<br class="">
<br class="">
<a href="https://reviews.llvm.org/D40156" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/D40156</a><br class="">
<br class="">
Files:<br class="">
lib/DebugInfo/DWARF/DWARFDie.cpp<br class="">
unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br class="">
<br class="">
<br class="">
Index: unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br class="">
===================================================================<br class="">
--- unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br class="">
+++ unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br class="">
@@ -1287,12 +1287,16 @@<br class="">
auto CUDie = CU.getUnitDIE();<br class="">
auto FuncSpecDie = CUDie.addChild(DW_TAG_subprogram);<br class="">
auto FuncAbsDie = CUDie.addChild(DW_TAG_subprogram);<br class="">
+ // Put the linkage name in a second abstract origin DIE to ensure we<br class="">
+ // recurse through more than just one DIE when looking for attributes.<br class="">
+ auto FuncAbsDie2 = CUDie.addChild(DW_TAG_subprogram);<br class="">
auto FuncDie = CUDie.addChild(DW_TAG_subprogram);<br class="">
auto VarAbsDie = CUDie.addChild(DW_TAG_variable);<br class="">
auto VarDie = CUDie.addChild(DW_TAG_variable);<br class="">
FuncSpecDie.addAttribute(DW_AT_name, DW_FORM_strp, SpecDieName);<br class="">
- FuncAbsDie.addAttribute(DW_AT_linkage_name, DW_FORM_strp, SpecLinkageName);<br class="">
+ FuncAbsDie2.addAttribute(DW_AT_linkage_name, DW_FORM_strp, SpecLinkageName);<br class="">
FuncAbsDie.addAttribute(DW_AT_specification, DW_FORM_ref4, FuncSpecDie);<br class="">
+ FuncAbsDie.addAttribute(DW_AT_abstract_origin, DW_FORM_ref4, FuncAbsDie2);<br class="">
FuncDie.addAttribute(DW_AT_abstract_origin, DW_FORM_ref4, FuncAbsDie);<br class="">
VarAbsDie.addAttribute(DW_AT_name, DW_FORM_strp, AbsDieName);<br class="">
VarDie.addAttribute(DW_AT_abstract_origin, DW_FORM_ref4, VarAbsDie);<br class="">
@@ -1314,7 +1318,8 @@<br class="">
<br class="">
auto FuncSpecDie = CUDie.getFirstChild();<br class="">
auto FuncAbsDie = FuncSpecDie.getSibling();<br class="">
- auto FuncDie = FuncAbsDie.getSibling();<br class="">
+ auto FuncAbsDie2 = FuncAbsDie.getSibling();<br class="">
+ auto FuncDie = FuncAbsDie2.getSibling();<br class="">
auto VarAbsDie = FuncDie.getSibling();<br class="">
auto VarDie = VarAbsDie.getSibling();<br class="">
<br class="">
Index: lib/DebugInfo/DWARF/DWARFDie.cpp<br class="">
===================================================================<br class="">
--- lib/DebugInfo/DWARF/DWARFDie.cpp<br class="">
+++ lib/DebugInfo/DWARF/DWARFDie.cpp<br class="">
@@ -298,17 +298,16 @@<br class="">
DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const {<br class="">
if (!isValid())<br class="">
return None;<br class="">
- auto Die = *this;<br class="">
- if (auto Value = Die.find(Attrs))<br class="">
+ if (auto Value = find(Attrs))<br class="">
return Value;<br class="">
- if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin))<br class="">
- Die = D;<br class="">
- if (auto Value = Die.find(Attrs))<br class="">
- return Value;<br class="">
- if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_specification))<br class="">
- Die = D;<br class="">
- if (auto Value = Die.find(Attrs))<br class="">
- return Value;<br class="">
+ if (auto Die = getAttributeValueAsReferencedDie(DW_AT_abstract_origin)) {<br class="">
+ if (auto Value = Die.findRecursively(Attrs))<br class="">
+ return Value;<br class="">
+ }<br class="">
+ if (auto Die = getAttributeValueAsReferencedDie(DW_AT_specification)) {<br class="">
+ if (auto Value = Die.findRecursively(Attrs))<br class="">
+ return Value;<br class="">
+ }<br class="">
return None;<br class="">
}<br class="">
<br class="">
<br class="">
<br class="">
</blockquote></div></div>
</div></blockquote></div><br class=""></div></div></blockquote></div>
</div></blockquote></div><br class=""></body></html>