Building Firefox with Debug Symbols

  • Revision slug: Building_Firefox_with_Debug_Symbols
  • Revision title: Building Firefox with Debug Symbols
  • Revision id: 53910
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment no changes

Revision Content

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:

{{ fx_minversion_header("4") }}

Building Firefox 4.0 and later

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

ac_add_options --enable-debug-symbols[=DBG]

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

export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debugger-info-modules=yes

Note that a typical release build will have additional options. See http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/win32/mozilla-central/nightly/mozconfig for the configuration used for nightly builds.

On Mac

 export MOZ_DEBUG_SYMBOLS=1 
 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 http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/macosx/mozilla-central/nightly/mozconfig 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 {{ Source_cvs("tools/tinderbox-configs/firefox/macosx/mozconfig") }} 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:

 export MOZ_DEBUG_SYMBOLS=1
 export CFLAGS="-gstabs+"
 export CXXFLAGS="-gstabs+"

See http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/linux/mozilla-central/nightly/mozconfig 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:

make -C objdir buildsymbols

The tinderbox uses an additional uploadsymbols target to upload symbols to a socorro server. See {{ Source_cvs("toolkit/crashreporter/tools/upload_symbols.sh") }} 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

{{ languages( { "ja": "ja/Building_Firefox_with_Debug_Symbols" } ) }}

Revision Source

<p>By default, a release build of Firefox will not generate debug symbols suitable for debugging or post-processing into the <a href="/en/Crash_reporting" title="en/Crash_reporting">breakpad</a> symbol format. Use the following <a href="/en/Configuring_Build_Options" title="en/Configuring_Build_Options">mozconfig</a> settings to do a build with symbols:</p>
<p>{{ fx_minversion_header("4") }}</p>
<h3>Building Firefox 4.0 and later</h3>
<p>Starting with Firefox 4.0b1 there is a single configure option to enabled building with symbols on all platforms.</p>
<pre>ac_add_options --enable-debug-symbols[=DBG]
</pre>
<p>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.</p>
<p>Note that this will override the values provided for CFLAGS and CXXFLAGS.</p>
<h3>Building older versions of Firefox with debug symbols</h3>
<h3>On Windows</h3>
<pre class="eval">export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debugger-info-modules=yes
</pre>
<p>Note that a typical release build will have additional options. See <a class=" external" href="http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/win32/mozilla-central/nightly/mozconfig" title="http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/win32/mozilla-central/nightly/mozconfig">http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/win32/mozilla-central/nightly/mozconfig</a> for the configuration used for nightly builds.</p>
<h3 name="On_Mac">On Mac</h3>
<pre class="eval"> export MOZ_DEBUG_SYMBOLS=1 
 export CFLAGS="-gdwarf-2"
 export CXXFLAGS="-gdwarf-2"
</pre>
<p>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.</p>
<p>See <a class="moz-txt-link-freetext external" href="http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/macosx/mozilla-central/nightly/mozconfig">http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/macosx/mozilla-central/nightly/mozconfig</a> for the configuration used for trunk nightly builds.</p>
<p>Note that the 1.9.0 branch doesn't have dwarf support on Mac, the configuration there is:</p>
<pre class="eval"> export CFLAGS="-g -gfull"
 export CXXFLAGS="-g -gfull"
</pre>
<p>See {{ Source_cvs("tools/tinderbox-configs/firefox/macosx/mozconfig") }} for the configuration used for 1.9.0 nightly builds.</p>
<h3 name="On_Linux">On Linux</h3>
<p>Unfortunately the default debugger flags produce output that cannot be used with crash reporter, so you have to force compatible debugger output like this:</p>
<pre class="eval"> export MOZ_DEBUG_SYMBOLS=1
 export CFLAGS="-gstabs+"
 export CXXFLAGS="-gstabs+"
</pre>
<p>See <a class=" external" href="http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/linux/mozilla-central/nightly/mozconfig" title="http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/linux/mozilla-central/nightly/mozconfig">http://hg.mozilla.org/build/buildbot-configs/file/tip/mozilla2/linux/mozilla-central/nightly/mozconfig</a> for the configuration used for nightly builds.</p>
<h3 name="Breakpad_symbol_files">Breakpad symbol files</h3>
<p>After the build is complete, run the following command to generate an archive of <a href="/en/Crash_reporting" title="en/Crash_reporting">Breakpad</a> symbol files:</p>
<pre class="eval">make -C objdir buildsymbols
</pre>
<p>The tinderbox uses an additional <code>uploadsymbols</code> target to upload symbols to a socorro server. See {{ Source_cvs("toolkit/crashreporter/tools/upload_symbols.sh") }} for more information about the environment variables used by this target.</p>
<h3 name="make_package"><code>make package</code></h3>
<p>If you use <code>make package</code> 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:</p>
<pre class="eval"> ac_add_options --disable-install-strip
</pre>
<p>{{ languages( { "ja": "ja/Building_Firefox_with_Debug_Symbols" } ) }}</p>
Revert to this revision