On Mon, Mar 21, 2011 at 3:04 PM, Holger Wirtz <dcored...@googlemail.com> 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 :-(
>
> On the other hand I won't invest too much time for studying rocket
> engeneering only to use framework XYZ. Has anyone some ideas how to
> debug with less effort?
>
Just a couple of ideas to add to others' suggestions. First, if you
are starting  from scratch, do some reading  on design of
multi-threaded programs in order to reduce sharing -- and the
potential for races -- right from the start. A good strategy is to set
up queues of work for auxiliary threads and also have queues where
those threads can place their results.

The helgrind tool, which is part of valgrind, is very useful for
rooting out race conditions at an API level. You might not be able to
run FlightGear with it in a practical way, but you can certainly run
graphical applications with it.

In gdb there are several breakpoint and scheduling commands which give
you the flexibility to only break in certain threads and to only let
one thread continue. This can be useful when several threads have
entered the same function (which might be perfectly reasonable) and
gdb appears to be bouncing all around.

Finally, command line gdb is intolerable; I haven't debugged that way
for years. I run gdb inside of emacs, which gives you instant access
to the source code. I won't push emacs on a vi user :), but there are
many alternatives these days on Linux which will provide a friendlier
debugging  experience.

Tim
> Thanks, Holger
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>

------------------------------------------------------------------------------
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
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to