diff options
Diffstat (limited to 'src/gdb.rs')
| -rw-r--r-- | src/gdb.rs | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1,4 +1,4 @@ -// Copyright (c) 2025 taitep +// Copyright (c) 2025-2026 taitep // SPDX-License-Identifier: BSD-2-Clause // // This file is part of TRVE (https://gitea.taitep.se/taitep/trve) @@ -7,7 +7,6 @@ use std::{ io::{self, BufRead, ErrorKind, Write}, net::{TcpListener, TcpStream}, - sync::mpsc, }; use crate::{ @@ -29,7 +28,7 @@ pub(crate) enum DebugCommand { ExitDebugMode, } -pub struct DebugStream(pub(crate) mpsc::Receiver<DebugCommand>); +pub struct DebugStream(pub(crate) crossbeam::channel::Receiver<DebugCommand>); #[derive(Clone, Copy, Debug)] pub(crate) enum StopReason { @@ -68,13 +67,13 @@ pub(crate) struct RegsResponse { pub pc: u64, } -pub fn run_stub(cmd_sender: mpsc::Sender<CoreCmd>) { +pub fn run_stub(cmd_sender: crossbeam::channel::Sender<CoreCmd>) { std::thread::spawn(move || { let listener = TcpListener::bind("127.0.0.1:1234").expect("couldnt start tcp listener"); for stream_res in listener.incoming() { if let Ok(stream) = stream_res { - let (dbg_tx, dbg_rx) = mpsc::channel(); + let (dbg_tx, dbg_rx) = crossbeam::channel::bounded(16); stream .set_nonblocking(true) @@ -92,7 +91,7 @@ pub fn run_stub(cmd_sender: mpsc::Sender<CoreCmd>) { fn handle_gdb_connection( gdb_stream: TcpStream, - dbg_tx: mpsc::Sender<DebugCommand>, + dbg_tx: crossbeam::channel::Sender<DebugCommand>, ) -> io::Result<()> { eprintln!("gdb connected"); let mut reader = io::BufReader::new(gdb_stream.try_clone()?); @@ -152,7 +151,7 @@ fn read_rsp_packet<R: BufRead>(reader: &mut R) -> io::Result<String> { fn handle_packet<W: Write, R: BufRead>( packet: &str, writer: &mut W, - dbg_tx: &mpsc::Sender<DebugCommand>, + dbg_tx: &crossbeam::channel::Sender<DebugCommand>, reader: &mut R, ) -> io::Result<()> { writer.write_all(b"+")?; |
