Fix some warnings

This commit is contained in:
2025-12-27 11:55:19 +01:00
parent 9f8e9ec380
commit 67406a9c48
4 changed files with 8 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ use crate::{
core::commands::CoreCmd, core::commands::CoreCmd,
decode::Instruction, decode::Instruction,
exceptions::ExceptionType, exceptions::ExceptionType,
gdb::{self, DebugCommand, StopReason}, gdb::{self, DebugCommand, DebugStream, StopReason},
instructions::find_and_exec, instructions::find_and_exec,
mem::MemConfig, mem::MemConfig,
}; };
@@ -39,7 +39,7 @@ impl Core {
loop { loop {
if let Ok(cmd) = self.command_stream.try_recv() { if let Ok(cmd) = self.command_stream.try_recv() {
match cmd { match cmd {
CoreCmd::EnterDbgMode(dbg_stream) => { CoreCmd::EnterDbgMode(DebugStream(dbg_stream)) => {
let _ = self.debug_loop(dbg_stream); let _ = self.debug_loop(dbg_stream);
} }
}; };
@@ -57,7 +57,7 @@ impl Core {
if let Ok(cmd) = self.command_stream.recv() { if let Ok(cmd) = self.command_stream.recv() {
eprintln!("Recieved a command"); eprintln!("Recieved a command");
match cmd { match cmd {
CoreCmd::EnterDbgMode(dbg_stream) => { CoreCmd::EnterDbgMode(DebugStream(dbg_stream)) => {
let _ = self.debug_loop(dbg_stream); let _ = self.debug_loop(dbg_stream);
} }
}; };

View File

@@ -1,7 +1,5 @@
use std::sync::mpsc;
use crate::gdb; use crate::gdb;
pub enum CoreCmd { pub enum CoreCmd {
EnterDbgMode(mpsc::Receiver<gdb::DebugCommand>), EnterDbgMode(gdb::DebugStream),
} }

View File

@@ -24,6 +24,8 @@ pub(crate) enum DebugCommand {
ExitDebugMode, ExitDebugMode,
} }
pub struct DebugStream(pub(crate) mpsc::Receiver<DebugCommand>);
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub(crate) enum StopReason { pub(crate) enum StopReason {
Exception(ExceptionType), Exception(ExceptionType),
@@ -74,7 +76,7 @@ pub fn run_stub(cmd_sender: mpsc::Sender<CoreCmd>) {
.expect("Couldnt set TCP stream to nonblocking"); .expect("Couldnt set TCP stream to nonblocking");
cmd_sender cmd_sender
.send(CoreCmd::EnterDbgMode(dbg_rx)) .send(CoreCmd::EnterDbgMode(DebugStream(dbg_rx)))
.expect("couldnt ask core to enter debug mode"); .expect("couldnt ask core to enter debug mode");
handle_gdb_connection(stream, dbg_tx).expect("failure during connection"); handle_gdb_connection(stream, dbg_tx).expect("failure during connection");

View File

@@ -4,7 +4,7 @@
// This file is part of TRVE (https://gitea.taitep.se/taitep/trve) // This file is part of TRVE (https://gitea.taitep.se/taitep/trve)
// See LICENSE file in the project root for full license text. // See LICENSE file in the project root for full license text.
use std::{env, path::PathBuf, sync::Arc, time::Duration}; use std::{path::PathBuf, sync::Arc, time::Duration};
use clap::Parser; use clap::Parser;