.NET 4 exe with Sleep

  • Author
  • Message
Offline

rajny

Rookie

Rookie

  • Posts: 4
  • Joined: November 3rd, 2012, 1:52 am
  • OS: win 7 64 bit

.NET 4 exe with Sleep

Unread postNovember 3rd, 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 ?
Offline

rajny

Rookie

Rookie

  • Posts: 4
  • Joined: November 3rd, 2012, 1:52 am
  • OS: win 7 64 bit

Re: .NET 4 exe with Sleep

Unread postNovember 3rd, 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 ?
Online
User avatar

dmex

Admin

Admin

  • Posts: 472
  • Joined: January 17th, 2011, 5:43 am

Re: .NET 4 exe with Sleep

Unread postNovember 4th, 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
Offline

rajny

Rookie

Rookie

  • Posts: 4
  • Joined: November 3rd, 2012, 1:52 am
  • OS: win 7 64 bit

Re: .NET 4 exe with Sleep

Unread postNovember 4th, 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.
Offline
User avatar

wj32

Founder

Founder

  • Posts: 695
  • Joined: January 17th, 2011, 5:19 am
  • Location: Australia
  • OS: Windows

Re: .NET 4 exe with Sleep

Unread postNovember 6th, 2012, 4:43 am

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

rajny

Rookie

Rookie

  • Posts: 4
  • Joined: November 3rd, 2012, 1:52 am
  • OS: win 7 64 bit

Re: .NET 4 exe with Sleep

Unread postNovember 6th, 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 1 guest