User account creation filtered due to spam.

Bug 40498 - no_instrument_function attribute not documented to prevent -pg instrumentation
Summary: no_instrument_function attribute not documented to prevent -pg instrumentation
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.3.3
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2009-06-20 01:08 UTC by Samuel Bronson
Modified: 2009-06-20 20:21 UTC (History)
1 user (show)

See Also:
Host: i486-linux-gnu
Target: i486-linux-gnu
Build: i486-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2009-06-20 20:21:23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Bronson 2009-06-20 01:08:03 UTC
I'm trying to profile DOSEMU using -pg, but I have a problem: the mcount() implementation here depends on GS being set to the value that libc (or the kernel) initialized it to. (Presumably, mcount() needs access to thread local state.)

However, DOSEMU has some signal handlers that might be called from DPMI context, where GS is presumably going to have a different setting, and the Linux kernel does not (cannot?) restore GS to it's former value for signal handlers.

Soo... I sought an __attribute__ to disable the instrumentation of these signal handlers, but the only one I could find, __attribute__((no_instrument_function)), does not seem to cover this case -- it neither overrides -pg, nor is it documented to do so.

Failing that, I sought a command-line flag to cancel the effect of -pg for just this subdirectory (or the file), but I couldn't find one of those, either.

Please add an __attribute__ for this, and perhaps a negative form of -pg as well.
Comment 1 Richard Biener 2009-06-20 10:17:55 UTC
__attribute__((no_instrument_function)) should do the trick.  Maybe you need to
cover more functions with it?
Comment 2 Samuel Bronson 2009-06-20 20:03:49 UTC
Oh, hmm ... looks like you're right: I was looking at the wrong function in objdump -- possibly because the functions somehow came out in a different order in the object file from the source file.

Perhaps the documentation should be updated to mention that "no_instrument_function" applies even for -pg? Right now, http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Function-Attributes.html only says:

no_instrument_function
    If -finstrument-functions is given, profiling function calls will be generated at entry and exit of most user-compiled functions. Functions with this attribute will not be so instrumented.
Comment 3 Richard Biener 2009-06-20 20:21:23 UTC
Yeah, the docs could be clarified.