Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Cc: <834575@bugs.debian.org>, <834575-forwarded@bugs.debian.org>,
	<bug-hurd@gnu.org>, <svante.signell@gmail.com>
Subject: Re: [pushed][PATCH v3 1/4] Extended-remote follow exec
Date: Thu, 14 Feb 2019 16:42:00 -0000	[thread overview]
Message-ID: <87a7iyiao5.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <49527ebd-a1b3-fff2-fc59-bb557e6d0c50@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]

Hi!

On Fri, 17 Feb 2017 16:45:01 +0000, Pedro Alves <palves@redhat.com> wrote:
> Only noticed this patch now.

Heh, and I've only now gotten back to completing this.  ;-)

> > 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
> > <https://bugs.debian.org/834575>.)
> 
> 
> > 
> > --- 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';
> 
> 
> hex2bin can throw, so wrap with a cleanup:
> 
>               char *pathname = (char *) xmalloc (pathlen + 1);
>               struct cleanup *old_chain = make_cleanup (xfree, pathname);
>   	      hex2bin (p1, (gdb_byte *) pathname, pathlen);
>   	      pathname[pathlen] = '\0';
>               discard_cleanups (old_chain);
> 
> OK with that change.

Thanks; pushed to master the attached commit
b671c7fb21306ce125717a44c30a71686bd24db1 "[gdb, hurd] Avoid using
'PATH_MAX' in 'gdb/remote.c'".


Grüße
 Thomas



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gdb-hurd-Avoid-using-PATH_MAX-in-gdb-remote.c.patch --]
[-- Type: text/x-diff, Size: 2311 bytes --]

From b671c7fb21306ce125717a44c30a71686bd24db1 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 17 Feb 2017 16:45:01 +0000
Subject: [PATCH] [gdb, hurd] Avoid using 'PATH_MAX' in 'gdb/remote.c'

..., which is not defined in GNU/Hurd systems, and so commit
94585166dfea8232c248044f9f4b1c217dc4ac2e "Extended-remote follow-exec" caused:

    [...]/gdb/remote.c: In member function 'void remote_target::remote_parse_stop_reply(const char*, stop_reply*)':
    [...]/gdb/remote.c:7343:22: error: 'PATH_MAX' was not declared in this scope
            char pathname[PATH_MAX];
                          ^~~~~~~~

	gdb/
	* remote.c (remote_target::remote_parse_stop_reply): Avoid using
	'PATH_MAX'.
---
 gdb/ChangeLog | 6 ++++++
 gdb/remote.c  | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f2bbd77558..bb27f74de1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-14  Thomas Schwinge  <thomas@codesourcery.com>
+	    Pedro Alves  <palves@redhat.com>
+
+	* remote.c (remote_target::remote_parse_stop_reply): Avoid using
+	'PATH_MAX'.
+
 2019-02-14  David Michael  <fedora.dm0@gmail.com>
 	    Samuel Thibault  <samuel.thibault@gnu.org>
 	    Thomas Schwinge  <thomas@codesourcery.com>
diff --git a/gdb/remote.c b/gdb/remote.c
index 18e678d07a..85af01e4b7 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7340,7 +7340,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.  */
@@ -7349,11 +7348,14 @@ Packet: '%s'\n"),
 
 	      /* Save the pathname for event reporting and for
 		 the next run command.  */
+	      char *pathname = (char *) xmalloc (pathlen + 1);
+	      struct cleanup *old_chain = make_cleanup (xfree, pathname);
 	      hex2bin (p1, (gdb_byte *) pathname, pathlen);
 	      pathname[pathlen] = '\0';
