我们如何在Visual C ++中获得最后成功执行的语句? [英] How we get the last successfully executed statement in Visual C++?

查看:83
本文介绍了我们如何在Visual C ++中获得最后成功执行的语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我一度陷入困境。我正在调试中执行代码。我将HRESULT值视为失败。但我无法从它设置此HRESULT的位置知道它。我检查了调用堆栈,但在我的情况下它没用。

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.

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

推荐答案

您可以在启动调试会话后设置数据断点。要声明数据断点,请在代码中的某个位置设置一个正常断点,可以在问题发生前一段时间查看有问题的变量或数据地址。启动调试器并等待它在该位置中断。然后选择以下菜单项:

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 ..."



在那里你可以输入变量hr的地址,并告诉调试器在存储在该地址的值发生变化时中断。



这个适用于VS 2010,英文版。


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.


这篇关于我们如何在Visual C ++中获得最后成功执行的语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