This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Small patch to enable build of gdb-7.6 for GNU/Hurd


Hello,

Since gdb 7.4.1 a PATH_MAX usage was introduced in the file
gdb/nto-tdep.c:nto_init_solib_absolute_prefix(). This function is only
called in gdb/nto-procfs.c. This file is QNX Neutrino specific and is
not compiled for Hurd (while nto-tdep.c, also QNX-specific is).

The attached patch solve_PATH_MAX_issue.patch fixes the FTBFS for
GNU/Hurd. Alternately the build should be changed to exclude compilation
of nto-tdep.c for non-QNX architectures. The compilation of various
targets specific code is enabled by --enable-targets=all in
the .../gdb/Makefile ALL_TARGET_OBS variable. This seems to be common of
builds for all architectures in Debian.

In case you need feedback from me use Cc: since I'm not subscribed to
gdb-patches.

Thanks,
Svante Signell

--- a/gdb/nto-tdep.c	2013-05-23 14:28:24.000000000 +0000
+++ b/gdb/nto-tdep.c	2013-05-23 15:01:24.000000000 +0000
@@ -147,9 +147,11 @@ nto_find_and_open_solib (char *solib, un
 void
 nto_init_solib_absolute_prefix (void)
 {
-  char buf[PATH_MAX * 2], arch_path[PATH_MAX];
+  char *buf, *arch_path;
   char *nto_root, *endian;
   const char *arch;
+  int arch_len, len;
+#define FMT "set solib-absolute-prefix %s"
 
   nto_root = nto_target ();
   if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
@@ -172,9 +174,13 @@ nto_init_solib_absolute_prefix (void)
 	       == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
-  xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, endian);
+  arch_len = strlen (nto_root) + 1 + strlen (arch) + strlen (endian) + 1;
+  arch_path = alloca (arch_len);
+  xsnprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian);
 
-  xsnprintf (buf, sizeof (buf), "set solib-absolute-prefix %s", arch_path);
+  len = strlen (FMT) - 2 + strlen (arch_path) + 1;
+  buf =  alloca (len);
+  xsnprintf (buf, len, FMT, arch_path);
   execute_command (buf, 0);
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]