Fix core_dump_procinfo tests for powerpc, for which child process was
stalled indefinitely in trap instruction even after PT_CONTINUE. For powerpc, program counter is not automatically incremented by trap instruction. We cannot increment PC in the trap handler, which breaks applications depending on this behavior, e.g., GDB. Therefore, we need to pass (PC + 4) instead of (void *)1 (== PC) to PT_CONTINUE when child process traps itself.
This commit is contained in:
parent
439c7faabc
commit
f340ec0453
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: t_ptrace_core_wait.h,v 1.1 2020/05/05 01:24:29 kamil Exp $ */
|
||||
/* $NetBSD: t_ptrace_core_wait.h,v 1.2 2020/06/24 04:47:10 rin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc.
|
||||
@ -207,7 +207,22 @@ ATF_TC_BODY(core_dump_procinfo, tc)
|
||||
|
||||
DPRINTF("Before resuming the child process where it left off and "
|
||||
"without signal to be sent\n");
|
||||
#ifndef __powerpc__
|
||||
SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
|
||||
#else
|
||||
/*
|
||||
* For powerpc, program counter is not automatically incremented by
|
||||
* a trap instruction. We cannot increment PC in the trap handler,
|
||||
* which breaks applications depending on this behavior, e.g., GDB.
|
||||
* Therefore, we need to pass (PC + 4) instead of (void *)1 (== PC)
|
||||
* to PT_CONTINUE here.
|
||||
*/
|
||||
struct reg r;
|
||||
|
||||
SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
|
||||
SYSCALL_REQUIRE(
|
||||
ptrace(PT_CONTINUE, child, (void *)(r.pc + 4), 0) != -1);
|
||||
#endif
|
||||
|
||||
DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
|
||||
TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
|
||||
|
Loading…
Reference in New Issue
Block a user