tags:

views:

29

answers:

2

I'm trying to debug an apache module on RHEL and the optimization is getting in the way. I tried deleting the '-O2' from EXTRA_CFLAGS in apache_2.2.4/build/config_vars.mk, but it didn't help. APXS is sufficiently complex (and my perl sufficiently poor) that I'm at a loss as to how to figure out how this flag is getting set.

Anybody know how to turn off the optimizer? (so the debugger can work nicely).

TIA.

A: 

It should be enough for debugging if you add '-Wc,-g' parameter.

Marko Kevac
A: 

Marko's answer is close, but -g only provides debugging symbols and does not disable the optimizer (which is sometimes a PITA for debugging).

When I'm debugging my mod_epp module, I use:

Build apache with: ./configure --enable-maintainer-mode --prefix=/usr/local/apache2 Build/install the module with: /usr/local/apache2/bin/apxs -Wc,-O0 -c -i mod_epp.c

This leads to both -O2 and -O0 given to gcc, where -O0 wins.

otmar