From owner-freebsd-hackers Tue Sep 15 06:36:58 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA07709 for freebsd-hackers-outgoing; Tue, 15 Sep 1998 06:36:58 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ocean.campus.luth.se (ocean.campus.luth.se [130.240.194.116]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA07693 for ; Tue, 15 Sep 1998 06:36:46 -0700 (PDT) (envelope-from karpen@ocean.campus.luth.se) Received: (from karpen@localhost) by ocean.campus.luth.se (8.9.1/8.9.1) id PAA00371; Tue, 15 Sep 1998 15:30:57 +0200 (CEST) (envelope-from karpen) From: Mikael Karpberg Message-Id: <199809151330.PAA00371@ocean.campus.luth.se> Subject: Re: Catching SIGSEGV In-Reply-To: from Konrad Heuer at "Sep 15, 98 12:22:11 pm" To: kheuer@gwdu60.gwdg.de (Konrad Heuer) Date: Tue, 15 Sep 1998 15:30:57 +0200 (CEST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL32 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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