Thursday, November 25, 2010

Parallel stacks and Common Stacks Algorithm

Hey,
For SharpDevelop I have created a version Parallel stacks. In this post I will present a algorithm that creates this Parallel stacks controls using "Common Stacks Algorithm".

Prerequisites: a debugger that gets you for every thread of the application it's call-stack;

SharpDevelop has a debugger that gives you for every thread of the debugged application it's call stack.
The Common Stacks Algorithms is like this:
1. For every thread, get it's call stack in ThreadStacks structure - just a class that contains the actual call-stack - and save them in some kind of list- List.
2. Get & Split common stacks
2.1. For all ThreadStacks, check if they have stack frames. If not, remove them from the list.
2.2 Get all call-stacks that start with the same stack-frame. This can be a Dictionary>.
2.3. For every group of ThreadStacks, find the place of split.
3. Create the common parent ThreadStack and clear the group of common stack-frames.
4. Link the parent to the children and children to parent.
5. Update the collection of ThreadStacks
6. Repeat from 1, until no split is possible - all are parents or simple leaves = the list of common stacks contains only 1 ThreadStack.

What do you think? Pretty nice!

For an implementation, see my Parallel branch in my github.

Happy coding!

Tuesday, November 23, 2010

CallStack dump in WinDbg debugger

C#
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");

// TODO: Implement Functionality Here
Thread t = new Thread(new ThreadStart(MyMethod));
Thread t1 = new Thread(new ThreadStart(MyMethod1));
t.Start();
t1.Start();
t1.Join();
t.Join();
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}

public static void MyMethod()
{
Console.WriteLine("enter");
Console.ReadLine();
Console.WriteLine("exit");
}


public static void MyMethod1()
{
Console.WriteLine("enter1");
Console.ReadLine();
Console.WriteLine("exit1");
}

Parent thread:

