lkml.org 
[lkml]   [1997]   [Feb]   [26]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromSystemkennung Linux <>
SubjectRe: get faulting address in segfault?
DateWed, 26 Feb 1997 10:58:46 +0100 (MET)
Hi,

> is it possible under linux to catch a
> segfault and get the faulting address?
> 
> That is can a signalhandler that catches
> SIGSEGV find out the faulting address?

All Unices pass a pointer to the saved old context to the sighandler
as the second or third parameter.  This is a struct sigcontext *.
Certain Linux versions for some reason call that parameter
struct sigcontext_struct *.  You can get the definition from
<sigcontext.h>; the kernel source defines struct sigcontext in
linux/include/asm-<cpu>/sigcontext.h.

Downside of the mechanism: it highly machine dependand.

  Ralf

\
 
 \ /
  Last update: 2005-03-22 13:39    [from the cache]
©2003-2008