[PATCH] MIPS/GDB/linux-nat.c: Fix a child detach condition for uClibc-ng
Sergey Korolev
s.korolev@ndmsystems.com
Thu Jun 14 22:54:00 GMT 2018
Current implementation expects that WIFSTOPPED (W_STOPCODE (0)) is true,
but in the uClibc-ng it is false on MIPS. The patch adds a "detach"
helper variable to avoid this corner case: WIFSTOPPED applied
only to a status filled by a waitpid call that should never return
the status with zero stop signal.
---
gdb/linux-nat.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 445b59fa4a..916de2d335 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -468,6 +468,7 @@ linux_nat_target::follow_fork (int follow_child, int
detach_fork)
/* Detach new forked process? */
if (detach_fork)
{
+ int detach = 1;
struct cleanup *old_chain = make_cleanup (delete_lwp_cleanup,
child_lp);
@@ -492,9 +493,11 @@ linux_nat_target::follow_fork (int follow_child, int
detach_fork)
perror_with_name (_("Couldn't do single step"));
if (my_waitpid (child_pid, &status, 0) < 0)
perror_with_name (_("Couldn't wait vfork process"));
+ else
+ detach = WIFSTOPPED (status);
}
- if (WIFSTOPPED (status))
+ if (detach)
{
int signo;
--
2.11.0
More information about the Gdb-patches
mailing list