如何在.cpp文件的每个函数中放置断点?
有宏可以做到吗? 使用哪些 DTE 对象?
Is there a macro that does it? Which DTE objects to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有宏可以做到吗? 使用哪些 DTE 对象?
Is there a macro that does it? Which DTE objects to use?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(8)
以下是 1800 INFORMATION 想法的快速实现:
Here's a quick implementation of 1800 INFORMATION's idea:
(这不完全是您所要求的,但几乎是:)
您可以通过调出新断点类的每个成员函数上放置断点> 对话框并输入:
请参阅 链接 了解更多详细信息。
(This is not quite what you're asking for, but almost:)
You can put a breakpoint on every member function of a class in Visual Studio by bringing up the New Breakpoint dialog and entering:
See Link for more details.
就像康斯坦丁的方法一样......这似乎是windbg的领域。
既然你有cpp,(即使你没有,你也可以编写一些脚本来解决),使用 logger Windows调试工具的一部分...这是一个非常方便的工具,可惜很少有人使用它。
记录器轻松调试 C/COM/C++,具有丰富的符号信息、钩子/分析/灵活的检测;
激活 Logger 的一种方法是启动 CDB 或 WinDbg 并附加到像平常一样的用户模式目标应用程序。 然后,使用 !logexts.logi 或 !logexts.loge 扩展命令。
这将在当前断点处插入代码,该代码将跳转到在目标应用程序进程中加载并初始化 Logexts.dll 的例程。 这称为“将 Logger 注入目标应用程序”。
Like Constantin's method... This seems like windbg territory.
Since you have the cpp, (even if you didn't you could script something to get by), it should be no problem to use logger part of the debugging tools for windows... it's a very handy tool, shame so few people use it.
logger debug's C/COM/C++ easily, with rich symbolic info, hooks/profiling/flexible instrumentation;
One way to activate Logger is to start CDB or WinDbg and attach to a user-mode target application as usual. Then, use the !logexts.logi or !logexts.loge extension command.
This will insert code at the current breakpoint that will jump off to a routine that loads and initializes Logexts.dll in the target application process. This is referred to as "injecting Logger into the target application."
我不知道要使用什么 DTE 函数,但您可以非常简单地录制一个几乎可以做到这一点的宏:
现在只需一遍又一遍地运行此命令(ctrl - 反复shift P)直到到达文件末尾。
如果有命名空间,则将4.改为:
这种可以无限修改以适合您的代码库
I don't know what DTE functions to use, but you could very simply record a macro that could pretty much do it:
Now just run this over and over (ctrl - shift P repeatedly) until you reach the end of the file.
If you have namespaces, then change 4. to:
This kind of thing can be infinitely modified to suit your codebase
有一个宏,但我只用c#测试过。
There is a macro, but I tested it only with c#.
下面是在 WinDbg 中实现类似功能的方法:
这会在模块
mymodule
中的类(或命名空间)CSpam
的每个方法中放置断点。我仍在 Visual Studio 中寻找与此功能接近的任何内容。
Here's how something similar could be achieved in WinDbg:
This puts breakpoint in every method of class (or namespace)
CSpam
in modulemymodule
.I'm still looking for anything close to this functionality in Visual Studio.
这是一种方法(我警告你这很糟糕):
Here's one way to do it (I warn you it is hacky):
将其放在文件顶部:
然后在每个函数的开头插入 DEBUG_BREAK,如下所示:
当您不再需要调试中断时,请注释
文件顶部的行。
Put this at the top of the file:
then insert DEBUG_BREAK in the beginning of every function, like this:
When you no longer want the debug breaks, comment the line
at the top of the file.