From c9bfa05ca72819b11e9868d105d06ee76aabec11 Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Sun, 11 Sep 2022 23:06:56 +0300 Subject: [PATCH] arm7tdmi small fixes Former-commit-id: cf1e2f885c6ea6574fb1bbcab395ef2b8cb6c81d Former-commit-id: 3738bcf43df5af77ad30c2388e52ff2e3a6f110a --- arm7tdmi/src/gdb/mod.rs | 6 +++++- arm7tdmi/src/gdb/target.rs | 2 +- arm7tdmi/src/simple_memory.rs | 6 ++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arm7tdmi/src/gdb/mod.rs b/arm7tdmi/src/gdb/mod.rs index 7927d91..8a7ec01 100644 --- a/arm7tdmi/src/gdb/mod.rs +++ b/arm7tdmi/src/gdb/mod.rs @@ -6,9 +6,13 @@ use log::info; mod breakpoints; pub mod target; +// Re-export the gdbstub crate +pub extern crate gdbstub; +pub extern crate gdbstub_arch; + /// Wait for tcp connection on port pub fn wait_for_connection(port: u16) -> io::Result { - let bind_addr = format!("localhost:{port}"); + let bind_addr = format!("0.0.0.0:{port}"); let sock = TcpListener::bind(bind_addr)?; info!("waiting for connection"); diff --git a/arm7tdmi/src/gdb/target.rs b/arm7tdmi/src/gdb/target.rs index c6f7b88..6fc3b4a 100644 --- a/arm7tdmi/src/gdb/target.rs +++ b/arm7tdmi/src/gdb/target.rs @@ -18,7 +18,7 @@ pub trait MemoryGdbInterface: MemoryInterface + DebugRead { impl Target for Arm7tdmiCore { type Error = (); - type Arch = gdbstub_arch::arm::Armv4t; // as an example + type Arch = gdbstub_arch::arm::Armv4t; #[inline(always)] fn base_ops(&mut self) -> BaseOps { diff --git a/arm7tdmi/src/simple_memory.rs b/arm7tdmi/src/simple_memory.rs index 1037c9b..df0e561 100644 --- a/arm7tdmi/src/simple_memory.rs +++ b/arm7tdmi/src/simple_memory.rs @@ -75,9 +75,7 @@ impl MemoryGdbInterface for SimpleMemory { "http://sourceware.org/gdb/gdb-memory-map.dtd"> - "#, self.data.len()) - .trim() - .as_bytes(); - copy_range_to_buf(memory_map, offset, length, buf) + "#, self.data.len()); + copy_range_to_buf(memory_map.trim().as_bytes(), offset, length, buf) } }