pub struct DebuggerSession { /* private fields */ }Expand description
Debugger session
与 Evaluator 共享同一个 DebuggerState(Rc<RefCell<>>),
因此命令对断点/执行模式的修改立即对求值器生效。
求值器状态(变量、调用栈)在暂停回调时通过 &mut Evaluator 传入。
Implementations§
Source§impl DebuggerSession
impl DebuggerSession
Sourcepub fn new(state: Rc<RefCell<DebuggerState>>) -> Self
pub fn new(state: Rc<RefCell<DebuggerState>>) -> Self
Create a new debugger session around a shared debugger state
Sourcepub fn set_source(&mut self, source: String, file: String)
pub fn set_source(&mut self, source: String, file: String)
Set the source code for listing
Sourcepub fn set_breakable_lines(&mut self, lines: HashSet<usize>)
pub fn set_breakable_lines(&mut self, lines: HashSet<usize>)
注入可命中的语句起始行集合(供 break N 校验)
共享的调试器状态(供宿主调用 Evaluator::attach_debugger)
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
用户是否已通过 quit 终止程序(宿主据此把 DebugPause 排除出错误处理)
Sourcepub fn run_pause_loop(&mut self, ev: &mut Evaluator) -> bool
pub fn run_pause_loop(&mut self, ev: &mut Evaluator) -> bool
暂停时的交互循环:打印位置与源码上下文,逐条读取命令直到继续/退出。
返回 true 表示终止程序(求值器将以 DebugPause 传播)。 stdin 读到 EOF 时停用调试器并放行到程序结束,避免无限 EOF 循环。
Sourcepub fn handle_command(
&mut self,
ev: &mut Evaluator,
cmd: &str,
) -> (String, CommandAction)
pub fn handle_command( &mut self, ev: &mut Evaluator, cmd: &str, ) -> (String, CommandAction)
Handle a debugger command, returning (message, action)
Auto Trait Implementations§
impl !RefUnwindSafe for DebuggerSession
impl !Send for DebuggerSession
impl !Sync for DebuggerSession
impl !UnwindSafe for DebuggerSession
impl Forget for DebuggerSession
impl Freeze for DebuggerSession
impl Move for DebuggerSession
impl Unpin for DebuggerSession
impl UnsafeUnpin for DebuggerSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more