Re: Determining address which caused SEGV

Jeff Dike (jdike@karaya.com)
Fri, 07 Jan 2000 18:04:59 -0500


> I am trying to write a signal handler for SEGV that can figure out
> what address was being accessed to cause the fault. Yes, I have a
> good reason for wanting this.

This is how I handle it. It requires no setup at handler registration time
(not that I did on purpose, anyway).

void user_segv_handler(int sig)
{
struct sigcontext_struct *sc;

sc = (struct sigcontext_struct *) (&sig + 1);
...
}

> Yes, I have a good reason for wanting this.

A bunch of people do. The above is taken from my user-mode port of the kernel.

Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/