- 1 year ago
Windows : Print stacktrace in case of a coredump during CI testing
To print a stack trace in case of a coredump during CI testing on Windows, you can use the windbg
debugger tool. Here's an example of how you can set it up:
Install WinDbg: Download and install the Windows Debugger (WinDbg) from the Windows Dev Center (https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/). Choose the version that matches your Windows architecture (32-bit or 64-bit).
Configure Symbol Paths: Configure the symbol paths in WinDbg to allow proper symbol resolution. This will provide more meaningful stack trace information. You can set the symbol path by going to
File -> Symbol File Path
in WinDbg and adding the necessary paths. The symbol server pathSRV*YourSymbolServerPath*http://msdl.microsoft.com/download/symbols
can be a good starting point.Create a Debugging Script: Create a script that can be executed by WinDbg to automatically load the coredump file and print the stack trace. For example, you can create a script called
debug.cmd
with the following content:css.symfix
.reload
k
q
This script configures symbol resolution, reloads symbols, prints the stack trace (
k
command), and then exits (q
command).Integrate in CI Pipeline: Configure your CI pipeline to execute the
windbg
command with the script when a coredump occurs. You can use the following command:makefilewindbg -z path_to_coredump_file -c "$<path_to_debug_script>\debug.cmd"
Replace
path_to_coredump_file
with the actual path to the coredump file, andpath_to_debug_script
with the path to the directory containing thedebug.cmd
script.When a coredump occurs during CI testing, the
windbg
command will be executed with the specified coredump file, and the script will be run to print the stack trace. The output can be captured and logged in your CI pipeline for further analysis.
Remember to adapt the setup to fit your specific CI environment and requirements. Additionally, you may need to adjust the symbol path and configuration based on your project's dependencies and build settings.