* mudflap - Another simple failure
@ 2003-04-05 12:16 Eyal Lebedinsky
0 siblings, 0 replies; only message in thread
From: Eyal Lebedinsky @ 2003-04-05 12:16 UTC (permalink / raw)
To: list, gcc, Eigler, Frank Ch.
I am getting better at this...
Well, I actually managed to build a very last system with this and
it mostly works, except I get a huge exception report which slows
everything to a crawl. I think I am almost there (with
multithreading disabled though).
As always, the example below is what I ended up after reducing
a much larger program. I tried a few simpler forms but they did
not fail.
And while I am on the ebox, why do I not see a proper stack trace
with line numbers? What I got for this test is below. The
'zz.c:19 (usemem)'
is correct, but I would have liked to see (and expected)
'zz.c:48 (main)'
for the next stack frame, etc.. I only see
./zz(main+0x52) [0x8048876]
I built with '-g -O0' specifically to expedite more accurate
reporting.
Nevertheless, it is so close that I can smell it, and if we can
reduce the 6GB report to a more manageable size then I expect
to see my secret programming sins clearly exposed.
----------------------------------------------------
buf=0x8051f30
p=0x8051f30 i=0
*******
mudflap violation 1 (check/read): time=1049530365.371258 ptr=08051f30
size=1 pc=080487f9 location=`zz.c:19 (usemem)'
./zz(__mf_check+0x245) [0x80487f9]
./zz(main+0x52) [0x8048876]
/lib/libc.so.6(__libc_start_main+0xbb) [0x4005714f]
Nearby object 1: checked region begins 0B into and ends 0B into
mudflap object 08051f60: name=`malloc region'
bounds=[08051f30,08051f34] size=5 area=heap check=1r/0w liveness=1
watching=0
alloc time=1049530365.371099 pc=40019f32
/usr/local/gcc-mudflap/lib/libmudflap.so.0(__real_malloc+0x142)
[0x40019f32]
./zz(__mf_check+0xfc) [0x80486b0]
./zz(main+0x25) [0x8048849]
number of nearby objects: 1
p=0x8051f30 i=1
*******
mudflap violation 2 (check/read): time=1049530365.371459 ptr=08051f31
size=1 pc=080487f9 location=`zz.c:19 (usemem)'
./zz(__mf_check+0x245) [0x80487f9]
./zz(main+0x52) [0x8048876]
/lib/libc.so.6(__libc_start_main+0xbb) [0x4005714f]
Nearby object 1: checked region begins 1B into and ends 1B into
mudflap object 08051f60: name=`malloc region'
number of nearby objects: 1
p=0x8051f30 i=2
*******
mudflap violation 3 (check/read): time=1049530365.371583 ptr=08051f32
size=1 pc=080487f9 location=`zz.c:19 (usemem)'
./zz(__mf_check+0x245) [0x80487f9]
./zz(main+0x52) [0x8048876]
/lib/libc.so.6(__libc_start_main+0xbb) [0x4005714f]
Nearby object 1: checked region begins 2B into and ends 2B into
mudflap object 08051f60: name=`malloc region'
number of nearby objects: 1
p=0x8051f30 i=3
*******
mudflap violation 4 (check/read): time=1049530365.371704 ptr=08051f33
size=1 pc=080487f9 location=`zz.c:19 (usemem)'
./zz(__mf_check+0x245) [0x80487f9]
./zz(main+0x52) [0x8048876]
/lib/libc.so.6(__libc_start_main+0xbb) [0x4005714f]
Nearby object 1: checked region begins 3B into and ends 3B into
mudflap object 08051f60: name=`malloc region'
number of nearby objects: 1
p=0x8051f30 i=4
*******
mudflap violation 5 (check/read): time=1049530365.371825 ptr=08051f34
size=1 pc=080487f9 location=`zz.c:19 (usemem)'
./zz(__mf_check+0x245) [0x80487f9]
./zz(main+0x52) [0x8048876]
/lib/libc.so.6(__libc_start_main+0xbb) [0x4005714f]
Nearby object 1: checked region begins 4B into and ends 4B into
mudflap object 08051f60: name=`malloc region'
number of nearby objects: 1
-----------------------------------------------
#!/bin/sh
mf="/usr/local/gcc-mudflap"
cat >zz.c <<EOF
#include <stdio.h>
#include <stdlib.h>
static char *buf = NULL;
static void getmem (char **p, int n)
{
*p = malloc (n);
}
static void usemem (int n)
{
char *p;
int i;
p = buf;
for (i = 0; i < n; ++i) {
fprintf (stderr, "p=%p i=%d\n", p, i);
if (' ' == p[i])
break;
}
}
int main ()
{
getmem (&buf, 5);
fprintf (stderr, "buf=%p\n", buf);
usemem (5);
return (0);
}
EOF
export LD_LIBRARY_PATH="$mf/lib"
cc="$mf/bin/i686-pc-linux-gnu-gcc-3.5-tree-ssa -fmudflap -g -O0"
#cc="gcc"
test -f zz && rm zz
$cc -Wall -o zz zz.c
./zz
--
Eyal Lebedinsky (eyal@eyal.emu.id.au) <http://samba.org/eyal/>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-04-05 8:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-05 12:16 mudflap - Another simple failure Eyal Lebedinsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).