Skip to content
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

Shorten panic messages #360

Merged
merged 4 commits into from Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev
Paths are hard
  • Loading branch information
mkeeter committed Jan 11, 2022
commit 8835526ceaf304a3461fc07e53473a479d3aadd8

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -19,6 +19,7 @@ goblin = { version = "0.4.3", features = ["std", "elf32", "endian_fd"] }
serde_json = "1.0.56"
path-slash = "0.1.3"
ctrlc = "3.1.5"
dunce = "1.0.2"
# a feature of zip we use is deprecated in 0.5.7, so let's make sure we stay
# on the version that works for us
zip = "=0.5.6"
@@ -148,7 +148,11 @@ pub fn package(
let remap_paths = {
let mut remap_paths = HashMap::new();

let cargo_home = fs::canonicalize(std::env::var("CARGO_HOME")?)?;
// On Windows, std::fs::canonicalize returns a UNC path, i.e. one
// beginning with "\\hostname\". However, rustc expects a non-UNC
// path for its --remap-path-prefix argument, so we use
// `dunce::canonicalize` instead
let cargo_home = dunce::canonicalize(std::env::var("CARGO_HOME")?)?;
let mut cargo_git = cargo_home.clone();
cargo_git.push("git");
cargo_git.push("checkouts");
@@ -167,7 +171,7 @@ pub fn package(
remap_paths.insert(cargo_registry, "/crates.io");

let mut hubris_dir =
fs::canonicalize(std::env::var("CARGO_MANIFEST_DIR")?)?;
dunce::canonicalize(std::env::var("CARGO_MANIFEST_DIR")?)?;
hubris_dir.pop(); // Remove "build/xtask"
hubris_dir.pop();
remap_paths.insert(hubris_dir, "/hubris");
@@ -540,12 +544,17 @@ pub fn package(
)?;
}
for (path, remap) in &remap_paths {
writeln!(
gdb_script,
"set substitute-path {} {}",
remap,
path.display()
)?;
let mut path_str = path
.to_str()
.ok_or(anyhow!("Could not convert path{:?} to str", path))?
.to_string();

// Even on Windows, GDB expects path components to be separated by '/',
// so we tweak the path here so that remapping works.
if cfg!(windows) {
path_str = path_str.replace("\\", "/");
}
writeln!(gdb_script, "set substitute-path {} {}", remap, path_str)?;
}
drop(gdb_script);