+	      discard_cleanups (old_chain);
 
 	      /* 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
-- 
2.19.2


  reply	other threads:[~2019-02-14 16:42 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 21:49 [PATCH 0/5] " Don Breazeal
2015-07-15 21:50 ` [PATCH 1/5] Extended-remote exec events Don Breazeal
2015-07-16 14:01   ` Yao Qi
2015-07-16 15:52     ` Don Breazeal
2015-07-16 16:35       ` Yao Qi
2015-07-16 17:06         ` Don Breazeal
2015-07-17 11:55           ` Yao Qi
2015-07-15 21:50 ` [PATCH 3/5] Extended-remote support for exec event tests Don Breazeal
2015-07-15 21:50 ` [PATCH 2/5] Extended-remote exec catchpoints Don Breazeal
2015-08-13 15:00   ` Pedro Alves
2015-07-15 21:51 ` [PATCH 4/5] Eliminate spurious warnings from remote exec Don Breazeal
2015-07-15 21:51 ` [PATCH 5/5] Extended-remote exec event docs Don Breazeal
2015-07-16  2:39   ` Eli Zaretskii
2015-07-30 23:19 ` [PATCH v2 0/5] Extended-remote exec events Don Breazeal
2015-07-30 23:19   ` [PATCH v2 2/5] Extended-remote exec catchpoints Don Breazeal
2015-07-30 23:19   ` [PATCH v2 1/5] Extended-remote follow exec Don Breazeal
2015-08-13 14:50     ` Pedro Alves
2015-07-30 23:20   ` [PATCH v2 5/5] Extended-remote exec event docs Don Breazeal
2015-07-31  6:36     ` Eli Zaretskii
2015-07-31 17:06       ` Don Breazeal
2015-08-13 15:43     ` Pedro Alves
2015-07-30 23:20   ` [PATCH v2 3/5] Extended-remote support for exec event tests Don Breazeal
2015-08-13 15:22     ` Pedro Alves
2015-07-30 23:20   ` [PATCH v2 4/5] Eliminate spurious warnings from remote exec Don Breazeal
2015-08-13 15:38     ` Pedro Alves
2015-09-09 23:05   ` [PATCH v3 0/4] Extended-remote exec events Don Breazeal
2015-09-09 23:06     ` [PATCH v3 2/4] Extended-remote exec catchpoints Don Breazeal
2015-09-09 23:06     ` [PATCH v3 4/4] Extended-remote exec event docs Don Breazeal
2015-09-10 15:23       ` Eli Zaretskii
2015-09-09 23:06     ` [PATCH v3 1/4] Extended-remote follow exec Don Breazeal
     [not found]       ` <55F17AFA.5080102@redhat.com>
2015-09-10 22:56         ` Don Breazeal
2015-09-10 23:00           ` Don Breazeal
2015-09-11  8:34           ` Pedro Alves
2015-09-11 18:38             ` [pushed][PATCH " Don Breazeal
2015-09-11 18:38               ` [pushed][PATCH v3 2/4] Extended-remote exec catchpoints Don Breazeal
2015-09-11 18:38               ` [pushed][PATCH v3 3/4] Extended-remote exec test Don Breazeal
2015-09-15 15:45                 ` Pedro Alves
2015-09-15 15:53                   ` Don Breazeal
2015-09-15 15:58                     ` Pedro Alves
2015-09-15 16:00                       ` Breazeal, Don
2015-09-15 16:28                         ` Pedro Alves
2015-09-11 18:39               ` [pushed][PATCH v3 4/4] Extended-remote exec event docs Don Breazeal
2015-09-15  8:56               ` [pushed][PATCH v3 1/4] Extended-remote follow exec Yao Qi
2015-09-15 16:12                 ` Don Breazeal
2015-09-15 16:31                   ` Yao Qi
2015-09-30 16:20               ` Pedro Alves
2015-09-30 16:22                 ` Breazeal, Don
2016-12-08 11:54               ` Thomas Schwinge
2017-02-17 16:45                 ` Pedro Alves
2019-02-14 16:42                   ` Thomas Schwinge [this message]
2019-02-14 17:26                     ` Tom Tromey
2019-02-14 23:11                       ` Tom Tromey
2015-09-09 23:06     ` [PATCH v3 3/4] Extended-remote support for exec event tests Don Breazeal
2015-09-10 13:26       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7iyiao5.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=834575-forwarded@bugs.debian.org \
    --cc=834575@bugs.debian.org \
    --cc=bug-hurd@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=svante.signell@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox