[−][src]Function bugsalot::debugger::wait_until_attached
pub fn wait_until_attached<T: Into<Option<Duration>>>(
timeout: T
) -> Result<(), &'static str>
Wait for a debugger to be attached to the current process.
Will return an Err("...")
if the debugger state is unknown, or waiting for the debugger times out.
Platforms
Platform | State | Notes |
---|---|---|
Windows | OK | |
Android | OK | |
Linux | OK | See state() for known bugs, signal type might be wrong/suboptimal for debuggers. |
FreeBSD | ??? | Untested, signal type might be wrong/suboptimal for debuggers |
NetBSD | ??? | Untested, signal type might be wrong/suboptimal for debuggers |
OS X | ??? | Untested, signal type might be wrong/suboptimal for debuggers |
iOS | ??? | Untested, signal type might be wrong/suboptimal for debuggers |
WASM | OK |
Examples
use std::time::Duration; use bugsalot::debugger; // Wait indefinitely for a debugger to attach. debugger::wait_until_attached(None).expect("state() not implemented on this platform"); // Wait up to a timeout for a debugger to attach. if debugger::wait_until_attached(Duration::from_millis(1)).is_ok() { println!("Debugger attached OK!"); } // Timeout can be an Optional duration as well. match debugger::wait_until_attached(Some(Duration::from_millis(1))) { Ok(()) => println!("Debugger attached OK!"), Err(m) => println!("Debugger didn't attach: {}", m), }