Debug with WinDbg

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018

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.

  1. Create a Personal Access Token with Symbols (read) scope and copy it to your clipboard.

  2. Open WinDbg, or install it if you haven't already.

  3. Select File > OpenExecutable to load the executable you wish to debug.

  4. 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
    
  5. Set a breakpoint by running the bp command. this will trigger a symbols request.

  6. 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: