DoStackSnapshot Tidbit #3: Callback CONTEXT Registers

In my initial post about DoStackSnapshot, I touched on how and when your profiler can “fill in the holes” by walking the unmanaged parts of the stack itself.  Doing this requires that your profiler have access to a register context at the top of the unmanaged block that you can use to begin your walk. …

2

DoStackSnapshot Tidbit #2: Looney HRESULTs

Generally, corerror.h tells you all you need to know about what kinds of HRESULTs to expect back from DoStackSnapshot.  However, there are some fringe cases where you can get back an HRESULT that’s not as descriptive as you might like. E_FAIL I don’t much like E_FAIL.  If DoStackSnapshot fails, you will typically see a more…

6

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,…

9

sigparse.cpp

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]]…

11

sigformat.cpp

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. #include “SigParse.cpp” // ——————————————————————— // ——————————————————————— // This file demonstrates how to use the general-purpose parser (SigParser) by…

0

PlugInToYourProfiler.cpp

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. #include “SigFormat.cpp” // ——————————————————————— // ——————————————————————— // This file does not compile on its own. It contains snippets…

0

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…

12

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…

12

Who’s the guy with the nifty haircut?

Howdy!  I’m David Broman, and I’ve been a developer on the Common Language Runtime for about a year, focusing on the Profiling API with Jonathan Keljo, Rico Mariani, and many others. Before the CLR, I worked in various MSN groups, including the MSN Newsletters system.  (Sign up for your free email newsletters now!), and the…

4