On Mon, 2011-03-21 at 15:04 +0100, Holger Wirtz wrote:
> Hi all,
>
> sorry - a little bit off-topic (in fact not so much as you might think,
> it's for a third-party software for FG):
>
> Has anyone some hints/websites/programs for debugging C -based multi
> threaded programs (exactly: glib based C code)? Currently I am
> developing with vi and a little bit gdb (command line) and very much
> debug output. But this setup seems to be very frustrating while
> searching for dead-locks and race-conditions :-(
I have my own locking functions that call the pthread ones and added a
small piece of code to check for the mutex value:
pthread_mutex_t mutex;
int mtx = mutex.__data.__count;
r = pthread_mutex_lock(&mutex);
if (mtx != 1) {
printf("Mutex was already locked\n");
}
You could add all kinds of fancy stuff using __FILE__, __FUNCTION__ and
__LINE__ to detect from where the code has been called.
Note: This only works for __GNUC__
Erik
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel