From owner-freebsd-hackers Thu Feb 25 14: 7:14 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 4A27714D74 for ; Thu, 25 Feb 1999 14:07:13 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.1/8.9.1) with ESMTP id OAA00656; Thu, 25 Feb 1999 14:06:56 -0800 (PST) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.2/8.9.1) id OAA01887; Thu, 25 Feb 1999 14:06:56 -0800 (PST) (envelope-from jdp@polstra.com) Date: Thu, 25 Feb 1999 14:06:56 -0800 (PST) Message-Id: <199902252206.OAA01887@vashon.polstra.com> To: robert+freebsd@cyrus.watson.org Subject: Re: Signal--how to find address in SIGSEGV? In-Reply-To: Organization: Polstra & Co., Seattle, WA Cc: hackers@freebsd.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article , Robert Watson wrote: > > I'm playing with a userland library that will provide a simple paging > service to code linked against it. As such, it catches SIGSEGV and > watches for trap 12 (T_PAGEFLT). I notice that i386/i386/machdep.c places > the fault address sf.sf_addr; i.e., in the stack frame. However, the > signal handler prototype: > > int > signal_handler(int signal, int code, struct sigcontext *scp) > > does not appear to see that as a possible argument. How can I get access > to the address in question in a C-friendly way? On the i386, the faulting address is in "scp->sc_err". On the alpha, I believe it's in "scp->sc_traparg_a0". > Also, is there a way to tell whether or not the address was used in > a read or a write I don't know of one. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Nobody ever went broke underestimating the taste of the American public." -- H. L. Mencken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message