File: //usr/share/gtk-doc/html/libbonobo/debugging.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Debugging</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="Libbonobo Reference Manual">
<link rel="up" href="misc.html" title="Miscellaneous">
<link rel="prev" href="misc.html" title="Miscellaneous">
<link rel="next" href="libbonobo-faq.html" title="Common Questions">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="general.html" title="General">
<link rel="chapter" href="factories.html" title="Objects, Factories, Reference Counting">
<link rel="chapter" href="property-bags.html" title="Property Bags, Events, Listeners">
<link rel="chapter" href="monikers.html" title="Monikers">
<link rel="chapter" href="streams.html" title="Storages and Streams">
<link rel="chapter" href="persist.html" title="Persistency">
<link rel="chapter" href="misc.html" title="Miscellaneous">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="misc.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="misc.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Libbonobo Reference Manual</th>
<td><a accesskey="n" href="libbonobo-faq.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry" lang="en">
<a name="debugging"></a><div class="titlepage"></div>
<div class="refsect1" lang="en">
<a name="id2786664"></a><h2>Debugging</h2>
<p>Bonobo component debugging advice, version 0.1
by Michael Meeks <mmeeks@gnu.org></p>
<p>Since it is not transparently obvious how to debug
Bonobo components the following suggestions may be of use.</p>
<div class="refsect2" lang="en">
<a name="id2786453"></a><h3>Read the FAQ</h3>
<p>This will cover particularly common errors and their
solutions obviating the need for further debugging.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2786463"></a><h3>Versions</h3>
<p> It is vital to ensure that the correct versions of
both the component and the container are being
run. The safest way to make sure this is the case is
to explicitly specify the path eg. </p>
<span><strong class="command"> ./bonobo-my-component & ./my-test-container </strong></span>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787420"></a><h3>Correct install</h3>
<p>It is rather important to make sure that bonobo has
compiled and installed correctly. If you are using CVS
ensure that your bonobo has installed without errors
and that you have run ldconfig.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787432"></a><h3>Stale processes</h3>
<p>It is a good idea to check there are no stale
component processes running in the background, check
with</p>
<span><strong class="command">ps ax | grep 'bonobo-my-component'</strong></span><p>or just:</p>
<span><strong class="command">bonobo-slay</strong></span>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787457"></a><h3>Debugging</h3>
<p>So: debugging. The best way to do this is to have
two X-terms, in one run the component:</p>
<span><strong class="command"><pre class="screen">
gdb ./bonobo-my-component
$ r
</pre></strong></span><p>And in the second run the container:</p>
<span><strong class="command"><pre class="screen">
gdb ./my-test-container
$ r
</pre></strong></span><p>Putting breakpoints in shared libraries such as
bonobo is not possible until they have been linked
in. Hence break in main, and then start populating
your breakpoints.</p>
<p>Ok, so it seems some people also get horribly
confused by libtool libraries that are in fact here to
help; libtool creates a shell script in place of the
binary to allow non-installed libraries to be linked
correctly. That aside you need to do:</p>
<span><strong class="command">$ libtool gdb ./my-program-name.</strong></span><p>NB. don't go fiddling in <code class="filename">.libs</code>,
you will get burned. NNB. it seems that emacs' debug
mode doesn't like this; you have to write a small
<code class="literal">'libtool gdb</code>' wrapper script
eg. '<code class="literal">libtool gdb $@</code>'</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787534"></a><h3>CORBA method tracing</h3>
<p>There is beautiful built in ORBit2 method tracing
facility that will show you all CORBA invocations,
their objects, arguments, microsecond timestamps
etc. To use it you need to configure ORBit2 with the
--enable-debug switch and then either define the
environment variable <code class="envar">ORBIT2_DEBUG</code> or
use the ORBDebugFlags command line option or orbitrc
flag. See the ORBit2 FAQ for more info.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787553"></a><h3>Order of execution</h3>
<p>It is of course important to ensure that the
component has registered before executing the
container. A good guide is to wait until your hard
disk has stopped thrashing madly before running the
container.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787566"></a><h3>Nothing will activate!</h3>
<span><strong class="command"><pre class="screen">
export BONOBO_ACTIVATION_DEBUG_OUTPUT=1
bonobo-slay
</pre></strong></span><p> And try again - it's possible that a debug message
is being suppressed by bonobo-activation-server that
this will show you. </p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787587"></a><h3>Nothing seems to happen, the code just locks</h3>
<p>Check that you are doing either a
<code class="function">bonobo_main()</code> or a
<code class="function">bonobo_activate()</code> followed by
<code class="function">gtk_main()</code>. Failure to do this
will cause strange lockups, caused because the POA is
still queueing incoming requests waiting to be
activated. NB. this must be done in both container
and component.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787619"></a><h3>Getting more information</h3>
<p>If you are doing serious development consider
compiling gtk+, glib and bonobo with debugging
symbols:</p>
<span><strong class="command">export CFLAGS='-g' ; ./configure</strong></span><p>If you suspect the name server of causing problems
use type:</p>
<span><strong class="command">export BONOBO_ACTIVATION_DEBUG_EXERUN=1</strong></span><p>to get debug to the console, simply adding a
breakpoint in <code class="function">g_log</code> will help get
at the innards of the bonobo-activation
process.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787658"></a><h3>Debugging bonobo-activation</h3>
<p> This is often best done by running: </p>
<span><strong class="command"><pre class="screen">
gdb ./bonobo-activation
r --ac-activate
</pre></strong></span><p>
And then cutting and pasting the IOR it spews out into
/tmp/orbit-$USER/reg:...-local.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787682"></a><h3>The last resort</h3>
<p>And finally when the handfuls of hair are coming out
thick and fast, consider reading the source, it only
looks scary, it won't bite.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2787694"></a><h3>Talk to the experts.</h3>
<p> Try reading the mailing list <a href="http://www.gnome.org/mailing-lists/archives/gnome-components-list/" target="_top">
archive </a>. </p>
<p>
Alternatively if you wish to buy in the programming expertise to meet
an agressive deadline see: <a href="http://www.gnome-support.com" target="_top">http://www.gnome-support.com</a>.
</p>
</div>
</div>
</div>
</body>
</html>