Mickey Shine
Mickey Shine

Reputation: 12539

How to set breakpoints programmatically in Visual C++?

What I am trying to do is to monitor memory value changes at some specific addresses, like binding a callback func to the 'onChange' event.

One idea for now that I can think up is to use memory write breakpoint. So how to manipulate breakpoints programmatically in Visual C++?

Upvotes: 7

Views: 9320

Answers (4)

ulatekh
ulatekh

Reputation: 1490

I've had great success with the hwbrk project.

Upvotes: 1

You can also place in your code:

__asm { int 3 }

If you are running under the VS debugger, that will invoke the breakpoint handler.

UPDATE: Actually it is the same than using the MSVC instrinsic __debugbreak (http://msdn.microsoft.com/en-us/library/f408b4et.aspx)

Upvotes: 1

Edward Clements
Edward Clements

Reputation: 5132

If you need to break into the debugger, use the DebugBreak function, if necessary under a #ifdef _DEBUG #endif block

Upvotes: 6

Saqlain
Saqlain

Reputation: 17918

Microsoft do provide a breakpoint interface which can be used for this purpose, have a look at http://msdn.microsoft.com/en-us/library/vstudio/envdte.breakpoint.aspx and http://msdn.microsoft.com/en-us/library/envdte80.breakpoint2(v=vs.80).aspx

Upvotes: 3

Related Questions