From 7326b92ce0a0f2a0229d73eba223f68271d96bdd Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 21 Sep 2008 16:41:49 +0000 Subject: [PATCH] user_debug_update_new_thread_flags() was setting some of the thread flags on the wrong thread (the current one instead of the newly created one). This would cause the thread not to be debugged as it should, e.g. profiling wouldn't work correctly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27671 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/debug/user_debugger.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/system/kernel/debug/user_debugger.cpp b/src/system/kernel/debug/user_debugger.cpp index c6505f036a..18f184cfc9 100644 --- a/src/system/kernel/debug/user_debugger.cpp +++ b/src/system/kernel/debug/user_debugger.cpp @@ -131,13 +131,12 @@ update_thread_user_debug_flag(struct thread* thread) /*! Updates the thread::flags THREAD_FLAGS_BREAKPOINTS_DEFINED bit of the - current thread. + given thread. Interrupts must be disabled and the team lock must be held. */ static void -update_thread_breakpoints_flag() +update_thread_breakpoints_flag(struct thread* thread) { - struct thread* thread = thread_get_current_thread(); struct team* team = thread->team; if (arch_has_breakpoints(&team->debug_info.arch_info)) @@ -170,13 +169,12 @@ update_threads_breakpoints_flag() /*! Updates the thread::flags B_TEAM_DEBUG_DEBUGGER_INSTALLED bit of the - current thread. + given thread. Interrupts must be disabled and the team lock must be held. */ static void -update_thread_debugger_installed_flag() +update_thread_debugger_installed_flag(struct thread* thread) { - struct thread* thread = thread_get_current_thread(); struct team* team = thread->team; if (atomic_get(&team->debug_info.flags) & B_TEAM_DEBUG_DEBUGGER_INSTALLED) @@ -917,6 +915,7 @@ user_debug_update_new_thread_flags(thread_id threadID) InterruptsLocker interruptsLocker; + SpinLocker teamLocker(gTeamSpinlock); SpinLocker threadLocker(gThreadSpinlock); struct thread *thread = thread_get_thread_struct_locked(threadID); @@ -924,12 +923,8 @@ user_debug_update_new_thread_flags(thread_id threadID) return; update_thread_user_debug_flag(thread); - - threadLocker.Unlock(); - - SpinLocker teamLocker(gTeamSpinlock); - update_thread_breakpoints_flag(); - update_thread_debugger_installed_flag(); + update_thread_breakpoints_flag(thread); + update_thread_debugger_installed_flag(thread); }