1 //! Override the target description XML specified by `Target::Arch`.
2 use crate::target::Target;
3 use crate::target::TargetResult;
4 
5 /// Target Extension - Override the target description XML specified by
6 /// `Target::Arch`.
7 ///
8 /// _Note:_ Unless you're working with a particularly dynamic,
9 /// runtime-configurable target, it's unlikely that you'll need to implement
10 /// this extension.
11 pub trait TargetDescriptionXmlOverride: Target {
12     /// Read a target's description XML file at the specified `annex`.
13     ///
14     /// The "root" `annex` will always be `b"target.xml"`, though advanced
15     /// targets may choose to split `target.xml` into multiple files via the
16     /// the `<xi:include href="other_file.xml"/>` XML tag. If the GDB client
17     /// encounter any such tags, it will re-invoke this handler with `annex`
18     /// specified to point to `b"other_file.xml"`.
19     ///
20     /// Refer to the
21     /// [target_description_xml](crate::arch::Arch::target_description_xml)
22     /// docs for more info.
23     ///
24     /// Return the number of bytes written into `buf` (which may be less than
25     /// `length`).
26     ///
27     /// If `offset` is greater than the length of the underlying data, return
28     /// `Ok(0)`.
target_description_xml( &self, annex: &[u8], offset: u64, length: usize, buf: &mut [u8], ) -> TargetResult<usize, Self>29     fn target_description_xml(
30         &self,
31         annex: &[u8],
32         offset: u64,
33         length: usize,
34         buf: &mut [u8],
35     ) -> TargetResult<usize, Self>;
36 }
37 
38 define_ext!(
39     TargetDescriptionXmlOverrideOps,
40     TargetDescriptionXmlOverride
41 );
42