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