I am debugging a very complex C ++ function that gives me some unexpected results with some inputs. I would like to compare code execution under different inputs to find out which part is causing me an error. A tool that can compare code execution paths is what I'm looking for. Please let me know if such a tool exists. Or else, if there are some methods that I can use to accomplish the same thing?
To describe my problem specifically, here I use a far-fetched example.
Say this is a function in pseudo code ,
double payTax(double income) { if (income < 10000) return noTax(); else if ( 10000 < income < 30000) return levelOneTax(); else if (30000 < income < 48000) return levelTwoTax(); else return levelThreeAboveTax(); }
Given input 15000, the function calculates the correct tax amount, but somehow input 16000 gives an erroneous tax amount. Presumably, entering 15000 and 16000 will cause the function to go through the same execution paths; on the other hand, if they go in different ways, then something should violate the function. Therefore, a tool that compares execution paths will reveal enough information that could help me quickly identify the error. I am looking for such a tool. It is preferably compatible with Visual Studio 2010. It would be better if such a tool also saved variable values.
PS debugging is the last thing I want to do, because the code base I work with is much larger and more complex than the trivial payTax example.
Please, help. Thanks.
source share