From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20584 invoked by alias); 5 Apr 2003 08:29:54 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 20311 invoked from network); 5 Apr 2003 08:27:21 -0000 Received: from unknown (HELO e4.eyal.emu.id.au) (203.51.32.18) by sources.redhat.com with SMTP; 5 Apr 2003 08:27:21 -0000 Received: from eyal.emu.id.au (e7.eyal.emu.id.au [192.168.2.7]) by e4.eyal.emu.id.au (8.11.6/8.11.6) with ESMTP id h358RAq14657; Sat, 5 Apr 2003 18:27:10 +1000 Received: from eyal.emu.id.au (really [192.168.2.7]) by eyal.emu.id.au via smail with esmtp id (Debian Smail3.2.0.114) for ; Sat, 5 Apr 2003 18:27:09 +1000 (EST) Message-ID: <3E8E935C.1286C0A2@eyal.emu.id.au> Date: Sat, 05 Apr 2003 12:16:00 -0000 From: Eyal Lebedinsky Organization: Eyal at Home X-Accept-Language: en MIME-Version: 1.0 To: "list, gcc" , "Eigler, Frank Ch." Subject: mudflap - Another simple failure Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-04/txt/msg00214.txt.bz2 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 < #include 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)