aboutsummaryrefslogtreecommitdiff
path: root/src/target/ext/memory_map.rs
blob: 46ffd2ac905308a6eebbf5892fb3cc0a8a6522ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Provide a memory map for the target.
use crate::target::{Target, TargetResult};

/// Target Extension - Read the target's memory map.
pub trait MemoryMap: Target {
    /// Get memory map XML file from the target.
    ///
    /// See the [GDB Documentation] for a description of the format.
    ///
    /// [GDB Documentation]: https://sourceware.org/gdb/onlinedocs/gdb/Memory-Map-Format.html
    ///
    /// Return the number of bytes written into `buf` (which may be less than
    /// `length`).
    ///
    /// If `offset` is greater than the length of the underlying data, return
    /// `Ok(0)`.
    fn memory_map_xml(
        &self,
        offset: u64,
        length: usize,
        buf: &mut [u8],
    ) -> TargetResult<usize, Self>;
}

define_ext!(MemoryMapOps, MemoryMap);