Debug with WinDbg
TFS 2017
Azure Artifacts offers a dedicated symbols server to publish your symbols. You can connect a debugger to automatically retrieve the correct symbol files and debug your application. Using WinDbg, you can load an executable or attach the debugger to a running process, consume your symbols, set up breakpoints, and step through and analyze your code.
Add the symbol server to WinDbg
To use the Azure Artifacts symbol server, you must add your organization to the symbols search path, but before we can do that, we must first create a personal access token.
Create a Personal Access Token with Symbols (read) scope and copy it to your clipboard.
Open WinDbg, or install it if you haven't already.
Select File > OpenExecutable to load the executable you wish to debug.
Run the following command to set the symbols path. Replace the placeholder <ORGANIZATION_NAME> with your organization name:
.sympath+ https://artifacts.dev.azure.com/<ORGANIZATION_NAME>/_apis/symbol/symsrv
Set a breakpoint by running the bp command. this will trigger a symbols request.
In the authentication prompt, paste your personal access token that you created earlier. You can leave the username field blank.
WinDbg should then acquire the symbols for your executable. To verify if your symbols are loaded, run the lm command to list all loaded modules.
Start debugging
With WinDbg, you can debug both kernel-mode and user-mode components:
- Getting started with WinDbg (user-mode).
- Getting started with WinDbg (kernel-mode).
- Using the WinDbg Graphical Interface.
- Using the Debugger Command Window.