question - inconsistent results from ptrace

Roland McGrath roland at redhat.com
Mon Apr 27 17:38:22 UTC 2009


> I followed your advice and looked at the registers. Here is what I found:
> 
> The function that behaves inconsistently is _dl_start in ld-2.8.so. Most 
> of the time the first variation in the flow occurs as early as 296 
> instructions down the road, namely at the jump
> 
> 30b3b0:    0f 86 d7 fd ff ff        jbe    30b18d <_dl_start+0x22d>
> 
> but sometimes later. ( I am attaching disassembled _dl_start). And yes, 
> the registers do differ at this point, but so they should, considering 
> all these "rdtsc" - or am I missing something?

Yes, that is some normal variation.  That is a loop of 5 iterations that
does "rdtsc" twice in a row to see the difference between the counts.  It
uses a "min" calculation to find the smallest of those five differences.
The < test in that calculation is what varies in your runs.  It varies
because the count of cycles between two "rdtsc" instructions varies.
(That's why there is this loop of 5 iterations to sample it.)

Indeed, this has absolutely nothing to do with ptrace (let alone utrace).
You lucked out in that there happens to be someone on this list who knows
all about glibc (me).  But this is really not the place to discuss arcane
implementation choices in glibc.


Thanks,
Roland




More information about the utrace-devel mailing list