Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get pretty stack trace on Linux?

60 views
Skip to first unread message

Masayuki Nakano

unread,
Sep 21, 2017, 8:51:49 PM9/21/17
to dev-pl...@lists.mozilla.org
I'd like to get pretty stack trance which shows method names rather than
only address with tryserver build on Linux. However,
nsTraceRefcnt::WalkTheStack() cannot get method names on Linux as you know.

The reason why I need to get it is, I have a bug report which depends on
the environment and I cannot reproduce it on my any environments.
Therefore, I'd like the reporter to log the stack trace when it occurs
with MOZ_LOG.

My questions are, how to or is it possible to get pretty stack trace on
Linux with MOZ_LOG? And/or do you have better idea to get similar
information to check which path causes a bug.

If it's impossible, I'll create a tryserver build with each ancestor
caller logs the path, though.

Thanks in advance.

--
Masayuki Nakano <masa...@d-toybox.com>
Software Engineer, Mozilla

Ted Mielczarek

unread,
Sep 21, 2017, 8:56:36 PM9/21/17
to dev-pl...@lists.mozilla.org
On Thu, Sep 21, 2017, at 08:51 PM, Masayuki Nakano wrote:
> I'd like to get pretty stack trance which shows method names rather than
> only address with tryserver build on Linux. However,
> nsTraceRefcnt::WalkTheStack() cannot get method names on Linux as you
> know.
>
> The reason why I need to get it is, I have a bug report which depends on
> the environment and I cannot reproduce it on my any environments.
> Therefore, I'd like the reporter to log the stack trace when it occurs
> with MOZ_LOG.
>
> My questions are, how to or is it possible to get pretty stack trace on
> Linux with MOZ_LOG? And/or do you have better idea to get similar
> information to check which path causes a bug.
>
> If it's impossible, I'll create a tryserver build with each ancestor
> caller logs the path, though.


Hi Masayuki,

Our test harnesses accomplish this by piping the output of Firefox
through one of the stack fixing scripts in tools/rb[1].
fix_linux_stack.py uses addr2line, which should at least give you
function symbols on Nightly. You could use my GDB symbol server
script[2] to fetch the actual debug symbols from the symbol server if
you want full source line information.

Regards,
-Ted


1. https://dxr.mozilla.org/mozilla-central/source/tools/rb
2. https://gist.github.com/luser/193572147c401c8a965c

Masayuki Nakano

unread,
Oct 13, 2017, 11:29:51 AM10/13/17
to Ted Mielczarek, dev-pl...@lists.mozilla.org
Ted, really sorry for the delay to say "Thank you" because of too busy
of my life.

I tried to do this on my environment (Ubuntu), then, I succeeded to get
a pretty stack trace even from trysever build.

1. Put |#include "nsTraceRefcnt.h"| and
|nsTraceRefcnt::WalkTheStack(stderr);| where I want to get stack trace.
2. Post it to tryserver.
3. Get Linux build from "B" of "target.tar.bz2" in treeherder.
4. Get build symbols from "B" of "target.crashreporter-symbols.zip" in
treeherder.
5. Then, extract all of them.
6. Run the tryserver build from terminal.
7. Save stack trace to a text file.
8. Run |<path to src dir>/tools/rb/fix_linux_stack.py < stack.txt|

Thank you very much!
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform

Masayuki Nakano

unread,
Oct 13, 2017, 11:59:44 AM10/13/17
to Ted Mielczarek, dev-pl...@lists.mozilla.org
On 10/14/2017 12:29 AM, Masayuki Nakano wrote:
> Ted, really sorry for the delay to say "Thank you" because of too busy
> of my life.
>
> I tried to do this on my environment (Ubuntu), then, I succeeded to get
> a pretty stack trace even from trysever build.
>
> 1. Put |#include "nsTraceRefcnt.h"| and
> |nsTraceRefcnt::WalkTheStack(stderr);| where I want to get stack trace.
> 2. Post it to tryserver.
> 3. Get Linux build from "B" of "target.tar.bz2" in treeherder.
> 4. Get build symbols from "B" of "target.crashreporter-symbols.zip" in
> treeherder.
> 5. Then, extract all of them.
> 6. Run the tryserver build from terminal.
> 7. Save stack trace to a text file.
> 8. Run |<path to src dir>/tools/rb/fix_linux_stack.py < stack.txt|

#8 runs in the directory which target.crashreporter-symbols.zip is unzipped.
0 new messages