fbsd-nat: Add a low_prepare_to_resume virtual method.

This method can be overridden by architecture-specific targets to
perform additional work before a thread is resumed.
This commit is contained in:
John Baldwin 2022-03-22 12:05:43 -07:00
parent 983b1119bc
commit a3627b5428
2 changed files with 11 additions and 2 deletions

View file

@ -1138,6 +1138,8 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
perror_with_name (request == PT_RESUME ? perror_with_name (request == PT_RESUME ?
("ptrace (PT_RESUME)") : ("ptrace (PT_RESUME)") :
("ptrace (PT_SUSPEND)")); ("ptrace (PT_SUSPEND)"));
if (request == PT_RESUME)
low_prepare_to_resume (tp);
} }
} }
else else
@ -1145,8 +1147,11 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
/* If ptid is a wildcard, resume all matching threads (they won't run /* If ptid is a wildcard, resume all matching threads (they won't run
until the process is continued however). */ until the process is continued however). */
for (thread_info *tp : all_non_exited_threads (this, ptid)) for (thread_info *tp : all_non_exited_threads (this, ptid))
if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1) {
perror_with_name (("ptrace (PT_RESUME)")); if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1)
perror_with_name (("ptrace (PT_RESUME)"));
low_prepare_to_resume (tp);
}
ptid = inferior_ptid; ptid = inferior_ptid;
} }

View file

@ -119,6 +119,10 @@ public:
virtual void low_delete_thread (thread_info *) virtual void low_delete_thread (thread_info *)
{} {}
/* Hook to call prior to resuming a thread. */
virtual void low_prepare_to_resume (thread_info *)
{}
protected: protected:
void post_startup_inferior (ptid_t) override; void post_startup_inferior (ptid_t) override;