SQL Server PDB Symbols and Callstacks The Easy Way

Lately, I have been doing a lot of work troubleshooting certain behaviors in SQL Server for workloads that are, to put it simply, designed horribly. As a part of this, I have found it necessary to collect callstacks with Extended Events and to materialize them using the debugger symbols for SQL Server to see where exactly certain types of issues are being encountered to better understand some of the internals of newer features in SQL Server 2017 and 2019. Years ago I blogged about how to use the package0.callstack action in Extended Events for this type of thing, and Paul also has a blog post that talks about how to download the PDB symbols for SQL Server as well as a post that also demonstrates using the package0.callstack action to determine what causes a particular wait type. Using the debugging tools to get the symbols is somewhat clunky and tedious, so when I happened on this amazingly simple method of getting symbol files I had to share it.

The SQLCallstackResolver on Github has to be one of the greatest things since sliced bread if you want to materialize callstacks from SQL Server. All you need is the current release of the application, and the appropriate SQL Server binaries, and it will create a Powershell script to download the appropriate symbols files. There is even a Wiki page with scripts for downloading most of the builds for all of the versions of SQL Server but if one happens to not be there, you can run the application, choose the Binn path where that build’s executable and DLL’s are located and it will generate the PowerShell script to download the symbols. What’s even better though is that the application allows you to paste a callstack from any version of SQL Server into the window, point the Symbols path to the appropriate folder with the symbols downloaded, and it uses the Microsoft.Diagnostics.Runtime.dll project to materialize the callstack to the function names and calls. So if you have the output of the callstack and you know what the build of SQL Server is that generated it, you can now materialize the functions with just this application. No need to take a memory dump of SQL Server, no need to use Symchk, no need for trace flag 3656 live in your server, you can copy/paste/resolve in one place.

This is very, very cool!

Leave a Reply

Your email address will not be published. Required fields are marked *

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.