12

我有两个 C++ 函数重载,我想在其中一个上设置断点:

0:000> bu myexe!displayerror
Matched: 00000000`ff3c6100 myexe!displayError (int, HRESULT, wchar_t *)
Matched: 00000000`ff3c60d0 myexe!displayError (int, HRESULT)
Ambiguous symbol error at 'myexe!displayerror'

哎呀,我可以在所有重载上设置断点,但似乎无法弄清楚如何:

0:000> bu myexe!displayerror*
Matched: 00000000`ff3c6100 myexe!displayError (int, HRESULT, wchar_t *)
Matched: 00000000`ff3c60d0 myexe!displayError (int, HRESULT)
Ambiguous symbol error at 'myexe!displayerror*'
4

5 回答 5

7

尝试:

bu 0xff3c6100

如果我没记错的话,WinDbg 也允许按地址设置断点。

于 2008-10-02T10:20:29.220 回答
5

你试过“bm myexe!displayerror*”吗?

于 2008-12-23T12:08:21.393 回答
3

bp @@( MyClass::MyMethod ) 中断方法(如果相同的方法被重载并因此出现在多个地址上时很有用)

于 2011-01-25T17:59:55.390 回答
3
bm myexe!displayerror

这将为所有重载设置断点,而不是bc用来清除不需要的重载

bc 1-3

或者只是禁用它们

bd 1-3

问题bm在于它产生的断点有时无法评估并触发中断。有时很烦人。

于 2010-11-14T06:40:06.387 回答
1

在您的 dll 中搜索与您的符号匹配的所有入口点

x myexe!displayerror

这将输出与搜索字符串匹配的所有符号及其入口点,然后在地址上设置断点

bp ff3c6100 // for myexe!displayError (int, HRESULT, wchar_t *)

当该地址被命中时,这将设置一个特定的断点,或者您针对另一个地址设置 bp。您可以将断点设置为只命中一次,清除断点并退出

bp /1 ff3c6100

您还可以执行转储调用堆栈、变量和继续等命令:

bp ff3c6100 "kb;dv;g"

您也可以在附加 WinDbg 时打开源代码,导航到要设置断点的代码行并按 F9(与使用 Visual Studio 的操作相同),它会在设置断点之前暂停一段时间在该行,这假设您可以访问源代码。

于 2012-03-10T11:50:44.177 回答