profile: Stop new threads and resume them with the debugger API.

If we don't stop new threads, then they can run before we
have a chance to start profiling them.
This commit is contained in:
Augustin Cavalier
2024-07-17 11:10:13 -04:00
parent 189a9bbf63
commit 421a5795ae
+4 -3
View File
@@ -88,7 +88,8 @@ Team::Init(team_id teamID, port_id debuggerPort)
// set team debugging flags
int32 teamDebugFlags = B_TEAM_DEBUG_THREADS
| B_TEAM_DEBUG_TEAM_CREATION | B_TEAM_DEBUG_IMAGES;
| B_TEAM_DEBUG_TEAM_CREATION | B_TEAM_DEBUG_IMAGES
| B_TEAM_DEBUG_STOP_NEW_THREADS;
error = set_team_debugging_flags(fNubPort, teamDebugFlags);
if (error != B_OK)
return error;
@@ -174,8 +175,8 @@ Team::InitThread(Thread* thread)
fThreads.Add(thread);
// resume the target thread to be sure, it's running
resume_thread(thread->ID());
// resume the target thread to be sure it's running
continue_thread(fDebugContext.nub_port, thread->ID());
} else {
// debugger-less profiling
thread->SetInterval(gOptions.interval);