delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/10/08:04:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: Marcus Crestani <crestani AT informatik DOT uni-tuebingen DOT de>
Reply-To: crestani AT informatik DOT uni-tuebingen DOT de
To: cygwin AT cygwin DOT com
Subject: SIGSEGV address with SA_SIGINFO
Date: Tue, 10 May 2005 14:03:50 +0200
User-Agent: KMail/1.8
MIME-Version: 1.0
Message-Id: <200505101403.50204.crestani@informatik.uni-tuebingen.de>

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019