Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions docs/framework/tools/sos-dll-sos-debugging-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ms.assetid: 9ac1b522-77ab-4cdc-852a-20fcdc9ae498
author: "mairaw"
ms.author: "mairaw"
---

# SOS.dll (SOS debugging extension)

The SOS Debugging Extension (SOS.dll) helps you debug managed programs in Visual Studio and in the Windows debugger (WinDbg.exe) by providing information about the internal Common Language Runtime (CLR) environment. This tool requires your project to have unmanaged debugging enabled. SOS.dll is automatically installed with the .NET Framework. To use SOS.dll in Visual Studio, install the [Windows Driver Kit (WDK)](/windows-hardware/drivers/download-the-wdk).
Expand Down Expand Up @@ -56,7 +57,7 @@ The SOS Debugging Extension (SOS.dll) helps you debug managed programs in Visual
|**GCHandles** [**-perdomain**]|Displays statistics about garbage collector handles in the process.<br /><br /> The **-perdomain** option arranges the statistics by application domain.<br /><br /> Use the **GCHandles** command to find memory leaks caused by garbage collector handle leaks. For example, a memory leak occurs when code retains a large array because a strong garbage collector handle still points to it, and the handle is discarded without freeing it.|
|**GCHandleLeaks**|Searches memory for any references to strong and pinned garbage collector handles in the process and displays the results. If a handle is found, the **GCHandleLeaks** command displays the address of the reference. If a handle is not found in memory, this command displays a notification.|
|**GCInfo** \<*MethodDesc address*>\<*Code address*>|Displays data that indicates when registers or stack locations contain managed objects. If a garbage collection occurs, the collector must know the locations of references to objects so it can update them with new object pointer values.|
|**GCRoot** [**-nostacks**] \<*Object address*>|Displays information about references (or roots) to an object at the specified address.<br /><br /> The **GCRoot** command examines the entire managed heap and the handle table for handles within other objects and handles on the stack. Each stack is then searched for pointers to objects, and the finalizer queue is also searched.<br /><br /> This command does not determine whether a stack root is valid or is discarded. Use the **CLRStack** and **U** commands to disassemble the frame that the local or argument value belongs to in order to determine if the stack root is still in use.<br /><br /> The **-nostacks** option restricts the search to garbage collector handles and freachable objects.|
|**GCRoot** [**-nostacks**] \<*Object address*>|Displays information about references (or roots) to an object at the specified address.<br /><br /> The **GCRoot** command examines the entire managed heap and the handle table for handles within other objects and handles on the stack. Each stack is then searched for pointers to objects, and the finalizer queue is also searched.<br /><br /> This command does not determine whether a stack root is valid or is discarded. Use the **CLRStack** and **U** commands to disassemble the frame that the local or argument value belongs to in order to determine if the stack root is still in use.<br /><br /> The **-nostacks** option restricts the search to garbage collector handles and reachable objects.|
|**GCWhere** *\<object address>*|Displays the location and size in the garbage collection heap of the argument passed in. When the argument lies in the managed heap but is not a valid object address, the size is displayed as 0 (zero).|
|**help** [\<*command*>] [`faq`]|Displays all available commands when no parameter is specified, or displays detailed help information about the specified command.<br /><br /> The `faq` parameter displays answers to frequently asked questions.|
|**HeapStat** [**-inclUnrooted** &#124; **-iu**]|Displays the generation sizes for each heap and the total free space in each generation on each heap. If the -**inclUnrooted** option is specified, the report includes information about the managed objects from the garbage collection heap that is no longer rooted.|
Expand Down Expand Up @@ -120,79 +121,79 @@ The following command displays the contents of an array at the address `00ad28d0
!dumparray -start 2 -length 5 -detail 00ad28d0
```

The following command displays the contents of an assembly at the address `1ca248`.
The following command displays the contents of an assembly at the address `1ca248`.

```
!dumpassembly 1ca248
```

The following command displays information about the garbage collector heap.
The following command displays information about the garbage collector heap.

```
!dumpheap
```

The following command writes the contents of the in-memory stress log to a (default) file called StressLog.txt in the current directory.
The following command writes the contents of the in-memory stress log to a (default) file called StressLog.txt in the current directory.

```
!DumpLog
```

The following command displays the `MethodDesc` structure at the address `902f40`.
The following command displays the `MethodDesc` structure at the address `902f40`.

```
!dumpmd 902f40
```

The following command displays information about a module at the address `1caa50`.
The following command displays information about a module at the address `1caa50`.

```
!dumpmodule 1caa50
```

The following command displays information about an object at the address `a79d40`.
The following command displays information about an object at the address `a79d40`.

```
!DumpObj a79d40
```

The following command displays the fields of a value class at the address `00a79d9c` using the method table at the address `0090320c`.
The following command displays the fields of a value class at the address `00a79d9c` using the method table at the address `0090320c`.

```
!DumpVC 0090320c 00a79d9c
```

The following command displays the process memory used by the garbage collector.
The following command displays the process memory used by the garbage collector.

```
!eeheap -gc
```

The following command displays all objects scheduled for finalization.
The following command displays all objects scheduled for finalization.

```
!finalizequeue
```

The following command determines the application domain of an object at the address `00a79d98`.
The following command determines the application domain of an object at the address `00a79d98`.

```
!findappdomain 00a79d98
```

The following command displays all garbage collector handles in the current process.
The following command displays all garbage collector handles in the current process.

```
!gcinfo 5b68dbb8
```

The following command displays the `MethodTable` and `EEClass` structures for the `Main` method in the class `MainClass` in the module `unittest.exe`.
The following command displays the `MethodTable` and `EEClass` structures for the `Main` method in the class `MainClass` in the module `unittest.exe`.

```
!name2ee unittest.exe MainClass.Main
```

The following command displays information about the metadata token at the address `02000003` in the module `unittest.exe`.
The following command displays information about the metadata token at the address `02000003` in the module `unittest.exe`.

```
!token2ee unittest.exe 02000003
Expand Down