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:
> Hi,
> I thought I'd just summarise some of the latrace quirks that I'd hit
hi,
so cool.. thanks
> 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.
so far I've never tried to trace C++ exception code..
We've replicated this on x86 - any simple C++ exception fails.
> 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.
nice, if you'd like to send a patch or whatever state your code is,
we can put it in or finish it
the code produces output like:
4416 strncmp(s1 = (0x84948, 4) "mode", s2 = (0x7ef632c6, 4)
"mode", n = 4) [/lib/l
ibc.so.6] {
4416 } strncmp = 0
patch copy & pasted at end of the mail; I do wonder if it might be right
to only do it if 'verbose' is selected.
> 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!
you're welcome ;) I guess it's probably not publicly available program
since you didnt share the name, but if you happen to isolate the issue
or make a reproducer, I'll be happy to investigate
The program that stuck is the 2nd subtest in SPEC 2k6's 445.gobmk.
> 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.
(1) I'll try C++ throwing an exception and let you know
(2) not sure how setjmp/longjmp is implemented on ARM,
x86_64 answer is above
thanks for sharing these issues, I wish I'd have more such input
No problem.
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, "\"");
}