Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys For sh3, increment PC when PT_CONTINUE fr...



details:   https://anonhg.NetBSD.org/src/rev/c092d8750c4d
branches:  trunk
changeset: 984797:c092d8750c4d
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Jul 24 08:39:54 2021 +0000

description:
For sh3, increment PC when PT_CONTINUE from trigger_trap(), as already
done for aarch64, arm, and powerpc. Otherwise, child is trapped to the
PTRACE_BREAKPOINT_ASM (== trapa) instruction indefinitely.

Fix tests/lib/libc/sys/t_ptrace_wait*:core_dump_procinfo.

diffstat:

 tests/lib/libc/sys/t_ptrace_core_wait.h |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (33 lines):

diff -r e57ff4752bc6 -r c092d8750c4d tests/lib/libc/sys/t_ptrace_core_wait.h
--- a/tests/lib/libc/sys/t_ptrace_core_wait.h   Sat Jul 24 07:59:10 2021 +0000
+++ b/tests/lib/libc/sys/t_ptrace_core_wait.h   Sat Jul 24 08:39:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_core_wait.h,v 1.3 2020/10/15 22:59:50 rin Exp $       */
+/*     $NetBSD: t_ptrace_core_wait.h,v 1.4 2021/07/24 08:39:54 rin Exp $       */
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -208,7 +208,8 @@
        DPRINTF("Before resuming the child process where it left off and "
            "without signal to be sent\n");
 
-#if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__)
+#if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__) || \
+    defined(__sh3__)
        /*
         * For these archs, program counter is not automatically incremented
         * by a trap instruction. We cannot increment PC in the trap handler,
@@ -220,12 +221,7 @@
 
        SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
        SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child,
-#  if defined(__aarch64__) || defined(__arm__)
-           (void *)(r.r_pc + PTRACE_BREAKPOINT_SIZE),
-#  elif defined(__powerpc__)
-           (void *)(r.pc + PTRACE_BREAKPOINT_SIZE),
-#  endif
-           0) != -1);
+           (void *)(PTRACE_REG_PC(&r) + PTRACE_BREAKPOINT_SIZE), 0) != -1);
 #else
        SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 #endif



Home | Main Index | Thread Index | Old Index