From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105586 invoked by alias); 15 Apr 2015 15:38:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 105574 invoked by uid 89); 15 Apr 2015 15:38:55 -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,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Wed, 15 Apr 2015 15:38:54 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id C66B591E84; Wed, 15 Apr 2015 15:38:53 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3FFcpkt017443; Wed, 15 Apr 2015 11:38:52 -0400 Message-ID: <552E860B.3040308@redhat.com> Date: Wed, 15 Apr 2015 15:38:00 -0000 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: Don Breazeal , gdb-patches@sourceware.org Subject: Re: [PATCH v7 5/7] Remote follow vfork References: <1428685786-18094-1-git-send-email-donb@codesourcery.com> <1428685786-18094-6-git-send-email-donb@codesourcery.com> In-Reply-To: <1428685786-18094-6-git-send-email-donb@codesourcery.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg00574.txt.bz2 On 04/10/2015 06:09 PM, Don Breazeal wrote: > Hi Pedro, > > This version of the patch incorporates changes based on your comments on > the previous version, as outlined below. > > On 3/24/2015 5:28 AM, Pedro Alves wrote: >> On 03/17/2015 08:56 PM, Don Breazeal wrote: >> >>> diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c >>> index dc43e38..42c3ec5 100644 >>> --- a/gdb/gdbserver/remote-utils.c >>> +++ b/gdb/gdbserver/remote-utils.c >>> @@ -1115,15 +1115,19 @@ prepare_resume_reply (char *buf, ptid_t ptid, >>> { >>> case TARGET_WAITKIND_STOPPED: >>> case TARGET_WAITKIND_FORKED: >>> + case TARGET_WAITKIND_VFORKED: >>> { >>> struct thread_info *saved_thread; >>> const char **regp; >>> struct regcache *regcache; >>> >>> - if (status->kind == TARGET_WAITKIND_FORKED && report_fork_events) >>> + if ((status->kind == TARGET_WAITKIND_FORKED && report_fork_events) >>> + || (status->kind == TARGET_WAITKIND_VFORKED >>> + && report_vfork_events)) >>> { >>> enum gdb_signal signal = GDB_SIGNAL_TRAP; >>> - const char *event = "xfork"; >>> + const char *event = (status->kind == TARGET_WAITKIND_FORKED >>> + ? "xfork" : "vfork"); >>> >>> sprintf (buf, "T%02x%s:", signal, event); >>> buf += strlen (buf); >>> @@ -1245,6 +1249,15 @@ prepare_resume_reply (char *buf, ptid_t ptid, >>> else >>> sprintf (buf, "X%02x", status->value.sig); >>> break; >>> + case TARGET_WAITKIND_VFORK_DONE: >>> + if (multi_process) >>> + { >>> + enum gdb_signal signal = GDB_SIGNAL_TRAP; >>> + const char *event = "vforkdone"; >>> + >> >> Should only include vforkdone if report_vfork_events is true, I'd think. > > If we get one of these events (fork, vfork, vforkdone) and report_xxx_events > is not set, then it is a bug, so I put those flags into asserts for all > three events to ensure proper behavior. I don't think that's a good idea. For instance, what if a thread/lwp has already stopped for VFORK_DONE but the event is left pending to report to the gdb. Meanwhile, gdb disconnects before the event is sent. Now a new gdb reconnects, without support for vfork-done. See server.c:handle_status, both non-stop and all-stop. That would trigger that assertion. > + if (status->kind == TARGET_WAITKIND_FORKED) > + { > + gdb_assert (report_fork_events); > + sprintf (buf, "T%02xfork:", signal); > + } > + else > + { > + gdb_assert (report_vfork_events); > + sprintf (buf, "T%02xvfork:", signal); Eh, I had asked to _remove_ the 'x's, not add them. Could you please drop them? Thanks, Pedro Alves