Hi folks,
enable_stack_trace_line_numbers = true
into your gn args on linux and get line-numbers (and column numbers) on your stack traces! (Example trace at the bottom).
If this ends up being stable for enough people, I suggest someone flip that flag on by default in
logging.gni.
Note that this will NOT be enabled on the bots as those use symbol_level = 0 which does not generate the line-number information. There is an open question about whether symbol_level=1 (just the line number tables) can be made efficient enough to turn on in the bots. But someone would have to do the analysis.
Special call out to danakj@ and dcheng@ for dealing with my very messy implementation of DWARF-4, to thakis@ and aeubanks@ for fixing the .dwarf_aranges issues in clang, and and to dprake@ with the lighting fast last-minute OWNERS approval for logging.gni change that let me land this. :)
Happy crashing (with line numbers) everyone!
-Albert
Example stack trace:
[ RUN ] StackTraceTest.DebugPrintWithNullPrefixBacktrace
#0 0x5588cc768fa9 base::debug::CollectStackTrace() [../../base/debug/stack_trace_posix.cc:867:39]
#1 0x5588cc68b1f3 base::debug::StackTrace::StackTrace() [../../base/debug/stack_trace.cc:200:12]
#2 0x5588cb84242b base::debug::StackTraceTest_DebugPrintWithNullPrefixBacktrace_Test::TestBody()
#3 0x5588cc639ee3 testing::Test::Run() [../../third_party/googletest/src/googletest/src/gtest.cc:2706:5]
#4 0x5588cc63b074 testing::TestInfo::Run() [../../third_party/googletest/src/googletest/src/gtest.cc:2885:11]
#5 0x5588cc63bcb7 testing::TestSuite::Run() [../../third_party/googletest/src/googletest/src/gtest.cc:3039:28]
#6 0x5588cc64f537 testing::internal::UnitTestImpl::RunAllTests() [../../third_party/googletest/src/googletest/src/gtest.cc:5897:44]
#7 0x5588cc64ee69 testing::UnitTest::Run() [../../third_party/googletest/src/googletest/src/gtest.cc:5158:3]
#8 0x5588cc82d6e5 base::TestSuite::Run() [../../third_party/googletest/src/googletest/include/gtest/gtest.h:2492:46]
#9 0x5588cc847f05 base::(anonymous namespace)::LaunchUnitTestsInternal() [../../base/callback.h:98:12]
#10 0x5588cc847d77 base::LaunchUnitTests() [../../base/test/launcher/unit_test_launcher.cc:247:10]
#11 0x5588cc8180ff main [../../base/test/run_all_unittests.cc:70:10]
#12 0x7f1638939d0a __libc_start_main
#13 0x5588cb60426a _start