main: add stop_for_debug feature to stop Ares when it starts for a debugger to attach

This commit is contained in:
Edward Amsden 2023-12-15 12:27:17 -06:00
parent f092c482ee
commit 820b1ac57a
2 changed files with 8 additions and 4 deletions

View File

@ -55,3 +55,4 @@ check_acyclic = []
check_forwarding = []
check_junior = []
sham_hints = []
stop_for_debug = []

View File

@ -5,10 +5,13 @@ use std::io;
fn main() -> io::Result<()> {
// debug
// eprintln!("serf: pid {}", std::process::id());
// if unsafe { libc::kill(std::process::id() as i32, libc::SIGSTOP) } != 0 {
// panic!("Could not stop ourselves.");
// };
#[cfg(feature = "stop_for_debug")]
{
eprintln!("serf: pid {}", std::process::id());
if unsafe { libc::kill(std::process::id() as i32, libc::SIGSTOP) } != 0 {
panic!("Could not stop ourselves.");
};
}
let filename = env::args().nth(1).expect("Must provide input filename");