develooper Front page | perl.perl5.porters | Postings from July 2007

Re: something to try out: gcc -fmudflap

Thread Previous | Thread Next
From:
Jonathan Stowe
Date:
July 31, 2007 07:26
Subject:
Re: something to try out: gcc -fmudflap
Message ID:
1185891996.6202.43.camel@coriolanus.gellyfish.com
On Tue, 2007-07-31 at 08:00 -0400, Jarkko Hietaniemi wrote:
> Apparently gcc (4) has gained a new interesting flag, -fmudflap, which
> causes gcc to instrument memory operations, so that in runtime memory
> access errors can be caught (a la valgrind, a la Purify, a la etc.)
> 
> Something like this should work:
> 
> cat > mud.c
> int main() {
>   char buf[100];
>   buf[100] = 0;
> }
> ^D
> gcc -o mud -fmudflap mud.c -lmudflap
> ./mud
> ***KABOOM***
> 

mudflap violation 1 (check/write): time=1185891822.644590
ptr=0x7fff75485750 size=101
pc=0x2aca35747a71 location=`mud.c:3 (main)'
      /usr/lib64/libmudflap.so.0(__mf_check+0x41) [0x2aca35747a71]
      ./mud(main+0xad) [0x400985]
      /lib64/libc.so.6(__libc_start_main+0xf4) [0x2aca35a05e64]
Nearby object 1: checked region begins 0B into and ends 1B after
mudflap object 0x604e20: name=`mud.c:2 (main) buf'
bounds=[0x7fff75485750,0x7fff754857b3] size=100 area=stack check=0r/3w
liveness=3
alloc time=1185891822.644584 pc=0x2aca357475a1
number of nearby objects: 1


:-\

It's libmudflap0-devel on Mandriva apparently.



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About