From 03764c2b853de4de43e8725b1a7a6fba2881a9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Pi=C3=A9ton?= Date: Mon, 10 Jun 2019 12:13:01 +0200 Subject: [PATCH 1/2] fix command line parsing for '-p'. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8321832..6b3f9c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,7 +51,7 @@ fn main() { if args.len() > 2 { for (i, arg) in args[1..].iter().enumerate() { if arg == "-p" { - pid = Some(arg.parse().unwrap()); + pid = Some(args[i+2].parse().unwrap()); } else if arg == "--verbose" { verbose_mode_enabled = true; From 0a11aca0a1af003e6e3fb8d497896d2266db328e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Pi=C3=A9ton?= Date: Mon, 10 Jun 2019 12:15:16 +0200 Subject: [PATCH 2/2] Add Thread-ID to output. --- libs/debugger/src/debugger.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libs/debugger/src/debugger.rs b/libs/debugger/src/debugger.rs index 911473e..fc432b4 100644 --- a/libs/debugger/src/debugger.rs +++ b/libs/debugger/src/debugger.rs @@ -154,8 +154,8 @@ pub struct Debugger<'a> { /// List of all PCs we hit during execution /// Keyed by PC - /// Tuple is (module, offset, symbol+offset, frequency) - coverage: HashMap, usize, String, u64)>, + /// Tuple is (module, offset, symbol+offset, frequency, threadid) + coverage: HashMap, usize, String, u64, u32)>, /// Set of DLL names and the corresponding DLL base modules: HashSet<(String, usize)>, @@ -679,7 +679,7 @@ impl<'a> Debugger<'a> { let funcoff = format!("{}+0x{:x}", bp.funcname, bp.funcoff); self.coverage.insert(addr, - (bp.modname.clone(), bp.offset, funcoff.clone(), 0)); + (bp.modname.clone(), bp.offset, funcoff.clone(), 0, tid)); } // Update coverage frequencies @@ -693,10 +693,10 @@ impl<'a> Debugger<'a> { if self.bp_print { let funcoff = format!("{}+0x{:x}", bp.funcname, bp.funcoff); mprint!(self, "{:8} of {:8} hit | {:10} freq | 0x{:x} | \ - {:>20}+0x{:08x} | {}\n", + {:>20}+0x{:08x} | {} | {}\n", self.coverage.len(), self.breakpoints.len(), freq, - addr, bp.modname, bp.offset, funcoff); + addr, bp.modname, bp.offset, funcoff, tid); } self.get_context(tid); @@ -841,11 +841,11 @@ impl<'a> Debugger<'a> { File::create("coverage.txt") .expect("Failed to open freq coverage file")); - for (pc, (module, offset, symoff, freq)) in self.coverage.iter() { + for (pc, (module, offset, symoff, freq, tid)) in self.coverage.iter() { write!(fd, "{:016x} | Freq: {:10} | \ - {:>20}+0x{:08x} | {}\n", - pc, freq, module, offset, symoff) + {:>20}+0x{:08x} | {} | {}\n", + pc, freq, module, offset, symoff, tid) .expect("Failed to write coverage info"); } @@ -989,7 +989,7 @@ impl<'a> Debugger<'a> { let filename = self.get_crash_filename( &self.context, &mut exception.ExceptionRecord); - mprint!(self, "Got crash: {}\n", filename); + mprint!(self, "Got crash (ThreadID: {}): {}\n", tid, filename); if !Path::new(&filename).is_file() { // Remove all breakpoints in the program