<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 21, 2014 at 11:09 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I worry that this will give the inaccurate answers that we were<br>
worried about without -gmlt turned on (inlining issues primarily).<br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Thoughts? Some, maybe slightly inaccurate, info is better than no info?<br></blockquote><div><br></div><div>Yes, I guess so. We will still get a correct file/line data, but if the PC/address belongs to</div><div>an inlined call, we might print the function name it was inlined into, instead of the name of inlined subroutine.</div>
<div>This is still probably better than no information at all.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, Apr 18, 2014 at 3:22 PM, Alexey Samsonov <<a href="mailto:samsonov@google.com">samsonov@google.com</a>> wrote:<br>
> Author: samsonov<br>
> Date: Fri Apr 18 17:22:44 2014<br>
> New Revision: 206665<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=206665&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=206665&view=rev</a><br>
> Log:<br>
> [llvm-symbolizer] Print file/line for a PC even if there is no DIE describing it.<br>
><br>
> This is important for symbolizing executables with debug info in<br>
> unavailable .dwo files. Even if all DIE entries are missing, we can<br>
> still symbolize an address: function name can be fetched from symbol table,<br>
> and file/line info can be fetched from line table.<br>
><br>
> Added:<br>
>     llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test   (with props)<br>
>     llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc<br>
> Modified:<br>
>     llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
>     llvm/trunk/test/DebugInfo/llvm-symbolizer.test<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=206665&r1=206664&r2=206665&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=206665&r1=206664&r2=206665&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)<br>
> +++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Fri Apr 18 17:22:44 2014<br>
> @@ -545,18 +545,32 @@ DILineInfoTable DWARFContext::getLineInf<br>
><br>
>  DIInliningInfo DWARFContext::getInliningInfoForAddress(uint64_t Address,<br>
>      DILineInfoSpecifier Specifier) {<br>
> +  DIInliningInfo InliningInfo;<br>
> +<br>
>    DWARFCompileUnit *CU = getCompileUnitForAddress(Address);<br>
>    if (!CU)<br>
> -    return DIInliningInfo();<br>
> +    return InliningInfo;<br>
><br>
> +  const DWARFLineTable *LineTable = nullptr;<br>
> +  const bool NeedsAbsoluteFilePath =<br>
> +      Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);<br>
>    const DWARFDebugInfoEntryInlinedChain &InlinedChain =<br>
>        CU->getInlinedChainForAddress(Address);<br>
> -  if (InlinedChain.DIEs.size() == 0)<br>
> -    return DIInliningInfo();<br>
> +  if (InlinedChain.DIEs.size() == 0) {<br>
> +    // If there is no DIE for address (e.g. it is in unavailable .dwo file),<br>
> +    // try to at least get file/line info from symbol table.<br>
> +    if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {<br>
> +      DILineInfo Frame;<br>
> +      LineTable = getLineTableForCompileUnit(CU);<br>
> +      if (getFileLineInfoForCompileUnit(CU, LineTable, Address,<br>
> +                                        NeedsAbsoluteFilePath, Frame)) {<br>
> +        InliningInfo.addFrame(Frame);<br>
> +      }<br>
> +    }<br>
> +    return InliningInfo;<br>
> +  }<br>
><br>
> -  DIInliningInfo InliningInfo;<br>
>    uint32_t CallFile = 0, CallLine = 0, CallColumn = 0;<br>
> -  const DWARFLineTable *LineTable = nullptr;<br>
>    for (uint32_t i = 0, n = InlinedChain.DIEs.size(); i != n; i++) {<br>
>      const DWARFDebugInfoEntryMinimal &FunctionDIE = InlinedChain.DIEs[i];<br>
>      DILineInfo Frame;<br>
> @@ -566,16 +580,13 @@ DIInliningInfo DWARFContext::getInlining<br>
>          Frame.FunctionName = Name;<br>
>      }<br>
>      if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {<br>
> -      const bool NeedsAbsoluteFilePath =<br>
> -          Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);<br>
>        if (i == 0) {<br>
>          // For the topmost frame, initialize the line table of this<br>
>          // compile unit and fetch file/line info from it.<br>
>          LineTable = getLineTableForCompileUnit(CU);<br>
>          // For the topmost routine, get file/line info from line table.<br>
>          getFileLineInfoForCompileUnit(CU, LineTable, Address,<br>
> -                                      NeedsAbsoluteFilePath,<br>
> -                                      Frame);<br>
> +                                      NeedsAbsoluteFilePath, Frame);<br>
>        } else {<br>
>          // Otherwise, use call file, call line and call column from<br>
>          // previous DIE in inlined chain.<br>
><br>
> Added: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test?rev=206665&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test?rev=206665&view=auto</a><br>

> ==============================================================================<br>
> Binary file - no diff available.<br>
><br>
> Propchange: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test<br>
> ------------------------------------------------------------------------------<br>
>     svn:executable = *<br>
><br>
> Propchange: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test<br>
> ------------------------------------------------------------------------------<br>
>     svn:mime-type = application/octet-stream<br>
><br>
> Added: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc?rev=206665&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc?rev=206665&view=auto</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc (added)<br>
> +++ llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc Fri Apr 18 17:22:44 2014<br>
> @@ -0,0 +1,18 @@<br>
> +int f(int a, int b) {<br>
> +  return a + b;<br>
> +}<br>
> +<br>
> +int g(int a) {<br>
> +  return a + 1;<br>
> +}<br>
> +<br>
> +<br>
> +int main() {<br>
> +  return f(2, g(2));<br>
> +}<br>
> +<br>
> +// Built with Clang 3.5.0:<br>
> +// $ mkdir -p /tmp/dbginfo<br>
> +// $ cp llvm-symbolizer-dwo-test.cc /tmp/dbginfo<br>
> +// $ cd /tmp/dbginfo<br>
> +// $ clang -gsplit-dwarf llvm-symbolizer-dwo-test.cc<br>
><br>
> Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=206665&r1=206664&r2=206665&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=206665&r1=206664&r2=206665&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/llvm-symbolizer.test (original)<br>
> +++ llvm/trunk/test/DebugInfo/llvm-symbolizer.test Fri Apr 18 17:22:44 2014<br>
> @@ -8,6 +8,7 @@ RUN: echo "\"%p/Inputs/dwarfdump-test3.e<br>
>  RUN: echo "%p/Inputs/macho-universal 0x1f84" >> %t.input<br>
>  RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input<br>
>  RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input<br>
> +RUN: echo "%p/Inputs/llvm-symbolizer-dwo-test 0x400514" >> %t.input<br>
><br>
>  RUN: llvm-symbolizer --functions --inlining --demangle=false \<br>
>  RUN:    --default-arch=i386 < %t.input | FileCheck %s<br>
> @@ -48,6 +49,9 @@ CHECK:      main<br>
>  CHECK:      _Z3inci<br>
>  CHECK:      _Z3inci<br>
><br>
> +CHECK: main<br>
> +CHECK-NEXT: llvm-symbolizer-dwo-test.cc:11<br>
> +<br>
>  RUN: echo "unexisting-file 0x1234" > %t.input2<br>
>  RUN: llvm-symbolizer < %t.input2<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Alexey Samsonov, Mountain View, CA</div></div>
</div></div>