Subject: Re: gdb over ktrace
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 04/15/2000 17:13:00
On Thu, Apr 13, 2000 at 05:20:27PM -0400, der Mouse wrote:
> >>         int *p;
> >>         p = 0;
> >>         *p = 100;
> > ??? Aren't you supposed to malloc space, rather than just arbitrarily
> > start accessing it?  You're stepping on whatever is in page 0...
> 
> Do we have any ports that have anything mapped at address zero?  I
> didn't *think* we did...

And if it does I *strongly* suggest it to be changed, so that deferencing
NULL will create a core dump.
Linux has page 0 mapped R/W for userland. This is a real pain, because you
can write programs that use invalid pointers and still work !!
I'm teaching C programming to students under linux, and this is a problem:
me: "if you use and uninitialised pointers it'll segfault"
student: "but my program use a uninitialised pointer pointer to store a
          string, it works !"

Not to mention that it makes catching bugs much much harder.

--
Manuel Bouyer <bouyer@antioche.eu.org>
--