4 Jul 2012 shlomif   » (Master)

Tech Tip: How to Build Firefox with Debugging Symbols on Linux

I spent a large part of today building Firefox on one of my Linux machines and trying to figure out why gdb did not display debugging symbols, and instead only displayed question marks in the backtrace (?? ). Eeventually, I found a solution, so I'd like to document the process for other people in the future.

The solution is documented in this bug report that I filed and involves the following steps:

  1. Checkout the firefox source from the mozilla-central repository

  2. Put something like the following in the .mozconfig file in the source's root (where client.mk can be found):

    . $topsrcdir/browser/config/mozconfig
    export LDFLAGS="-Wl,--no-keep-memory"
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-dbg
    ac_add_options --disable-optimize
    ac_add_options --enable-debug
    ac_add_options --enable-tests
    ac_add_options --enable-debug-symbols
    ac_add_options --prefix="$HOME/opt/firefox-from-hg"
    

    The important lines are the --enable-debug, --enable-debug-symbols and the LDFLAGS one.

  3. Type make -f client.mk. Now you'll need to wait.

  4. Type make -f client.mk install PKG_SKIP_STRIP=1 and make sure you do not forget the PKG_SKIP_STRIP=1 parameter.

  5. Now you can use gdb ~/opt/firefox-from-hg/bin/firefox to debug Firefox with all the debugging symbols.

Enjoy!

Syndicated 2012-07-04 17:08:20 from shlomif

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!