kernel/debug: Report new team before resuming it

Ensures that the new team has been reported to the debugger before
the main thread gets resumed. This allows the debugger to attach
to child teams as early as possible.

`fork` and `load_image` without `B_WAIT_TILL_LOADED` have always been
working as desired. This commit fixes the remaining case of
`B_WAIT_TILL_LOADED` by reporting before resuming the thread of
`runtime_loader`.

Change-Id: I7fd74606801c6ca5335d91c92f3157e6c6e66308
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7797
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Trung Nguyen
2024-06-24 17:45:54 +00:00
committed by waddlesplash
parent 25cf646333
commit 1f2b4425c4
+4 -3
View File
@@ -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: