Bug #256
openRe-enable building with no compiler optimization at all in debug mode
0%
Description
Commit 559fa7ed44238e811ac0c11321ed021c35cba2be removed -O0 CFLAGS, thus now -02 is the default, which makes debugging difficult as it is not possible anymore to set breakpoints on certain functions. Here is a small patch to address this issue without overriding completely CFLAGS.
Files
Updated by Pierre-Louis Bonicoli about 13 years ago
- Status changed from New to Feedback
Thanks for opening an issue with a patch !
Building withCFLAGS="-O0 -g" ./configure
in order to set breakpoints is this a problem ?
Maybe --enable-debug
should be --enable-backtrace
?
Updated by Arnaud Fontaine about 13 years ago
Perhaps we could have --enable-debug
which builds with -O0
and a separate option --enable-backtrace
, however I'm wondering if it would be necessary because it won't be a full backtrace anyway when not using -O0
.
For example, I tried building with --enable-debug
and without -00
after introducing a NULL pointer in irc_privmsg, I get the following backtrace:
05-10-2011 12:02:40 FATAL: Failed assertion in src/util.c(596): hash && key
./bip(print_trace+0x1e)[0x7f4ee889720e]
./bip(fatal+0x96)[0x7f4ee88972e6]
./bip(+0x1cdaf)[0x7f4ee8897daf]
./bip(log_find_file+0x2d)[0x7f4ee889355d]
./bip(log_write+0x2b)[0x7f4ee88943bb]
./bip(irc_dispatch_server+0x13e0)[0x7f4ee888ed50]
./bip(irc_dispatch+0x1ad)[0x7f4ee888ff7d]
./bip(bip_on_event+0x15f)[0x7f4ee889172f]
./bip(irc_main+0xc3)[0x7f4ee8891bb3]
./bip(main+0x424)[0x7f4ee8882d64]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f4ee7cdbead]
./bip(+0x8131)[0x7f4ee8883131]
And when building with -O0
:
05-10-2011 12:04:00 FATAL: Failed assertion in src/util.c(596): hash && key
./bip(print_trace+0x1f)[0x7f944dacae50]
./bip(fatal+0xa6)[0x7f944dacaf3b]
./bip(hash_get+0x35)[0x7f944dacbd52]
./bip(log_find_file+0x2c)[0x7f944dac5b02]
./bip(log_write+0x27)[0x7f944dac7e20]
./bip(+0x1f401)[0x7f944dac6401]
./bip(log_privmsg+0x3b)[0x7f944dac6448]
./bip(+0x1b27a)[0x7f944dac227a]
./bip(irc_dispatch_server+0x9be)[0x7f944dabe08e]
./bip(irc_dispatch+0x4d)[0x7f944dac09a4]
./bip(bip_on_event+0x1bc)[0x7f944dac38ae]
./bip(irc_main+0xf6)[0x7f944dac3aae]
./bip(main+0x969)[0x7f944dab5478]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f944cf07ead]
./bip(+0x7879)[0x7f944daae879]
As you can see, the backtrace is not full when not building with -O0
(log_privmsg
is not there for example).
Anyhow, I think that most people builds with --enable-backtrace
because of an issue, therefore it would be useful anyway to build with -O0
to have the most meaningful backtrace because it would help figuring out what's wrong from a developer point of view.
What do you think?