To give a little context, I am testing a function (written in C) with the same input every time. In some runs it gives a result, and in others in gives a completely different one. Debugging is not a viable approach, because there are too many variables for me to keep track of alone.

Is there a program that records code runs, and then allows me to compare them side by side, in order to search for differences?

  • Do you know what output you expect for each input?
    – CPerkins
    Jul 27 '16 at 16:02
  • @CPerkins Yes, I have no doubts regarding that. Jul 27 '16 at 16:33
  • Do you have access to diff?
    – CPerkins
    Jul 27 '16 at 17:20
  • @CPerkins I do, but I am not seeing how it can be used for this purpose. I want to analyze the code as it is running, not compare the outputs. Jul 27 '16 at 17:21
  • 1
    @Mawg, I eventually found the problem. It was a non-initialized variable, that sometimes was 0, sometimes was garbage, but that garbage messed up my final results. When I said too many variables, I meant structs within structs within arrays within linked lists within etc. There was absolutely no way I could have kept track of all the values of those structs using debugging, and even if I could, that wouldn't help me find the uninitialized variable. And yes, I unit test. Jul 28 '16 at 19:57

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.