ClrStack
clrstack=ClrStack
CLRStack=ClrStack
+ DumpALC
+ dumpalc=DumpALC
DumpArray
da=DumpArray
dumparray=DumpArray
bpmd
ClrStack
dbgout
+DumpALC
DumpArray
DumpAssembly
DumpAsync
Object Inspection Examining code and stacks
----------------------------- -----------------------------
DumpObj (do) Threads (clrthreads)
-DumpArray (da) ThreadState
-DumpAsync IP2MD
-DumpDelegate U
-DumpStackObjects (dso) DumpStack
-DumpHeap EEStack
-DumpVC ClrStack
-GCRoot GCInfo
-ObjSize EHInfo
-FinalizeQueue BPMD (bpmd)
-PrintException (pe) COMState
+DumpALC (dumpalc) ThreadState
+DumpArray (da) IP2MD
+DumpAsync U
+DumpDelegate DumpStack
+DumpStackObjects (dso) EEStack
+DumpHeap ClrStack
+DumpVC GCInfo
+GCRoot EHInfo
+ObjSize BPMD (bpmd)
+FinalizeQueue COMState
+PrintException (pe)
TraverseHeap
Examining CLR data structures Diagnostic Utilities
\\
+COMMAND: dumpalc.
+DumpALC
+ <object address>
+
+This command allows you to dump the AssemblyLoadContext into which the type of the
+specified object was loaded.
+
+ Example output:
+ 0:000> !dumpalc 000001c2800101a0
+ Name: Host.HostAssemblyLoadContext
+ MethodTable: 00007ff7c9cb1428
+ EEClass: 00007ff7c9ca4b40
+ Size: 88(0x58) bytes
+ File: c:\test\host.dll
+ Fields:
+ MT Field Offset Type VT Attr Value Name
+ 00007ff7c9920eb8 4000ea3 8 System.Object 0 instance 000001c28000cff0 _unloadLock
+ 0000000000000000 4000ea4 10 0 instance 0000000000000000 _resolvingUnmanagedDll
+ 0000000000000000 4000ea5 18 0 instance 0000000000000000 _resolving
+ 00007ff7c9d36850 4000ea6 20 ...Private.CoreLib]] 0 instance 000001c2800101b8 _unloading
+ 00007ff7c9a74748 4000ea7 28 System.String 0 instance 0000000000000000 _name
+ 00007ff7c9a427f0 4000ea8 30 System.IntPtr 1 instance 000001C2FA21DD50 _nativeAssemblyLoadContext
+ 00007ff7c9a1c7e0 4000ea9 38 System.Int64 1 instance 0 _id
+ 00007ff7c9ac57b8 4000eaa 40 System.Int32 1 instance 0 _state
+ 00007ff7c9a107b8 4000eab 44 System.Boolean 1 instance 1 _isCollectible
+ 00007ff7c9cb4070 4000ea1 b08 ...Private.CoreLib]] 0 static 000001c28000d090 s_allContexts
+ 00007ff7c9a1c7e0 4000ea2 970 System.Int64 1 static 1 s_nextId
+ 0000000000000000 4000eac b10 ...yLoadEventHandler 0 static 0000000000000000 AssemblyLoad
+ 0000000000000000 4000ead b18 ...solveEventHandler 0 static 0000000000000000 TypeResolve
+ 0000000000000000 4000eae b20 ...solveEventHandler 0 static 0000000000000000 ResourceResolve
+ 0000000000000000 4000eaf b28 ...solveEventHandler 0 static 0000000000000000 AssemblyResolve
+ 0000000000000000 4000eb0 b30 0 static 0000000000000000 s_asyncLocalCurrent
+ 00007ff7c9cb26d0 4000001 48 ...ependencyResolver 0 instance 000001c28000d1c0 _resolver
+
+\\
+
COMMAND: dumpasync.
!DumpAsync [-addr <Object Address>]
[-mt <MethodTable address>]
Object Inspection Examining code and stacks
----------------------------- -----------------------------
DumpObj (dumpobj) Threads (clrthreads)
-DumpArray ThreadState
-DumpAsync (dumpasync) IP2MD (ip2md)
-DumpDelegate (dumpdelegate) u (clru)
-DumpStackObjects (dso) DumpStack (dumpstack)
-DumpHeap (dumpheap) EEStack (eestack)
-DumpVC ClrStack (clrstack)
-FinalizeQueue (finalizequeue) GCInfo
-GCRoot (gcroot) EHInfo
-PrintException (pe) bpmd (bpmd)
+DumpALC (dumpalc) ThreadState
+DumpArray IP2MD (ip2md)
+DumpAsync (dumpasync) u (clru)
+DumpDelegate (dumpdelegate) DumpStack (dumpstack)
+DumpStackObjects (dso) EEStack (eestack)
+DumpHeap (dumpheap) ClrStack (clrstack)
+DumpVC GCInfo
+FinalizeQueue (finalizequeue) EHInfo
+GCRoot (gcroot) bpmd (bpmd)
+PrintException (pe)
Examining CLR data structures Diagnostic Utilities
----------------------------- -----------------------------
5b9a628c 4000003 8 System.Int32 instance 12 z
\\
+COMMAND: dumpalc.
+DumpALC
+ <object address>
+
+This command allows you to dump the AssemblyLoadContext into which the type of the
+specified object was loaded.
+
+ Example output:
+ (lldb) dumpalc 000001c2800101a0
+ Name: Host.HostAssemblyLoadContext
+ MethodTable: 00007ff7c9cb1428
+ EEClass: 00007ff7c9ca4b40
+ Size: 88(0x58) bytes
+ File: /home/user/test/host.dll
+ Fields:
+ MT Field Offset Type VT Attr Value Name
+ 00007ff7c9920eb8 4000ea3 8 System.Object 0 instance 000001c28000cff0 _unloadLock
+ 0000000000000000 4000ea4 10 0 instance 0000000000000000 _resolvingUnmanagedDll
+ 0000000000000000 4000ea5 18 0 instance 0000000000000000 _resolving
+ 00007ff7c9d36850 4000ea6 20 ...Private.CoreLib]] 0 instance 000001c2800101b8 _unloading
+ 00007ff7c9a74748 4000ea7 28 System.String 0 instance 0000000000000000 _name
+ 00007ff7c9a427f0 4000ea8 30 System.IntPtr 1 instance 000001C2FA21DD50 _nativeAssemblyLoadContext
+ 00007ff7c9a1c7e0 4000ea9 38 System.Int64 1 instance 0 _id
+ 00007ff7c9ac57b8 4000eaa 40 System.Int32 1 instance 0 _state
+ 00007ff7c9a107b8 4000eab 44 System.Boolean 1 instance 1 _isCollectible
+ 00007ff7c9cb4070 4000ea1 b08 ...Private.CoreLib]] 0 static 000001c28000d090 s_allContexts
+ 00007ff7c9a1c7e0 4000ea2 970 System.Int64 1 static 1 s_nextId
+ 0000000000000000 4000eac b10 ...yLoadEventHandler 0 static 0000000000000000 AssemblyLoad
+ 0000000000000000 4000ead b18 ...solveEventHandler 0 static 0000000000000000 TypeResolve
+ 0000000000000000 4000eae b20 ...solveEventHandler 0 static 0000000000000000 ResourceResolve
+ 0000000000000000 4000eaf b28 ...solveEventHandler 0 static 0000000000000000 AssemblyResolve
+ 0000000000000000 4000eb0 b30 0 static 0000000000000000 s_asyncLocalCurrent
+ 00007ff7c9cb26d0 4000001 48 ...ependencyResolver 0 instance 000001c28000d1c0 _resolver
+
+\\
+
COMMAND: dumpasync.
DumpAsync [-addr <Object Address>]
[-mt <MethodTable address>]
return S_OK;
}
+HRESULT PrintALC(TADDR taObj)
+{
+ if (!sos::IsObject(taObj, true))
+ {
+ ExtOut("<Note: this object has an invalid CLASS field>\n");
+ }
+
+ DacpObjectData objData;
+ HRESULT Status;
+ if ((Status=objData.Request(g_sos, TO_CDADDR(taObj))) != S_OK)
+ {
+ ExtOut("Invalid object\n");
+ return Status;
+ }
+
+ if (objData.ObjectType==OBJ_FREE)
+ {
+ ExtOut("Free Object\n");
+ DWORD_PTR size = (DWORD_PTR)objData.Size;
+ ExtOut("Size: %" POINTERSIZE_TYPE "d(0x%" POINTERSIZE_TYPE "x) bytes\n", size, size);
+ return S_OK;
+ }
+
+ CLRDATA_ADDRESS assemblyLoadContext;
+ ReleaseHolder<ISOSDacInterface8> sos8;
+ if (SUCCEEDED(Status = g_sos->QueryInterface(__uuidof(ISOSDacInterface8), &sos8)))
+ {
+ Status = sos8->GetAssemblyLoadContext(objData.MethodTable, &assemblyLoadContext);
+ }
+
+ if (assemblyLoadContext == NULL)
+ {
+ ExtOut("Name: System.Runtime.Loader.DefaultAssemblyLoadContext\n");
+ ExtOut("The managed instance of this context doesn't exist yet\n");
+ return S_OK;
+ }
+
+ return PrintObj(assemblyLoadContext);
+}
+
BOOL IndicesInRange (DWORD * indices, DWORD * lowerBounds, DWORD * bounds, DWORD rank)
{
int i = 0;
return Status;
}
+/**********************************************************************\
+* Routine Description: *
+* *
+* This function is called to dump the contents of an object from a *
+* given address *
+* *
+\**********************************************************************/
+DECLARE_API(DumpALC)
+{
+ INIT_API();
+
+ MINIDUMP_NOT_SUPPORTED();
+
+ BOOL dml = FALSE;
+ StringHolder str_Object;
+ CMDOption option[] =
+ { // name, vptr, type, hasValue
+#ifndef FEATURE_PAL
+ {"/d", &dml, COBOOL, FALSE},
+#endif
+ };
+ CMDValue arg[] =
+ { // vptr, type
+ {&str_Object.data, COSTRING}
+ };
+ size_t nArg;
+ if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg))
+ {
+ return Status;
+ }
+
+ DWORD_PTR p_Object = GetExpression(str_Object.data);
+ EnableDMLHolder dmlHolder(dml);
+ if (p_Object == 0)
+ {
+ ExtOut("Invalid parameter %s\n", args);
+ return Status;
+ }
+
+ try
+ {
+ Status = PrintALC(p_Object);
+ }
+ catch(const sos::Exception &e)
+ {
+ ExtOut("%s\n", e.what());
+ return E_FAIL;
+ }
+
+ return Status;
+}
+
/**********************************************************************\
* Routine Description: *
* *
interpreter.AddCommand("clrthreads", new sosCommand("Threads"), "List the managed threads running.");
interpreter.AddCommand("clru", new sosCommand("u"), "Displays an annotated disassembly of a managed method.");
interpreter.AddCommand("dbgout", new sosCommand("dbgout"), "Enable/disable (-off) internal SOS logging.");
+ interpreter.AddCommand("dumpalc", new sosCommand("DumpALC"), "Displays details about a collectible AssemblyLoadContext to which the specified object is loaded.");
interpreter.AddCommand("dumparray", new sosCommand("DumpArray"), "Displays details about a managed array.");
interpreter.AddCommand("dumpasync", new sosCommand("DumpAsync"), "Displays info about async state machines on the garbage-collected heap.");
interpreter.AddCommand("dumpassembly", new sosCommand("DumpAssembly"), "Displays details about an assembly.");
[Command(Name = "clrstack", AliasExpansion = "ClrStack", Help = "Provides a stack trace of managed code only.")]
[Command(Name = "clrthreads", AliasExpansion = "Threads", Help = "List the managed threads running.")]
[Command(Name = "dbgout", AliasExpansion = "dbgout", Help = "Enable/disable (-off) internal SOS logging.")]
+ [Command(Name = "dumpalc", AliasExpansion = "DumpALC", Help = "Displays details about a collectible AssemblyLoadContext into which the specified object is loaded.")]
[Command(Name = "dumparray", AliasExpansion = "DumpArray", Help = "Displays details about a managed array.")]
[Command(Name = "dumpasync", AliasExpansion = "DumpAsync", Help = "Displays info about async state machines on the garbage-collected heap.")]
[Command(Name = "dumpassembly", AliasExpansion = "DumpAssembly", Help = "Displays details about an assembly.")]
// SVR
HRESULT GetGenerationTableSvr(CLRDATA_ADDRESS heapAddr, unsigned int cGenerations, struct DacpGenerationData *pGenerationData, unsigned int *pNeeded);
HRESULT GetFinalizationFillPointersSvr(CLRDATA_ADDRESS heapAddr, unsigned int cFillPointers, CLRDATA_ADDRESS *pFinalizationFillPointers, unsigned int *pNeeded);
+
+ HRESULT GetAssemblyLoadContext(CLRDATA_ADDRESS methodTable, CLRDATA_ADDRESS* assemblyLoadContext);
}
MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface7,0xc1020dde,0xfe98,0x4536,0xa5,0x3b,0xf3,0x5a,0x74,0xc3,0x27,0xeb);
+MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface8,0xc12f35a9,0xe55c,0x4520,0xa8,0x94,0xb3,0xdc,0x51,0x65,0xdf,0xce);
+
+
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
CLRDATA_ADDRESS *pFinalizationFillPointers,
unsigned int *pNeeded) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetAssemblyLoadContext(
+ CLRDATA_ADDRESS methodTable,
+ CLRDATA_ADDRESS *assemblyLoadContext) = 0;
};
CLRDATA_ADDRESS *pFinalizationFillPointers,
unsigned int *pNeeded);
+ HRESULT ( STDMETHODCALLTYPE *GetAssemblyLoadContext )(
+ ISOSDacInterface8 * This,
+ CLRDATA_ADDRESS methodTable,
+ CLRDATA_ADDRESS *assemblyLoadContext);
+
END_INTERFACE
} ISOSDacInterface8Vtbl;
#define ISOSDacInterface8_GetFinalizationFillPointersSvr(This,heapAddr,cFillPointers,pFinalizationFillPointers,pNeeded) \
( (This)->lpVtbl -> GetFinalizationFillPointersSvr(This,heapAddr,cFillPointers,pFinalizationFillPointers,pNeeded) )
+#define ISOSDacInterface8_GetAssemblyLoadContext(This,methodTable,assemblyLoadContext) \
+ ( (This)->lpVtbl -> GetAssemblyLoadContext(This,methodTable,assemblyLoadContext) )
+
#endif /* COBJMACROS */