Enter, Leave, Tailcall Hooks Part 1: The Basics

The CLR Profiling API allows you to hook managed functions so that your profiler is called when a function is entered, returns, or exits via tailcall. We refer to these as Enter/Leave/Tailcall hooks, or “ELT” hooks. In this special multi-part investigative series, I will uncover the truth behind ELT. Today I’ll write about some of…


Versions of Microsoft .NET Framework, CLR, and Your Profiler

[Updated 8/13/2008 with the release of Visual Studio 2008 SP1.] With the many releases of the Microsoft .NET Frameworks and their service packs, it might not be obvious what versions of the Common Language Runtime (CLR) come alongside them and whether your profiler should care.  So I’m posting this to help clarify the various versions….


Profiler stack walking: Basics and beyond

Introduction This article is targeted toward profiler authors, and anyone interested in building a profiler to examine managed applications.   I will describe how you can program your profiler to walk managed stacks in version 2.0 of the Common Language Runtime.  I’ll try to keep the mood light and zany, as one might expect given the…


DoStackSnapshot Tidbit #1: Exception Filters

Believe it or not, my last (rather large) post on stack walking actually left out several miscellaneous details about using DoStackSnapshot.  I’ll be posting those details separately.  We’ll start off with some light reading on exception filters.  No deadlocks this time, I promise. For those of you diehard C# fans, you might be unaware of…



8/25/10 Update: All sample code for this topic is now also available on the MSDN Code Gallery SigParse page. All source code is provided as is, with no warranties intended or implied. Use at your own risk. /* Sig ::= MethodDefSig | MethodRefSig | StandAloneMethodSig | FieldSig | PropertySig | LocalVarSig MethodDefSig ::= [[HASTHIS] [EXPLICITTHIS]]…


Creating an IL-rewriting profiler

A frequent topic of discussion between those of us on the CLR Profiling API team at Microsoft and our customers is how to write a profiler that rewrites IL to do cool stuff. Unfortunately, there still is very little documentation on how to do this, and what documentation there is, is rather scattered. I’m not…


CLRProfiler V4 Released

  CLRProfiler V4 is now publicly available.  You may download from here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=be2d842b-fdce-4600-8d32-a3cf74fda5e1 This is of interest both to folks who want a free profiler to diagnose memory issues with their managed apps, and for folks who author profilers of their own, and would like to look at source code of a real-world example of…


Goodbye from Dave

Hello to my millions of readers across the world.  Or, well, maybe 10 readers across the world.  Something like that. Anyway, I wanted to let you all know that the CLR Profiling API is shifting ownership to some other fantastic folks on the CLR team.  So after many years of working on this facet of…


WOW64 and Your Profiler

Has this ever happened to you? My profiler loads and runs great on my 32 bit box. But when I try to run it on a 64 bit box, it never loads. Shouldn’t the WOW just make this all work?! When it comes to running your profilers on 64 bit boxes, there aren’t any special…


Sample: A Signature Blob Parser for your Profiler

8/25/10 Update: The sample code linked below is now also available on the MSDN Code Gallery SigParse page. If your profiler plays with metadata, you’ve undoubtedly come across signature blobs. They’re used to encode type information for method definitions & references, local variables, and a whole lot more. They’re wonderfully compact, recursively versatile, and sometimes,…