This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
dynamic tracing problem
- From: Joe Buehler <aspam at cox dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 7 Oct 2011 19:10:42 +0000 (UTC)
- Subject: dynamic tracing problem
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