[gdb, hurd] Avoid using 'PATH_MAX' in 'gdb/remote.c'
authorThomas Schwinge <thomas@codesourcery.com>
Fri, 17 Feb 2017 16:45:01 +0000 (16:45 +0000)
committerThomas Schwinge <thomas@codesourcery.com>
Thu, 14 Feb 2019 16:40:19 +0000 (17:40 +0100)
..., 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
gdb/remote.c

index f2bbd77558dd374c12e6626996d7685c96edc9a9..bb27f74de147764304112536c1524706762709fb 100644 (file)
@@ -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>
index 18e678d07af86a60e1f35e9e9aaefd9acf461c7f..85af01e4b7321de679db6ca63a8fb7e308bdd87c 100644 (file)
@@ -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
This page took 0.029876 seconds and 4 git commands to generate.