how to set data breakpoint? 
Author Message
 how to set data breakpoint?

Hi!

This may sound like a beginner question, which is not far from the truth,
anyway. I need to set a breakpoint on a memory address, to see who is
modifying the value. More specific, it is the VTable pointer for an object I
have, but I think it should work alike for any "data breakpoint", that is,
to stop the execution when a memory location changes content.

This shouldn't be too difficult, but trying what I found in MSDN lead to an
incredibly slow run, and a very silent crash (both VC and MSDN dissapeared!)

Thank you for any idea!
iuli



Sat, 21 Feb 2004 17:46:12 GMT  
 how to set data breakpoint?
The answer that you think you want (how to set a data breakpoint)
can be found at this page:

http://www.highprogrammer.com/alan/visualstudio.html

However what you *really* want to know is, who is modifying my
vtable pointer. I'll give you two-to-one odds that it is the compiler
that is modifying it and that it is *supposed* to be modifying it. When
you use virtual functions and have inherited classes the C++
standard *requires* that the compiler adjust the vtable pointer at
the beginning of each constructor and destructor so that it points to
a vtable appropriate for the current object type, not the most derived
object type.

In other words, if you call a virtual function in a constructor or destructor
(directly or indirectly) it will not call virtual functions that are overridden
in derived classes. And, if you think about it, you'll realize that that is
right and proper.

Of course I might be wrong about why you need data breakpoints -
let me know.

Quote:

> Hi!

> This may sound like a beginner question, which is not far from the truth,
> anyway. I need to set a breakpoint on a memory address, to see who is
> modifying the value. More specific, it is the VTable pointer for an object I
> have, but I think it should work alike for any "data breakpoint", that is,
> to stop the execution when a memory location changes content.

> This shouldn't be too difficult, but trying what I found in MSDN lead to an
> incredibly slow run, and a very silent crash (both VC and MSDN dissapeared!)

> Thank you for any idea!
> iuli



Sun, 22 Feb 2004 11:59:30 GMT  
 how to set data breakpoint?
Hi!

Thanks for your reply. Finally the problem was solved after a few hours. It
was a linking problem :). I was using a DLL with the wrong headers (too
new!). Anyway, the vtable pointer was valid in the constructor, then, in the
second call to the object, it was NULL. That showed up in an ASSERT_VALID,
although if I ignored the assert, the program was running smooth (of course,
there weren't any virtual methods called!).

Thanks again.
iuli


Quote:
> The answer that you think you want (how to set a data breakpoint)
> can be found at this page:

> http://www.highprogrammer.com/alan/visualstudio.html

> However what you *really* want to know is, who is modifying my
> vtable pointer. I'll give you two-to-one odds that it is the compiler
> that is modifying it and that it is *supposed* to be modifying it. When
> you use virtual functions and have inherited classes the C++
> standard *requires* that the compiler adjust the vtable pointer at
> the beginning of each constructor and destructor so that it points to
> a vtable appropriate for the current object type, not the most derived
> object type.

> In other words, if you call a virtual function in a constructor or
destructor
> (directly or indirectly) it will not call virtual functions that are
overridden
> in derived classes. And, if you think about it, you'll realize that that
is
> right and proper.

> Of course I might be wrong about why you need data breakpoints -
> let me know.



Sun, 22 Feb 2004 23:03:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Can't Set breakpoint in C++ DLL

2. Setting a breakpoint in a DLL loaded with LoadLibrary

3. Hotw-To set Conditional Breakpoints with function expressions

4. How to set breakpoint on thread start/end

5. How to set a memory breakpoint

6. Setting breakpoint when register equals certain value

7. Setting a breakpoint on a memory location

8. How to set a breakpoint on memory location?

9. Need help setting DLL breakpoints

10. Can't set breakpoint in DLL

11. Programically Setting Breakpoints

12. Any way to set conditional breakpoint?

 

 
Powered by phpBB® Forum Software