-
-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy .pdb
files to Editable Installations
and Wheel
s for easier debugging on windows
#2213
Comments
I don’t have experience developing on macOS, so please correct me if I’m wrong. For macOS, I think this issue can be alleviated by setting But for MSVC, only If
meson-python seems to copy According to their documentation, they seem to have strong support for development debugging.
See also mesonbuild/meson#10639
This suggests that pandas includes Personally, I like to include debug information even in release builds. I agree with this perspective. |
The workaround is copy the I'm in favor of adding the support, but it should be considered for all major supported platforms. As always, pull requests are welcome! |
But it's really painful😫.
You're right, I realized this while searching for related issues on GitHub.
Thanks! I might give it a try this weekend if I have time, but I don’t have a macOS to test on. |
Thanks for the workaround! I never would have figured that out on my own. |
This is exactly what PR #2220 does, but that PR still has some finishing work to be done. Unfortunately, I have almost no time to push it. |
Copy
.pdb
files toEditable Installations
andWheel
s for easier debugging on windowsHi team, first of all, thank you for developing this awesome tool.
Is your feature request related to a problem? Please describe
I have a project that uses the Mixed Rust/Python layout. After running
maturin dev
, the project layout looks like this:I then started debugging, but was surprised to find that I couldn’t set breakpoints and saw
<unknown>
entries in the Rust panic backtrace:I realized this was likely due to the
lib_name.cp310-win_amd64.pyd
/.dll
not finding the corresponding.pdb
file.Specifically,
cargo build
produces bothlib_name.dll
andlib_name.pdb
in the same directory (target\debug\
), so there is no problem. However, bothmaturin dev
andmaturin build
only copy thelib_name.dll
to another directory without copying thelib_name.pdb
, causing the above issue.Describe the solution you'd like
Running
$env:RUSTFLAGS="--print=link-args"; cargo build
, I observed thatrustc
emits the linker flags/DEBUG
and/PDBALTPATH:%_PDB%
.This means that as long as
lib_name.cp310-win_amd64.pyd
andlib_name.pdb
are in the same directory, the debug information should load correctly.After I manually copied
target\debug\lib_name.pdb
tomy_project\lib_name.pdb
, the issue was resolved.Describe your feature request
I would like
maturin
to automatically copy the.pdb
files to the editable installation directory (my_project\
) and also include them in the wheel.Since developers may not always generate
.pdb
files, or might modify the/PDBALTPATH:%_PDB%
flag, I suggest adding a--pdb[=relative_path]
option tomaturin
.--pdb
option is specified,maturin
should copy the.pdb
file (with the same name aslib_name.dll
) tomy_project\lib_name.pdb
and include it in the wheel.--pdb="foo\bar.pdb"
is specified,maturin
should copy the.pdb
file tomy_project\foo\bar.pdb
and place it in the corresponding location in the wheel./PDBALTPATH:<relative_path>
This would only affect Windows, as debugging information on Linux and macOS can be included within the library file.
Describe alternatives you've considered
Manually copying the
.pdb
files.Rejection 1
See https://learn.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2022
This means manually copying
.pdb
files every timematurin dev
is re-run, which is not ideal.Rejection 2
Even if developers manually copy the
.pdb
files, they cannot include them in the wheel.Additional context
For local development, the debugging experience without
.pdb
files is very poor, as I am unable to set breakpoints.For wheel users, not having
.pdb
files means that Rust panic backtraces will only show<unknown>
entries, making it harder to report issues to developers. You can see an example here.The text was updated successfully, but these errors were encountered: