Building Firefox with Debug Symbols

By default, a release build of Firefox will not generate debug symbols suitable for debugging or post-processing into the breakpad symbol format. Use the following mozconfig settings to do a build with symbols:

Building Firefox 4.0 and later

Starting with Firefox 4.0b1 there is a single configure option to enable building with symbols on all platforms.

ac_add_options --enable-debug-symbols

This will optionally take the type of symbols that need to be produced (like "-gstabs+" or "-gdwarf-2"). By default it uses "-g" on Linux and MacOS.

Note that this will override the values provided for CFLAGS and CXXFLAGS.

Building older versions of Firefox with debug symbols

On Windows

ac_add_options --enable-debugger-info-modules=yes

Note that a typical release build will have additional options. See for the configuration used for nightly builds.

On Mac

 export CFLAGS="-gdwarf-2"
 export CXXFLAGS="-gdwarf-2"

You should use CFLAGS/CXXFLAGS instead of passing compiler flags in --enable-optimize, because --enable-optimize=flags overrides module-specific optimization settings, which you really don't want to do. See bug 407794 for more info.

See for the configuration used for trunk nightly builds.

Note that the 1.9.0 branch doesn't have dwarf support on Mac, the configuration there is:

 export CFLAGS="-g -gfull"
 export CXXFLAGS="-g -gfull"

See for the configuration used for 1.9.0 nightly builds.

On Linux

Unfortunately the default debugger flags produce output that cannot be used with crash reporter, so you have to force compatible debugger output like this:

 ac_add_options --enable-debug-symbols="-gdwarf-2"

See for the configuration used for nightly builds.

Breakpad symbol files

After the build is complete, run the following command to generate an archive of Breakpad symbol files:

mach buildsymbols

The tinderbox uses an additional uploadsymbols target to upload symbols to a socorro server. See for more information about the environment variables used by this target.

make package

If you use make package to package your build, symbols will be stripped. If you want to keep the symbols in the patches, you need to add this to your mozconfig:

 ac_add_options --disable-install-strip