Get guest registers

Reviewed By: jasonwhite

Differential Revision: D36315857

fbshipit-source-id: bd00a87fea9b17a28d5afc438d640f2b68bd5975
This commit is contained in:
Anastasios Andronidis 2022-05-11 09:05:58 -07:00 committed by Facebook GitHub Bot
parent 9899fe55c4
commit 1aac7d0ad2
2 changed files with 16 additions and 0 deletions

View file

@ -2005,6 +2005,15 @@ impl<L: Tool + 'static> Guest<L> for TracedTask<L> {
self.assume_stopped()
}
async fn regs(&mut self) -> user_regs_struct {
let task = self.assume_stopped();
match task.getregs() {
Ok(ret) => ret,
Err(err) => self.abort(Err(err)).await,
}
}
async fn stack(&mut self) -> Self::Stack {
match GuestStack::new(self.tid, self.stack_checked_out.clone()) {
Ok(ret) => ret,

View file

@ -78,6 +78,9 @@ pub trait Guest<T: Tool>: Send + GlobalRPC<T::GlobalState> {
/// Returns an immutable reference to thread state.
fn thread_state(&self) -> &T::ThreadState;
/// Returns the current register values of the guest thread.
async fn regs(&mut self) -> libc::user_regs_struct;
/// Returns the current stack pointer with this guest thread.
async fn stack(&mut self) -> Self::Stack;
@ -329,6 +332,10 @@ where
self.inner.thread_state().as_ref()
}
async fn regs(&mut self) -> libc::user_regs_struct {
self.inner.regs().await
}
async fn stack(&mut self) -> Self::Stack {
self.inner.stack().await
}