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 // set team debugging flags
int32 teamDebugFlags = B_TEAM_DEBUG_THREADS 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); error = set_team_debugging_flags(fNubPort, teamDebugFlags);
if (error != B_OK) if (error != B_OK)
return error; return error;
@@ -174,8 +175,8 @@ Team::InitThread(Thread* thread)
fThreads.Add(thread); fThreads.Add(thread);
// resume the target thread to be sure, it's running // resume the target thread to be sure it's running
resume_thread(thread->ID()); continue_thread(fDebugContext.nub_port, thread->ID());
} else { } else {
// debugger-less profiling // debugger-less profiling
thread->SetInterval(gOptions.interval); thread->SetInterval(gOptions.interval);