Re: a patch for runtime debugging control for libbonobo



Hi Jaka,

On Mon, 2002-05-13 at 22:36, Jaka Mocnik wrote:
> attached is a patch that enables control of debugging output via an
> environment variable BONOBO_DEBUG_FLAGS, in a manner similar to ORBit2:

	Wow - this is really good; Thanks for putting that work in !

	One thing we do in ORBit2 which saves a good number of cycles [ since a
chunk of this stuff is called really often ] is to use:

#ifdef G_ENABLE_DEBUG
	if (_orbit_debug_flags & ORBIT_DEBUG_REFS)
		g_hash_table_foreach (
			object_hash, object_hash_dump, NULL);
#endif

	ie. replace all the previous #ifdef FOO_DEBUG #ifdef BAA_DEBUG with
#ifdef G_ENABLE_DEBUG if (flags & foo) - so that we still have the
conditional compilation and can compile the stuff out for the common
case.

	That also has the benefit of leaving the debugging code annotated
inside structures such as:

typedef struct {
        int      ref_count;
        gboolean immortal;
        GList   *objs;
-#ifdef BONOBO_REF_HOOKS
+       /* the following is required for reference debugging */
        GList   *refs;
        int      destroyed;
-#endif
 } BonoboAggregateObject;

	Killing that comment with a:

#ifdef G_ENABLE_DEBUG
#endif

	etc. :-)

> additionaly, if BONOBO_DEBUG_DIR is defined, the debugging output is
> sent to a file in that directory, named bonobo-debug-<pid>. otherwise it
> just goes to stdout.

	Nice touch.

> the patch patches Makefile.am, bonobo-object.c and
> bonobo-running-context.c. it adds two new files bonobo-debug.c and
> bonobo-debug.h. the latter header is private and is not installed.

	Fine. Make sure you remember to cvs add the bonobo-debug.[ch] files :-)

> it helped a lot when debugging ref counting in GGV. if it seems helpful,
> it might be included in the library. otherwise, I'll just keep it in my
> private tree.

	Yes - very useful; can you add in a load of G_ENABLE_DEBUG ifdefs and
commit, sending me a patch as you do so.

	Thanks again,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]