I found the following interesting articles on the net on debugging threads using gdb.
Here is a summary of commands
1. info threads
Shows information on threads
Allows you to switch to that thread. Then you can do a bt or something similar
3. break file.c:lineno thread
Allows to set a break point conditionally for a specific thread
4. set print thread-events on
Turns on printing entry and exit of a thread
5. thread apply
Applies a command to a thread/all threads
I still don't know how to tackle my issue of dying thread. However, I expect a combo of 3,4 might shed some light. I will post the details tomorrow after trying.