You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: Both LLDB and MSVC Debugger ignore imports. MSVC debugger jumps to the main function if there's a breakpoint on an import, LLDB looks for the next breakpoint and ends the debugging session if there's none.
The following are steps to reproduce the issue, which is not being able to debug Zig binaries on Windows with PDB files, and workarounds to make the debugging possible. I tested them on Windows 10 Pro x64 in VS Code, but the first link comes from someone who tried them on NeoVim.
Steps to Reproduce and Observed Behavior
Step 1: Install CodeLLDB extension in VS Code, it integrates the LLDB debugger in VS Code to debug C, C++ and Zig files (maybe more from LLVM).
Step 2: Create the .vscode folder inside the project's folder and create a "launch.json file" inside that folder.
Step 3: Paste the following inside the launch.json file and save it:
Step 4: Try to run the debugger and see that it ignores all breakpoints and only runs the binary.
If you set "stopOnEntry" to true, then VS Code will show you "Exception 0x80000003" between assembly code and the debugger will crash after a few debugging steps.
Note: The same issue happens on Zig 0.12.0 and 0.12.1. I didn't test it with older versions than those.
Workarounds
Create the environment variable for your system LLDB_USE_NATIVE_PDB_READER and set it to 1. Restart VSCode, and CodeLLDB should be able to debug Zig binaries with DPB debug files as intented.
Given that this workaround isn't necessary for debugging C and C++ files it makes me think that Zig creates "broken" PDB files or in a non-standard way.
Both links have a lot of info on how LLDB works on VSCode, I recommend you read them.
LLDB should be able to debug Zig binaries on Windows without issues nor having to use workarounds. On VS Code specifically, when using the CodeLLDB extension or when using LLDB manually from the console.
It would also be nice if Zig had an option to create DWARF files instead of PDB ones to be able to debug the binaries with GDB.
The text was updated successfully, but these errors were encountered:
One more "bug" discovered (I don't if it's really a bug or intented behavior):
Both LLDB and MSVC Debugger ignore imports. MSVC debugger jumps to the nearest function if there's a breakpoint on an import, LLDB looks for the next breakpoint and ends the debugging session if there's none.
Zig Version
0.13.0
EDIT: Both LLDB and MSVC Debugger ignore imports. MSVC debugger jumps to the main function if there's a breakpoint on an import, LLDB looks for the next breakpoint and ends the debugging session if there's none.
The following are steps to reproduce the issue, which is not being able to debug Zig binaries on Windows with PDB files, and workarounds to make the debugging possible. I tested them on Windows 10 Pro x64 in VS Code, but the first link comes from someone who tried them on NeoVim.
Steps to Reproduce and Observed Behavior
Step 1: Install CodeLLDB extension in VS Code, it integrates the LLDB debugger in VS Code to debug C, C++ and Zig files (maybe more from LLVM).
Step 2: Create the .vscode folder inside the project's folder and create a "launch.json file" inside that folder.
Step 3: Paste the following inside the launch.json file and save it:
Step 4: Try to run the debugger and see that it ignores all breakpoints and only runs the binary.
If you set "stopOnEntry" to true, then VS Code will show you "Exception 0x80000003" between assembly code and the debugger will crash after a few debugging steps.
Note: The same issue happens on Zig 0.12.0 and 0.12.1. I didn't test it with older versions than those.
Workarounds
LLDB_USE_NATIVE_PDB_READER
and set it to 1. Restart VSCode, and CodeLLDB should be able to debug Zig binaries with DPB debug files as intented.Given that this workaround isn't necessary for debugging C and C++ files it makes me think that Zig creates "broken" PDB files or in a non-standard way.
Both links have a lot of info on how LLDB works on VSCode, I recommend you read them.
Sources:
https://www.reddit.com/r/neovim/comments/1eeydfp/solving_codelldb_with_dap_not_picking_up_pdb/
https://werat.dev/blog/debugging-wine-with-lldb-and-vscode/
Expected Behavior
LLDB should be able to debug Zig binaries on Windows without issues nor having to use workarounds. On VS Code specifically, when using the CodeLLDB extension or when using LLDB manually from the console.
It would also be nice if Zig had an option to create DWARF files instead of PDB ones to be able to debug the binaries with GDB.
The text was updated successfully, but these errors were encountered: