From 31d9352ff6fb0ee3dfb1dc63259370b6c61b3334 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 16 Apr 2009 21:57:52 +0000 Subject: [PATCH] Make sure kernel breakpoints are installed on all CPUs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30209 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/arch/x86/arch_user_debugger.cpp | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/system/kernel/arch/x86/arch_user_debugger.cpp b/src/system/kernel/arch/x86/arch_user_debugger.cpp index 438786d3a0..9d61f7605a 100644 --- a/src/system/kernel/arch/x86/arch_user_debugger.cpp +++ b/src/system/kernel/arch/x86/arch_user_debugger.cpp @@ -212,6 +212,20 @@ clear_breakpoint(void *address, bool watchpoint) #if KERNEL_BREAKPOINTS + +static void +install_breakpoints_per_cpu(void* /*cookie*/, int cpu) +{ + struct team* kernelTeam = team_get_kernel_team(); + + GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); + + install_breakpoints(kernelTeam->debug_info.arch_info); + + RELEASE_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); +} + + static status_t set_kernel_breakpoint(void *address, uint32 type, uint32 length) { @@ -226,9 +240,10 @@ set_kernel_breakpoint(void *address, uint32 type, uint32 length) status_t error = set_breakpoint(kernelTeam->debug_info.arch_info, address, type, length, true); - install_breakpoints(kernelTeam->debug_info.arch_info); - RELEASE_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); + + call_all_cpus(install_breakpoints_per_cpu, NULL); + restore_interrupts(state); return error; @@ -249,9 +264,10 @@ clear_kernel_breakpoint(void *address, bool watchpoint) status_t error = clear_breakpoint(kernelTeam->debug_info.arch_info, address, watchpoint); - install_breakpoints(kernelTeam->debug_info.arch_info); - RELEASE_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); + + call_all_cpus(install_breakpoints_per_cpu, NULL); + restore_interrupts(state); return error; @@ -404,7 +420,7 @@ debugger_breakpoint(int argc, char** argv) } if (error == B_OK) - install_breakpoints(info); + call_all_cpus_sync(install_breakpoints_per_cpu, NULL); else kprintf("Failed to install breakpoint: %s\n", strerror(error)); @@ -467,7 +483,7 @@ debugger_watchpoint(int argc, char** argv) } if (error == B_OK) - install_breakpoints(info); + call_all_cpus_sync(install_breakpoints_per_cpu, NULL); else kprintf("Failed to install breakpoint: %s\n", strerror(error));