public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Joe Buehler <aspam@cox.net>
Cc: gcc-help@gcc.gnu.org
Subject: Re: dynamic tracing problem
Date: Sat, 08 Oct 2011 01:09:00 -0000	[thread overview]
Message-ID: <mcrhb3k9tn7.fsf@coign.corp.google.com> (raw)
In-Reply-To: <loom.20111007T204606-672@post.gmane.org> (Joe Buehler's message	of "Fri, 7 Oct 2011 19:10:42 +0000 (UTC)")

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

  reply	other threads:[~2011-10-08  1:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 19:20 Joe Buehler
2011-10-08  1:09 ` Ian Lance Taylor [this message]
2011-10-08 15:11   ` Joe Buehler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcrhb3k9tn7.fsf@coign.corp.google.com \
    --to=iant@google.com \
    --cc=aspam@cox.net \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).