mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
xous: hosted: attach to debugger on panic
When a `panic!()` is hit and we're running in a hosted environment, attach a debugger using `debug-here`. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
0bce0eeb53
commit
67adccf16a
2 changed files with 15 additions and 0 deletions
|
|
@ -24,3 +24,4 @@ default = []
|
|||
[target.'cfg(any(windows,unix))'.dependencies]
|
||||
lazy_static = "1.4"
|
||||
hex = "0.4"
|
||||
debug-here = "*"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,19 @@ pub use syscall::*;
|
|||
#[cfg(not(target_os = "none"))]
|
||||
pub use arch::ProcessArgsAsThread;
|
||||
|
||||
#[cfg(target_os = "none")]
|
||||
pub fn init() {}
|
||||
|
||||
#[cfg(not(target_os = "none"))]
|
||||
pub fn init() {
|
||||
use std::panic;
|
||||
panic::set_hook(Box::new(|arg| {
|
||||
println!("PANIC!");
|
||||
println!("Details: {:?}", arg);
|
||||
debug_here::debug_here!();
|
||||
}));
|
||||
}
|
||||
|
||||
/// Convert a four-letter string into a 32-bit int.
|
||||
#[macro_export]
|
||||
macro_rules! make_name {
|
||||
|
|
@ -39,6 +52,7 @@ macro_rules! maybe_main {
|
|||
extern "Rust" {
|
||||
fn xous_entry() -> !;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
xous::arch::ensure_connection().unwrap();
|
||||
unsafe { xous_entry() };
|
||||
|
|
|
|||
Loading…
Reference in a new issue