0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 00:17:37 +01:00
mongodb/docs/parsing_stack_traces.md
Alexander Neben 71f830ce49 SERVER-87034 Initial markdown format (#19276)
GitOrigin-RevId: 64e388007ec1ac3744537253540995af628bcc00
2024-02-27 19:58:04 +00:00

1.9 KiB

Parsing Stack Traces

addr2line

addr2line is a utility to translate addresses into filenames and line numbers.

addr2line -e mongod -ifC <offset>

c++filt

Use c++filt to demangle function names by pasting the whole stack trace to stdin.

Finding the Right Binary

To find the correct binary for a specific log you need to:

  1. Get the commit from the header of the logs.
  2. Use git to locate that commit and check for the surrounding "version bump" commit.
  3. Download and open the binary:
curl -O http://s3.amazonaws.com/downloads.mongodb.org/linux/mongodb-linux-x86_64-debugsymbols-1.x.x.tgz

You can also get the debugsymbols archive for official builds through the Downloads page. In the Archived Releases section, click on the appropriate platform link to view the available archives. Select the appropriate debug symbols archive.

Example: Reading the Log

Note that the log has lines like this:

/home/abc/mongod(_ZN5mongo15printStackTraceERSo+0x27) [0x689280]

You want to use the address in between the brackets 0x689280. Note that you will get more than one stack frame for the address if the code is inlined.

Example: Using addr2line

Actual example from a v1.8.1 64-bit Linux build:

$ curl http://downloads.mongodb.org/linux/mongodb-linux-x86_64-debugsymbols-1.8.1.tgz > out.tgz
$ tar -xzf out.tgz
$ cd mongodb-linux-x86_64-debugsymbols-1.8.1/
$ cd bin
$ addr2line --help
$ addr2line -i -e mongod 0x6d6a74
/mnt/home/buildbot/slave/Linux_64bit_V1.8/mongo/db/repl/health.cpp:394
$ addr2line -i -e mongod 0x6d0694
/mnt/home/buildbot/slave/Linux_64bit_V1.8/mongo/db/repl/rs.h:385
/mnt/home/buildbot/slave/Linux_64bit_V1.8/mongo/db/repl/replset_commands.cpp:111