Click here to Skip to main content
15,883,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends,

I am stuck at one point. I am executing code in debug. And I am getting the HRESULT value as failed. But I am not able to know that from where it set this HRESULT. I check the call stack, but it is not useful in my case.
C++
if (FAILED(hr))
{
	logFile.WriteLog("Failed to process file", hr);//Here I set the debug point
	return hr;
}

I want to know that which statement is called before above statement.
If anybody know then share with me please.
Thanks in advance
Posted
Comments
chandanadhikari 2-Dec-13 7:49am    
hi,
well if these lines are inside a big function then place break point at the very beginning of function(which might be much before the if condition ) and then debug by stepping-into functions one be one .hope it helps .

1 solution

You can set a "data breakpoint" after you started a debugging session. To declare a data breakpoint, set a normal breakpoint somewhere in the part of your code that can see the variable or data address in question, some time before the problem occurs. Start the debugger and wait for it to break at that position. Then select the following menu entry:
"Debug --> New Breakpoint --> New Data Breakpoint ..."

There you can enter the address of your variable hr, and tell the debugger to break when the value stored at that address changes.

This applies to VS 2010, english version.
 
Share this answer
 
Comments
nv3 2-Dec-13 9:07am    
Stefan, that won't help him very much if hr is a variable on the stack, as it usually would be ;-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900