#515: Silently overrides DEBUG and OPTIMISE options ----------------------------+----------------------------------------------- Reporter: barry.wardell | Owner: eschnett Type: defect | Status: new Priority: major | Milestone: Component: SimFactory | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by barry.wardell):
I think there is a bit of confusion about exactly what the problem is so I'll clear it up. The problem is not with the presence of debug symbols. As was mentioned, these are always included independent of debug and optimise being enabled. The problem is that by default SimFactory enables optimisation (-O2 on the machine I was using) so that many things are optimised away, making debugging much more difficult.
The main thing I wanted to achieve was to disable optimisation (-O0). In principal this should be achieved using --no-optimise. The problem is that the current code ignores this option completely, making --optimise and --no-optimise completely useless. This is what my second patch fixes (I will commit this). However, even when this is fixed, the effect of --no- optimise is to not enable optimisation. Note that this is not the same as disabling optimisation as it relies on the compiler's default optimisation level, which I think is typically -O2. So the patch is only part of the solution and is essentially useless for solving my original problem.
The real solution to my original problem would be to run with --debug. This explicitly disables optimisation, although as Erik mentioned this enables lots of extra debug code too. In my case this wouldn't be a problem - the bug is sufficiently difficult to track down that any extra information at the cost of speed is helpful.
The conflict I was referring to between --debug and --optimise (and DEBUG=yes and OPTIMISE=yes) is that debug explicitly disables optimisation (-O0) while optimise explicitly enables it (-O2). I'm not sure what a compiler does when it is given both of these, but I'm sure it can't be a good idea. I think --debug does the correct thing in that it sets.
I discovered that there is some documentation for --debug. It's available by running 'sim --help'. However, this documentation says "Build Cactus with debug symbols", which is wrong.
The issues I mentioned so far can basically be considered to be bugs in SimFactory. The remaining problem is that optionlists are '''silently''' modified when building. Even worse, the fact that we set DEBUG and OPTIMISE in the optionlists suggests that it is possible to change these settings in the optionlist. This is what leads to confusing behaviour. Someone who is used to Cactus optionlists has no reason to expect DEBUG to have not been enabled and will be very confused by the result.
Note that I don't have any problem with these things being only controlled by SimFactory's --debug, etc. In fact itt seems quite useful to me. The problem is having apparently two ways to do it, one of which people are used to and which doesn't work, without warning.