Parsing Stack Traces


addr2line -e mongod -ifC <offset>


You can use c++filt to demangle function names by pasting the whole stack trace to stdin.

Finding the Right Binary

To find the binary you need:

  • Get the commit at the header of any of our logs.
  • Use git to locate that commit and check for the surrounding “version bump” commit

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 find debugsymbols for official builds by clicking list on the Downloads page.

Example 1

Then, the log has lines like this:

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

You want the address in between the brackets 0x689280.

Note you will get more than one stack frame for the address if the code is inlined.

Example 2

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
$ addr2line -i -e mongod 0x6d0694