Visual studio debug - set a condition on a particular variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leejwen
    New Member
    • Jun 2007
    • 50

    Visual studio debug - set a condition on a particular variable

    I'm using VS 2005 under WINDOWS to debug a piece of code. Can I set a breakpoint based on a variable's value. For example, I have a variable IFC. I want to find out where IFC is set to 5.

    Another question: could somebody tell me where I can find a best tutorial about how to use Visual Studio debug.
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    Set the breakpoint, then in breakpoints window, in right-click context menu, 'condition' item.

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      You can set a watch expression. That is you can watch a variable and have the program breaks without setting a break point in code.

      However that generally makes things run very slowly in deed because the debugger has to check the variable value after every instruction. If you can use a break point with a condition set on it.

      Comment

      • leejwen
        New Member
        • Jun 2007
        • 50

        #4
        Sorry for the confusion. Actually, I want the debug to be stopped automatically where the variable IFC=5, for example. Is it possible to set a condition? This program is huge with lots functions while IFC is a global variable. :-)

        Many thanks

        Comment

        Working...