This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SIGSEGV address with SA_SIGINFO


Hi,
I am trying obtain the address caused by a SIGSEGV inside a signal handler, 
but it seems that the siginfo_t struct isn't set correctly. The value I get 
from si->si_addr differs from the address where the segfault actually 
occurred.

void fault_handler (int sn, siginfo_t * si, void *ctx)
{
  fprintf (stderr, "fault_handler: %x\n", si->si_addr);
}

void install_fault_handler (void)
{
  struct sigaction act, segv_oact;
  memset(&act, sizeof(sigaction), 0);
  act.sa_sigaction = fault_handler;
  sigemptyset(&act.sa_mask);
  act.sa_flags = SA_SIGINFO;
  sigaction(SIGSEGV, &act, &segv_oact);
}

int main (void)
{
  char *p = 0;
  install_fault_handler ();
  p[0] = 23;
  return 0;
}

The SEGFAULT in the above code snippet occurs in 0x0, the information 
retrieved from si->si_addr actually shows 0x7c80b651.

I found in the archives that some "limited implementation of sigaction" was 
done in 2004. What is the state of the SA_SIGINFO functionality in current 
cygwin? 
Is there a way to obtain the correct fault address?

Please CC me privately, I am not subscribed to this list.
Thanks for your help,
-- 
Marcus

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]