From patchwork Thu Aug 6 09:33:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 8039 Received: (qmail 126792 invoked by alias); 6 Aug 2015 09:34:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 126773 invoked by uid 89); 6 Aug 2015 09:34:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 06 Aug 2015 09:34:00 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 63F94FC0DD; Thu, 6 Aug 2015 09:33:59 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t769XvKR008385; Thu, 6 Aug 2015 05:33:58 -0400 Message-ID: <55C32A05.3060204@redhat.com> Date: Thu, 06 Aug 2015 10:33:57 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: [pushed][PATCH 1/3] Linux gdbserver fork event debug output (Re: [PATCH/7.10 1/2] Linux gdbserver confused when event randomization returns a process exit event) References: <1438362229-27653-1-git-send-email-palves@redhat.com> <1438362229-27653-2-git-send-email-palves@redhat.com> <86io8weize.fsf@gmail.com> In-Reply-To: <86io8weize.fsf@gmail.com> On 08/03/2015 11:58 AM, Yao Qi wrote: > Looks this code is dead code even without your patch. This code is > guarded by "if (!report_to_gdb)", but if report_to_gdb is false, > "(event_child->waitstatus.kind != TARGET_WAITKIND_IGNORE)" is false too. > Indeed. I've pushed this preliminary patch, to address that. Thanks! -------- From ad071a3055b9b47dad340c1a1cb3a9b39529cef0 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 6 Aug 2015 10:30:16 +0100 Subject: [PATCH 1/3] Linux gdbserver fork event debug output The "extended event with waitstatus" debug output is unreachable, as it is guarded by "if (!report_to_gdb)". If extended_event_reported is true, then so is report_to_gdb. Move it to where we print why we're reporting an event to GDB. Also, the debug output currently tries to print the wrong struct target_waitstatus. gdb/gdbserver/ChangeLog: 2015-08-06 Pedro Alves * linux-low.c (linux_wait_1): Move fork event output out of the !report_to_gdb check. Pass event_child->waitstatus to target_waitstatus_to_string instead of ourstatus. --- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/linux-low.c | 16 +++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 43cae40..eb1101c 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2015-08-06 Pedro Alves + + * linux-low.c (linux_wait_1): Move fork event output out of the + !report_to_gdb check. Pass event_child->waitstatus to + target_waitstatus_to_string instead of ourstatus. + 2015-08-04 Yao Qi * linux-aarch64-low.c (aarch64_supports_tracepoints): Return 0 diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index f1e1d72..76b212d 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -3153,13 +3153,6 @@ linux_wait_1 (ptid_t ptid, paddress (event_child->stop_pc), paddress (event_child->step_range_start), paddress (event_child->step_range_end)); - if (extended_event_reported (&event_child->waitstatus)) - { - char *str = target_waitstatus_to_string (ourstatus); - debug_printf ("LWP %ld: extended event with waitstatus %s\n", - lwpid_of (get_lwp_thread (event_child)), str); - xfree (str); - } } /* We're not reporting this breakpoint to GDB, so apply the @@ -3190,6 +3183,15 @@ linux_wait_1 (ptid_t ptid, if (debug_threads) { + if (extended_event_reported (&event_child->waitstatus)) + { + char *str; + + str = target_waitstatus_to_string (&event_child->waitstatus); + debug_printf ("LWP %ld: extended event with waitstatus %s\n", + lwpid_of (get_lwp_thread (event_child)), str); + xfree (str); + } if (current_thread->last_resume_kind == resume_step) { if (event_child->step_range_start == event_child->step_range_end)