From: Brian Raiter <breadbox@muppetlabs.com>
To: linux-assembly@vger.kernel.org
Subject: Re: Access to Program Counter in C
Date: Fri, 19 Nov 2004 03:30:54 -0800 [thread overview]
Message-ID: <16797.55662.422644.907944@eidolon.muppetlabs.com> (raw)
In-Reply-To: <419D9361.6070903@codito.com>
> A M wrote:
>> Does anybody know how to access the address of the
>> current executing instruction in C while the program
>> is executing?
> doing exactly as your words say, won't be possible (as
> far as my limited experience with ix86 architecture goes),
> but something nearabout can be achieved with little inline
> assembly fragment.
Actually, there's a gcc-specific extension that can do this, namely
the unary && operator, which will return the address of a goto label:
int somefunction(void)
{
/* ... */
void *pc = &&here;
here:
/* ... */
}
Of course you shouldn't use this unless you completely don't care
about portability.
b
next prev parent reply other threads:[~2004-11-19 11:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-16 16:38 Access to Program Counter in C A M
2004-11-19 6:32 ` sandeep
2004-11-19 11:30 ` Brian Raiter [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-11-19 7:31 siddharth vora
2004-11-19 8:03 ` Justinas
2004-11-19 8:04 ` sandeep
2004-11-19 7:58 siddharth vora
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=16797.55662.422644.907944@eidolon.muppetlabs.com \
--to=breadbox@muppetlabs.com \
--cc=linux-assembly@vger.kernel.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 NNTP newsgroup(s).