Skip to content

Commit

Permalink
Rollup merge of rust-lang#39983 - AndrewGaspar:rust-windbg, r=brson
Browse files Browse the repository at this point in the history
Adds rust-windbg.cmd script

Adds rust-gdb/rust-lldb equivalent for windbg that loads the Rust .natvis files on start.

This change modifies the bootstrap code to add rust-windbg to bin and the .natvis files to lib/rustlib/etc.

Example usage from cmd or PowerShell:
```
rust-windbg -c "bu rs_f442289d74765418!rs::main;g" target\debug\rs.exe
```
  • Loading branch information
frewsxcv authored Apr 26, 2017
2 parents 7e7114f + 70e6739 commit 27fbe8c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,12 @@ pub fn debugger_scripts(build: &Build,
install(&build.src.join("src/etc/").join(file), &dst, 0o644);
};
if host.contains("windows-msvc") {
// no debugger scripts
// windbg debugger scripts
install(&build.src.join("src/etc/rust-windbg.cmd"), &sysroot.join("bin"),
0o755);

cp_debugger_script("natvis/libcore.natvis");
cp_debugger_script("natvis/libcollections.natvis");
} else {
cp_debugger_script("debugger_pretty_printers_common.py");

Expand Down
18 changes: 18 additions & 0 deletions src/etc/rust-windbg.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
setlocal

REM Copyright 2014 The Rust Project Developers. See the COPYRIGHT
REM file at the top-level directory of this distribution and at
REM http://rust-lang.org/COPYRIGHT.
REM
REM Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
REM http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
REM <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
REM option. This file may not be copied, modified, or distributed
REM except according to those terms.

for /f "delims=" %%i in ('rustc --print=sysroot') do set rustc_sysroot=%%i

set rust_etc=%rustc_sysroot%\lib\rustlib\etc

windbg -c ".nvload %rust_etc%\libcore.natvis;.nvload %rust_etc%\libcollections.natvis;" %*

0 comments on commit 27fbe8c

Please sign in to comment.