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? šŸ˜‰

thiswizardway


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.

thiswizardway2


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


Targeted Audiance – Intermediate.

Advertisements

Actions

Information

6 responses

10 08 2009
Marko

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
rageshctech

No posts after July? Where are you?

6 12 2009
GLaz

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

9 12 2009
Jijo.Raj

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,
Jijo.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s




%d bloggers like this: