aboutsummaryrefslogtreecommitdiff
path: root/examples/armv4t/gdb/memory_map.rs
blob: 0aa5c08dc96aeb83955d8ec5b62e0d73f5a19e6b (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
26
use super::copy_range_to_buf;
use crate::emu::Emu;
use gdbstub::target;
use gdbstub::target::TargetResult;

impl target::ext::memory_map::MemoryMap for Emu {
    fn memory_map_xml(
        &self,
        offset: u64,
        length: usize,
        buf: &mut [u8],
    ) -> TargetResult<usize, Self> {
        // Sample memory map, with RAM coverying the whole
        // memory space.
        let memory_map = r#"<?xml version="1.0"?>
<!DOCTYPE memory-map
    PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
            "http://sourceware.org/gdb/gdb-memory-map.dtd">
<memory-map>
    <memory type="ram" start="0x0" length="0x100000000"/>
</memory-map>"#
            .trim()
            .as_bytes();
        Ok(copy_range_to_buf(memory_map, offset, length, buf))
    }
}