public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* dynamic tracing problem
@ 2011-10-07 19:20 Joe Buehler
  2011-10-08  1:09 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Buehler @ 2011-10-07 19:20 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-08 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 19:20 dynamic tracing problem Joe Buehler
2011-10-08  1:09 ` Ian Lance Taylor
2011-10-08 15:11   ` Joe Buehler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).