Posted by: benoitgirard | May 16, 2012

Dev Tip: Debugging optimized code without a clobber – Rebuilding a module without optimization

Sometimes you have an optimized build for whatever reason (say you’re doing a lot of profiling) but optimizations make non trivial debugging impossible. You don’t have an up to date build without optimization so you whine, start a non optimize build and start looking at bugzilla for 20 mins.

Frankenstein optimized/non optimized build to the rescue! Simply add:

CXXFLAGS += -O0 -g

to the Makefile for the module(s) you’re interested in debugging, for me it was gfx/layers/Makefile.in.

How does this work? Well optimizations are done at the object level and each object file are built to follow the ABI. As long as the ABI is followed, and it really really should, then you can expect this to work without any problems.

Disclaimer: This isn’t supported! If you have problems then do a clobber build.

About these ads

Responses

  1. Do that with MOZ_OPTIMIZE_FLAGS instead of CXXFLAGS.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: