diff options
Diffstat (limited to 'src/target/ext/target_description_xml_override.rs')
-rw-r--r-- | src/target/ext/target_description_xml_override.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/target/ext/target_description_xml_override.rs b/src/target/ext/target_description_xml_override.rs index 7cac034..7cb9011 100644 --- a/src/target/ext/target_description_xml_override.rs +++ b/src/target/ext/target_description_xml_override.rs @@ -1,5 +1,5 @@ //! Override the target description XML specified by `Target::Arch`. -use crate::target::Target; +use crate::target::{Target, TargetResult}; /// Target Extension - Override the target description XML specified by /// `Target::Arch`. @@ -8,12 +8,30 @@ use crate::target::Target; /// runtime-configurable target, it's unlikely that you'll need to implement /// this extension. pub trait TargetDescriptionXmlOverride: Target { - /// Return the target's description XML file (`target.xml`). + /// Read a target's description XML file at the specified `annex`. + /// + /// The "root" `annex` will always be `b"target.xml"`, though advanced + /// targets may choose to split `target.xml` into multiple files via the + /// the `<xi:include href="other_file.xml"/>` XML tag. If the GDB client + /// encounter any such tags, it will re-invoke this handler with `annex` + /// specified to point to `b"other_file.xml"`. /// /// Refer to the /// [target_description_xml](crate::arch::Arch::target_description_xml) /// docs for more info. - fn target_description_xml(&self) -> &str; + /// + /// 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 target_description_xml( + &self, + annex: &[u8], + offset: u64, + length: usize, + buf: &mut [u8], + ) -> TargetResult<usize, Self>; } define_ext!( |