dynamic tracing problem
Joe Buehler
aspam@cox.net
Fri Oct 7 19:20:00 GMT 2011
I am attempting to use inline assembly to implement a tracing mechanism that
results in code something like this (asm syntax not meant to be exact):
"pre" C code...
/* via inline asm */
j trace
.pushsubsection 1000
trace:
"trace" C code...
/* via inline asm */
j post
.popsubsection
post:
"post" C code...
The idea is that the trace code can be nullified by changing the "j trace"
instruction to a NOP or activated by putting the jump back.
I have an implementation and it almost works. It malfunctions when applied on a
large scale. I assume it is malfunctioning because gcc has placed essential
side-effects in the trace block.
How can I tell gcc not to move anything past the first asm?
How can I tell it to not expect any computations in the trace block to get past
the second asm?
Both asm statements are currently volatile. I have experimented a little with
"memory" clobbers without success. I need some help from an expert here.
I am using gcc 4.1 and 4.3.3 if it matters.
Joe Buehler
More information about the Gcc-help
mailing list