This pointer trap of windbg

Source: Internet
Author: User
This pointer trap of windbg

When you enter the class member function, this pointer does not immediately point to the object address. When you use this to set a memory breakpoint, this is a huge trap. The following class constructor is used as an example to analyze the assembly code in debug.

CPP source code is as follows:

Class node {public: node (); int data ;}; node: node () {int A = 10; A = (INT) This ;} void main () {node N; N. data = 100 ;}

The node n address is passed into the constructor through ECx:


After entering node: node, this value is not equal to ECx, view the address of this, found its address is just esp-0ch (before executing push EBP), and is fixed, in the debug version, this point is universal.


The subsequent code will affect this twice:

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.