Centralise static state in a struct

This neatens things up a bit and reduces our namespace spew.
Add thread safety

GObject methods (specifically, g_object_new() and finalise) can be
called concurrently from multiple threads, and will race for access to
the gobject-list state. Prevent that with locking.

Also use GOnce to protect the initialisation code in get_func().
Add gdb instructions to README
Add ‘all’ and ‘clean’ recipes to the Makefile

Just to make things a bit more standard.
Add an opportunistic thread-safety fix

It turns out that g_object_weak_ref() isn’t thread safe, and threaded
applications doing lots of concurrent object references/dereferences
across multiple threads can miss out _object_finalized() calls, which
effectively part-corrupts the objects table, and can cause crashes when
printing it out.

See: https://bugzilla.gnome.org/show_bug.cgi?id=548954

This fix tries to avoid some of those crashes, but can’t avoid all of
them, since it only detects really obviously corrupt entries in the
table.

More importantly, it includes a comment which describes the potential
long-term fixes, none of which I have time to implement at the moment.
Merge pull request #2 from pwithnall/thread-safety

Thread safety