aboutsummaryrefslogtreecommitdiff
path: root/src/target/ext/base/singlethread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/ext/base/singlethread.rs')
-rw-r--r--src/target/ext/base/singlethread.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/target/ext/base/singlethread.rs b/src/target/ext/base/singlethread.rs
index c949886..40b002e 100644
--- a/src/target/ext/base/singlethread.rs
+++ b/src/target/ext/base/singlethread.rs
@@ -2,7 +2,8 @@
use crate::arch::Arch;
use crate::common::Signal;
-use crate::target::{Target, TargetResult};
+use crate::target::Target;
+use crate::target::TargetResult;
/// Base required debugging operations for single threaded targets.
pub trait SingleThreadBase: Target {
@@ -32,16 +33,24 @@ pub trait SingleThreadBase: Target {
None
}
- /// Read bytes from the specified address range.
+ /// Read bytes from the specified address range and return the number of
+ /// bytes that were read.
///
- /// If the requested address range could not be accessed (e.g: due to
- /// MMU protection, unhanded page fault, etc...), an appropriate
- /// non-fatal error should be returned.
+ /// Implementations may return a number `n` that is less than `data.len()`
+ /// to indicate that memory starting at `start_addr + n` cannot be
+ /// accessed.
+ ///
+ /// Implemenations may also return an appropriate non-fatal error if the
+ /// requested address range could not be accessed (e.g: due to MMU
+ /// protection, unhanded page fault, etc...).
+ ///
+ /// Implementations must guarantee that the returned number is less than or
+ /// equal `data.len()`.
fn read_addrs(
&mut self,
start_addr: <Self::Arch as Arch>::Usize,
data: &mut [u8],
- ) -> TargetResult<(), Self>;
+ ) -> TargetResult<usize, Self>;
/// Write bytes to the specified address range.
///