Hello,
I am wondering whether we are using the right defaults for code downloaded and compiled from the master branch in the git repository. I mean the code in that branch is almost always considered unstable and when people try to compile and use it they mostly do this for debugging purposes (well, at least developers, ordinary users should not be using the code).
If you compile the code from the git repository, using compilation defaults and a very simple configuration file, it is likely that you end up having lots of memory related messages in syslog and and binary optimized for speed which can be difficult to debug with gdb.
We have DBG_QM_MALLOC enabled by default in the git repository which I think is good, however, the value of memdbg is set to L_DBG and the value of debug is set to L_WARN by default. This means that unless you explicitly configure memdbg in your configuration file, you'll see all the memory debugging messages and it is a *a lot* of text.
You can disable memory debugging messages by setting the value of memdbg higher than debug, but I pretty much always forget to do it. Also the default configuration files are not consistent in this regard. The simple one disables it by setting debug to 2 (L_DBG is 3 so memory debugging is disabled), but if you want to investigate a problem and set debug to 3 to do that then you end up having lots of traffic in syslog again and you have to use memdbg explicitly in the configuration file. The complex one, sip-router-oob.cfg, uses the defaults so you get all the messages.
How about changing the default for memdbg to a value that is higher than 3 (the debugging value)? Then we would always have memory debugging messages disabled and people (both users and developers) can easily turn them on by configuring a lower value in the configuration file.
The second default which I believe is not entirely correct for the code stored in the master branch in the git repository is the compilation mode. The makefile system generates code that is optimized for speed by default. We use -O9 which turns on pretty much all performance optimizations in gcc. That includes variables stored in CPU registers, however, code that uses such optimizations is difficult to debug because gdb cannot display values of variables stored in registers properly.
Here again, I pretty much always forget to add mode=debug when configuring the build and often have to recompile the code after trying to use gdb to debug something. Shouldn't we use mode=debug by default for the code in git master branch?
Or perhaps it is just me having these issues? Maybe others have secret techniques to share how to avoid such dumb problems?
-- Jan