args - adding support to display string pointer and length
by Jiri Olsa
Reply-To:
In-Reply-To: <BANLkTim=1AUfafP5OEeMQF5GNZPiGCpWeg(a)mail.gmail.com>
On Thu, May 26, 2011 at 10:34:44AM +0100, David Gilbert wrote:
> On 25 May 2011 20:22, Jiri Olsa <jolsa(a)redhat.com> wrote:
> > On Wed, May 25, 2011 at 04:02:07PM +0100, David Gilbert wrote:
SNIP
> Here is the string pointer/length patch:
>
> diff --git a/src/args.c b/src/args.c
> index b766326..d418e00 100644
> --- a/src/args.c
> +++ b/src/args.c
> @@ -834,12 +834,17 @@ do {
> \
> char *s = val;
> int slen = strlen(s);
> int left = alen;
> + int pointerlen;
> +
> + pointerlen = snprintf(argbuf, left, "(%p, %d) ", s, strlen(s));
> + left -= pointerlen;
> +
>
> if ((slen + 2) > left) {
> - snprintf(argbuf, left, "\"%s", s);
> + snprintf(argbuf+pointerlen, left, "\"%s", s);
> strncpy(argbuf + left - sizeof("...\"") + 1, "...\"", sizeof("...\""));
> } else {
> - strcpy(argbuf, "\"");
> + strcpy(argbuf+pointerlen, "\"");
> strcat(argbuf, s);
> strcat(argbuf, "\"");
> }
added.. plus support for configuring option,
please check and comment
git://fedorapeople.org/~jolsa/latrace.git
branch char_pointer_len
jirka
12 years, 9 months
Thoughts and quirks
by David Gilbert
Hi,
I thought I'd just summarise some of the latrace quirks that I'd hit
over the last few weeks of using it; I'm not
sure yet whether all of these are ARM specific (I've not had the
chance to try and replicate them all on x86)
1) C++ programs that throw exceptions don't seem to like running under
latrace (povray in SPEC 2k6 in particular);
it fails with an exception saying that its terminating 'after throwing
an instance of 'int''; it looks like it normally does
throw exceptions, and it seems to be misreading which exception it is.
I found adding:
-n_Unwind_RaiseException,__cxa_get_globals,__cxa_throw,__cxa_allocate_exception,__cxxabiv1::__cxa_allocate_exception
to latrace seems to help.
2) I'd also had problems with setjmp - I think this was in perl (in
the spec wrapper); adding
-nlongjmp,siglongjmp,_longjmp,__longjmp_chk,__libc_longjmp,__libc_siglongjmp
3) I don't think the output is opened with O_LARGEFILE, I found that
after the 4GB log file got truncated (I now pipe to bzip2)
4) Given (1) and (2) and a few other quirks, I hit the limit on the
length of the symbol list (about 200 chars); unfortunately
it just fails silently rather than telling you this.
5) For my purposes I modified the code that prints args to print the
address and the length of strings passed as arguments;
quite useful to see where the strings are coming from.
I've got a few other quirks I've not been able to get to the bottom of
yet (e.g. one program that I think is stuck in a loop when run
under latrace but I've not figured out why); but it's managed to get
me probably a few 100GB of logs - thanks!
I'd be intereste d to know if anyone has seen (1) or (2) on any other
platform, else we need to go digging on ARM and figure out why.
Dave
12 years, 11 months