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
latrace tests on ARM
by David Gilbert
Hi,
I enabled the tests for arm in configure.ac, copied the
test/sysdeps/i686 to arm and tried it
(I ran test/test.sh from the top level - is that the intended way?)
test_char_3 failed:
expected pattern='test_char_3\(a = 0x01, b = 0xfe, c = 0x07\)'
received='test_char_3(a = 0x01, b = 0xfe '�', c = 0x07)
[/discs/more/daveg/git/latrace/lib-test-args.so] {
} test_char_3 = 0xf7 '�'
(I modified re_test to print the expected/received).
The problem here is that on ARM 'char' is unsigned by default where as
on most other platforms it's
signed; the code in src/args.c does:
if (*((char*) pval) <= ' ')
len = snprintf(argbuf, alen, "0x%02x",
*((unsigned char*) pval));
else
len = snprintf(argbuf, alen, "0x%02x \'%c\'",
*((unsigned char*)
pval), *((char*) pval));
on ARM the 0xfe is treated as a positive value and hence the test
prints the character out.
Is there a reason that you didn't use isprint() - perhaps worried
about the difference between locales?
I'm also getting result mismatches on test_char_6 (getting 0x0e
instead of the expected 0x6e).
I haven't worked through the math of teh code in test_char_6, but with
all those divides and stuff I
wouldn't be surprised if this is also a signedness issue.
I also had to change the shell in test/test.sh to /bin/bash - the
/bin/sh I have seems to be dash
which doesn't have functions.
Another suggestion is not to separate test_long into CPU specific
sysdeps; there are only a few
combinations and they'll be shared among lots of CPUs - i686 and ARM
are the same for those tests.
Dave
12 years, 11 months
destination strings and arguments
by David Gilbert
Hi,
On library functions like strcpy() where there is a destination
string, latrace -A ends up trying to print out the
destination buffer which may be completely invalid.
Maybe it's worth doing the same trick that ltrace does, and just
declare the destination parameters as void*
Dave
12 years, 11 months
control file leak
by Akos PASZTORY
Hi,
when you Ctrl-C latrace, the control dir/file stays around:
$ ./latrace -q /bin/cat
controled config: /tmp/lt-config-Bl4RzW/config
<Ctrl-C>
$ ls -d /tmp/lt-config-*
/tmp/lt-config-Bl4RzW/config
This happens because the signal terminates latrace itself in lt_run().
It could maybe install a SIGINT handler that sets a flag and wrap the
waitpid() into an loop that checks for EINTR plus this flag...
--
akos
12 years, 11 months
[Patch] Build fix for ARM
by David Gilbert
Hi,
I had a build problem with latrace on ARM in that it didn't recognise that
I was on ARM and thus didn't compile in argument support.
I tracked it back to our uname being 'armv7l' rather than 'arm' which it was
testing for, so I've got the tiny patch below.
(I'm curious actually which ARM system has a uname -m that is 'arm').
(This was against a version from a couple of weeks ago - the latrace git repo
seems to be down).
Dave
----------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 966f6bb..b3a2ec0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,7 +74,7 @@ AC_TYPE_UINT16_T
AC_TYPE_UINT8_T
date=`date "+%B %G"`
-unamem=`uname -m | sed 's/i.86/i686/'`
+unamem=`uname -m | sed -e 's/i.86/i686/' -e 's/^armv.*/arm/'`
AC_SUBST(CONFIG_DATE, "$date")
AC_SUBST(CONFIG_SYSDEP_DIR, "$unamem")
12 years, 11 months