range out of bounds (probe-rs host-side)
Today, I suddenly got the following error when testing the feature/testing branch of probe-rs
/usr/bin/cargo test --color=always --package embedded-test-example --test example_test --no-fail-fast -- --format=json -Z unstable-options --show-output Testing started at 3:39 AM ... Finished
testprofile [unoptimized + debuginfo] target(s) in 0.11s Running tests/example_test.rs (target/riscv32imac-unknown-none-elf/debug/deps/example_test-15696883cefc5ae6) Finished in 2.162s thread 'main' panicked at probe-rs/src/probe/espusbjtag/protocol.rs:361:37: range end index 112 out of range for slice of length 64 stack backtrace: 0: rust_begin_unwind at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5 1: core::panicking::panic_fmt at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14 2: core::slice::index::slice_end_index_len_fail_rt at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:76:5 3: core::slice::index::slice_end_index_len_fail at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/slice/index.rs:68:9 4: probe_rs::probe::espusbjtag::protocol::ProtocolHandler::send_buffer 5: probe_rs::probe::espusbjtag::protocol::ProtocolHandler::flush 6: probe_rs::probe::common::<impl probe_rs::probe::JTAGAccess for Probe>::write_register_batch 7: probe_rs::architecture::riscv::dtm::Dtm::execute 8: probe_rs::architecture::riscv::dtm::Dtm::read_deferred_result 9: probe_rs::architecture::riscv::communication_interface::RiscvCommunicationInterface::read_dm_register_untyped 10: probe_rs::architecture::riscv::communication_interface::RiscvCommunicationInterface::read_dm_register 11: probe_rs::architecture::riscv::communication_interface::RiscvCommunicationInterface::execute_abstract_command 12: probe_rs::architecture::riscv::communication_interface::RiscvCommunicationInterface::abstract_cmd_register_read 13: probe_rs::architecture::riscv::Riscv32::read_csr 14: <probe_rs::architecture::riscv::Riscv32 as probe_rs::core::CoreInterface>::debug_on_sw_breakpoint 15: <probe_rs::architecture::riscv::Riscv32 as probe_rs::core::CoreInterface>::debug_core_stop 16: <probe_rs::session::Session as core::ops::drop::Drop>::drop 17: core::ptr::drop_in_place<probe_rs::session::Session> 18: alloc::sync::Arc<T,A>::drop_slow 19: probe_rs::cmd::test::Cmd::run 20: probe_rs::main note: Some details are omitted, run withRUST_BACKTRACE=fullfor a verbose backtrace. error: test failed, to rerun pass-p embedded-test-example --test example_testerror: 1 target failed:-p embedded-test-example --test example_testProcess finished with exit code 101
This isn't embedded-test specific, this issue pops up from time to time in probe-rs. I don't know what causes it, unfortunately - the device doesn't send back bits probe-rs expects, but whether it's caused by the device restarting or the bits getting lost in transit or processing, I can't tell.