I've been trying to use programmatic data breakpoints, à la the [`CBreakpoint`](http://www.morearty.com/code/breakpoint/) example, by using [`SetThreadContext`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms680632.aspx) to set the debug register directly. Most references that I can find indicate the Visual Studio will still break whenever it encounters a data breakpoint, even if it didn't set that data breakpoint itself. However, this doesn't appear to be how Visual Studio 2010 works.

I'm in a situation where my data breakpoint works perfectly when the program is not being debugged (it crashes with `STATUS_SINGLE_STEP`, which is the exception raised by a data breakpoint). It also breaks properly if I'm debugging with WinDbg. But when debugging it under either Visual Studio 2010, it seems to just keep trucking and ignore the breakpoint. Does anyone have any experience with using a programmatically-set data breakpoint under Visual Studio 2010, under Windows 7? Is there something that I need to do to it them to break? (I tried adding `STATUS_SINGLE_STEP` to the 'first-chance exceptions' list, with no change in behavior.)

Alternately, is there anything that I might be doing to swallow the `STATUS_SINGLE_STEP` exception in the debugger? Would a structured exception handler eat the exception before the debugger can see it? Is anything affected by the fact that this is a x86\_64 program? Is there some dance I need to do in the Visual Studio 2010 settings?