Saturday, 07 March 2009
« Hall of Shame - | Main | SOSEX v4.0 Now Available »

At long last, I’m pleased to announce the availability of SOSEX version 2.0.  This is a major overhaul of the extension that optimizes and enhances existing functionality, adds many new features, and changes the command naming scheme to be more like the built-in debugger engine commands.  I’ve added support for many of the staple debugger commands by implementing similar functionality and prefixing the commands with “m” (managed).  Included are: mbp, mbm, mbl, mbc, mbe, mbd, mdt, mdv, mframe, mk, mln and mx.

Here’s a quick overview of new things you can do with SOSEX v2:

  • Search the heaps for FREE objects by using the new “-free” switch to the “dumpgen” command.  This helps in diagnosing managed heap fragmentation
  • Search the heaps for string objects using the new “strings” command.  You can search for strings matching criteria including min length, max length, gen # and string filter
  • Specify one-shot, pass count and command for all your managed breakpoints using new breakpoint options
  • Set breakpoints on methods that match a wildcard search pattern
  • See your full callstack, managed and unmanaged frames, with the “mk” command.  This isn’t straightforward to do with the “clrstack” and “k” commands
  • Find type, method and field names in managed assemblies using the “mx” command
  • Find out what type of managed data, if any, is located at a given address with the “mln”

Be sure to check out “help” or “sosexhelp” for all commands to ensure you’re aware of all the new goodies.  Stay tuned in the coming days and weeks, as I’ll be posting articles that dive into each individual command in detail.  To start with, though, I’d like to provide an overview of my personal favorite new feature: the “mdt” (Managed Display Type) command.

!mdt allows you to dump the fields of a given type by type name or to examine the fields of an object or value type instance.  Not only can you examine the fields of an object or value type instance, but you can also examine an entire object graph by specifying the “-r” (recursive) switch.  Want to examine a local variable or argument?  No problem.  Just enter “!mdt <Var Name>”, and voila!  The best way to demonstrate the power of this command is with a few examples.

0:000> !mdt System.DateTime 003bef0c
003bef0c (System.DateTime) 2008/01/02 03:04:05.678 VALTYPE (MT=65cd9e98, ADDR=003bef0c)

0:000> !mdt theGuid
003bef1c (System.Guid) {29b9c9c8-3751-42be-8c7a-8b92ff499588} VALTYPE (MT=65cd6c60, ADDR=003bef1c)

0:000> !mdt ConsoleTestApp.TestStruct
   Member1: uint
   Member2: uint

0:000> !mdt ConsoleTestApp.TestStruct 003bef04
003bef04 (ConsoleTestApp.TestStruct) VALTYPE (MT=001b3198, ADDR=003bef04)
   Member1:0x162E (System.UInt32)
   Member2:0x451434E0 (System.UInt32)

0:000> !mdt 6487ce0
06487ce0 (System.Runtime.Remoting.Proxies.__TransparentProxy)
   _rp:06487cb4 (System.Runtime.Remoting.Proxies.RemotingProxy)
   _stubData:06482a5c (BOXED System.IntPtr) VALTYPE (MT=65cfb114, ADDR=06482a60)
   _pMT:65cf902c (System.IntPtr)
   _pInterfaceMT:00000000 (System.IntPtr)
   _stub:68c71e70 (System.IntPtr)

