|
From: Ranko Z. <ra...@sp...> - 2003-08-06 01:58:54
|
How about:
valgrind --gdb-attach=3Dyes your_prog
You can examine your code, backtrace and everything else before it genera=
tes
the core.
R.
> -----Original Message-----
> From: val...@li...
> [mailto:val...@li...]On Behalf Of
> Bor...@pd...
> Sent: 05 August 2003 11:16
> To: nj...@ca...
> Cc: val...@li...
> Subject: AW: [Valgrind-users] core for null pointer access
>
>
> I think a correct behaviour would be something to ask the user if he wa=
nts
> to get a core, wants to end the program, or continue with the execution
> beside the printing of the errortext together with a the stack output.
> The way valgrind handles this situation now, seems like a not well defi=
ned
> behaviour of valgrind in itself. With the above mentioned method, the u=
ser
> would be sure, that this is a bug of his program and not one of
> valgrind...which is really usefull, when the scenario for the Null-Poin=
ter
> Access gets much more complicated than my little example programm. For
> example by passing of an NULL pointer as function parameter through som=
e
> function calls. If you than only get a core for valgrind, I don't think
> every user will see the bug.
>
> Sincerely Borg Enders
>
>
> -----Urspr=FCngliche Nachricht-----
> Von: Nicholas Nethercote [mailto:nj...@ca...]
> Gesendet: Dienstag, 5. August 2003 10:08
> An: Enders, Borg
> Cc: val...@li...
> Betreff: Re: [Valgrind-users] core for null pointer access
>
>
> On Tue, 5 Aug 2003 Bor...@pd... wrote:
>
> > The following programm causes a core:
> > int main( int argc, char** argv )
> > {
> > int *a =3D NULL;
> >
> > int b =3D *a;
> >
> > return 0;
> > }
> >
> > Valgrind output:
> > =3D=3D26211=3D=3D Memcheck, a.k.a. Valgrind, a memory error detector =
for
> > x86-linux. =3D=3D26211=3D=3D Copyright (C) 2002-2003, and GNU GPL'd, =
by Julian
> > Seward. =3D=3D26211=3D=3D Using valgrind-20030725, a program supervis=
ion
> > framework for x86-linux. =3D=3D26211=3D=3D Copyright (C) 2000-2003, a=
nd GNU
> > GPL'd, by Julian Seward. =3D=3D26211=3D=3D Estimated CPU clock rate i=
s 699 MHz
> > =3D=3D26211=3D=3D For more details, rerun with: -v
> > =3D=3D26211=3D=3D
> > =3D=3D26211=3D=3D Invalid read of size 4
> > =3D=3D26211=3D=3D at 0x804844A: main (speicher_test.cc:23)
> > =3D=3D26211=3D=3D by 0x8048340: (within /home/benders/val2/tst/a.o=
ut)
> > =3D=3D26211=3D=3D Address 0x0 is not stack'd, malloc'd or free'd
> > Memory fault(coredump)
> >
> >
> > I think valgrind, should handle this problem correctly and not core b=
y
> > it's self.
>
> Really? What do you think would be the right way to handle this proble=
m
> correctly?
>
> N
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072
> 303_01/01
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
|