Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Sep 1998 15:30:57 +0200 (CEST)
From:      Mikael Karpberg <karpen@ocean.campus.luth.se>
To:        kheuer@gwdu60.gwdg.de (Konrad Heuer)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Catching SIGSEGV
Message-ID:  <199809151330.PAA00371@ocean.campus.luth.se>
In-Reply-To: <Pine.BSF.3.96.980915114921.5972A-100000@gwdu60.gwdg.de> from Konrad Heuer at "Sep 15, 98 12:22:11 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
According to Konrad Heuer:
> int nsegv = 0;
> int *ptr;
> int zero = 0; 
> 
> void sighdl ( int sig )
> {
>   ptr = &zero;
>   nsegv++; 
> }
> 
> int dowork ( )
> {
>   int buf;
> 
>   signal(SIGSEGV, sighdl);
> 
>   ptr = InvalidAddress;
>   buf = *ptr;
> }

My guess is that you would want to declare things like this:

volatile int nsegv = 0;
volatile int *ptr;
int zero = 0;

Then the restarted "buf = *ptr;" line will not use a buffered value for ptr
but read it from memory. I think.

  /Mikael


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809151330.PAA00371>