Re: Determining address which caused SEGV

From: Jeff Dike (jdike@karaya.com)
Date: Fri Jan 07 2000 - 18:04:59 EST


> 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/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:11 EST