diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index 3b2cd0a7dd..9e6584d232 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -1886,6 +1886,10 @@ load_image_internal(char**& _flatArgs, size_t flatArgsSize, int32 argCount, // more precisely: It's owned by the team's main thread, now. teamReference.Detach(); + // notify the debugger while the main thread is still suspended so that it + // has a chance to attach early to the child. + user_debug_team_created(teamID); + // wait for the loader of the new team to finish its work if ((flags & B_WAIT_TILL_LOADED) != 0) { if (mainThread != NULL) { @@ -1911,9 +1915,6 @@ load_image_internal(char**& _flatArgs, size_t flatArgsSize, int32 argCount, return loadingInfo.result; } - // notify the debugger - user_debug_team_created(teamID); - return thread; err6: