1 use super::copy_range_to_buf; 2 use crate::emu::Emu; 3 use gdbstub::target; 4 use gdbstub::target::TargetResult; 5 6 impl target::ext::libraries::LibrariesSvr4 for Emu { get_libraries_svr4( &self, offset: u64, length: usize, buf: &mut [u8], ) -> TargetResult<usize, Self>7 fn get_libraries_svr4( 8 &self, 9 offset: u64, 10 length: usize, 11 buf: &mut [u8], 12 ) -> TargetResult<usize, Self> { 13 // `l_ld` is the address of the `PT_DYNAMIC` ELF segment, so fake an 14 // address here. 15 // 16 // The `main-lm`, `lm`, and `lmid` seem to refer to in-memory structures 17 // which gdb may read, but gdb also seems to work well enough if they're 18 // null-ish or otherwise pointing to non-present things. 19 let xml = r#" 20 <library-list-svr4 version="1.0" main-lm="0x4"> 21 <library name="/test.elf" lm="0x8" l_addr="0" l_ld="0" lmid="0x14"/> 22 </library-list-svr4> 23 "# 24 .trim() 25 .as_bytes(); 26 Ok(copy_range_to_buf(xml, offset, length, buf)) 27 } 28 } 29