mirror of
https://github.com/obhq/obliteration.git
synced 2024-11-23 03:09:52 +00:00
Updates some dependencies, minor refactors (#1120)
This commit is contained in:
parent
582fd110b2
commit
c25bf3e09d
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -740,9 +740,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.20"
|
||||
version = "4.5.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
|
||||
checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@ -750,9 +750,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.20"
|
||||
version = "4.5.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
|
||||
checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@ -2482,9 +2482,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.158"
|
||||
version = "0.2.164"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
||||
checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
@ -4115,9 +4115,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.86"
|
||||
version = "2.0.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c"
|
||||
checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -4515,9 +4515,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.10.0"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
|
||||
checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"serde",
|
||||
|
@ -19,11 +19,11 @@ qt = []
|
||||
[dependencies]
|
||||
bitfield-struct = "0.9.2"
|
||||
ciborium = "0.2.2"
|
||||
clap = { version = "4.5.20", features = ["derive"], optional = true }
|
||||
clap = { version = "4.5.21", features = ["derive"], optional = true }
|
||||
gdbstub = "0.7.3"
|
||||
gdbstub_arch = "0.3.1"
|
||||
humansize = "2.1.3"
|
||||
libc = "0.2.155"
|
||||
libc = "0.2.164"
|
||||
obconf = { path = "../src/obconf", features = ["serde", "virt"] }
|
||||
obfw = { git = "https://github.com/obhq/firmware-dumper.git", features = [
|
||||
"read",
|
||||
@ -35,7 +35,7 @@ pkg = { path = "../src/pkg" }
|
||||
rfd = { version = "0.14.0", optional = true }
|
||||
serde = { version = "1.0.209", features = ["derive"] }
|
||||
thiserror = "1.0"
|
||||
uuid = { version = "1.10.0", features = ["serde", "v4"] }
|
||||
uuid = { version = "1.11.0", features = ["serde", "v4"] }
|
||||
|
||||
[dependencies.slint]
|
||||
version = "1.8.0"
|
||||
|
@ -3,9 +3,7 @@ use crate::debug::DebugClient;
|
||||
use crate::error::RustError;
|
||||
use crate::profile::Profile;
|
||||
use crate::screen::Screen;
|
||||
use gdbstub::common::Signal;
|
||||
use gdbstub::stub::state_machine::GdbStubStateMachine;
|
||||
use gdbstub::stub::MultiThreadStopReason;
|
||||
use std::ffi::{c_char, c_void, CStr};
|
||||
use std::ptr::null_mut;
|
||||
use std::sync::atomic::Ordering;
|
||||
@ -78,52 +76,13 @@ pub unsafe extern "C" fn vmm_draw(vmm: *mut Vmm) -> *mut RustError {
|
||||
pub unsafe extern "C" fn vmm_dispatch_debug(vmm: *mut Vmm, stop: *mut KernelStop) -> DebugResult {
|
||||
// Consume stop reason now to prevent memory leak.
|
||||
let vmm = &mut *vmm;
|
||||
let mut stop = if stop.is_null() {
|
||||
let stop = if stop.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(Box::from_raw(stop).0)
|
||||
};
|
||||
|
||||
loop {
|
||||
// Check current state.
|
||||
let r = match vmm.gdb.take().unwrap() {
|
||||
GdbStubStateMachine::Idle(s) => match super::debug::dispatch_idle(&mut vmm.cpu, s) {
|
||||
Ok(Ok(v)) => Ok(v),
|
||||
Ok(Err(v)) => {
|
||||
// No pending data from the debugger.
|
||||
vmm.gdb = Some(v.into());
|
||||
return DebugResult::Ok;
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
},
|
||||
GdbStubStateMachine::Running(s) => {
|
||||
match super::debug::dispatch_running(&mut vmm.cpu, s, stop.take()) {
|
||||
Ok(Ok(v)) => Ok(v),
|
||||
Ok(Err(v)) => {
|
||||
// No pending data from the debugger.
|
||||
vmm.gdb = Some(v.into());
|
||||
return DebugResult::Ok;
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
GdbStubStateMachine::CtrlCInterrupt(s) => {
|
||||
vmm.cpu.lock();
|
||||
|
||||
s.interrupt_handled(
|
||||
&mut vmm.cpu,
|
||||
Some(MultiThreadStopReason::Signal(Signal::SIGINT)),
|
||||
)
|
||||
.map_err(|e| RustError::with_source("couldn't handle CTRL+C from a debugger", e))
|
||||
}
|
||||
GdbStubStateMachine::Disconnected(_) => return DebugResult::Disconnected,
|
||||
};
|
||||
|
||||
match r {
|
||||
Ok(v) => vmm.gdb = Some(v),
|
||||
Err(e) => return DebugResult::Error { reason: e.into_c() },
|
||||
}
|
||||
}
|
||||
vmm.dispatch_debug(stop)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -11,6 +11,7 @@ use crate::hv::{Hypervisor, Ram};
|
||||
use crate::profile::Profile;
|
||||
use crate::screen::Screen;
|
||||
use cpu::GdbError;
|
||||
use gdbstub::common::Signal;
|
||||
use gdbstub::stub::state_machine::GdbStubStateMachine;
|
||||
use gdbstub::stub::{GdbStubError, MultiThreadStopReason};
|
||||
use kernel::{KernelError, ProgramHeaderError};
|
||||
@ -345,6 +346,53 @@ impl Vmm {
|
||||
|
||||
Ok(vmm)
|
||||
}
|
||||
|
||||
fn dispatch_debug(&mut self, mut stop: Option<MultiThreadStopReason<u64>>) -> DebugResult {
|
||||
loop {
|
||||
// Check current state.
|
||||
let r = match self.gdb.take().unwrap() {
|
||||
GdbStubStateMachine::Idle(s) => {
|
||||
match debug::dispatch_idle(&mut self.cpu, s) {
|
||||
Ok(Ok(v)) => Ok(v),
|
||||
Ok(Err(v)) => {
|
||||
// No pending data from the debugger.
|
||||
self.gdb = Some(v.into());
|
||||
return DebugResult::Ok;
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
GdbStubStateMachine::Running(s) => {
|
||||
match debug::dispatch_running(&mut self.cpu, s, stop.take()) {
|
||||
Ok(Ok(v)) => Ok(v),
|
||||
Ok(Err(v)) => {
|
||||
// No pending data from the debugger.
|
||||
self.gdb = Some(v.into());
|
||||
return DebugResult::Ok;
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
GdbStubStateMachine::CtrlCInterrupt(s) => {
|
||||
self.cpu.lock();
|
||||
|
||||
s.interrupt_handled(
|
||||
&mut self.cpu,
|
||||
Some(MultiThreadStopReason::Signal(Signal::SIGINT)),
|
||||
)
|
||||
.map_err(|e| {
|
||||
RustError::with_source("couldn't handle CTRL+C from a debugger", e)
|
||||
})
|
||||
}
|
||||
GdbStubStateMachine::Disconnected(_) => return DebugResult::Disconnected,
|
||||
};
|
||||
|
||||
match r {
|
||||
Ok(v) => self.gdb = Some(v),
|
||||
Err(e) => return DebugResult::Error { reason: e.into_c() },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Vmm {
|
||||
|
Loading…
Reference in New Issue
Block a user