How to Watch this Pointer – The Wizards Way!

30 07 2009

How to watch the this pointer? Just add ‘this’ to watch window. Everyone does like that. Isn’t it? But how Visual C++ wizards watch ‘this’ pointer? šŸ˜‰


The secret is, visual C++ compiler passes this pointer via ECX register. So add (ClassName*)(@ECX) to watch window will give you this pointer. Have a look at the screenshot.


Interesting, the internals of Visual C++. Isn’t it?

Targeted Audiance – Intermediate.



6 responses

10 08 2009

Another way open the C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat file and put those string inside.

27 08 2009
Buy Spy Clock

Wow, cool site. Thanks for posting. Really like reading sites like this.

28 08 2009
Brass Knuckles Pendant

Excellent observations and you have a great way of expressing things. Thanks for this.

10 09 2009

No posts after July? Where are you?

6 12 2009

What about adding ‘this’ into watch window?
It works as well šŸ™‚

9 12 2009

Hi Glaz,

Thanks for the comment. The intention of this article is about – how ‘this’ pointer is passed underneath.

A candle can be lighted by using a magic wand or by using a matchbox. Using matchbox is easy but magic wand need skills. šŸ™‚

Best Regards,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: