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]

pthread_mutex_init + gdb issue again


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/


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