This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to avoid code elimination


Hi All,

I am new to gcc (used other C compilers before).

I have construct of the like in my C code

.
.
.
if(cond)
{ e=e;
}
.
.

The reasoning here is that I need to stuff a GDB break point on e=e;
cond goes from false to true after some long to wait condition occurs.

Basically my debug session goes like this

set a temp break in this function reach it, then stick a BP on e=e,
then run and wait the BP.

The e=e; comes form the idea that I reuse here whatever int scalar is
in the vincinity.

I tried to compile with -O0 but to no joy gcc always remove my 'NOP'
intruction knowing better than me what I could do with it.

Is there any other idioms I should use, may be an asm("nop") or the
like I guess ?

Thanx in advance
Cheers,
Phi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]