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 resume_if_halted(&mut self) -> Result<(), DmiError>
pub fn resume_if_halted(&mut self) -> Result<(), DmiError>
en: Resume the hart if it is halted, with the console mailbox put back first: the end of a session whose transport does not resume on detach. ja: 止まっていれば(mailbox を戻してから)走らせる。detach で走らない transport の session の最後。
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
en: Recover the owned transport (to detach after the session). The console mailbox is put back first, since the caller’s detach resumes the hart. ja: transport を返す(後で detach するため)。detach で hart が走るので、先に mailbox を戻す。
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) -> Vec<u32>
pub fn restore_flash_breakpoints(&mut self) -> Vec<u32>
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. The session can end with the hart running (GDB gone mid-continue, a
fatal error), and the page rewrite needs it halted, so it is halted for the rewrite and
resumed after. Returns the pages it could not restore (they may still hold an ebreak).
ja: 管理中の flash page をすべて pristine に戻す(残った ebreak を消す)。detach 前に呼ぶ。
session は hart が走ったまま終わることがあり(continue 中に GDB が消えた、致命的な error)、
page の書き直しには止まった hart が要るので、止めて書き直し、走らせ直す。戻せなかった page を返す
(ebreak が残っているかもしれない)。
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 support_target_description_xml_override(
&mut self,
) -> Option<TargetDescriptionXmlOverrideOps<'_, Self>>
fn support_target_description_xml_override( &mut self, ) -> Option<TargetDescriptionXmlOverrideOps<'_, Self>>
Target::Arch.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_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.Source§fn support_memory_map(
&mut self,
) -> Option<&mut dyn MemoryMap<Error = Self::Error, Arch = Self::Arch>>
fn support_memory_map( &mut self, ) -> Option<&mut dyn MemoryMap<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_flash_operations(
&mut self,
) -> Option<&mut dyn Flash<Error = Self::Error, Arch = Self::Arch>>
fn support_flash_operations( &mut self, ) -> Option<&mut dyn Flash<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_catch_syscalls(
&mut self,
) -> Option<&mut dyn CatchSyscalls<Error = Self::Error, Arch = Self::Arch>>
fn support_catch_syscalls( &mut self, ) -> Option<&mut dyn CatchSyscalls<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_host_io(
&mut self,
) -> Option<&mut dyn HostIo<Error = Self::Error, Arch = Self::Arch>>
fn support_host_io( &mut self, ) -> Option<&mut dyn HostIo<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_exec_file(
&mut self,
) -> Option<&mut dyn ExecFile<Error = Self::Error, Arch = Self::Arch>>
fn support_exec_file( &mut self, ) -> Option<&mut dyn ExecFile<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_auxv(
&mut self,
) -> Option<&mut dyn Auxv<Error = Self::Error, Arch = Self::Arch>>
fn support_auxv( &mut self, ) -> Option<&mut dyn Auxv<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_libraries_svr4(
&mut self,
) -> Option<&mut dyn LibrariesSvr4<Error = Self::Error, Arch = Self::Arch>>
fn support_libraries_svr4( &mut self, ) -> Option<&mut dyn LibrariesSvr4<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_libraries(
&mut self,
) -> Option<&mut dyn Libraries<Error = Self::Error, Arch = Self::Arch>>
fn support_libraries( &mut self, ) -> Option<&mut dyn Libraries<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_host_info(
&mut self,
) -> Option<&mut dyn HostInfo<Error = Self::Error, Arch = Self::Arch>>
fn support_host_info( &mut self, ) -> Option<&mut dyn HostInfo<Error = Self::Error, Arch = Self::Arch>>
Source§fn support_process_info(
&mut self,
) -> Option<&mut dyn ProcessInfo<Error = Self::Error, Arch = Self::Arch>>
fn support_process_info( &mut self, ) -> Option<&mut dyn ProcessInfo<Error = Self::Error, Arch = Self::Arch>>
Source§impl<T: DtmAccess> TargetDescriptionXmlOverride for Ch32Target<T>
impl<T: DtmAccess> TargetDescriptionXmlOverride for Ch32Target<T>
Source§fn target_description_xml(
&self,
_annex: &[u8],
offset: u64,
length: usize,
buf: &mut [u8],
) -> TargetResult<usize, Self>
fn target_description_xml( &self, _annex: &[u8], offset: u64, length: usize, buf: &mut [u8], ) -> TargetResult<usize, Self>
annex. Read more