I often face cases where I could troubleshoot programs by comparing the execution traces of two versions of it, from the same inputs, until the behaviors diverge.

This could probably be done by logging all steps taken (minimally, could be just the visited line numbers; maximally, output of all modified values). And on a second run, break as soon as a change is found.

Comparison with the granularity of high-level languages constructs (lines) could do; assembly-level as well (provided cross referencing the source code is done).

Is there any symbolic debugger or equivalent product able to do that ?

  • "tracing line numbers" is likely to be pretty useless if the two programs, of any scale, differed by a single inserted blank line, (or more likely, by random blank lines, comments, or linebreaks). You'll have to define what you mean by "Step" more carefully. – Ira Baxter Mar 29 '14 at 2:53
  • I also suspect that if both programs read nondeterministic values (eg., a random number generator, or a time of day clock), that you'd find the divergence at that point. This shows you need to define "equivalence of values"; are the variables char x; and int x; equivalent if they are both incremented, and the character overflows? If the program only cares about the lower 8 bits x, they are. – Ira Baxter Mar 29 '14 at 2:57
  • @Ira: quite right about line numbers, and more generally it seems obvious that execution traces can diverge only where code is entered. In theory, just the modified lines should be traced then, and "old" line numbers should be preserved (a diff tool can do). The practical issue to be solved is that divergence can only trigger at the Nth passing, where N is huge and unknown. – Yves Daoust Mar 29 '14 at 9:22
  • @Ira: using this approach on non-deterministic programs (be they randomized or concurrent) makes little sense. Execution traces must be repeatable. – Yves Daoust Mar 29 '14 at 9:25
  • Yves Daust: Diff is a pretty awful tool for lining up line numbers; you need a smart differencer to track how one relates to the other. And of course, where they differ, you should expect divergence; otherwise, why would they be different? Regarding non-determinitic programs: what real programs of scale do you wish to apply this to, that don't have some aspect of this? – Ira Baxter Mar 29 '14 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.