Bug 207933 - [Linux] StackTrace symbols are not demangled
Summary: [Linux] StackTrace symbols are not demangled
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-19 03:38 PST by Philippe Normand
Modified: 2020-02-25 01:20 PST (History)
7 users (show)

See Also:


Attachments
Patch (1.84 KB, patch)
2020-02-19 03:47 PST, Philippe Normand
ysuzuki: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 2020-02-19 03:38:51 PST
The demangle() function should be called when BACKTRACE_SYMBOLS is enabled as well.
Comment 1 Philippe Normand 2020-02-19 03:47:00 PST
Created attachment 391151 [details]
Patch
Comment 2 Philippe Normand 2020-02-24 01:06:30 PST
Traces are incomplete in WPE because BACKTRACE_SYMBOLS is disabled, we have traces like this:

  1   0x7f9be067c7e4 webkitWebViewLoadFailed(_WebKitWebView*, WebKitLoadEvent, char const*, _GError*)
    2   0x7f9be0650e31 NavigationClient::didFailProvisionalNavigationWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, API::Navigation*, WebCore::ResourceError const&, API::Object*)
    3   0x7f9be05929d0 WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared(WTF::Ref<WebKit::WebProcessProxy, WTF::DumbPtrTraits<WebKit::WebProcessProxy> >&&, WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&)
    4   0x7f9be05ce0f3 WebKit::WebPageProxy::didFailProvisionalLoadForFrame(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&)
    5   0x7f9be02ff0de void IPC::handleMessage<Messages::WebPageProxy::DidFailProvisionalLoadForFrame, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&)>(IPC::Decoder&, WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&))
    6   0x7f9be02d6744 WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
    7   0x7f9be04b1f8a IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&)
    8   0x7f9be0589d2f non-virtual thunk to WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
    9   0x7f9be04aaca0 IPC::Connection::dispatchMessage(IPC::Decoder&)
    10  0x7f9be04ac075 IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder, std::default_delete<IPC::Decoder> >)
    11  0x7f9be04ac90f IPC::Connection::dispatchIncomingMessages()
    12  0x7f9bde091e49 WTF::RunLoop::performWork()
    13  0x7f9bde0f32f9
    14  0x7f9be4a3858e g_main_context_dispatch
    15  0x7f9be4a38940
    16  0x7f9be4a38c33 g_main_loop_run
    17  0x55847d369de9
    18  0x7f9be4a60cae
    19  0x7f9be4a60a54
    20  0x7f9be4a60a54
    21  0x7f9be4a6115b g_test_run_suite
    22  0x7f9be4a611b5 g_test_run
    23  0x55847d368fea
    24  0x7f9bd9849173 __libc_start_main
    25  0x55847d36915e

With backtrace_symbols enabled we'd get:

1   0x7f184b80e074 webkitWebViewLoadFailed(_WebKitWebView*, WebKitLoadEvent, char const*, _GError*)
    2   0x7f184b7e26c1 NavigationClient::didFailProvisionalNavigationWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, API::Navigation*, WebCore::ResourceError const&, API::Object*)
    3   0x7f184b72556d WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared(WTF::Ref<WebKit::WebProcessProxy, WTF::DumbPtrTraits<WebKit::WebProcessProxy> >&&, WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&)
    4   0x7f184b760633 WebKit::WebPageProxy::didFailProvisionalLoadForFrame(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&)
    5   0x7f184b4ac0b0 void IPC::handleMessage<Messages::WebPageProxy::DidFailProvisionalLoadForFrame, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&)>(IPC::Decoder&, WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData&&, unsigned long, WTF::String const&, WebCore::ResourceError const&, WebCore::WillContinueLoading, WebKit::UserData const&))
    6   0x7f184b4874e7 WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
    7   0x7f184b65749a IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&)
    8   0x7f184b71cdaf non-virtual thunk to WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
    9   0x7f184b6501b0 IPC::Connection::dispatchMessage(IPC::Decoder&)
    10  0x7f184b651585 IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder, std::default_delete<IPC::Decoder> >)
    11  0x7f184b651e1f IPC::Connection::dispatchIncomingMessages()
    12  0x7f184969bea9 WTF::RunLoop::performWork()
    13  0x7f18496fd399 /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18(+0x1442399) [0x7f18496fd399]
    14  0x7f184f20b52e g_main_context_dispatch
    15  0x7f184f20b8e0 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x538e0) [0x7f184f20b8e0]
    16  0x7f184f20bbd3 g_main_loop_run
    17  0x560c97e9ada9 /app/webkit/WebKitBuild/Release/bin/TestWebKitAPI/WebKit2Gtk/TestSSL(+0x6da9) [0x560c97e9ada9]
    18  0x7f184f233a5e /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x7ba5e) [0x7f184f233a5e]
    19  0x7f184f233804 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x7b804) [0x7f184f233804]
    20  0x7f184f233804 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x7b804) [0x7f184f233804]
    21  0x7f184f233f0b g_test_run_suite
    22  0x7f184f233f65 g_test_run
    23  0x560c97e99faa /app/webkit/WebKitBuild/Release/bin/TestWebKitAPI/WebKit2Gtk/TestSSL(+0x5faa) [0x560c97e99faa]
    24  0x7f184517c173 __libc_start_main
    25  0x560c97e9a11e /app/webkit/WebKitBuild/Release/bin/TestWebKitAPI/WebKit2Gtk/TestSSL(+0x611e) [0x560c97e9a11e]
Comment 3 Yusuke Suzuki 2020-02-24 13:36:40 PST
Comment on attachment 391151 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391151&action=review

> Source/WTF/wtf/StackTrace.cpp:141
>          auto demangled = demangle(stack[i]);
>          if (demangled) {
>              mangledName = demangled->mangledName();
>              cxaDemangled = demangled->demangledName();
>          }

If it works, why do we have `HAVE(BACKTRACE_SYMBOLS)` path? It looks like we should always use DLADDR path when we have BACKTRACE_SYMBOLS too.
Can we just remove BACKTRACE_SYMBOLS code?
Comment 4 Yusuke Suzuki 2020-02-24 13:48:58 PST
Comment on attachment 391151 [details]
Patch

Ah, I've missed your comment. OK, dladdr cannot work well if the code is JIT, and HAVE(BACKTRACE_SYMBOLS) can fill some cases.
Comment 5 Philippe Normand 2020-02-25 01:19:40 PST
Committed r257298: <https://trac.webkit.org/changeset/257298>
Comment 6 Radar WebKit Bug Importer 2020-02-25 01:20:17 PST
<rdar://problem/59758165>