From: Ralf W. <Ral...@gm...> - 2005-12-13 15:45:34
|
* Keith MARSHALL wrote on Tue, Dec 13, 2005 at 04:26:34PM CET: > Brian Dessent wrote, quoting Ralf Wildenhues: > > > > Interesting, according to that on x86 it essentially disables > > -fomit-frame-pointer if -g is also in effect, unless I'm misinterpreting > > the comments. That certainly explains the ambiguity. > > I also found it interesting, but I interpret it differently. AIUI, > in respect of x86 machines the `-fomit-frame-pointer' documentation > is just plain wrong; `-O2' and `-O3' (tested), and possibly `-O' and > `-Os' (untested) simply do *not* cause the `fomit-frame-pointer' option > to be enabled; `-g' apparently has no bearing on this. If you want to > avoid the use of the EBP register to maintain frame pointers, then you > *must* specify `-fomit-frame-pointer' explicitly; you will not achieve > this effect, if you simply specify -O2 or -O3. This is how I read it, too. Whether you actually enable debugging information is independent of whether -fomit-frame-pointer would interfere with debugging. Without actually having done any tests, or knowing much about gcc internals (so please take this with a grain of salt): gcc/opts.c:decode_options has | if (optimize >= 1) | { | flag_defer_pop = 1; | #ifdef DELAY_SLOTS | flag_delayed_branch = 1; | #endif | #ifdef CAN_DEBUG_WITHOUT_FP | flag_omit_frame_pointer = 1; | #endif [...] gcc/config/i386/i386.h does not define CAN_DEBUG_WITHOUT_FP, unlike gcc/config/ia64/ia64.h for example. > OTOH, if you *do* use > `-fomit-frame-pointer', then `-g' may become redundant -- you may not > be able to effectively run your program in a debugger. Well, I'd just say that enabling both -g and -fomit-frame-pointer just does not make much sense on some machines, unless you use very recent (unfinished? not yet implemented? I have no idea) GCC and GDB. Cheers, Ralf |