[lldb/API] Introduce SBProcess::ForceScriptedState method

This patch introduces a new method to the SBProcess API called
ForceScriptedState. As the name suggests, this affordance will allow the
user to alter the state of the scripted process programatically.

This is necessary to update the scripted process state when perform
interactive debugging.

Differential Revision: https://reviews.llvm.org/D145294

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2023-03-13 15:34:29 -07:00
parent 7be8341f19
commit 0d77e03474
4 changed files with 24 additions and 0 deletions

View File

@@ -466,6 +466,16 @@ SBEvent SBProcess::GetStopEventForStopID(uint32_t stop_id) {
return sb_event;
}
void SBProcess::ForceScriptedState(StateType new_state) {
LLDB_INSTRUMENT_VA(this, new_state);
if (ProcessSP process_sp = GetSP()) {
std::lock_guard<std::recursive_mutex> guard(
process_sp->GetTarget().GetAPIMutex());
process_sp->ForceScriptedState(new_state);
}
}
StateType SBProcess::GetState() {
LLDB_INSTRUMENT_VA(this);