Check that the core is halted before attempting to print a backtrace, as it will fail otherwise.
@@ -184,6 +184,9 @@ impl DebugCli {
help_text: "Show backtrace",
function: |cli_data, _args| {
+ let status = cli_data.core.status()?;
+
+ if status.is_halted() {
let regs = cli_data.core.registers();
let program_counter = cli_data.core.read_core_reg(regs.program_counter())?;
@@ -196,6 +199,9 @@ impl DebugCli {
} else {
println!("No debug information present!");
}
+ } else {
+ println!("Core must be halted for a backtrace.");
+ }
Ok(CliState::Continue)
},
