Date: Thu, 25 Feb 1999 14:06:56 -0800 (PST) From: John Polstra <jdp@polstra.com> To: robert+freebsd@cyrus.watson.org Cc: hackers@freebsd.org Subject: Re: Signal--how to find address in SIGSEGV? Message-ID: <199902252206.OAA01887@vashon.polstra.com> In-Reply-To: <Pine.BSF.3.96.990225160136.4294B-100000@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <Pine.BSF.3.96.990225160136.4294B-100000@fledge.watson.org>,
Robert Watson <robert+freebsd@cyrus.watson.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902252206.OAA01887>
