Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #410 from knurling-rs/simplify-canary
Browse files Browse the repository at this point in the history
Simplify canary
  • Loading branch information
Urhengulas authored Jun 22, 2023
2 parents e8b4cb8 + 1b2140b commit 4cf82a9
Show file tree
Hide file tree
Showing 12 changed files with 192 additions and 192 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

- [#410] Simplify canary
- [#405] Also enable merge queue for changelog enforcer
- [#404] Switch from bors to merge queue
- [#402] Do not panic if locations do not contain the frame

[#410]: https://github.com/knurling-rs/probe-run/pull/410
[#405]: https://github.com/knurling-rs/probe-run/pull/405
[#404]: https://github.com/knurling-rs/probe-run/pull/404
[#402]: https://github.com/knurling-rs/probe-run/pull/402
Expand Down
23 changes: 11 additions & 12 deletions src/backtrace/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::Path;
use std::path::PathBuf;

use probe_rs::Core;
use signal_hook::consts::signal;
Expand Down Expand Up @@ -27,36 +27,36 @@ impl From<&String> for BacktraceOptions {
}
}

pub struct Settings<'p> {
pub struct Settings {
pub backtrace_limit: u32,
pub backtrace: BacktraceOptions,
pub canary_touched: bool,
pub current_dir: &'p Path,
pub current_dir: PathBuf,
pub halted_due_to_signal: bool,
pub include_addresses: bool,
pub shorten_paths: bool,
pub stack_overflow: bool,
}

impl<'p> Settings<'p> {
impl Settings {
pub fn new(
canary_touched: bool,
current_dir: &'p Path,
current_dir: PathBuf,
halted_due_to_signal: bool,
opts: &Opts,
stack_overflow: bool,
) -> Self {
Self {
backtrace_limit: opts.backtrace_limit,
backtrace: (&opts.backtrace).into(),
canary_touched,
current_dir,
halted_due_to_signal,
include_addresses: opts.verbose > 0,
shorten_paths: opts.shorten_paths,
stack_overflow,
}
}

fn panic_present(&self) -> bool {
self.canary_touched || self.halted_due_to_signal
self.stack_overflow || self.halted_due_to_signal
}
}

Expand All @@ -65,11 +65,10 @@ pub fn print(
core: &mut Core,
elf: &Elf,
target_info: &TargetInfo,
settings: &mut Settings<'_>,
settings: &mut Settings,
) -> anyhow::Result<Outcome> {
let mut unwind = unwind::target(core, elf, target_info);

let frames = symbolicate::frames(&unwind.raw_frames, settings.current_dir, elf);
let frames = symbolicate::frames(&unwind.raw_frames, &settings.current_dir, elf);

let contains_exception = unwind
.raw_frames
Expand Down
Loading

0 comments on commit 4cf82a9

Please sign in to comment.