Module Name: src Committed By: kamil Date: Tue May 26 23:08:56 UTC 2020
Modified Files: src/sys/kern: sys_ptrace_common.c Log Message: Avoid taking lwp_lock when calling process_sstep() for sibling LWPs This makes the code consistend between single-threaded and multi-threaded code. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/kern/sys_ptrace_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.81 src/sys/kern/sys_ptrace_common.c:1.82 --- src/sys/kern/sys_ptrace_common.c:1.81 Sat May 23 23:42:43 2020 +++ src/sys/kern/sys_ptrace_common.c Tue May 26 23:08:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.81 2020/05/23 23:42:43 ad Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.81 2020/05/23 23:42:43 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -1421,16 +1421,13 @@ do_ptrace(struct ptrace_methods *ptm, st * the requested thread, and clear it for other threads. */ LIST_FOREACH(lt2, &t->p_lwps, l_sibling) { - if (ISSET(lt2->l_pflag, LP_SINGLESTEP)) { - lwp_lock(lt2); - process_sstep(lt2, 1); - lwp_unlock(lt2); - } else if (lt != lt2) { - lwp_lock(lt2); - process_sstep(lt2, 0); - lwp_unlock(lt2); - } + error = process_sstep(lt2, + ISSET(lt2->l_pflag, LP_SINGLESTEP)); + if (error) + break; } + if (error) + break; error = process_sstep(lt, ISSET(lt->l_pflag, LP_SINGLESTEP) || req == PT_STEP); if (error)