什么是数据断点? [英] What are data breakpoints?

查看:405
本文介绍了什么是数据断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现有个数据断点。我使用Visual Studio在C ++中工作了5年,我从来没有使用过数据断点。



有人可以告诉我们什么是数据断点,使用它们和如何使用它们与VS?



根据我的理解,我们可以设置一个数据断点,当我们要检查更改变量的值。



任何其他示例?

解决方案

定义:


数据断点允许您在
执行时存储在
指定的内存位置更改。


从MSDN:如何:设置数据断点



如何设置内存更改断点


  1. 从调试菜单中选择新建断点并在断点窗口菜单中点击新数据断点



    - 或 -



    ,然后点击新建下拉菜单


  2. 在地址框中,输入新的数据断点。评估为存储器地址的存储器地址或表达式。例如,& foo在变量foo的内容发生变化时中断。


  3. 在字节数框中,输入您希望调试器的字节数看。例如,如果输入4,调试器将观察从& foo开始的四个字节,如果这些字节中的任何字节更改值,则调试器将中断。




I just came to know that there are data breakpoints. I have worked for the last 5 years in C++ using Visual Studio, and I have never used data breakpoints.

Can someone throw some light on what data breakpoints are, when to use them and how to use them with VS?

As per my understanding we can set a data breakpoint when we want to check for changes to a variable's value. In this case, we can set a data breakpoint with a condition on the variable value.

Any other examples?

解决方案

Definition:

Data breakpoints allow you to break execution when the value stored at a specified memory location changes.

From MSDN: How to: Set a Data Breakpoint:

How to Set a Memory Change Breakpoint

  1. From the Debug Menu, choose New Breakpoint and click New Data Breakpoint

    —or—

    in the Breakpoints window Menu, click the New dropdown and choose New Data Breakpoint.

    The New Breakpoint dialog box appears.

  2. In the Address box, enter a memory address or expression that evaluates to a memory address. For example, &foo to break when the contents of variable foo change.

  3. In the Byte Count box, enter the number of bytes you want the debugger to watch. For example, if you enter 4, the debugger will watch the four bytes starting at &foo and break if any of those bytes change value.

  4. Click OK.

这篇关于什么是数据断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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