Re: recent commit breaks multi-module debugging

Matthias Radestock <[email protected]> Thu, 21 Jun 2007 19:53:51 +0100
Newsgroups gmane.comp.lang.erlang.distel.devel
Message-ID <[email protected]>
Bill Clementson <[email protected]> writes:

> The edb-monitor-cleanup function is called when the connection to the
> node is lost.

Good.

>> When the edb buffer connects to the new node, it first received a list
>> of interpreted modules. That should *clear* edb-interpreted-modules,
>> since the node is new. Subsequently, toggling interpretation should just
>> work. So how do we get this weird behaviour you are seeing?
>
> This appears to be the problem. I stepped through the code and noticed
> that the edb-monitor-node variable wasn't being cleared by
> edb-monitor-cleanup. Therefore, when I re-connect to the same node and
> switch on interpreting, the edb-monitor-node-change-p function checks
> to see whether the monitor buffer is live and whether the node has
> changed:
>
> (defun edb-monitor-node-change-p (node)
>   "Do we have to detach/reattach to debug on NODE?"
>   (and (edb-monitor-live-p)
>        (not (equal node edb-monitor-node))))
>
> Since the edb-monitor-node value is the same as the "new" node value,
> Distel thinks that it's just working with the same node.

Hang on. Notice the first branch of the 'and'? This function should
always return false if there is no active monitor. Since, as you say
above, the active monitor does indeed get killed when the node dies,
that is the case we should be considering, in which case whether node
equals edb-monitor-node makes no difference to the outcome.

Now, edb-monitor-node-change-p returning false should actually be
perfectly ok, because in that case edb-ensure-monitoring
will run 
    (if (edb-monitor-live-p)
	t
      (edb-start-monitor node))))
That will start a new monitor, which in turn will fetch the list of
interpreted modules, breakpoints etc from the node.

...unless of course edb-monitor-live-p returns t. That really shouldn't
happen if, as you say, the monitor buffer gets killed as expected when a
node dies. Worth checking though. It would explain why your patch below
makes a difference!

> However, I'm surprised that this affects me but does not affect
> you. When you went through my test case, did you re-connect with the
> same node name or did you use a different node name?

I used the same node name.

> Have a look at the attached patch (which removes my previous patch to
> edb-toggle-interpret and clears the edb-monitor-node variable when
> edb-monitor-cleanup is called.

I am happy with this patch. I can think of no good reason why
edb-monitor-node should be non-nil when there is no active
monitor, and setting it to nil is probably a good idea, regardless of
whether that is the cause of the problem you are experiencing.

> Let me know if you see any potential problems with this patch.

Feel free to commit it.

However, I'd still like to know what the *real* cause of the problem
is. It looks like in your setup edb-monitor-live-p is returning t when
it shouldn't, which could easily cause problems elsewhere.


Regards,


Matthias.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/