0:000> !mdt 6487ce0 -r
06487ce0 (System.Runtime.Remoting.Proxies.__TransparentProxy)
   _rp:06487cb4 (System.Runtime.Remoting.Proxies.RemotingProxy)
      _tp:06487ce0 (System.Runtime.Remoting.Proxies.__TransparentProxy)
      _identity:06487a98 (System.Runtime.Remoting.Identity)
         _flags:0x4 (System.Int32)
         _tpOrObject:06487ce0 (System.Runtime.Remoting.Proxies.__TransparentProxy)
         _ObjURI:06484c88 (System.String: "/49cf1154_ea17_4f51_b666_8f91a1263a00/0um3p4he0mnsfugppw1z7gkd_1.rem")
         _URL:NULL (System.String)
         _objRef:06484e10 (System.Runtime.Remoting.ObjRef)
            uri:06484c88 (System.String: "/49cf1154_ea17_4f51_b666_8f91a1263a00/0um3p4he0mnsfugppw1z7gkd_1.rem")
            typeInfo:064850f4 (System.Runtime.Remoting.TypeInfo)
               serverType:064862d4 (System.String: "System.AppDomain, mscorlib, Version=, Culture=neutral…
               serverHierarchy:NULL (System.Object[])
               interfacesImplemented:064864bc (System.String[], Elements: 2)
            envoyInfo:NULL (System.Runtime.Remoting.IEnvoyInfo)
            channelInfo:06486b5c (System.Runtime.Remoting.ChannelInfo)
               channelData:06486b68 (System.Object[], Elements: 1)
            objrefFlags:0x0 (System.Int32)
            srvIdentity:06484e2c (System.Runtime.InteropServices.GCHandle) VALTYPE (MT=65cfbcb8, ADDR=06484e2c)
               m_handle:007e11ec (System.IntPtr)
            domainID:0x2 (System.Int32)
         _channelSink:06487c90 (System.Runtime.Remoting.Channels.CrossAppDomainSink)
            _xadData:06483834 (System.Runtime.Remoting.Channels.CrossAppDomainData)
               _ContextID:06483854 (BOXED System.Int32) BOXEDVAL=0x87C330
               _DomainID:0x2 (System.Int32)
               _processGuid:06483530 (System.String: "88866410_d263_4d8a_b901_8278132285be")
         _envoyChain:06487ca8 (System.Runtime.Remoting.Messaging.EnvoyTerminatorSink)
         _dph:NULL (System.Runtime.Remoting.Contexts.DynamicPropertyHolder)
         _lease:NULL (System.Runtime.Remoting.Lifetime.Lease)
      _serverObject:NULL (System.MarshalByRefObject)
      _flags:0x3 (System.Runtime.Remoting.Proxies.RealProxyFlags)
      _srvIdentity:06487cd0 (System.Runtime.InteropServices.GCHandle) VALTYPE (MT=65cfbcb8, ADDR=06487cd0)
         m_handle:007e11ec (System.IntPtr)
      _optFlags:0x7000000 (System.Int32)
      _domainID:0x2 (System.Int32)
      _ccm:NULL (System.Runtime.Remoting.Messaging.ConstructorCallMessage)
      _ctorThread:0x0 (System.Int32)
   _stubData:06482a5c (BOXED System.IntPtr) VALTYPE (MT=65cfb114, ADDR=06482a60)
      m_value:ffffffff (System.UIntPtr)
   _pMT:65cf902c (System.IntPtr)
   _pInterfaceMT:00000000 (System.IntPtr)
   _stub:68c71e70 (System.IntPtr)

I hope you enjoy using SOSEX v2.0 as much as I’ve enjoyed writing it!

Download: 32-bit  64-bit

Sunday, 08 March 2009 20:02:40 (GMT Standard Time, UTC+00:00)
I can't even begin to express how cool this is. Thank you for your hard work!
Monday, 09 March 2009 14:43:06 (GMT Standard Time, UTC+00:00)
Holy shit. This is so cool!
Gregory Suvalian
Thursday, 09 April 2009 12:28:14 (GMT Standard Time, UTC+00:00)
Hey Steve,
This is very cool. We all appreciate the great work you are doing here.
Have you considered opening the source for this, as an example to the community?
I don't think there are very many public WinDBG extensions available, especially of this quality.

Saturday, 11 April 2009 21:36:51 (GMT Standard Time, UTC+00:00)
Hi Sean,

Unfortunately, the source needs to stay closed. There are several reasons for this - some personal, some legal. The best route for me to go is to keep it a free, yet closed-source utility. Sorry about that.

Steve Johnson
Tuesday, 21 April 2009 06:53:15 (GMT Standard Time, UTC+00:00)
Wednesday, 06 May 2009 01:34:31 (GMT Standard Time, UTC+00:00)
Hi Steve,

Your SOSEX dll is so cool, I have a question, given an Method Address how can I get the address of the Method Name in unicode format?, this is because I would like to use as .printf

Tuesday, 12 May 2009 19:06:52 (GMT Standard Time, UTC+00:00)
Hi Steve,
I can't seem to figure out how to pass command to mbm. For example, after I set a break point with command !mbm module!namespace.class.method "!mk;g"

The break point just breaks and doesn't execute command "!mk;g". Using bl, I don't see the command were specified for the breakpoint either.

Just wonder if you could give an example on how to specify command for mbm.

Thanks a lot!

Wednesday, 13 May 2009 00:00:52 (GMT Standard Time, UTC+00:00)
Thanks for the report, YZ. This may be a good old fashioned bug. I'll look into it.
Steve Johnson
Wednesday, 20 May 2009 10:13:33 (GMT Standard Time, UTC+00:00)
Hi Steve,
Your work help me a lot when debug dotnet 2.0 application.
Thank you for your hard work!
But I have trouble to make it work when debugging dotnet 1.1 application.
(Because mscordacwks.dll released with dotnet 2.0..??)
Any suggestion?

Saturday, 23 May 2009 05:59:08 (GMT Standard Time, UTC+00:00)
Sorry. Marriage is the only adventure open to the cowardly. Help me! Help to find sites on the: Turbo Tax. I found only this - <a href="">turbo tax</a>. Alcohol treatment, cocaine rehab centers for all over the united states. Seattle alcohol and drug treatment recovery center. Best regards :-(, Flo from Azerbaijan.
Wednesday, 27 May 2009 12:53:40 (GMT Standard Time, UTC+00:00)
I have this issue with command !dumpgen 0 at my dump :
14213fb8 11744 System.String STRVAL=e06d7363 Exception in C:\Debugging\dbgnetfx\sosex_32\sosex.dll.dumpgen debugger extension.
PC: 7c812a5b VA: 00feaff0 R/W: 19930520 Parameter: 62335464

sosex.dll verion

Any help ?

Sunday, 31 May 2009 10:48:02 (GMT Standard Time, UTC+00:00)
scott_wu: Sorry, SOSEX only supports .NET 2.0-3.5
Steve Johnson
Tuesday, 04 August 2009 16:49:27 (GMT Standard Time, UTC+00:00)
This is a great tool, thanks so much. Can mdt display a static class variable? I can't figure out how to do that.
Tuesday, 11 August 2009 14:52:52 (GMT Standard Time, UTC+00:00)
Spiffy, yes, mdt can do that. Just do "!mdt TypeName". This will display a list of all the fields of the class and will list the values for static fields.
Steve Johnson
Thursday, 08 October 2009 17:11:52 (GMT Standard Time, UTC+00:00)
Hi Steve;

Thanks for your contributions. I'm trying to figure out how I can get the same output as !dumpfield but against 2.x assemblies using the public version of SOS with the SOSEX v2. In troubleshooting ASP.NET applications, likely the most common scenario is searching for large DataTables which is predicated on something like this:

.foreach(m_table {!dumpheap -type System.Data.DataTable -short})
.foreach (m_Count {!dumpfield -field nextRowID m_table})
.if( ${m_Count} > 1000)

Do any of your extensions help with this?
Monday, 14 December 2009 11:02:16 (GMT Standard Time, UTC+00:00)
Hi Steve,

Thanks a lot for the extension. Really great.

For the DumpGen command, is it possible to possible to include a switch to sort on particular order (say on total no of objects, or total size or object type). It would be really helpfull to have such switch.

I appreciate the effort you have put in for this extension and respect your decision to not disclose the source. However, is there a possibility that you can point me to the resource(s) how to write extensions. I have been trying to write one but struggling with it.

Monday, 04 January 2010 09:54:11 (GMT Standard Time, UTC+00:00)
Dear Steve,

I have the following issue:
WinDbg stopped at a managed exception. Using !pe displays the exception. !clrstack works fine, but I'd like to have the unmanaged parts as well.
However, !mk does not work at this point and stops with the following message: IXCLRDataStackWalk::Next failed. Error = 0x8007001e

Thank you for !mk, thank you for SOSEX. It helps me a lot.

Friday, 12 February 2010 18:13:49 (GMT Standard Time, UTC+00:00)
Hi Steve

I posted my question in another post of yours by accident. I meant to ask it here.

I know you say your SOSEX tool is "free". But does that mean that I don't need to get a license from you to use it? Are there any other legal hurdles we need to go through?

Monday, 15 March 2010 21:51:00 (GMT Standard Time, UTC+00:00)
Do you have a managed equivalent for .bpcmds ?
Wednesday, 31 March 2010 07:47:40 (GMT Standard Time, UTC+00:00)
Steve, thanks a lot for your effort!
I'm joining Christian Benien's question (,guid,9fdcf4a4-6e09-4807-bc31-ac1adf836f6c.aspx#3): is this SOSEX release accessible from VS?

Thursday, 01 April 2010 20:17:48 (GMT Standard Time, UTC+00:00)
@Ofek - I've not tried it.

@Matthew - No I do not, but it's a good idea. Possibly in the future.
Steve Johnson
Comments are closed.