This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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: _stp_vsnprintf() broken


On Sat, 2007-05-12 at 12:46 -0500, Quentin Barnes wrote:
> In my ARM port, I noticed "_stp_printf("%p ", pc);" calls were
> outputting trashed pointer values rotated and truncated.  I tracked
> the problem down to _stp_vsnprintf().  The case for 'p' was doing
> a va_arg(args, int64_t). 

That is actually correct. I implemented %p this way because systemtap
only supports strings, 64-bit ints, and stats. So pointers internally
are always cast to int64_t. We can't simply use %lx to print them
because that would result in things like ffffffffc0400e16 on 32-bit
machines.

So use of %p is correct in tapset functions and systemtap scripts.
Unfortunately it started getting used in runtime C code (notably the
stack functions) to print pointers, which coincidentally works on some
architectures.

So I think the thing to do is clearly document this limitation of %p,
review all %p usage in the runtime and fix as appropriate. 

I'll clean this up ASAP. Thanks for reporting the problem.

Martin



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