Source: gdb
Version: 7.11.1-2
Severity: important
Tags: patch
User: [email protected]
Usertags: hurd

Hi,

gdb fails to build on GNU/Hurd due to a missing rename of "thread_id_to_pid" to
"global_thread_id_to_ptid" in gdb/gnu-nat.c and a PATH_MAX issue in
gdb/remote.c. The two attached patches fixes these problems. These patches can
probably be forwarded upstream for review.

Thanks!
Index: gdb-7.11.1/gdb/gnu-nat.c
===================================================================
--- gdb-7.11.1.orig/gdb/gnu-nat.c
+++ gdb-7.11.1/gdb/gnu-nat.c
@@ -2970,7 +2970,7 @@ set_sig_thread_cmd (char *args, int from
     inf->signal_thread = 0;
   else
     {
-      ptid_t ptid = thread_id_to_pid (atoi (args));
+      ptid_t ptid = global_thread_id_to_ptid (atoi (args));
 
       if (ptid_equal (ptid, minus_one_ptid))
 	error (_("Thread ID %s not known.  "
Index: gdb-7.11.1/gdb/remote.c
===================================================================
--- gdb-7.11.1.orig/gdb/remote.c
+++ gdb-7.11.1/gdb/remote.c
@@ -6557,7 +6557,7 @@ Packet: '%s'\n"),
 	  else if (strprefix (p, p1, "exec"))
 	    {
 	      ULONGEST ignored;
-	      char pathname[PATH_MAX];
+	      char *pathname = NULL;
 	      int pathlen;
 
 	      /* Determine the length of the execd pathname.  */
@@ -6566,12 +6566,14 @@ Packet: '%s'\n"),
 
 	      /* Save the pathname for event reporting and for
 		 the next run command.  */
+	      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.kind = TARGET_WAITKIND_EXECD;
+	      xfree (pathname);
 
 	      /* Skip the registers included in this packet, since
 		 they may be for an architecture different from the

Reply via email to