.NET 4 exe with Sleep

rajny
Member
Posts: 4
OS: win 7 64 bit

.NET 4 exe with Sleep

Unread postby rajny » Sat Nov 03, 2012 2:53 am

I have a simple app that I built which has a Thread.Sleep in one of hte functions.

When I look at the thread's stack trace, it does not show Thread.Sleep. it stops at the function calling the sleep. The rest of the stack above is just ntdll functions and clr dll functions.

Why dont I se the Thread.Sleep. The reason i'm concerned is that will all leaf functions be hidden like this and only show up native code ?

rajny
Member
Posts: 4
OS: win 7 64 bit

Re: .NET 4 exe with Sleep

Unread postby rajny » Sat Nov 03, 2012 10:34 pm

interesting thing I see in windbg for the stack I see
03 00000000`0beaad80 000007fe`ed4def6c clr!CreateHistoryReader+0x3331a

and then when I run !clrstack it shows this
000000000beaae38 000000007756165a [HelperMethodFrame: 000000000beaae38] System.Threading.Thread.SleepInternal(Int32)

so that means that windbg extension is able to map it correctly. is the sos and clr extension source available somewhere that I can look at ?

User avatar
dmex
Admin
Posts: 702
Location: Australia

Re: .NET 4 exe with Sleep

Unread postby dmex » Sun Nov 04, 2012 1:03 am

It all depends on what the CLR is doing at the time the stack is queried - nothing is guaranteed to resemble your code once the MSIL is compiled:

thread.PNG

rajny
Member
Posts: 4
OS: win 7 64 bit

Re: .NET 4 exe with Sleep

Unread postby rajny » Sun Nov 04, 2012 4:02 am

Ok but how is clrstack able to resolve it as above and not the regular windbg stack.
the !clrstack command clearly resolves it. so there is something different the extension is doing to map the IP to the correct CLR function.

User avatar
wj32
Founder
Posts: 721
OS: Windows
Location: Australia
Contact:

Re: .NET 4 exe with Sleep

Unread postby wj32 » Tue Nov 06, 2012 4:43 am

The CLR stack feature in PH is a bit dodgy, I have to admit. Have you tried Process Explorer?

rajny
Member
Posts: 4
OS: win 7 64 bit

Re: .NET 4 exe with Sleep

Unread postby rajny » Tue Nov 06, 2012 7:33 pm

Even PE does not show the SleepInternal. It shows it as a Managed to unmanaged transition !
I wonder how the !clrstack does it.

Also what does a HelperFrame mean and how does it work.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 9 guests

cron