locked
adding a watchpoint (breaking when a variable changes) RRS feed

  • Question

  • How is it possible to add a watchpoint in Visual Studio. A watchpoint is basically a conditional breakpoint that is _not tied to a codeline_. What I want to be able to do is to break whenever someone changes a particluar variable.

    There seems to be two options:

        "Watch" a variable and see for myself if/when it ever changes. This is slow, and doesn't really
        work if you're debugging event/time critical bugs.

        Debug->New Breakpoint->New Data Breakpoint. This seems to be what I want, but the
         menu option is always disabled (even when the debugger is running).

    So how do I do it? (I'm using Visual Studio 2005 Professional Edition)

    espen
    Monday, December 11, 2006 10:47 AM

Answers

  • Run your application under debugger.

    Then Debug>Winows>Breakpoints

    In Breakpoint Pain press New with down arrow.

    Select a start address of data block and amount of memory to watch.

    It works only if you call from Breakpoints Panel under debugger.

     

    Monday, December 11, 2006 6:57 PM

All replies

  • Run your application under debugger.

    Then Debug>Winows>Breakpoints

    In Breakpoint Pain press New with down arrow.

    Select a start address of data block and amount of memory to watch.

    It works only if you call from Breakpoints Panel under debugger.

     

    Monday, December 11, 2006 6:57 PM
  • I guess you mean the Breakpoint Pane/Panel? I tried this but it still doesn't work - here too the option "New data breakpoint" is disabled and the debugger is running.

    I did not mention, but I am actually making Windows Mobile (5.0) C++ applications. This could very likely be the reason for this option to always be disabled. Watchpoints might not be supported for that platform?

    Thanks for the help anyways.
    Tuesday, December 12, 2006 11:05 AM
  • Yes its panel.

    May be its true. For Windows Mobile it doesn't work. I did not check it for this platform.

    Tuesday, December 12, 2006 11:22 AM