prasanth
prasanth

Reputation: 79

Example in the sprof MAN page is not working

I tried using Sprof profiling to test. I tried with the MAN page example: https://github.com/makelinux/examples/tree/master/sprof, but I couldn't see the output as mentioned in the page, I am getting error

Inconsistency detected by ld.so: dl-open.c: 707: _dl_open: Assertion `_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT' failed!


$ sprof -V
sprof (Ubuntu GLIBC 2.23-0ubuntu9) 2.23
 tried with Glibc-2.18 and 2.19 too

Upvotes: 1

Views: 1747

Answers (2)

Felipe A. Rodriguez
Felipe A. Rodriguez

Reputation: 21

The Bug only occurs with sprof's special loading so simply disabling the assertion when an object is loaded with the sprof flag __RTLD_SPROF allows me to use sprof while avoiding changes that might disturb the normal shared object loading mechanism. Edit glibc/elf/dl-open.c:707 to:

  if (!(__glibc_unlikely (mode & __RTLD_SPROF))) {
   assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
  }

This works for me with glibc-2.20 and has been posted to https://sourceware.org/bugzilla/show_bug.cgi?id=22380

Upvotes: 2

Florian Weimer
Florian Weimer

Reputation: 33717

This has been reported as a glibc bug here:

It's probably best to continue any further discussion there.

Upvotes: 3

Related Questions