junni lomo
junni lomo

Reputation: 779

Visual Studio environment 2010 C++ Debug techniques suggestion required

I am using Visual Studio 2012 for my project in C++. I have a function where I put a break point.

 MyFunction(int userid, double totalamount,char *ce_account_ref_num, int payment_type)

My debugger goes to this point and shows some undesirable inputs for userid. Is it possible to go back to the point where this function is called and verify inputs?

Upvotes: 1

Views: 108

Answers (4)

stamhaney
stamhaney

Reputation: 1314

I do this by pressing ctrl and - . This can be done recursively (press the combination again). This takes me back to the point where my cursor was last. By doing this I can go back to where the function is called and check the values etc. And by the way you can execute the same function again (in debug mode) by going to the point where the function is called by selecting "set next statement" from the right click menu, while you are debugging - a very powerful feature.

Upvotes: 0

someone_ smiley
someone_ smiley

Reputation: 1066

Unfortunately it is not possible to role back(undo executions) to the point where this function is called. However you can try put break point right after you give input and verify it. Call stack is also helpful to track how your program flow sequence get there.

Upvotes: 0

user1610015
user1610015

Reputation: 6678

In the Call Stack window (usually on the bottom-right of Visual Studio), double-click the line with the name of the method where you want to see values of variables.

Upvotes: 4

Didac Perez Parera
Didac Perez Parera

Reputation: 3824

You can do many things but maybe the best choice is to comment all the lines in your MyFunction method and step over to the next line outside MyFunction to check the variables. You can also check the Call Stack and Call Hierarchy to see where your function is called from, in the case you have more than one call to the same method.

Upvotes: 1

Related Questions