0:000> !dumpstack
OS Thread Id: 0x1220 (0)
Current frame: ntdll!KiFastSystemCallRet
ChildEBP RetAddr Caller, Callee
0012f060 7c90df4a ntdll!ZwWaitForMultipleObjects+0xc
0012f064 7c809590 KERNEL32!WaitForMultipleObjectsEx+0x12c, calling ntdll!NtWaitForMultipleObjects
0012f08c 7c910323 ntdll!RtlpImageNtHeader+0x56, calling ntdll!_SEH_epilog
0012f0bc 7c812cfb KERNEL32!GetProcessVersion+0xfa, calling ntdll!RtlImageNtHeader
0012f0c0 7c812d27 KERNEL32!GetProcessVersion+0x12c, calling KERNEL32!_SEH_epilog
0012f100 791f516a clr!WaitForMultipleObjectsEx_SO_TOLERANT+0x56, calling KERNEL32!WaitForMultipleObjectsEx
0012f164 791f4f98 clr!Thread::DoAppropriateAptStateWait+0x4d, calling clr!WaitForMultipleObjectsEx_SO_TOLERANT
0012f184 791f4dd8 clr!Thread::DoAppropriateWaitWorker+0x17d, calling clr!Thread::DoAppropriateAptStateWait
0012f1ac 7c8106f5 KERNEL32!CreateThread+0x1e, calling KERNEL32!CreateRemoteThread
0012f218 791f4e99 clr!Thread::DoAppropriateWait+0x60, calling clr!Thread::DoAppropriateWaitWorker
0012f264 79150d3b clr!LoaderHeap::RealAllocMemUnsafe+0x57, calling clr!ClrLeaveCriticalSection
0012f284 792dcfed clr!Thread::JoinEx+0xd5, calling clr!Thread::DoAppropriateWait
0012f2d4 792dd0db clr!ThreadNative::DoJoin+0xaf, calling clr!Thread::JoinEx
0012f33c 792dd1db clr!ThreadNative::Join+0xf2, calling clr!ThreadNative::DoJoin
0012f388 792dd157 clr!ThreadNative::Join+0x3e, calling clr!LazyMachStateCaptureState
0012f3a4 79161f8e clr!PreStubWorker+0x165, calling clr!_EH_epilog3
0012f3e0 7a053eb5 (MethodDesc 79885160 +0x5 System.Threading.Thread.Join()), calling clr!ThreadNative::Join
0012f3e4 0303013e (MethodDesc 009c37f0 +0xce testc.Program.Main(System.String[])), calling (MethodDesc 79885160 +0 System.Threading.Thread.Join())
0012f414 791421db clr!CallDescrWorker+0x33
0012f418 7914e021 clr!SigParser::GetElemType+0x28, calling clr!SigParser::SkipCustomModifiers
0012f424 79164a2a clr!CallDescrWorkerWithHandler+0x8e, calling clr!CallDescrWorker
0012f478 7915c58d clr!ArgIterator::Init+0x6b, calling clr!MetaSig::HasRetBuffArg
0012f4a0 79164bcc clr!MethodDesc::CallDescr+0x194, calling clr!CallDescrWorkerWithHandler
0012f4cc 791628bb clr!MetaSig::MetaSig+0x3c, calling MSVCR100_CLR0400!memcpy
0012f4dc 79164b0a clr!MethodDesc::CallDescr+0xa8, calling clr!ClrSafeInt::addition
0012f4e8 79164b1a clr!MethodDesc::CallDescr+0xb4, calling clr!_alloca_probe_16
0012f558 7914e30a clr!MethodDesc::GetSigFromMetadata+0x21
0012f59c 79164aa5 clr!MethodDesc::CallDescr+0x21, calling clr!_alloca_probe_16
0012f5e0 79164c01 clr!MethodDesc::CallTargetWorker+0x21, calling clr!MethodDesc::CallDescr
0012f5fc 79164c21 clr!MethodDescCallSite::Call+0x1c, calling clr!MethodDesc::CallTargetWorker
0012f614 7922ce82 clr!ClassLoader::RunMain+0x24c, calling clr!MethodDescCallSite::CallWithValueTypes_RetArgSlot
0012f714 7914e30a clr!MethodDesc::GetSigFromMetadata+0x21
0012f778 7922cf90 clr!Assembly::ExecuteMainMethod+0xc1, calling clr!ClassLoader::RunMain
0012f7a8 79141ad1 clr!_EH_epilog3_GS+0xa, calling clr!__security_check_cookie
0012f7ac 7919d804 clr!SString::ConvertToUnicode+0x8b, calling clr!_EH_epilog3_GS
0012f7dc 7915cd88 clr!HardCodedMetaSig::GetBinarySig+0x130, calling clr!_EH_epilog3_GS
0012f7f4 7915c927 clr!Binder::CheckInit+0xf, calling clr!MethodTable::IsClassInited
0012f804 7915ce4a clr!Binder::GetMethod+0x79, calling clr!_EH_epilog3
0012f82c 79164aa5 clr!MethodDesc::CallDescr+0x21, calling clr!_alloca_probe_16
0012f834 79141d85 clr!UnsafeEETryEnterCriticalSection+0xf, calling ntdll!RtlTryEnterCriticalSection
0012f838 79141d9e clr!UnsafeEETryEnterCriticalSection+0x28, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0012f844 79141d55 clr!CrstBase::Enter+0xb4, calling clr!UnsafeEETryEnterCriticalSection
0012f868 7c927784 ntdll!RtlFreeHeapSlowly+0x5c2, calling ntdll!_SEH_epilog
0012f86c 7c927573 ntdll!RtlFreeHeap+0xf9, calling ntdll!RtlFreeHeapSlowly
0012f878 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0012f888 79141c49 clr!UnsafeEELeaveCriticalSection+0xe, calling ntdll!RtlLeaveCriticalSection
0012f88c 79141c5c clr!UnsafeEELeaveCriticalSection+0x21, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0012f894 79141c8f clr!CrstBase::Leave+0x2b, calling clr!UnsafeEELeaveCriticalSection
0012f8a8 791d393d clr!SetObjectReferenceUnchecked+0x4e, calling clr!ErectWriteBarrier
0012f8cc 7c9101db ntdll!RtlAllocateHeap+0xeac, calling ntdll!_SEH_epilog
0012f8d0 7919bf7e clr!EEHeapAlloc+0xcb, calling ntdll!RtlAllocateHeap
0012f8dc 7919bf8f clr!EEHeapAlloc+0xe8, calling clr!_EH_epilog3
0012f8fc 7c80262a KERNEL32!WaitForSingleObjectEx+0xe5, calling ntdll!RtlDeactivateActivationContextUnsafeFast
0012f914 79141b19 clr!_EH_epilog3_catch_GS+0xa, calling clr!__security_check_cookie
0012f938 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0012f93c 7919c036 clr!EEHeapFree+0x36, calling ntdll!RtlFreeHeap
0012f950 7919c09d clr!EEHeapFreeInProcessHeap+0x24, calling clr!EEHeapFree
0012f964 7919c06d clr!operator delete[]+0x30, calling clr!EEHeapFreeInProcessHeap
0012f96c 7919c07e clr!operator delete[]+0x41, calling clr!_EH_epilog3
0012f994 7919c07e clr!operator delete[]+0x41, calling clr!_EH_epilog3
0012f998 7929320a clr!AppDomain::SetFriendlyName+0x16c, calling clr!operator delete[]
0012f99c 79293210 clr!AppDomain::SetFriendlyName+0x172, calling clr!_EH_epilog3
0012f9e0 7922cda4 clr!SystemDomain::ExecuteMainMethod+0x4ec, calling clr!Assembly::ExecuteMainMethod
0012fad8 791f6b82 clr!WKS::gc_heap::allocate_more_space+0x13, calling clr!WKS::gc_heap::try_allocate_more_space
0012fb24 7c927784 ntdll!RtlFreeHeapSlowly+0x5c2, calling ntdll!_SEH_epilog
0012fb28 7c927573 ntdll!RtlFreeHeap+0xf9, calling ntdll!RtlFreeHeapSlowly
0012fb34 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0012fb50 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0012fb54 7c911452 ntdll!RtlpFreeDebugInfo+0x5c, calling ntdll!RtlFreeHeap
0012fb58 7c911483 ntdll!RtlpFreeDebugInfo+0x77, calling ntdll!RtlLeaveCriticalSection
0012fb60 7c911460 ntdll!RtlpFreeDebugInfo+0x6a, calling ntdll!_SEH_epilog
0012fb8c 7c911460 ntdll!RtlpFreeDebugInfo+0x6a, calling ntdll!_SEH_epilog
0012fb90 7c9113e1 ntdll!RtlDeleteCriticalSection+0x72, calling ntdll!RtlpFreeDebugInfo
0012fb94 7c9113f2 ntdll!RtlDeleteCriticalSection+0x83, calling ntdll!_SEH_epilog
0012fba4 79141d85 clr!UnsafeEETryEnterCriticalSection+0xf, calling ntdll!RtlTryEnterCriticalSection
0012fba8 79141d9e clr!UnsafeEETryEnterCriticalSection+0x28, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0012fbb4 79141d55 clr!CrstBase::Enter+0xb4, calling clr!UnsafeEETryEnterCriticalSection
0012fbc4 79141c49 clr!UnsafeEELeaveCriticalSection+0xe, calling ntdll!RtlLeaveCriticalSection
0012fbc8 79141c5c clr!UnsafeEELeaveCriticalSection+0x21, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0012fbd0 79141c8f clr!CrstBase::Leave+0x2b, calling clr!UnsafeEELeaveCriticalSection
0012fbf0 79141d85 clr!UnsafeEETryEnterCriticalSection+0xf, calling ntdll!RtlTryEnterCriticalSection
0012fbf4 79141d9e clr!UnsafeEETryEnterCriticalSection+0x28, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0012fc00 79141d55 clr!CrstBase::Enter+0xb4, calling clr!UnsafeEETryEnterCriticalSection
0012fc1c 79141bf3 clr!GCHolderBase<1,0,0,0>::Pop+0x20, calling clr!Thread::DisablePreemptiveGC
0012fc28 7919c345 clr!CrstBase::AcquirePreempLock+0x33, calling clr!_EH_epilog3
0012fc54 7919c345 clr!CrstBase::AcquirePreempLock+0x33, calling clr!_EH_epilog3
0012fc58 79141ad1 clr!_EH_epilog3_GS+0xa, calling clr!__security_check_cookie
0012fc5c 7915cd88 clr!HardCodedMetaSig::GetBinarySig+0x130, calling clr!_EH_epilog3_GS
0012fc74 79141c49 clr!UnsafeEELeaveCriticalSection+0xe, calling ntdll!RtlLeaveCriticalSection
0012fc78 79141c5c clr!UnsafeEELeaveCriticalSection+0x21, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0012fc80 79141c8f clr!CrstBase::Leave+0x2b, calling clr!UnsafeEELeaveCriticalSection
0012fc8c 791632e6 clr!DomainLocalModule::SetClassFlags+0x81, calling clr!_EH_epilog3
0012fda0 790703e5 MSVCR100_CLR0400!_getptd+0x8, calling MSVCR100_CLR0400!_getptd_noexit
0012fdd8 79073b18 MSVCR100_CLR0400!_towlower_l+0x24, calling MSVCR100_CLR0400!_LocaleUpdate::_LocaleUpdate
0012fe50 7919bf7e clr!EEHeapAlloc+0xcb, calling ntdll!RtlAllocateHeap
0012fe5c 7919bf8f clr!EEHeapAlloc+0xe8, calling clr!_EH_epilog3
0012fe98 792963b9 clr!EEStartupHelper+0x9a3, calling clr!_EH_epilog3_catch_GS
0012fe9c 7922c496 clr!EEStartup+0x52, calling clr!EEStartupHelper
0012fec4 7922d199 clr!ExecuteEXE+0x58, calling clr!SystemDomain::ExecuteMainMethod
0012ff18 7922d09a clr!_CorExeMainInternal+0x19f, calling clr!ExecuteEXE
0012ff30 603b5011 mscoreei!BaseWrapper,&DoTheRelease,2>,0,&CompareDefault,2>::~BaseWrapper,&DoTheRelease,2>,0,&CompareDefault,2>+0x30, calling mscoreei!_EH_epilog3
0012ff64 792aaf00 clr!_CorExeMain+0x4e, calling clr!_CorExeMainInternal
0012ff9c 603b55ab mscoreei!_CorExeMain+0x38
0012ffa8 79007f16 mscoree!ShellShim__CorExeMain+0x99
0012ffb8 79004de3 mscoree!_CorExeMain_Exported+0x8, calling mscoree!ShellShim__CorExeMain
0012ffc0 7c817077 KERNEL32!BaseProcessStart+0x23

