Re: SIGSEGV handler

From: Richard Zidlicky (Richard.Zidlicky@stud.informatik.uni-erlangen.de)
Date: Thu Jun 01 2000 - 18:12:18 EST


On Wed, May 31, 2000 at 05:20:37PM -0400, Mohammad Banikazemi wrote:
> I am trying to write a handler for SIGSEGV.
> My handler is of the following form:
>
> void segv_handler(sig, scs)
> int sig;
> struct sigcontext_struct scs;
> {
>
> ...
>
> }
>
> I expect to find the virtual address which caused the SIGSEGV
> in scs.cr2 and based on that my handler is supposed to take an action.
>
> However, in *some* of my programs, this field of scs doesn't contain
> the correct virtual address. Inside my segv_handler routine, I print the

if it is conssistent on a per program basis, maybe you have accidentally
included some wrong headers?

It has always worked for my programs.

> P.S. I posted the same question in comp.os.linux.development.apps and
> some
> one suggested that I use a handler of the following form
>
> void segv_handler(iSig, pSigInfo, pContext)
> int iSig;
> struct siginfo *pSigInfo;
> void *pContext;
> {
> segv_address = pSigInfo->si_addr;
> :
> :
> }
>
> I assume that I have to set the sa_flags to SA_SIGINFO when I set my
> segv_handler to be the segv handler by using the sigaction call. I have
> done this
> but the address I find in pSigInfo->si_addr is incorrect. I am pretty
> sure
> about the address which causes the execution of my segv_handler.

doesn't work in 2.2.X, i hope it will work in 2.4

Bye
Richard

-
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 : Wed Jun 07 2000 - 21:00:16 EST