Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/tests/lib/libc/sys Pull up following revision(s) (request...
details: https://anonhg.NetBSD.org/src/rev/5129a3e10625
branches: netbsd-9
changeset: 458489:5129a3e10625
user: martin <martin%NetBSD.org@localhost>
date: Tue Oct 15 18:47:03 2019 +0000
description:
Pull up following revision(s) (requested by kamil in ticket #317):
tests/lib/libc/sys/t_ptrace_wait.c: revision 1.133
Merge PT_GET_PROCESS_STATE checks into traceme_raise ATF ptrace tests
Assert that PT_GET_PROCESS_STATE for !child and !lwp events returns
non-error and zeroed struct ptrace_state.
These checks are not really special to traceme_raise, it's just an
opportunity to reuse them in an existing tests without writing a dedicated
one.
This behavior is needed to maintain in 3rd party software (GDB).
diffstat:
tests/lib/libc/sys/t_ptrace_wait.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diffs (51 lines):
diff -r 2502c291fd31 -r 5129a3e10625 tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:43:02 2019 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:47:03 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $ */
+/* $NetBSD: t_ptrace_wait.c,v 1.131.2.5 2019/10/15 18:47:03 martin Exp $ */
/*-
* Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.5 2019/10/15 18:47:03 martin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -140,7 +140,10 @@
int status;
#endif
+ ptrace_state_t state, zero_state;
+ const int slen = sizeof(state);
struct ptrace_siginfo info;
+ memset(&zero_state, 0, sizeof(zero_state));
memset(&info, 0, sizeof(info));
DPRINTF("Before forking process PID=%d\n", getpid());
@@ -170,6 +173,9 @@
switch (sigval) {
case SIGKILL:
validate_status_signaled(status, sigval, 0);
+ SYSCALL_REQUIRE(
+ ptrace(PT_GET_PROCESS_STATE, child, &state, slen) == -1);
+
break;
default:
validate_status_stopped(status, sigval);
@@ -188,6 +194,11 @@
ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
+ DPRINTF("Assert that PT_GET_PROCESS_STATE returns non-error");
+ SYSCALL_REQUIRE(
+ ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+ ATF_REQUIRE(memcmp(&state, &zero_state, slen) == 0);
+
DPRINTF("Before resuming the child process where it left off "
"and without signal to be sent\n");
SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
Home |
Main Index |
Thread Index |
Old Index