Muokkaa

Jaa


Debug with WinDbg

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

Azure Artifacts provides a dedicated symbols server for publishing symbols. This server allows you to connect a debugger that can automatically fetch the correct symbol files, enabling you to debug your application efficiently. With tools like WinDbg, you can load an executable, attach the debugger to a running process, consume your symbols, set up breakpoints, and systematically analyze your code.

Add 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, and then select OpenExecutable to load the executable you wish to debug.

  4. Run the following command to set the symbols path. Replace the placeholder with your specific 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. During the authentication prompt, insert the personal access token you generated earlier. You can leave the username field empty. WinDbg will proceed to obtain the symbols for your executable.

  7. To verify if your symbols are loaded, run the lm command to list all loaded modules.

Start debugging

WinDbg enhances the scope and versatility of debugging, enabling effective troubleshooting of components in both user-mode and kernel-mode: