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]

Re: dynamic tracing problem


Joe Buehler <aspam@cox.net> writes:

> 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 don't see how this can work reliably in gcc when optimizing.  gcc
freely rearranges blocks, and there is no way to prevent that.  If there
are any blocks between "trace" and "post", they may get moved out of the
subsection.  It's even possible that other blocks will get moved into
the subsection.

Ian


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