Considering this code:
std::vector<myObject*> veryLargeArray;
for (int i = 0; i < veryLargeArray.size(); ++i)
{
param_type* currParams = veryLargeArray[i]->GetParams<param_type>();
currParams->phi = /* some complex formula */;
}
How would I step that code such that I know what answer is being stored in phi before another iteration of the loop starts which will effectively destroy currParams and with it my chances of watching its values in the debugger?
I am running into this situation all too often and my solution is to either recompile the code by putting a dummy variable just before the end of the block where I then put the break OR go through the array of values, which sometimes may be huge, just so that I can see what value was stored or may require extra work just to convert the stored param_type into the correct object. Both solutions are not ideal as the first introduces warnings (which is treated as an error, in which case I have to set per file rules) as well as recompilation of the code, both of which I would like to avoid, while the second wastes time.
You could have a tracepoint output the value of
phion each iteration through the loop. You should even be able to combine this with breakpoint conditions.