为什么断点只与行相关,而不是与某些状态集相关?
为什么断点总是与行相关联,并且可以选择与状态相关联?为什么我们不能设置仅与状态或状态更改而不与行相关的断点?这与整个类的断点有何关系?
我们通常可以在任意点暂停执行——为什么我们不能在达到某个状态时让 IDE 暂停执行,无论执行点在哪里?我们将如何实施这些休息? (我假设当状态更改触发暂停时,正在调试的代码可能已经继续)。
我最近开始思考这个问题,当时我想知道是否有一种方法可以在访问某个文件时暂停执行,并且还思考我的调试过程通常如何分为两个部分:有针对性的断点和基于预感的全局搜索。代码正在运行。
尽职调查:至少在此处相关帖子。
另外:我特别直接的兴趣恰好是 Visual Studio 上的 C#——通过下面 Mark Wilkins 的链接,我设法追踪 Visual Studio 中的“数据断点”设置,仅在调试 C++ 本机代码时启用。
Why is it that breakpoints are always tied to lines, and optionally to state? Why can't we have breakpoints that are tied solely to state or state changes, and not to lines? How does this relate to breakpointing on a whole class?
We can typically suspend execution at an arbitrary point -- why can't we have our IDE's suspend execution when a certain state is hit, wherever the execution point is? How would we implement these breaks? (I assume that by the time the state change has triggered a suspension the code being debugged may have continued).
I started thinking about this recently, when I wondered if there might be a way of suspended execution when a certain file was accessed, and thought also about how my debugging process often splits into two components: targeted breakpointing and global searches based on hunches about the code is behaving.
Due diligence: related post here, at least.
addition: my particular immediate interest happens to be in c# on visual studio -- with Mark Wilkins' link below I managed to track down "data breakpoint" setting in visual studio, only enabled while debugging C++ native code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以设置断点,以便当地址处的值发生更改时调试器停止(数据断点)。我相信在 GDB 中它被称为 观察点。在 Visual Studio 中,您还可以设置数据断点(菜单“调试”\“新断点”)。
It is possible to set breakpoints such that it stops in the debugger when a value at an address changes (data breakpoints). I believe that in GDB it is called a watchpoint. And in Visual Studio, you can set a data breakpoint as well (menu Debug \ new breakpoint).
VS 经常请求“数据断点”,但似乎从来没有足够高的优先级来在 CLR 中实现。也许可以在这里投票:
http://connect .microsoft.com/VisualStudio/feedback/details/333647/data-breakpoints-in-托管代码
"Data breakpoints" are often requested for VS, but never seem to be high enough priority to implement in the CLR. Perhaps go upvote it here:
http://connect.microsoft.com/VisualStudio/feedback/details/333647/data-breakpoints-in-managed-code