<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
+/// Climb up the parent chain to get the compile unit DIE this DIE belongs to.<br>
+DIE *DIE::getCompileUnit() const{<br>
+  DIE *p = getParent();<br>
+  while (p) {<br>
+    if (p->getTag() == dwarf::DW_TAG_compile_unit)<br>
+      return p;<br>
+    p = p->getParent();<br>
+  }<br>
+  return NULL;<br>
+}<br>
+<br></blockquote><div><br></div><div style>Shouldn't this be unreachable or is there some case where we have orphaned DIEs?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+/// For a given compile unit DIE, returns offset from beginning of debug info.<br>
+unsigned DwarfUnits::getCUOffset(DIE *Die) {<br>
+  for (SmallVector<CompileUnit *, 1>::iterator I = CUs.begin(),<br>
+       E = CUs.end(); I != E; ++I) {<br>
+    CompileUnit *TheCU = *I;<br>
+    if (TheCU->getCUDie() == Die)<br>
+      return TheCU->getDebugInfoOffset();<br>
+  }<br>
+  return 0;<br>
+}<br>
+<br></blockquote><div><br></div><div style>Can you make this a little more safe? Assert that it's a compile unit on entry and that'd hopefully make the return 0 also be unreachable?</div><div> </div><div style>Also can you show at least some of the debug info for how you made your determination? This seems odd (at least the abstract origin part) and I'd like to understand how we lto'd something together and got this.</div>
<div style><br></div><div style>Thanks!</div><div style><br></div><div style>-eric</div></div><br></div></div>