help with mudflap on arm-linux

Baurzhan Ismagulov ibr@radix50.net
Thu Sep 18 10:49:00 GMT 2008


Hello,

I'm debugging sporadic application crashes on arm-linux. I get 28-MiB
core files (twice as much the app could theoretically use) with
overwritten memory.

When I built the app with -fmudflapth -fstack-protector-all -lmudflapth
-lssp -lpthread (the app is single-threaded, but links to libxml2, which
requires lpthread), the compiler produced many warnings that #pragma
redefine_extern is not supported. With an instrumented app, I got
unregister violations on g_list_remove on arm-linux.

I managed to reproduce that on arm-linux with a sample program doing
g_list_append 20K times and then g_list_remove'ing everything. However,
the results do not seem to be consistent. On i386-linux, mudflap reports
read violations for the same program. Valgrind on i386 doesn't report
any problems except still allocated memory (which is ok). My own malloc
hooks (implemented according to
http://www.gnu.org/software/libc/manual/html_mono/libc.html#Hooks-for-Malloc)
that add a pointer to a list when it is allocated, and removing after it
is deallocated, do not detect any problems on arm-linux.

On the target, I'm using Linux 2.6.20 with glibc 2.3.6 and gcc 4.1.1,
glibc 2.3.2 built for arm-unknown-linux-gnu with crosstool (I've tried
both glibc 2.3.6 and 2.3.2 on the target, with the same result). On
i386, it's gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).

Questions:

1. Is #pragma redefine_extern important for mudflap? The manual says it
   is implemented only for Solaris. If mudflap didn't work due to that,
   then I don't see how it could report any violations at all, so I
   assume there should be some other mechanism for arm-linux, no?

2. Do I understand correctly that unregister violation is a double free?

3. How can I debug my app? Should mudflap from 4.1.1 work on my
   platform, or should I use a newer version?

Thanks in advance,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/



More information about the Gcc-help mailing list