pub struct Ch32Target<T: DtmAccess> { /* private fields */ }Expand description
en: gdbstub target that OWNS its transport T (owning, not borrowing, keeps the type free
of a lifetime so it fits BlockingEventLoop::Target). Recover the transport with
Ch32Target::into_inner to detach cleanly afterwards.
ja: transport T を所有する gdbstub target(所有にすることでライフタイムが付かず
BlockingEventLoop::Target に収まる)。後始末は Ch32Target::into_inner で回収する。
Implementations§
Source§impl<T: DtmAccess> Ch32Target<T>
impl<T: DtmAccess> Ch32Target<T>
Sourcepub fn new(
dtm: T,
flash: Option<(u32, FlashProgMode)>,
) -> Result<Self, DmiError>
pub fn new( dtm: T, flash: Option<(u32, FlashProgMode)>, ) -> Result<Self, DmiError>
en: Wrap a transport and halt the core so GDB attaches to a stopped target. flash is the
FLASH-controller profile for this family (fast-page size + program mode, from
ch32rv_flash::flash_controller_profile), or None to refuse flash software breakpoints.
ja: transport を包んで halt。flash はこの family の FLASH-controller profile(fast page
サイズ + program mode。None なら flash SW breakpoint を拒否)。
Sourcepub fn hw_trigger_count(&self) -> u32
pub fn hw_trigger_count(&self) -> u32
Number of hardware trigger slots the core exposes (0 on V003/V2A).
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Recover the owned transport (to detach after the session).
Sourcepub fn flash_breakpoints_supported(&self) -> bool
pub fn flash_breakpoints_supported(&self) -> bool
True if this core supports flash software breakpoints (verified FLASH-controller profile).
Sourcepub fn restore_flash_breakpoints(&mut self)
pub fn restore_flash_breakpoints(&mut self)
en: Restore every managed flash page to its pristine content (removing any ebreak still
patched in). Call before detaching so an interrupted session never leaves a breakpoint
baked into flash. Best-effort.
ja: 管理中の flash page をすべて pristine に戻す(残った ebreak を消す)。detach 前に
呼び、途中終了しても flash に breakpoint が焼き付かないようにする。best-effort。
Trait Implementations§
Source§impl<T: DtmAccess> Breakpoints for Ch32Target<T>
impl<T: DtmAccess> Breakpoints for Ch32Target<T>
Source§fn support_sw_breakpoint(&mut self) -> Option<SwBreakpointOps<'_, Self>>
fn support_sw_breakpoint(&mut self) -> Option<SwBreakpointOps<'_, Self>>
Source§fn support_hw_breakpoint(&mut self) -> Option<HwBreakpointOps<'_, Self>>
fn support_hw_breakpoint(&mut self) -> Option<HwBreakpointOps<'_, Self>>
Source§fn support_hw_watchpoint(
&mut self,
) -> Option<&mut dyn HwWatchpoint<Error = Self::Error, Arch = Self::Arch>>
fn support_hw_watchpoint( &mut self, ) -> Option<&mut dyn HwWatchpoint<Error = Self::Error, Arch = Self::Arch>>
Source§impl<T: DtmAccess> HwBreakpoint for Ch32Target<T>
impl<T: DtmAccess> HwBreakpoint for Ch32Target<T>
Source§fn add_hw_breakpoint(
&mut self,
addr: u32,
_kind: usize,
) -> TargetResult<bool, Self>
fn add_hw_breakpoint( &mut self, addr: u32, _kind: usize, ) -> TargetResult<bool, Self>
Source§fn remove_hw_breakpoint(
&mut self,
addr: u32,
_kind: usize,
) -> TargetResult<bool, Self>
fn remove_hw_breakpoint( &mut self, addr: u32, _kind: usize, ) -> TargetResult<bool, Self>
Source§impl<T: DtmAccess> SingleThreadBase for Ch32Target<T>
impl<T: DtmAccess> SingleThreadBase for Ch32Target<T>
Source§fn read_registers(&mut self, regs: &mut Rv32CoreRegs) -> TargetResult<(), Self>
fn read_registers(&mut self, regs: &mut Rv32CoreRegs) -> TargetResult<(), Self>
Source§fn write_registers(&mut self, regs: &Rv32CoreRegs) -> TargetResult<(), Self>
fn write_registers(&mut self, regs: &Rv32CoreRegs) -> TargetResult<(), Self>
Source§fn read_addrs(
&mut self,
start: u32,
data: &mut [u8],
) -> TargetResult<usize, Self>
fn read_addrs( &mut self, start: u32, data: &mut [u8], ) -> TargetResult<usize, Self>
Source§fn write_addrs(&mut self, start: u32, data: &[u8]) -> TargetResult<(), Self>
fn write_addrs(&mut self, start: u32, data: &[u8]) -> TargetResult<(), Self>
Source§fn support_resume(&mut self) -> Option<SingleThreadResumeOps<'_, Self>>
fn support_resume(&mut self) -> Option<SingleThreadResumeOps<'_, Self>>
continue or step)Source§fn support_single_register_access(
&mut self,
) -> Option<&mut dyn SingleRegisterAccess<(), Error = Self::Error, Arch = Self::Arch>>
fn support_single_register_access( &mut self, ) -> Option<&mut dyn SingleRegisterAccess<(), Error = Self::Error, Arch = Self::Arch>>
SingleRegisterAccess for more details. Read moreSource§impl<T: DtmAccess> SingleThreadResume for Ch32Target<T>
impl<T: DtmAccess> SingleThreadResume for Ch32Target<T>
Source§fn resume(&mut self, _signal: Option<Signal>) -> Result<(), Self::Error>
fn resume(&mut self, _signal: Option<Signal>) -> Result<(), Self::Error>
Source§fn support_single_step(&mut self) -> Option<SingleThreadSingleStepOps<'_, Self>>
fn support_single_step(&mut self) -> Option<SingleThreadSingleStepOps<'_, Self>>
Source§fn support_range_step(
&mut self,
) -> Option<&mut dyn SingleThreadRangeStepping<Error = Self::Error, Arch = Self::Arch>>
fn support_range_step( &mut self, ) -> Option<&mut dyn SingleThreadRangeStepping<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_reverse_step(
&mut self,
) -> Option<&mut dyn ReverseStep<(), Error = Self::Error, Arch = Self::Arch>>
fn support_reverse_step( &mut self, ) -> Option<&mut dyn ReverseStep<(), Error = Self::Error, Arch = Self::Arch>>
Source§fn support_reverse_cont(
&mut self,
) -> Option<&mut dyn ReverseCont<(), Error = Self::Error, Arch = Self::Arch>>
fn support_reverse_cont( &mut self, ) -> Option<&mut dyn ReverseCont<(), Error = Self::Error, Arch = Self::Arch>>
Source§impl<T: DtmAccess> SingleThreadSingleStep for Ch32Target<T>
impl<T: DtmAccess> SingleThreadSingleStep for Ch32Target<T>
Source§impl<T: DtmAccess> SwBreakpoint for Ch32Target<T>
impl<T: DtmAccess> SwBreakpoint for Ch32Target<T>
Source§fn add_sw_breakpoint(
&mut self,
addr: u32,
kind: usize,
) -> TargetResult<bool, Self>
fn add_sw_breakpoint( &mut self, addr: u32, kind: usize, ) -> TargetResult<bool, Self>
en: Set a breakpoint GDB asked for as “software” (Z0). We first try a RAM memory-patch
(ebreak); if the write does not stick - the classic case being a flash address, where
the DM sw silently no-ops - we transparently fall back to a hardware execute trigger
when the core has a free slot. That makes plain break work on flash-resident code for
V4-class cores (which expose triggers) without the risk of rewriting flash. Cores with no
trigger module (V003/V103) can still set RAM breakpoints; a flash breakpoint there returns
unsupported (a flash-patch approach is a follow-up).
ja: GDB が Z0(software)で要求した breakpoint。まず RAM の memory patch(ebreak)を
試し、書き込みが定着しない(典型は flash 番地。DM の sw が無反応)場合は、空き HW slot が
あれば HW execute trigger へ透過的にフォールバックし(flash 書き換えの危険なし)、trigger が
無ければ page 書き換えの flash software breakpoint へフォールバックする。これで trigger を
持たない core(V203 等)でも flash 上のコードに通常 break が効く(flash 書き換えの摩耗あり)。
順序は RAM → HW trigger → flash-patch。どれも不可なら未対応を返す。
Source§fn remove_sw_breakpoint(
&mut self,
addr: u32,
_kind: usize,
) -> TargetResult<bool, Self>
fn remove_sw_breakpoint( &mut self, addr: u32, _kind: usize, ) -> TargetResult<bool, Self>
Source§impl<T: DtmAccess> Target for Ch32Target<T>
impl<T: DtmAccess> Target for Ch32Target<T>
Source§fn base_ops(&mut self) -> BaseOps<'_, Self::Arch, Self::Error>
fn base_ops(&mut self) -> BaseOps<'_, Self::Arch, Self::Error>
Source§fn support_breakpoints(&mut self) -> Option<BreakpointsOps<'_, Self>>
fn support_breakpoints(&mut self) -> Option<BreakpointsOps<'_, Self>>
Source§fn guard_rail_implicit_sw_breakpoints(&self) -> bool
fn guard_rail_implicit_sw_breakpoints(&self) -> bool
SwBreakpoints), notify the user
that the GDB client may set “implicit” software breakpoints by
rewriting the target’s instruction stream. Read moreSource§fn use_no_ack_mode(&self) -> bool
fn use_no_ack_mode(&self) -> bool
Source§fn use_x_upcase_packet(&self) -> bool
fn use_x_upcase_packet(&self) -> bool
X packet to write to target
memory (as opposed to the basic M packet). Read moreSource§fn use_resume_stub(&self) -> bool
fn use_resume_stub(&self) -> bool
gdbstub should provide a “stub” resume implementation on
targets without support for resumption. Read moreSource§fn use_rle(&self) -> bool
fn use_rle(&self) -> bool
Source§fn use_target_description_xml(&self) -> bool
fn use_target_description_xml(&self) -> bool
Source§fn use_lldb_register_info(&self) -> bool
fn use_lldb_register_info(&self) -> bool
Source§fn use_fork_stop_reason(&self) -> bool
fn use_fork_stop_reason(&self) -> bool
BaseStopReason::Fork. Read moreSource§fn use_vfork_stop_reason(&self) -> bool
fn use_vfork_stop_reason(&self) -> bool
BaseStopReason::VFork. Read moreSource§fn use_vforkdone_stop_reason(&self) -> bool
fn use_vforkdone_stop_reason(&self) -> bool
BaseStopReason::VForkDone. Read moreSource§fn support_monitor_cmd(
&mut self,
) -> Option<&mut dyn MonitorCmd<Error = Self::Error, Arch = Self::Arch>>
fn support_monitor_cmd( &mut self, ) -> Option<&mut dyn MonitorCmd<Error = Self::Error, Arch = Self::Arch>>
monitor commands.Source§fn support_extended_mode(
&mut self,
) -> Option<&mut dyn ExtendedMode<Error = Self::Error, Arch = Self::Arch>>
fn support_extended_mode( &mut self, ) -> Option<&mut dyn ExtendedMode<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_section_offsets(
&mut self,
) -> Option<&mut dyn SectionOffsets<Error = Self::Error, Arch = Self::Arch>>
fn support_section_offsets( &mut self, ) -> Option<&mut dyn SectionOffsets<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_tracepoints(
&mut self,
) -> Option<&mut dyn Tracepoints<Error = Self::Error, Arch = Self::Arch>>
fn support_tracepoints( &mut self, ) -> Option<&mut dyn Tracepoints<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_target_description_xml_override(
&mut self,
) -> Option<&mut dyn TargetDescriptionXmlOverride<Error = Self::Error, Arch = Self::Arch>>
fn support_target_description_xml_override( &mut self, ) -> Option<&mut dyn TargetDescriptionXmlOverride<Error = Self::Error, Arch = Self::Arch>>
Target::Arch.Source§fn support_lldb_register_info_override(
&mut self,
) -> Option<&mut dyn LldbRegisterInfoOverride<Error = Self::Error, Arch = Self::Arch>>
fn support_lldb_register_info_override( &mut self, ) -> Option<&mut dyn LldbRegisterInfoOverride<Error = Self::Error, Arch = Self::Arch>>
Target::Arch.