More info regarding the segfault caused by using -D under Cygwin:...
Well, in short, I found it! Attached here please find the relevant patch to ./jabberd/mio.c (basically one line of code to increase the Pth thread stack size, wrapped in a #ifdef __CYGWIN__...that's IT!), along with the full version of the file in case the patch is a goof. With this one change, Jabberd 1.4.3CVS now builds under Cygwin as it does elsewhere, and works the same I believe, INCLUDING running in proper debug mode!
Can't speak for anyone else, but just being able to tackle this problem, let alone see it through to a solution and having the ability to semi-grasp in what limited way I can what's going on is pretty darn exciting. Haven't done this in forever, let alone at this depth, and it juices me! :-)
It's a bit late now, but tomorrow I'll write up in detail what all I went through, just in case there are any new coders out there who wish to keep Cygwin in mind when they're coding. Honestly, it's quite robust now, but there are just a few potential gotchas along the way...things like no ability to change stack size via ulimit (but you can use an i386 PE-specific ld switch --stack and/or --heap to set the reserve size for each in your app).
And the glitch in this case was actually a stack overflow issue WITHIN GNU Pth, but likely due to the thread stack size not being large enough. I basically set a conditional so that under Cygwin the PTH_ATTR_STACKSIZE was set to 128KB instead of the default 64KB, just before calling pth_spawn() to generate a thread. That's all it took.
It's possible this can be ratcheted down to 96KB (basically something < 128KB), but for now this should do. Note I have not stress-tested this, but if someone has a simple script/tool--that's easy to use--to beat against a Jabber server, I'll be more than glad to give it a whack and see what it can take.
Anyway, off to bed.
Index: jabberd/mio.c
===================================================================
RCS file: /home/cvs/jabberd14/jabberd/mio.c,v
retrieving revision 1.68
diff -u -r1.68 mio.c
--- jabberd/mio.c 24 Sep 2003 21:50:04 -0000 1.68
+++ jabberd/mio.c 12 Nov 2003 05:08:43 -0000
@@ -1063,6 +1063,9 @@
/* start main accept/read/write thread */
attr = pth_attr_new();
pth_attr_set(attr,PTH_ATTR_JOINABLE,FALSE);
+#ifdef __CYGWIN__
+ pth_attr_set(attr,PTH_ATTR_STACK_SIZE, 128*1024);
+#endif
mio__data->t=pth_spawn(attr,(void*)_mio_main,NULL);
pth_attr_destroy(attr);