Child 1 thread stack:

0:003> !dumpstack
OS Thread Id: 0x1588 (3)
Current frame: ntdll!KiFastSystemCallRet
ChildEBP RetAddr Caller, Callee
0315f514 7c90daea ntdll!ZwRequestWaitReplyPort+0xc
0315f518 7c912de8 ntdll!CsrClientCallServer+0x8c, calling ntdll!NtRequestWaitReplyPort
0315f538 7c872a51 KERNEL32!ReadConsoleInternal+0x1be, calling ntdll!CsrClientCallServer
0315f558 7c927784 ntdll!RtlFreeHeapSlowly+0x5c2, calling ntdll!_SEH_epilog
0315f5bc 7914ee15 clr!Precode::GetMethodDesc+0x46, calling clr!FixupPrecode::GetMethodDesc
0315f5e0 79151734 clr!BaseWrapper,&StubRelease,2>,0,&CompareDefault,2>::~BaseWrapper,&StubRelease,2>,0,&CompareDefault,2>+0x2f, calling clr!_EH_epilog3
0315f634 7c872b98 KERNEL32!ReadConsoleA+0x3b, calling KERNEL32!ReadConsoleInternal
0315f678 7916498a clr!SafeHandle::DangerousAddRef+0x111, calling clr!Frame::Pop
0315f67c 7916499f clr!SafeHandle::DangerousAddRef+0x126, calling clr!_EH_epilog3
0315f690 79161e82 clr!MethodDesc::DoPrestub+0x51d, calling clr!_EH_epilog3
0315f6bc 7c8018b7 KERNEL32!ReadFile+0x64, calling KERNEL32!ReadConsoleA
0315f714 79b41c8b (MethodDesc 79902c90 +0x6b DomainNeutralILStubClass.IL_STUB_PInvoke(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte*, Int32, Int32 ByRef, IntPtr))
0315f740 79b41c8b (MethodDesc 79902c90 +0x6b DomainNeutralILStubClass.IL_STUB_PInvoke(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte*, Int32, Int32 ByRef, IntPtr))
0315f774 7a1af7e8 (MethodDesc 799b7628 +0x8c System.IO.__ConsoleStream.ReadFileNative(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte[], Int32, Int32, Int32, Int32 ByRef)), calling 79a8141c
0315f794 7a1af7e8 (MethodDesc 799b7628 +0x8c System.IO.__ConsoleStream.ReadFileNative(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte[], Int32, Int32, Int32, Int32 ByRef)), calling 79a8141c
0315f7bc 7a1af6d0 (MethodDesc 799b7610 +0x9c System.IO.__ConsoleStream.Read(Byte[], Int32, Int32)), calling (MethodDesc 799b7628 +0 System.IO.__ConsoleStream.ReadFileNative(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte[], Int32, Int32, Int32, Int32 ByRef))
0315f7e4 79af8bfb (MethodDesc 798eff48 +0x3b System.IO.StreamReader.ReadBuffer())
0315f800 79ad560a (MethodDesc 798eff50 +0x16e System.IO.StreamReader.ReadLine())
0315f820 7a1b5f45 (MethodDesc 799841b4 +0x19 System.IO.TextReader+SyncTextReader.ReadLine())
0315f830 7a0ac292 (MethodDesc 799084ec +0x12 System.Console.ReadLine())
0315f838 030301a3 (MethodDesc 009c37fc +0x23 testc.Program.MyMethod()), calling (MethodDesc 799084ec +0 System.Console.ReadLine())
0315f840 79b2ae5b (MethodDesc 7996e4d4 +0x63 System.Threading.ThreadHelper.ThreadStart_Context(System.Object))
0315f850 79ab7ff4 (MethodDesc 798f75e8 +0xb0 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean))
0315f86c 79ab7f34 (MethodDesc 798f75dc +0x2c System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)), calling (MethodDesc 798f75e8 +0 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean))
0315f88c 79b2ade8 (MethodDesc 798e86c0 +0x44 System.Threading.ThreadHelper.ThreadStart()), calling (MethodDesc 798f75dc +0 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object))
0315f8a4 791421db clr!CallDescrWorker+0x33
0315f8a8 7c91930f ntdll!RtlAllocateHeapSlowly+0x113b, calling ntdll!_SEH_epilog
0315f8ac 7c918f21 ntdll!RtlAllocateHeap+0xe64, calling ntdll!RtlAllocateHeapSlowly
0315f8b4 79164a2a clr!CallDescrWorkerWithHandler+0x8e, calling clr!CallDescrWorker
0315f908 7915c58d clr!ArgIterator::Init+0x6b, calling clr!MetaSig::HasRetBuffArg
0315f930 79164bcc clr!MethodDesc::CallDescr+0x194, calling clr!CallDescrWorkerWithHandler
0315f95c 791628bb clr!MetaSig::MetaSig+0x3c, calling MSVCR100_CLR0400!memcpy
0315f96c 79164b0a clr!MethodDesc::CallDescr+0xa8, calling clr!ClrSafeInt::addition
0315f978 79164b1a clr!MethodDesc::CallDescr+0xb4, calling clr!_alloca_probe_16
0315f9d4 7c918047 ntdll!LdrpSnapThunk+0x317, calling ntdll!LdrpGetProcedureAddress
0315fa00 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0315fa04 7919c036 clr!EEHeapFree+0x36, calling ntdll!RtlFreeHeap
0315fa18 7919c09d clr!EEHeapFreeInProcessHeap+0x24, calling clr!EEHeapFree
0315fa30 79164aa5 clr!MethodDesc::CallDescr+0x21, calling clr!_alloca_probe_16
0315fa74 79164c01 clr!MethodDesc::CallTargetWorker+0x21, calling clr!MethodDesc::CallDescr
0315fa90 792db512 clr!ThreadNative::KickOffThread_Worker+0x1e1, calling clr!MethodDesc::CallTargetWorker
0315fad0 603b43e4 mscoreei!_unlock+0x15, calling ntdll!RtlLeaveCriticalSection
0315fadc 603b43ed mscoreei!_initptd+0xb2, calling mscoreei!_unlock
0315fae4 603b4139 mscoreei!_initptd+0x9b, calling mscoreei!_SEH_epilog4
0315fb00 7c94b1b0 ntdll!RtlpCoalesceFreeBlocks+0x3ed, calling ntdll!RtlCompareMemoryUlong
0315fb28 7c92770a ntdll!RtlFreeHeapSlowly+0x3a0, calling ntdll!RtlpUpdateIndexInsertBlock
0315fb30 7c927784 ntdll!RtlFreeHeapSlowly+0x5c2, calling ntdll!_SEH_epilog
0315fb58 603b4384 mscoreei!_CRT_INIT+0x259, calling mscoreei!_SEH_epilog4
0315fb78 7c80e6cb KERNEL32!BasepGetModuleHandleExW+0x250, calling KERNEL32!_SEH_epilog
0315fb7c 790853d0 MSVCR100_CLR0400!__addlocaleref+0x8a
0315fb84 79085112 MSVCR100_CLR0400!_unlock+0x15, calling ntdll!RtlLeaveCriticalSection
0315fba4 7c91930f ntdll!RtlAllocateHeapSlowly+0x113b, calling ntdll!_SEH_epilog
0315fba8 7c918f21 ntdll!RtlAllocateHeap+0xe64, calling ntdll!RtlAllocateHeapSlowly
0315fbb4 7c9101db ntdll!RtlAllocateHeap+0xeac, calling ntdll!_SEH_epilog
0315fc30 7c918047 ntdll!LdrpSnapThunk+0x317, calling ntdll!LdrpGetProcedureAddress
0315fc5c 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0315fc60 7919c036 clr!EEHeapFree+0x36, calling ntdll!RtlFreeHeap
0315fc74 7919c09d clr!EEHeapFreeInProcessHeap+0x24, calling clr!EEHeapFree
0315fc9c 791f5c05 clr!Thread::DoExtraWorkForFinalizer+0x114
0315fcb0 791f5c87 clr!Thread::ShouldChangeAbortToUnload+0x101, calling clr!Thread::DoExtraWorkForFinalizer+0xb7
0315fcc8 79141d85 clr!UnsafeEETryEnterCriticalSection+0xf, calling ntdll!RtlTryEnterCriticalSection
0315fccc 79141d9e clr!UnsafeEETryEnterCriticalSection+0x28, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0315fcd8 79141d55 clr!CrstBase::Enter+0xb4, calling clr!UnsafeEETryEnterCriticalSection
0315fcf0 7914191f clr!ClrFlsGetValue+0xb, calling 00941ee0
0315fcf8 7914191f clr!ClrFlsGetValue+0xb, calling 00941ee0
0315fd00 79141e36 clr!DecCantStopCount+0xa, calling clr!ClrFlsGetValue
0315fd0c 7919dea7 clr!ThreadStore::UnlockThreadStore+0x4b, calling clr!DecCantStopCount
0315fd60 791f5d42 clr!Thread::ShouldChangeAbortToUnload+0x399, calling clr!Thread::ShouldChangeAbortToUnload+0x34
0315fdc0 791f5dd9 clr!Thread::ShouldChangeAbortToUnload+0x43a, calling clr!Thread::ShouldChangeAbortToUnload+0x33c
0315fde4 792db3e5 clr!ManagedThreadBase::KickOff+0x15, calling clr!Thread::ShouldChangeAbortToUnload+0x403
0315fdfc 792db2e0 clr!ThreadNative::KickOffThread+0x23e, calling clr!ManagedThreadBase::KickOff
0315fe38 7919c036 clr!EEHeapFree+0x36, calling ntdll!RtlFreeHeap
0315fe60 7919c06d clr!operator delete[]+0x30, calling clr!EEHeapFreeInProcessHeap
0315fe94 791f5a08 clr!Thread::intermediateThreadProc+0x4b
0315ffa0 791f59f6 clr!Thread::intermediateThreadProc+0x39, calling clr!_alloca_probe_16
0315ffb4 7c80b729 KERNEL32!BaseThreadStart+0x37

