[llvm] r206665 - [llvm-symbolizer] Print file/line for a PC even if there is no DIE describing it.
Eric Christopher
echristo at gmail.com
Mon Apr 21 11:09:12 PDT 2014
I worry that this will give the inaccurate answers that we were
worried about without -gmlt turned on (inlining issues primarily).
Thoughts? Some, maybe slightly inaccurate, info is better than no info?
-eric
On Fri, Apr 18, 2014 at 3:22 PM, Alexey Samsonov <samsonov at google.com> wrote:
> Author: samsonov
> Date: Fri Apr 18 17:22:44 2014
> New Revision: 206665
>
> URL: http://llvm.org/viewvc/llvm-project?rev=206665&view=rev
> Log:
> [llvm-symbolizer] Print file/line for a PC even if there is no DIE describing it.
>
> This is important for symbolizing executables with debug info in
> unavailable .dwo files. Even if all DIE entries are missing, we can
> still symbolize an address: function name can be fetched from symbol table,
> and file/line info can be fetched from line table.
>
> Added:
> llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test (with props)
> llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc
> Modified:
> llvm/trunk/lib/DebugInfo/DWARFContext.cpp
> llvm/trunk/test/DebugInfo/llvm-symbolizer.test
>
> Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=206665&r1=206664&r2=206665&view=diff
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Fri Apr 18 17:22:44 2014
> @@ -545,18 +545,32 @@ DILineInfoTable DWARFContext::getLineInf
>
> DIInliningInfo DWARFContext::getInliningInfoForAddress(uint64_t Address,
> DILineInfoSpecifier Specifier) {
> + DIInliningInfo InliningInfo;
> +
> DWARFCompileUnit *CU = getCompileUnitForAddress(Address);
> if (!CU)
> - return DIInliningInfo();
> + return InliningInfo;
>
> + const DWARFLineTable *LineTable = nullptr;
> + const bool NeedsAbsoluteFilePath =
> + Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);
> const DWARFDebugInfoEntryInlinedChain &InlinedChain =
> CU->getInlinedChainForAddress(Address);
> - if (InlinedChain.DIEs.size() == 0)
> - return DIInliningInfo();
> + if (InlinedChain.DIEs.size() == 0) {
> + // If there is no DIE for address (e.g. it is in unavailable .dwo file),
> + // try to at least get file/line info from symbol table.
> + if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {
> + DILineInfo Frame;
> + LineTable = getLineTableForCompileUnit(CU);
> + if (getFileLineInfoForCompileUnit(CU, LineTable, Address,
> + NeedsAbsoluteFilePath, Frame)) {
> + InliningInfo.addFrame(Frame);
> + }
> + }
> + return InliningInfo;
> + }
>
> - DIInliningInfo InliningInfo;
> uint32_t CallFile = 0, CallLine = 0, CallColumn = 0;
> - const DWARFLineTable *LineTable = nullptr;
> for (uint32_t i = 0, n = InlinedChain.DIEs.size(); i != n; i++) {
> const DWARFDebugInfoEntryMinimal &FunctionDIE = InlinedChain.DIEs[i];
> DILineInfo Frame;
> @@ -566,16 +580,13 @@ DIInliningInfo DWARFContext::getInlining
> Frame.FunctionName = Name;
> }
> if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {
> - const bool NeedsAbsoluteFilePath =
> - Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);
> if (i == 0) {
> // For the topmost frame, initialize the line table of this
> // compile unit and fetch file/line info from it.
> LineTable = getLineTableForCompileUnit(CU);
> // For the topmost routine, get file/line info from line table.
> getFileLineInfoForCompileUnit(CU, LineTable, Address,
> - NeedsAbsoluteFilePath,
> - Frame);
> + NeedsAbsoluteFilePath, Frame);
> } else {
> // Otherwise, use call file, call line and call column from
> // previous DIE in inlined chain.
>
> Added: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test?rev=206665&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test
> ------------------------------------------------------------------------------
> svn:executable = *
>
> Propchange: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc?rev=206665&view=auto
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc (added)
> +++ llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-dwo-test.cc Fri Apr 18 17:22:44 2014
> @@ -0,0 +1,18 @@
> +int f(int a, int b) {
> + return a + b;
> +}
> +
> +int g(int a) {
> + return a + 1;
> +}
> +
> +
> +int main() {
> + return f(2, g(2));
> +}
> +
> +// Built with Clang 3.5.0:
> +// $ mkdir -p /tmp/dbginfo
> +// $ cp llvm-symbolizer-dwo-test.cc /tmp/dbginfo
> +// $ cd /tmp/dbginfo
> +// $ clang -gsplit-dwarf llvm-symbolizer-dwo-test.cc
>
> Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=206665&r1=206664&r2=206665&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/llvm-symbolizer.test (original)
> +++ llvm/trunk/test/DebugInfo/llvm-symbolizer.test Fri Apr 18 17:22:44 2014
> @@ -8,6 +8,7 @@ RUN: echo "\"%p/Inputs/dwarfdump-test3.e
> RUN: echo "%p/Inputs/macho-universal 0x1f84" >> %t.input
> RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input
> RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input
> +RUN: echo "%p/Inputs/llvm-symbolizer-dwo-test 0x400514" >> %t.input
>
> RUN: llvm-symbolizer --functions --inlining --demangle=false \
> RUN: --default-arch=i386 < %t.input | FileCheck %s
> @@ -48,6 +49,9 @@ CHECK: main
> CHECK: _Z3inci
> CHECK: _Z3inci
>
> +CHECK: main
> +CHECK-NEXT: llvm-symbolizer-dwo-test.cc:11
> +
> RUN: echo "unexisting-file 0x1234" > %t.input2
> RUN: llvm-symbolizer < %t.input2
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list