delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/05/08/04:41:58

X-Spam-Check-By: sourceware.org
Date: Mon, 8 May 2006 01:41:39 -0700
From: clayne AT anodized DOT com
To: cygwin AT cygwin DOT com
Subject: pthread_mutex_init + gdb issue again
Message-ID: <20060508084139.GB18330@ns1.anodized.com>
Mime-Version: 1.0
User-Agent: Mutt/1.5.11
X-Assp-Spam-Prob: 0.00000
X-Assp-Whitelisted: Yes
X-Assp-Envelope-From: clayne AT ns1 DOT anodized DOT com
X-IsSubscribed: yes
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

Alright, I'm aware of the "check for invalid memory region and throw
exception" issue present when debugging pthread applications under gdb
and that the actual segfault is innocuous. However, the following solutions:

1. "handle SIGSEGV nostop"
   "handle SIGTRAP nostop"

2. (hit continue on every SIGSEGV raised).

Are unacceptable to me. I have functions which initialize mutexes for
1000s of objects at load time. e.g. parse, alloc struct, init mutex within
struct. For one, it becomes fruitless to try and debug a real segfault issue
when using gdb and pthreads under cygwin. The only option when working
with mass mutexes is disable stopping on SIGSEGV within gdb - rendering
useless the debugging of an actual real segfault situation.

This is the best I could come up with to get around it, and frankly it's a
ridiculous hack, that's entirely non-portable, possibly even with future
versions of cygwin libraries - but it's necessary to keep my sanity when
debugging pthreads based apps under cygwin:

#ifdef __CYGWIN__
# define PT_m_init(x, y) \
{ \
	*x = malloc(sizeof(struct __pthread_mutex_t)); \
	(**x).__dummy = 56; \
}
#else
# define PT_m_init(x, y) \
	pthread_mutex_init((x), (y))
#endif

Someone throw me a bone here, please.

-cl

--
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