This is the mail archive of the mailing list for the glibc 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: [PATCH] Adding systemtap probe points in pthread library(slightly revised again)

> The problem I had at the beginning was related to some modules not
> defining IN_LIB, so the following code was complaining:

I see.  No such code should be actually using these macros.  But it may
wind up indirectly including lowlevellock.h for some reason.  Is that
what you saw?  Please cite the particular compilation errors you saw.

> Some code (files) really are not libraries, examples of those are utils
> in iconv. And some do not include, as they do their own
> "-DNOT_IN_libc=1" in their Makefiles.

Sure, but I really don't think any of that code ought to be using the
macros where you have probes used.

> The simplest hack would be to not "#error" the  define, but to quietly
> define IN_LIB to something else.

If the header is used but not the macros that use the probe macros, then
the safe thing is to define IN_LIB to something that ensures a syntax
error.  Then there won't be the #error failures just from having the header
file, but if any uses of those ever macros leaks into non-library code,
then compilation will fail loudly so we can see what is going on.  We don't
want to quietly insert probes with stupid names into places where we don't
intend to have probes.

> A better fix but involves touch a lot of Makefiles this one -- note that
> I defined IN_LIB for non libraries code to "nonlib":

No, this is a bad change to make.

> +condattr_destroy - probe for pthread_condattr_destroy

Who cares about that?  It makes no sense to have this probe an no other
probes about pthread_*attr_* calls.  I see no reason anyone would ever
wants probes on these calls.  They are ancillary machinery to making
pthread_*_init calls, nothing interesting themselves.

> @@ -556,6 +556,8 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
>    /* Pass the descriptor to the caller.  */
>    *newthread = (pthread_t) pd;
> +  LIBC_PROBE (pthread_create, 2, start_routine, arg);

Why doesn't this get all four arguments?

>  __pthread_cond_timedwait:
>  	cfi_startproc
> +
> +        LIBC_PROBE_ASM (cond_timedwait, %rdi)

Why doesn't this get all the arguments?

>  __pthread_cond_wait:
> +
> +        LIBC_PROBE_ASM (cond_wait, %rdi)

Why doesn't this get all the arguments?


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