Child 2 thread stack:
0:004> !dumpstack
OS Thread Id: 0x1710 (4)
Current frame: ntdll!KiFastSystemCallRet
ChildEBP RetAddr Caller, Callee
0325f388 7c90df4a ntdll!ZwWaitForMultipleObjects+0xc
0325f38c 7c809590 KERNEL32!WaitForMultipleObjectsEx+0x12c, calling ntdll!NtWaitForMultipleObjects
0325f428 791f516a clr!WaitForMultipleObjectsEx_SO_TOLERANT+0x56, calling KERNEL32!WaitForMultipleObjectsEx
0325f48c 791f4f98 clr!Thread::DoAppropriateAptStateWait+0x4d, calling clr!WaitForMultipleObjectsEx_SO_TOLERANT
0325f4ac 791f4dd8 clr!Thread::DoAppropriateWaitWorker+0x17d, calling clr!Thread::DoAppropriateAptStateWait
0325f540 791f4e99 clr!Thread::DoAppropriateWait+0x60, calling clr!Thread::DoAppropriateWaitWorker
0325f58c 7c80a7ae KERNEL32!CreateEventW+0x9a, calling KERNEL32!SetLastError
0325f5ac 791f4f17 clr!CLREvent::WaitEx+0x106, calling clr!Thread::DoAppropriateWait
0325f5d8 7949df7c clr!CLRGetTickCount64+0x15f, calling clr!_allmul
0325f600 7919d409 clr!CLREvent::Wait+0x19, calling clr!CLREvent::WaitEx
0325f614 792e0160 clr!AwareLock::EnterEpilogHelper+0xa8, calling clr!CLREvent::Wait
0325f668 79141d55 clr!CrstBase::Enter+0xb4, calling clr!UnsafeEETryEnterCriticalSection
0325f67c 79141c5c clr!UnsafeEELeaveCriticalSection+0x21, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0325f684 79141c8f clr!CrstBase::Leave+0x2b, calling clr!UnsafeEELeaveCriticalSection
0325f6a4 792e0256 clr!AwareLock::EnterEpilog+0x42, calling clr!AwareLock::EnterEpilogHelper
0325f6e4 792e029b clr!AwareLock::Enter+0x5f, calling clr!AwareLock::EnterEpilog
0325f704 791e0f78 clr!JIT_MonEnterWorker_Portable+0xf8, calling clr!ObjHeader::EnterObjMonitor
0325f718 79ad7774 (MethodDesc 799080b0 +0x58 System.IO.__ConsoleStream.Write(Byte[], Int32, Int32)), calling (MethodDesc 799b7634 +0 System.IO.__ConsoleStream.WriteFileNative(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte[], Int32, Int32, Int32, Int32 ByRef))
0325f734 79b2e0c4 (MethodDesc 79885774 +0x14 System.Threading.Monitor.Enter(System.Object, Boolean ByRef)), calling clr!JIT_MonReliableEnter
0325f738 79142ec3 clr!JIT_MonExitWorker+0xb, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0325f748 791e0ed7 clr!JIT_MonEnterWorker_Portable+0x21, calling clr!LazyMachStateCaptureState
0325f7a0 7a1b5f3a (MethodDesc 799841b4 +0xe System.IO.TextReader+SyncTextReader.ReadLine()), calling clr!JIT_MonEnterWorker
0325f7b0 7a0ac292 (MethodDesc 799084ec +0x12 System.Console.ReadLine())
0325f7b8 030301f3 (MethodDesc 009c3808 +0x23 testc.Program.MyMethod1()), calling (MethodDesc 799084ec +0 System.Console.ReadLine())
0325f7c0 79b2ae5b (MethodDesc 7996e4d4 +0x63 System.Threading.ThreadHelper.ThreadStart_Context(System.Object))
0325f7d0 79ab7ff4 (MethodDesc 798f75e8 +0xb0 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean))
0325f7ec 79ab7f34 (MethodDesc 798f75dc +0x2c System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)), calling (MethodDesc 798f75e8 +0 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean))
0325f80c 79b2ade8 (MethodDesc 798e86c0 +0x44 System.Threading.ThreadHelper.ThreadStart()), calling (MethodDesc 798f75dc +0 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object))
0325f824 791421db clr!CallDescrWorker+0x33
0325f834 79164a2a clr!CallDescrWorkerWithHandler+0x8e, calling clr!CallDescrWorker
0325f888 7915c58d clr!ArgIterator::Init+0x6b, calling clr!MetaSig::HasRetBuffArg
0325f8b0 79164bcc clr!MethodDesc::CallDescr+0x194, calling clr!CallDescrWorkerWithHandler
0325f8dc 791628bb clr!MetaSig::MetaSig+0x3c, calling MSVCR100_CLR0400!memcpy
0325f8ec 79164b0a clr!MethodDesc::CallDescr+0xa8, calling clr!ClrSafeInt::addition
0325f8f8 79164b1a clr!MethodDesc::CallDescr+0xb4, calling clr!_alloca_probe_16
0325f954 7c9101db ntdll!RtlAllocateHeap+0xeac, calling ntdll!_SEH_epilog
0325f980 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0325f984 7919c036 clr!EEHeapFree+0x36, calling ntdll!RtlFreeHeap
0325f998 7919c09d clr!EEHeapFreeInProcessHeap+0x24, calling clr!EEHeapFree
0325f9b0 79164aa5 clr!MethodDesc::CallDescr+0x21, calling clr!_alloca_probe_16
0325f9f4 79164c01 clr!MethodDesc::CallTargetWorker+0x21, calling clr!MethodDesc::CallDescr
0325fa10 792db512 clr!ThreadNative::KickOffThread_Worker+0x1e1, calling clr!MethodDesc::CallTargetWorker
0325fa60 7c917dba ntdll!LdrpGetProcedureAddress+0x186, calling ntdll!LdrpSnapThunk
0325fa80 7c94b065 ntdll!RtlpCoalesceFreeBlocks+0x1a7, calling ntdll!RtlCompareMemoryUlong
0325faa8 7c92770a ntdll!RtlFreeHeapSlowly+0x3a0, calling ntdll!RtlpUpdateIndexInsertBlock
0325fab0 7c927784 ntdll!RtlFreeHeapSlowly+0x5c2, calling ntdll!_SEH_epilog
0325fac4 7c80e6cb KERNEL32!BasepGetModuleHandleExW+0x250, calling KERNEL32!_SEH_epilog
0325fac8 603b41e7 mscoreei!__addlocaleref+0x8a
0325fadc 603b43ed mscoreei!_initptd+0xb2, calling mscoreei!_unlock
0325fae4 603b4139 mscoreei!_initptd+0x9b, calling mscoreei!_SEH_epilog4
0325fb24 7c91930f ntdll!RtlAllocateHeapSlowly+0x113b, calling ntdll!_SEH_epilog
0325fb28 7c918f21 ntdll!RtlAllocateHeap+0xe64, calling ntdll!RtlAllocateHeapSlowly
0325fb34 7c9101db ntdll!RtlAllocateHeap+0xeac, calling ntdll!_SEH_epilog
0325fb4c 603b4358 mscoreei!_CRT_INIT+0x1d0, calling mscoreei!DllMain
0325fbb0 7c9101db ntdll!RtlAllocateHeap+0xeac, calling ntdll!_SEH_epilog
0325fbdc 7c91005d ntdll!RtlFreeHeap+0x647, calling ntdll!_SEH_epilog
0325fbe0 7919c036 clr!EEHeapFree+0x36, calling ntdll!RtlFreeHeap
0325fbf4 7919c09d clr!EEHeapFreeInProcessHeap+0x24, calling clr!EEHeapFree
0325fc1c 791f5c05 clr!Thread::DoExtraWorkForFinalizer+0x114
0325fc30 791f5c87 clr!Thread::ShouldChangeAbortToUnload+0x101, calling clr!Thread::DoExtraWorkForFinalizer+0xb7
0325fc48 79141d85 clr!UnsafeEETryEnterCriticalSection+0xf, calling ntdll!RtlTryEnterCriticalSection
0325fc4c 79141d9e clr!UnsafeEETryEnterCriticalSection+0x28, calling (JitHelp: CORINFO_HELP_GET_THREAD)
0325fc58 79141d55 clr!CrstBase::Enter+0xb4, calling clr!UnsafeEETryEnterCriticalSection
0325fc70 7914191f clr!ClrFlsGetValue+0xb, calling 00941ee0
0325fc78 7914191f clr!ClrFlsGetValue+0xb, calling 00941ee0
0325fc80 79141e36 clr!DecCantStopCount+0xa, calling clr!ClrFlsGetValue
0325fc8c 7919dea7 clr!ThreadStore::UnlockThreadStore+0x4b, calling clr!DecCantStopCount
0325fce0 791f5d42 clr!Thread::ShouldChangeAbortToUnload+0x399, calling clr!Thread::ShouldChangeAbortToUnload+0x34
0325fd40 791f5dd9 clr!Thread::ShouldChangeAbortToUnload+0x43a, calling clr!Thread::ShouldChangeAbortToUnload+0x33c
0325fd64 792db3e5 clr!ManagedThreadBase::KickOff+0x15, calling clr!Thread::ShouldChangeAbortToUnload+0x403
0325fd7c 792db2e0 clr!ThreadNative::KickOffThread+0x23e, calling clr!ManagedThreadBase::KickOff
0325fdb8 7919c036 clr!EEHeapFree+0x36, calling ntdll!RtlFreeHeap
0325fde0 7919c06d clr!operator delete[]+0x30, calling clr!EEHeapFreeInProcessHeap
0325fe14 791f5a08 clr!Thread::intermediateThreadProc+0x4b
0325ffa0 791f59f6 clr!Thread::intermediateThreadProc+0x39, calling clr!_alloca_probe_16
0325ffb4 7c80b729 KERNEL32!BaseThreadStart+0x37

