This is the mail archive of the libc-help@sourceware.org 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: Is gprof profiling (-pg) reentrant/thread-safe?


On Tue, May 3, 2016 at 10:36 AM, Stu  Juengst <juengst@rubiconlabs.io> wrote:
> I was seeing some mysterious segmentation faults in my multi-threaded Linux application which was built with the -pg option for gprof profiling.  They went away when I turned -pg off.  I took a look at the mcount source for the version of glibc that I'm using (2.2.5) and see that it is updating linked lists in a single global structure (_gmonparam) with no synchronization mechanism to keep multiple threads from accessing this structure simultaneously. Am I missing something, or is gprof profiling not reentrant/thread-safe?

The profil() function in glibc is not thread safe, and it says this in
the manual.

It *should* be thread safe, but nobody has done the work to enhance it.

Please note that thread-safety and reetrancy are two distinct things.

Cheers,
Carlos.


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