Index: gdb-8.0/gdb/remote.c =================================================================== --- gdb-8.0.orig/gdb/remote.c +++ gdb-8.0/gdb/remote.c @@ -6939,7 +6939,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. */ @@ -6948,12 +6948,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