Sunday, November 14, 2010

SharpDevelop improvements(2): Pinned data-tips

Hey everybody,
I've developed a data-pins version in SharpDevelop IDE. See my github for implementation.
You can:
- add a data pin with variables
- refresh data inside pins
- save and load data pins
- move pin grid independent of the pin location and pin location independent of pin grid - this is not supported in VS 2010
- add comment to a data pin.

Friday, November 12, 2010

SharpDevelop improvements(1)

Hey everybody,

SharpDevelop is at 4.1 pre-alpha and some of my contributions are inside.
These are:
- WPF breakpoints pad with code completion
- WPF bookmark pad
- WPF watch pad with code completion
- WPF local vars pad
- change Reflector path in Options panels.
- spell checker based on (N)hunspell - this addin is not inside the release but you can find it on my github.

The next improvements concerns pin data tips and edit value in debug tooltips.

Give #D a try! :)

Happy programming!

Thursday, November 4, 2010

My SharpDevelop wish list

1. Parallel Tasks window/pad
2. Parallel Stacks window/pad
3. Format code on save(C#, VB, X(A)ML,)


I'll add others in the future...

Create Git new remote branch script

if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 branch_name
exit 127
fi
branch_name=$1
git push origin master:refs/heads/$branch_name
echo "git push origin master:refs/heads/$branch_name"
git fetch origin
git checkout --track -b $branch_name origin/$branch_name
git pull