Line-numbers for Linux Stack Traces now available!

284 views
Skip to first unread message

Albert J. Wong (王重傑)

unread,
Aug 12, 2021, 11:59:53 PM8/12/21
to Chromium-dev
Hi folks,

Once https://chromium-review.googlesource.com/c/chromium/src/+/3002926 lands (fingers crossed), you should be able to add 

  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

K. Moon

unread,
Aug 13, 2021, 12:03:27 PM8/13/21
to Albert Wong, Chromium-dev
Fancy; thanks for doing this!

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CALcbsXDG1%3DOav4AmL_yjePCfUb3k6-1fKpntzaPxRWM9Jx-YVg%40mail.gmail.com.

Ken Russell

unread,
Aug 13, 2021, 3:42:31 PM8/13/21
to K. Moon, Albert Wong, Chromium-dev
Thanks Albert for implementing this! It will speed up debugging of unit tests quite a lot.


Xianzhu Wang

unread,
Aug 20, 2021, 3:35:40 PM8/20/21
to Kenneth Russell, K. Moon, Albert Wong, Chromium-dev
Thanks for implementing this!

However, content_shell seems to lose the ability to dump stack traces. Now it just shows the following when it crashes:
  Received signal 11 SEGV_MAPERR 000000000050
  Received signal 6

Without enable_stack_frame_line_number=true, it shows
  Received signal 11 SEGV_MAPERR 000000000050
  ... stack trace without line numbers ...
and no "Received signal 6".

It seems that the stack trace dump code crashed with SIGABRT with enable_stack_frame_line_number=true?

Xianzhu Wang

unread,
Aug 27, 2021, 12:54:07 PM8/27/21
to Kenneth Russell, K. Moon, Albert Wong, Chromium-dev
On Fri, Aug 20, 2021 at 12:34 PM Xianzhu Wang <wangx...@chromium.org> wrote:
Thanks for implementing this!

However, content_shell seems to lose the ability to dump stack traces. Now it just shows the following when it crashes:
  Received signal 11 SEGV_MAPERR 000000000050
  Received signal 6

Without enable_stack_frame_line_number=true, it shows
  Received signal 11 SEGV_MAPERR 000000000050
  ... stack trace without line numbers ...
and no "Received signal 6".

It seems that the stack trace dump code crashed with SIGABRT with enable_stack_frame_line_number=true?

Reply all
Reply to author
Forward
0 new messages