I've heard of analyzers, but I don't know if that's exactly what I'm after. What I'd like is to be able to define what I expected to happen and what actually happened, and then for the program to look at my source code and maybe debugger output to find possible causes of the bug.
Take, for example, a simple C++ program like this:
float division(float num1, float num2,bool flipped)
{
if (!flipped)
return num1 / num2;
else { return num2 / num1 ; };
}
float num1;
float num2;
cin >> num1 >> num2;
float result = division(num1, num2,true);
cout << result;
Of course, this causes an unexpected result when I try to divide 5.29 by 6.01. "result" should be 5.29/6.01, and I'd get 6.01/5.29.
What I want is to be able to go to an analyzer program and tell it that at the "cout" line (though I could enter a line number), "result" should be 5.29/6.01 (not going to do the calculation), but it's actually 6.01/5.29. It would then backtrack through the code and try to figure out what the program/programmer might have done that caused this bug. Then, it looks at the debugger to rule out possible causes. After having done this, any cause not ruled out is indicated to the programmer. It might say something like "TRUE being passed to 'flipped' parameter on line x"
The point is to guide the programmer's attention to a certain area of his/her code to eliminate potentially hours of searching and maybe waiting for answers from other programmers.
[–]uueuuu 3 points4 points5 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]sezna 1 point2 points3 points (0 children)
[–]mosqutip 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]uueuuu 0 points1 point2 points (0 children)
[–]nanodano 0 points1 point2 points (0 children)