delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/03/09/22:13:11

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
X-Mail-Handler: Dyn Standard SMTP by Dyn
X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX1/TqMdeaDA4jhlTrazWf3Dz
Date: Sat, 9 Mar 2013 22:12:50 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: emacs-X11 crashes under gdb in recent snapshots
Message-ID: <20130310031250.GA6666@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <5137B57A DOT 2020204 AT cornell DOT edu> <20130307054426 DOT GB8145 AT ednor DOT casa DOT cgf DOT cx> <20130307064921 DOT GA2424 AT ednor DOT casa DOT cgf DOT cx> <20130308163430 DOT GA814 AT ednor DOT casa DOT cgf DOT cx> <20130309220222 DOT GB7961 AT ednor DOT casa DOT cgf DOT cx> <513BC0C9 DOT 8030409 AT cornell DOT edu>
MIME-Version: 1.0
In-Reply-To: <513BC0C9.8030409@cornell.edu>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Sat, Mar 09, 2013 at 06:07:53PM -0500, Ken Brown wrote:
>On 3/9/2013 5:02 PM, Christopher Faylor wrote:
>> On Fri, Mar 08, 2013 at 11:34:30AM -0500, Christopher Faylor wrote:
>>> On Thu, Mar 07, 2013 at 01:49:21AM -0500, Christopher Faylor wrote:
>>>> On Thu, Mar 07, 2013 at 12:44:26AM -0500, Christopher Faylor wrote:
>>>>> On Wed, Mar 06, 2013 at 04:30:34PM -0500, Ken Brown wrote:
>>>>>> Starting with the 20130102 snapshot, I get a SEGV if I run emacs-X11
>>>>>> under gdb.
>>>>>
>>>>> Thanks for the explicit instructions.
>>>>>
>>>>> I can reproduce this.  Investigating.
>>>>
>>>> I see what the problem is but it's too late to fix it now.
>>>>
>>>> So, instead, I will go to bed and obsess and dream about it instead.
>>>>
>>>> I will fix it tomorrow, though.
>>>
>>> Or not.  RL intervened.  Still checking.  It's trickier to fix than
>>> I thought.
>>
>> This should be fixed now.  You'll need the new just-released gdb and
>> the upcoming snapshot for this to work correctly.
>
>Confirmed.  Thanks.
>
>> Changes in gdb and cygwin1.dll should now allow gdb to recognize
>> Cygwin-specific signals.  That's something that I've wanted to do for
>> more than ten years.  I startled my wife with my whoop! when gdb
>> reported a "SIGTERM" at the correct line in my source code.
>
>Do you have a simple test case that illustrates this new feature?  I'd 
>like to startle my wife too.

I have a directory with 509 test cases that I've accumulated over the
years (I would have had more but, at one point, I though that the
directory named "test" was actually an errant program named "test" and
deleted it in a housekeeping task gone horribly wrong).  So, I just
ran "gdb sigwait".  Where sigwait is the program below.

But, just killing any program with a SIGTERM should demonstrate the
new functionality.

cgf

#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <pthread.h>

static pthread_attr_t  logger_attr;
static pthread_cond_t  logger_cond;
static pthread_mutex_t  logger_lock;
static pthread_t   logger_tid;


static int pipefd[2];

void *logger_thread(void *arg)
{
int n;
char buffer[80];


  setvbuf(stdout, NULL, _IOLBF, 0); // *** THIS DOES NOT WORK PROPERLY ***

  sigset_t ss;
  sigemptyset (&ss);
  sigaddset (&ss, SIGTERM);
  int sig;
  puts ("waiting...");
  printf ("%d = sigwait\n", sigwait (&ss, &sig));
  printf ("sig %d\n", sig);
  return NULL;
}

main()
{
  fprintf (stdout, "in main\n");
  pthread_attr_init(&logger_attr);
  pthread_attr_setstacksize(&logger_attr,1048576);
 
  pthread_attr_setdetachstate(&logger_attr,PTHREAD_CREATE_DETACHED);
  pthread_create (&logger_tid, &logger_attr, logger_thread, NULL);


  //setvbuf(stdout, NULL, _IOLBF, 0);

  printf("test1\n");
  fflush(stdout);
  sleep(3);
  printf ("calling pthread_kill(%p, SIGTERM)\n", (void *)logger_tid);
  pthread_kill (logger_tid, SIGTERM);
  sleep(1);

  fprintf(stderr,"done\n");
}

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

- Raw text -


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