From 3b76b415e9ca95d49f85bf622df5dfbb2f37e8c3 Mon Sep 17 00:00:00 2001 From: jkratoch Date: Tue, 20 Jul 2010 12:33:29 +0000 Subject: [PATCH] gdb/ Code cleanup. * linux-nat.c (linux_nat_wait_1): Reset STATUS after calling linux_nat_wait_1. Use always LP->STATUS afterwards. --- gdb/ChangeLog | 6 ++++++ gdb/linux-nat.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8776c0cb1f..f469860ca3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2010-07-20 Jan Kratochvil + + Code cleanup. + * linux-nat.c (linux_nat_wait_1): Reset STATUS after calling + linux_nat_wait_1. Use always LP->STATUS afterwards. + 2010-07-20 Hui Zhu * inf-ptrace.c (inf_ptrace_create_inferior): Initialize back_to. diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index a659afa7b6..b894d848bb 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -3367,6 +3367,9 @@ retry: lp = linux_nat_filter_event (lwpid, status, options); + /* STATUS is now no longer valid, use LP->STATUS instead. */ + status = 0; + if (lp && ptid_is_pid (ptid) && ptid_get_pid (lp->ptid) != ptid_get_pid (ptid)) @@ -3375,7 +3378,7 @@ retry: if (debug_linux_nat) fprintf (stderr, "LWP %ld got an event %06x, leaving pending.\n", - ptid_get_lwp (lp->ptid), status); + ptid_get_lwp (lp->ptid), lp->status); if (WIFSTOPPED (lp->status)) { @@ -3412,7 +3415,7 @@ retry: lp->signalled = 0; } } - else if (WIFEXITED (status) || WIFSIGNALED (status)) + else if (WIFEXITED (lp->status) || WIFSIGNALED (lp->status)) { if (debug_linux_nat) fprintf (stderr, "Process %ld exited while stopping LWPs\n", -- 2.11.0