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]

Re: emacs-X11 crashes under gdb in recent snapshots


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


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