Setting conditional breakpoints using object ids)

Source: Internet
Author: User
Original article: http://blogs.msdn.com/greggm/archive/2007/01/17/setting-conditional-breakpoints-using-object-ids.aspx

In local code, it is very useful to set an interruption condition that is the breakpoint of an instance of a specified object, so that the program can only be interrupted on a specified object instance. To achieve this effect, you can directly determine through the object address:

This = (CMyObject *) 0x10fc10

In managed code, the garbage collector (GC) moves object instances. Even if you use a language that strongly supports pointers, setting such a conditional breakpoint is futile. The alternative is to use object ids ).

Step 1: Create an object ID. To identify an object, you need to find the object instance you want to identify and put it in the monitoring window (watch window), right-click the object instance, run Make Object ID on the pop-up menu. In this way, '{1 #}' is available in the invigilator #}':

+ This {cswin. Form1, Text: Form1}{1 #}Cswin. Form1

Here, '1 # 'indicates that this object is the first identified object, and the ID of the next identified object will increase progressively (2 #, 3 #, etc ). there are articles on object identification in MSDN.

Step 2: set the condition breakpoint. In the breakpoint window, right-click the "condition breakpoint" menu and set the condition, for example:

This = 1 #

Happy debugging.

Published Wednesday, January 17,200 7 PM by greggm
Translated by Winking Zhang.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.