From patchwork Thu Dec 8 11:54:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 18283 Received: (qmail 94334 invoked by alias); 8 Dec 2016 11:54:57 -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 94317 invoked by uid 89); 8 Dec 2016 11:54:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=H*r:PST, Don X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Dec 2016 11:54:46 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1cExHg-0003So-77 from Thomas_Schwinge@mentor.com ; Thu, 08 Dec 2016 03:54:44 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.224.2; Thu, 8 Dec 2016 03:54:43 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 40C6FC222B; Thu, 8 Dec 2016 03:54:43 -0800 (PST) From: Thomas Schwinge To: Don Breazeal , CC: , <834575@bugs.debian.org>, <834575-forwarded@bugs.debian.org>, Subject: Re: [pushed][PATCH v3 1/4] Extended-remote follow exec In-Reply-To: <1441996698-12694-1-git-send-email-donb@codesourcery.com> References: <1441996698-12694-1-git-send-email-donb@codesourcery.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Thu, 8 Dec 2016 12:54:36 +0100 Message-ID: <87vauuiqkj.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Fri, 11 Sep 2015 11:38:15 -0700, Don Breazeal wrote: > Here is what I pushed. > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -6089,11 +6178,42 @@ Packet: '%s'\n"), > event->ws.kind = TARGET_WAITKIND_VFORK_DONE; > p = skip_to_semicolon (p1 + 1); > } > + else if (strncmp (p, "exec", p1 - p) == 0) > + { > + ULONGEST ignored; > + char pathname[PATH_MAX]; > + int pathlen; > + > + /* Determine the length of the execd pathname. */ > + p = unpack_varlen_hex (++p1, &ignored); > + pathlen = (p - p1) / 2; > + > + /* Save the pathname for event reporting and for > + the next run command. */ > + hex2bin (p1, (gdb_byte *) pathname, pathlen); > + pathname[pathlen] = '\0'; > + > + /* This is freed during event handling. */ > + event->ws.value.execd_pathname = xstrdup (pathname); > + event->ws.kind = TARGET_WAITKIND_EXECD; > + > + /* Skip the registers included in this packet, since > + they may be for an architecture different from the > + one used by the original program. */ > + skipregs = 1; > + } On GNU/Hurd, there is no "#define PATH_MAX", so this fails to build. (I'm aware that there is other PATH_MAX usage in GDB sources, which we ought to fix at some point, for example in gdbserver -- which is not yet enabled for GNU/Hurd.) OK to push the following? (Similar to Svante's patch in .) Grüße Thomas --- gdb/remote.c +++ gdb/remote.c @@ -6927,7 +6927,6 @@ Packet: '%s'\n"), else if (strprefix (p, p1, "exec")) { ULONGEST ignored; - char pathname[PATH_MAX]; int pathlen; /* Determine the length of the execd pathname. */ @@ -6936,11 +6935,12 @@ Packet: '%s'\n"), /* Save the pathname for event reporting and for the next run command. */ + char *pathname = (char *) xmalloc (pathlen + 1); hex2bin (p1, (gdb_byte *) pathname, pathlen); pathname[pathlen] = '\0'; /* This is freed during event handling. */ - event->ws.value.execd_pathname = xstrdup (pathname); + event->ws.value.execd_pathname = pathname; event->ws.kind = TARGET_WAITKIND_EXECD; /* Skip the registers included in this packet, since