I have implemented a tool for helping me debug some algorithms that are <br>very similar but I need some help in improving how it works.<br><br>I have a set of implementations of algorithms that all compute the same result. 
<br>I normally run two implementations (lets say&nbsp; C&nbsp; and&nbsp; E)&nbsp; at a time and <br>compare the runs for speed, space used, and other characteristics.<br>If the implementations are correct both runs return the same result but
<br>if there is a bug the results may be different.<br><br>If the results are different I track down the problem by running a method<br>called traceBug.&nbsp; (Tracebug is started by pressing a button).<br>The high level part of each implementation is the same but they each invoke a method
<br>which is different for each implementation.&nbsp; <br>Let&#39;s say&nbsp; C&nbsp; invokes&nbsp; Mc&nbsp; and&nbsp; E&nbsp; invokes&nbsp; Me&nbsp; where&nbsp; Mc&nbsp; and&nbsp; Me&nbsp; are different.<br>Note that&nbsp; Mc&nbsp; (if it has no bugs) always computes the same result for the same
<br>
input parameters.&nbsp; Similarly for&nbsp; Me.<br><br>Conceptually, TraceBug works as follows. <br>Repeat<br>&nbsp;&nbsp;&nbsp; If&nbsp; C has not been started start it.&nbsp; Continue running C&nbsp; until&nbsp; Mc is invoked.<br>&nbsp;&nbsp;&nbsp; Store the result of&nbsp; Mc, in Ac.
<br>&nbsp;&nbsp;&nbsp; If&nbsp; E has not been started start it.&nbsp; Continue running&nbsp; E&nbsp; until&nbsp; Me is invoked.<br>&nbsp;&nbsp;&nbsp; Store the result of&nbsp; Me&nbsp; in&nbsp; Ae.<br>Until Ac&nbsp; and&nbsp; Ae&nbsp; are different.&nbsp;&nbsp; //&nbsp; since there is a bug this must happen<br><br>Ac&nbsp; and&nbsp; Ae&nbsp; are arrays.&nbsp; Since they are different, for some index&nbsp; i,&nbsp; Ac[i] != Ae[i].
<br>TraceBug&nbsp; now&nbsp; invokes&nbsp; M&#39;c&nbsp; where is&nbsp; M&#39;c takes the same parameters as&nbsp; Mc<br>except for one additional parameter&nbsp; i.&nbsp; M&#39;c&nbsp; does the same computations as&nbsp; Mc<br>except that when the value&nbsp; Ac[i] is about to be computed a halt is invoked thus
<br>bringing up the debugger.<br><br>I can now use the debugger to investigate how Ac[i] is computed!<br>I also invoke traceBug so that the halt occurs when&nbsp; Ae[i] is about to be computed.<br><br>Thus by running traceBug twice&nbsp; I am able to bring up two debuggers somewhere
<br>near where my bug is!&nbsp; Having two debuggers up at the same time<br>is very useful in finding where my bug is!<br><br>I would like to be able to improve traceBug in two ways.<br><br>First, I would like to only press the traceBug button once.
<br>This means that once the debugger is brought up traceBug needs to be restarted<br>so that it can cause the second debugger to come up.<br>Obviously this can be done but I don&#39;t know how to do it.<br><br>Second, instead of restarting traceBug from the beginning,&nbsp; I would like to
<br>have it be restarted at the point immediately after the line where&nbsp; M&#39;c is invoked.<br>It could then immediately invoke&nbsp; M&#39;e.&nbsp;&nbsp; This would avoid running&nbsp; C&nbsp; and&nbsp; E&nbsp; twice<br>and thus be faster.&nbsp; This is not that important to me since&nbsp; C&nbsp; and&nbsp; E&nbsp; are
<br>usually fast (a few seconds), but I would like to know how to do this and I may <br>deal with slower algorithms in the future.<br><br>Thanks in advance for any advice.<br><br>Ralph<br><br><br><br><br>