Re: How to dump more info when received a SIGSEGV signal?



On 2006-01-27, cyril.li@xxxxxxxxx <cyril.li@xxxxxxxxx> wrote:
[...]
> The processor is IA32 and Linux kernel is 2.6
>
> ------------------------------------------------------------------------------------------
>
> void segv_handler(int sig, struct sigcontext ctx)
> {
> printf("eip = %x\n", ctx.eip);

Hm. Very interesting. My man page for sigaction on linux does not define
struct sigcontext. Instead it talks about siginfo_t and that structure
does not have eip field.

[...]

> m.sa_flags = SA_SIGINFO;
> m.sa_handler = (void (*)(int))segv_handler;

Well, usually if SA_SIGINFO flag is set, then sa_sigaction field shall
be used.

Aha, searching the Web shows that this structure used to be used on
NetBSD, but later releases got rid of it and use siginfo_t instead.

Read man pages! :)

--
Minds, like parachutes, function best when open
.