Re: Address of instruction causing SIGSEGV
From: Jeroen N. Witmond (jnw_at_xs4all.nl)
Date: 08/25/04
- Next message: Robert Redelmeier: "Re: Accessing PCI registers in user space"
- Previous message: Panho Lee: "UDP level multicasting"
- In reply to: Ulrich Weigand: "Re: Address of instruction causing SIGSEGV"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Aug 2004 12:35:11 -0700
Ulrich Weigand <weigand@informatik.uni-erlangen.de> wrote in message news:<2p1o8eFflplfU1@uni-berlin.de>...
> jnw@xs4all.nl (Jeroen N. Witmond) writes:
>
> >- Is using an undeclared and undocumented parameter of the handler
> >(and a cast of the handler's address to sighandler_t to kill gcc's
> >warnings) the only way to access struct sigcontext?
>
> Yes. However, you could instead install your handler as SA_SIGINFO,
> in which case you'd get a (declared and documented) ucontext_t pointer
> as third argument, which holds a (platform-specific) mcontext_t element,
> which in turn also contains register information including eip.
>
Just for the record (and all other people running into the same
problem): with "static void siginfoAction(int sig, siginfo_t *siginfo,
void *context)" as declaration of the handler,
"(void*)((ucontext_t*)context)->uc_mcontext.gregs[REG_EIP]" is the
address of the instruction that causes the SIGSEGV, at least for
Linux/i386.
Jeroen.
- Next message: Robert Redelmeier: "Re: Accessing PCI registers in user space"
- Previous message: Panho Lee: "UDP level multicasting"
- In reply to: Ulrich Weigand: "Re: Address of instruction causing SIGSEGV"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|