Skip to content

Commit

Permalink
Some SOS fixes/cleanup (bpmd, setclrpath, setsostid).
Browse files Browse the repository at this point in the history
Enable the module load notification when no module or methods are found.

setclrpath/setsostid print the current path/tid if no arguments. "setsostid -clear"
now clears the tid/os id mapping.

Added better exception hook to sos plugin to catch special CLRN exception. Before
multiple lldb "Exception breakpoints" where set each time bpmd added a new bp. Added
a "DoNotDeleteOrDisable" message to the exception breakpoint created.

Fix bpmd on release builds. RtlpRaiseException was being inlined and the ExceptionRecord
parameter was being optimized away causing the GetLastEventInformation api to failed
and the special CLRN exception to be ignored.

Add sos help support. "soshelp" displays help about a command.
  • Loading branch information
mikem8361 committed Dec 3, 2015
1 parent b3a45c0 commit aa78a27
Show file tree
Hide file tree
Showing 15 changed files with 1,661 additions and 127 deletions.
21 changes: 20 additions & 1 deletion Documentation/building/debugging-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ SOS commands supported by the lldb plugin:
FindAppDomain
GCRoot
GCInfo
Help
IP2MD
Name2EE
PrintException
Expand All @@ -76,12 +77,30 @@ There are some aliases for the most common commands:
clrstack -> sos ClrStack
clrthreads -> sos Threads
dumpheap -> sos DumpHeap
dumplog -> sos DumpLog
dumpmd -> sos DumpMD
dumpmt -> sos DumpMT
dumpobj -> sos DumpObj
dso -> sos DumpStackObjects
eeheap -> sos EEHeap
gcroot -> sos GCRoot
ip2md -> sos IP2MD
printexception -> sos PrintException
name2ee -> sos Name2EE
pe -> sos PrintException
soshelp -> sos Help

Problems and limitations of lldb and sos:

Many of the sos commands like clrstack or dso don't work on core dumps because lldb doesn't
return the actual OS thread id for a native thread. The "setsostid" command can be used to work
around this lldb bug. Use the "clrthreads" to find the os tid and the lldb command "thread list"
to find the thread index (#1 for example) for the current thread (* in first column). The first
setsostid argument is the os tid and the second is the thread index: "setsosid ecd5 1".

The "gcroot" command either crashes lldb 3.6 or returns invalid results. Works fine with lldb 3.7.

Loading Linux core dumps with lldb 3.7 doesn't work. lldb 3.7 loads OSX and FreeBSD core dumps
just fine.

For more information on SOS commands see: https://msdn.microsoft.com/en-us/library/bb190764(v=vs.110).aspx

Expand Down
2 changes: 2 additions & 0 deletions src/ToolBox/SOS/Strike/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,6 @@ target_link_libraries(sos ${SOS_LIBRARY})
install (TARGETS sos DESTINATION .)
if(WIN32)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/sos.pdb DESTINATION PDB)
else(WIN32)
install (FILES sosdocsunix.txt DESTINATION .)
endif(WIN32)
19 changes: 12 additions & 7 deletions src/ToolBox/SOS/Strike/exts.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,16 @@ class __ExtensionCleanUp

inline void EENotLoadedMessage(HRESULT Status)
{
ExtOut("Failed to find runtime DLL (clr.dll), 0x%08x\n",Status);
ExtOut("Extension commands need clr.dll in order to have something to do.\n");
ExtOut("Failed to find runtime DLL (%s), 0x%08x\n", MAKEDLLNAME_A("coreclr"), Status);
ExtOut("Extension commands need it in order to have something to do.\n");
}

inline void DACMessage(HRESULT Status)
{
ExtOut("Failed to load data access DLL, 0x%08x\n",Status);
ExtOut("Failed to load data access DLL, 0x%08x\n", Status);
#ifndef FEATURE_PAL
ExtOut("Verify that 1) you have a recent build of the debugger (6.2.14 or newer)\n");
ExtOut(" 2) the file mscordacwks.dll that matches your version of clr.dll is \n");
ExtOut(" 2) the file mscordacwks.dll that matches your version of coreclr.dll is \n");
ExtOut(" in the version directory or on the symbol path\n");
ExtOut(" 3) or, if you are debugging a dump file, verify that the file \n");
ExtOut(" mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.\n");
Expand All @@ -213,7 +214,11 @@ inline void DACMessage(HRESULT Status)
ExtOut("If that succeeds, the SOS command should work on retry.\n");
ExtOut("\n");
ExtOut("If you are debugging a minidump, you need to make sure that your executable\n");
ExtOut("path is pointing to clr.dll as well.\n");
ExtOut("path is pointing to coreclr.dll as well.\n");
#else
ExtOut("You can run the debugger command 'setclrpath' to control the load of %s.\n", MAKEDLLNAME_A("mscordaccore"));
ExtOut("If that succeeds, the SOS command should work on retry.\n");
#endif // FEATURE_PAL
}

HRESULT CheckEEDll();
Expand Down Expand Up @@ -259,12 +264,12 @@ HRESULT CheckEEDll();
g_clrData = NULL; \
if ((Status = CheckEEDll()) != S_OK) \
{ \
ExtOut("Failed to find runtime DLL (clr.dll), 0x%08x\n", Status); \
ExtOut("Failed to find runtime DLL (%s), 0x%08x\n", MAKEDLLNAME_A("coreclr"), Status); \
ExtOut("Some functionality may be impaired\n"); \
} \
else if ((Status = LoadClrDebugDll()) != S_OK) \
{ \
ExtOut("Failed to load data access DLL, 0x%08x\n", Status); \
ExtOut("Failed to load data access DLL (%s), 0x%08x\n", MAKEDLLNAME_A("mscordaccore"), Status); \
ExtOut("Some functionality may be impaired\n"); \
} \
else \
Expand Down
Loading

0 comments on commit aa78a27

Please sign in to comment.