Re: How to avoid code elimination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HI David,

I can't really do 'volatile' because as I said, I used to borow
whatever scalar I found in the C code vincinity (at a glance) that I
can nopify.

In short it is a quick and dirty setting of a conditioned BP, the
condition can be raised after million iteration, so just setting a BP
and asking GDB to continue until the right cond is arrived is way to
slow, so I code the condition in C

if(cond)
{
}

then I need a BP in the if(){} , then I need an instruction to stick
into the {} and e=e x=x is a good quick and dirty way to do it, even
though I don't own e or x here, so I can't volatilize it.

Since I said the word, I want a nop in there, so let's be it a real nop :).

Remember I said right at the begining I am new to gcc, and I used
other 'older' C compilers that bearly had a  asm() backdoor, so the
e=e trick was ok, because -g trig a no-optimisation :)

doing an asm("nop") seems to do the job for gcc, and I guess (not
verified) would be portable across architectures, so for gcc/gdb combo
I will do this.

I noted as you mentioned that the various optimisations make single
step (at C level, not asm instruction) some source bouncing but that's
ok, since I use the -tui, I got the ^L key that start melting but I
can remap :)

Cheers,
Phi



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux