This is a mirror of official site: http://jasper-net.blogspot.com/

Windbg: Finding a specific instance of a managed object in a windows process

| Tuesday, August 16, 2011
Todays post is a small detour from the regular Exchange related posts. The other day I was troubleshooting an issue with a program. It did not behave as expected in production and so I fired up WinDbg to inspect the value of some objects. I attached WindDbg to the process in question and load psscor4, a replacement from Microsoft for the standard SOS extension (Note that if you want to use psscor, you need the right version: Psscor2 is for .NET 2.0-3.5 software. Psscor4 is only for .NET 4 programs). The WinDbg results I present in this article are not from the process I actually examined. I hacked together a small sample program instead.

The sample class creates instances of a class named Person. A Person class has two properties: A name (string) and an age (int). The object instance I’m looking for is named Mallory. The goal is to get a look at the object instance with a call to !DumpObj. So all I need is the memory address of the Person instance named Alice. This should be easy.

So here we go. First, load the SOS extension. Since I ‘m examining an x64 process, I ‘m using the X64 version of psscor.

.load C:\temp\Psscor4\amd64\amd64\psscor4.dll

The first thing to do is to get an overview about the target class. How many instances of the Person class are currently lying around? A call to Dumpheap reveals this:

0:007> !dumpheap -type Person -stat
Loading the heap objects into our cache.
total 21 objects
Statistics:
              MT    Count    TotalSize       Change Class Name
000007ff000242b0        1           40            1 System.Collections.Generic.List`1[[DebugTest.Person, DebugTest]]
000007ff00024220       20          640           20 DebugTest.Person

So, we have one list of Person objects: List<Person> and 20 instances of the Person class itself. Since there are only 20 of them, let’s just dump them to the console:

Total 21 objects, Total size: 680
0:007> !dumpheap -type Person
Loading the heap objects into our cache.
         Address               MT     Size
00000000027f2588 000007ff000242b0       40    0 System.Collections.Generic.List`1[[DebugTest.Person, DebugTest]]
00000000027f2588 000007ff000242b0       40    
00000000027f25d0 000007ff00024220       32    0 DebugTest.Person
00000000027f25d0 000007ff00024220       32    
00000000027f2630 000007ff00024220       32    0 DebugTest.Person
00000000027f2630 000007ff00024220       32    
00000000027f2650 000007ff00024220       32    0 DebugTest.Person

Read more: InfiniTec - Henning Krauses Blog
QR: Windbg-Finding-a-specific-instance-of-a-managed-object-in-a-windows-process.aspx

Posted via email from Jasper-net

11 comments:

Anonymous said...

It does appear, however, that hypnosis can help a person achieve his or her
weight loss goals. Authorities inside the area will
need to have an intensive understanding of laboratory and
labeling techniques, infection security precautions, appropriate blood attract approaches to the elderly and for infants
and even more. Many people don't have the time to weight themselves every day, but checking the scale on a regular basis can definitely help when you're working to lose weight and keep it off.


Also visit my homepage ... visit the up coming article

Anonymous said...

Too many folks have already thrown away plenty of good money on nothing but useless salt tablets
being shipped from South America. In fact, I always suggest to those
overweight vegetarians to keep to a max of 4 pounds a week so
you won't suffer loose skin post weight loss. Then leave it a while until your tummy lets you know that you're
hungry again before opting for a healthy snack.

Here is my web site :: Read the Full Posting

Anonymous said...

For any kind of luxury item of consumption, MAD (Money, Authority and Desire) is required.
Often, long term schedules with a bit of breathing room work best.
Another radio commercial production tip to chew on is
to make sure the audio quality is excellent on any spot your produce.


Check out my web page http://alaskatourscom.blogspot.de/2006/12/dining-in-alaska-best-food-and-drink-in_22.html

Anonymous said...

Break your 3 normal main meals into 5 smaller portion
sizes - morning, snack, lunch, snack, dinner. In fact, I always suggest to those overweight vegetarians to keep to a max of 4
pounds a week so you won't suffer loose skin post weight loss. That way, the actual process will end up being much less frustrating and, for the majority of people, enjoyable.

my website :: Click At this website ()

Anonymous said...

The internet is fueling the success of music because it can be listened to at any time of the day and
anywhere in the world. Much of your best players marketplaces in the united states are supervised.
These channels offer a variety of genres for the user.

My web-site :: windows internet radio stations - -

Anonymous said...

That's like Houston Texas being without a Country station. So your personal, non-commercial, watercraft is exempt from a licensing requirement. What s more is that 2G phones can come in a tinier and slimmer package, even its batteries.

Feel free to surf to my web-site :: tube radio kit new **

Anonymous said...

Sure, there is a mixture of art in everything that people do and say,
but what exactly do I mean. This side slider enables quick typing of the text, probably to mail or type some important information for future
use. Apart from that, this special type of radio entertainment
tool has got immense popularity because of its capability to
bring, news, discussions on recent events, arguments,
comedies, sports updates an d several other forms of programs to enthrall their listeners with varied interest.



My webpage ... internetradio aufnehmen :: :
:

Anonymous said...

Try simple games and check how your internet connection is
and then move on play more games. Aside from the obvious difficulties of pitching so brilliantly in such a high pressure situation, Larsen's feat is even more impressive when one considers that the Dodgers had four future Hall of Famers in their lineup: Duke Snider, Jackie Robinson, Roy Campanella and Pee Wee Reese. Harry Potter Hogwarts is one more entry into this new series of LEGO board games.

Here is my homepage mouse click the up coming web site

Anonymous said...

I have interviewed a few parents to attempt to understand what their true objection is with their child playing video games.
It is an adventurous game filled with fun and excitement.

The nature of Reddit's platform makes it possible -- through great and creative effort, it appears -- to give users a gift of the unexpected, rather than deriving humor from humiliation.

Here is my blog post - Www Hotmail Com Br

Anonymous said...

They want to win by playing their very best as opposed to winning by putting the other person off.
If you are unable to sign in to Game Center or are having problems staying connected:.
In addition, you can save the effort of coding the store functionality,
virtual goods dependencies, billing interfaces and rewards.


Feel free to surf to my homepage - android game apps []

Anonymous said...

Dominion: Intrigue is a standalone expansion for the award-winning Dominion
card game that shook the gaming world in 2008.
Leveling up to defeat all the enemies can be time arresting so apprehend to absorb a acceptable bulk of hours anniversary day
accepting the a lot of out of this game. It sounds like you log into the game and join a "Shadow war"
server and play with hundreds of other players within
that PVP world, but that world is different from the cooperative Arkfall boss hunting world.


Here is my webpage - click through the following page