-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add the GDB pretty-printers to the Windows Rust installation #29658
Comments
At the end of 2014, you can debug Rust file on gdb with pretty-printer support. So I think someone fixed that problem that bothered @michaelwoerister at that time (for once). |
Sorry , just discovered this issue now. The problem at the time was that on two out of three Windows systems that I tested things on, GDB would hang indefinitely when trying to load the program. I'd say there is no harm in adding the python scripts to the Windows installation. About the |
Hi ! Is this still an issue ? |
@michaelwoerister Do you know if this has been fixed? |
I don't really know what the state of GDB on Windows is these days. @brson would know more about what we distribute on which platforms. My statement from before is still true: I have no problem with distributing the python scripts on Windows and someone would need to test if the |
Looking at a recent nightly, it seems we do distribute the pretty printing scripts and rust-gdb on windows. We don't insert the rust/src/librustc_trans/debuginfo/gdb.rs Lines 85 to 88 in 80271e8
|
Because it made GDB on Windows hang or crash at the time this code was written. |
Is there any progress on this topic? |
Did anyone re-try it with latest versions of everything since this statement was made 15 months ago?
What do you suggest instead? Is there any other debugger for Windows well integrated in the Rust toolchain? cc @Boereck |
I was searching how Rust debugging can be done in VS Code and found the C++ extension supports debugging via MSVC. The C++ extension uses the debug adapter protocol. Looking at the source code and package.json file, it looks like the DAP server is downloaded here. But reading the |
Thanks for checking @Boereck |
At least I haven't had a problem with a hanging MinGW (GDB version 8.1 and 8.2). Maybe it is time to check if the hanging is still occurring with recent GCC builds. Powershell: # Exit if anything fails
$ErrorActionPreference = "Stop"
# Find out where the pretty printer Python module is
$RUSTC_SYSROOT = rustc --print=sysroot
$GDB_PYTHON_MODULE_DIRECTORY = "$RUSTC_SYSROOT\lib\rustlib\etc" #-replace '\\','/'
if ($LASTEXITCODE -ne 0) {
throw "rustc exited with $LASTEXITCODE"
}
# Run GDB with the additional arguments that load the pretty printers
# Set the environment variable `RUST_GDB` to overwrite the call to a
# different/specific command (defaults to `gdb`).
if (Test-Path env:RUST_GDB) {
$RUST_GDB = $env:RUST_GDB
} else {
$RUST_GDB = "gdb"
}
$PYTHONPATH="$env:PYTHONPATH;$GDB_PYTHON_MODULE_DIRECTORY"
& "$RUST_GDB" --directory="$GDB_PYTHON_MODULE_DIRECTORY" -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" $args Batch: @echo off
REM Find out where the pretty printer Python module is
for /f %%s in ('rustc --print=sysroot') do SET RUSTC_SYSROOT=%%s
REM appearently %errorlevel% does not get set in code above, so let's check for RUSTC_SYSROOT
if not defined RUSTC_SYSROOT ( exit /b 1 )
SET GDB_PYTHON_MODULE_DIRECTORY=%RUSTC_SYSROOT%\lib\rustlib\etc
REM Run GDB with the additional arguments that load the pretty printers
REM Set the environment variable `RUST_GDB` to overwrite the call to a
REM different/specific command (defaults to `gdb`).
if not defined RUST_GDB ( SET RUST_GDB=gdb )
if not defined PYTHONPATH (
SET PYTHONPATH=%GDB_PYTHON_MODULE_DIRECTORY%
) else (
SET PYTHONPATH=%PYTHONPATH%;%GDB_PYTHON_MODULE_DIRECTORY%
)
%RUST_GDB% --directory="%GDB_PYTHON_MODULE_DIRECTORY%" -iex "add-auto-load-safe-path %GDB_PYTHON_MODULE_DIRECTORY%" %* Edit: Deleted duplicate functionality from batch file. |
Distributing these scripts seems to be pretty easy to do, with a tweak in https://github.com/rust-lang/rust/blob/master/src/bootstrap/dist.rs#L591-L614 |
Is there any update on this? Shipping a Windows script for |
See also: |
Yep, heppening todat also. |
The pretty printers can be made to work in Windows, as described here: http://stackoverflow.com/questions/33570021/how-to-set-up-gdb-for-debugging-rust-programs-in-windows/33570022#33570022
At a minimum the GDB pretty-printers should be added to the Windows GNU ABI Rust installation, so that they don't have to downloaded separately.
At best, the pretty-printers GDB auto-loading should work as well. I think for that the GDB auto-load info should be added to the debug information of the generated code in Windows.
@michaelwoerister Regarding this comment: #16365 (comment) , what issues did you have trying this out in Windows?
The text was updated successfully, but these errors were encountered: