This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Small patch to enable build of gdb-7.6 for GNU/Hurd
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Svante Signell <svante dot signell at gmail dot com>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>, Pedro Alves <palves at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 29 May 2013 13:26:06 +0400
- Subject: Re: Small patch to enable build of gdb-7.6 for GNU/Hurd
- References: <519F2A7A dot 4050002 at redhat dot com> <1369386446 dot 8127 dot 51 dot camel at s1499 dot it dot kth dot se> <m3hahslp0a dot fsf at redhat dot com> <1369654913 dot 8127 dot 84 dot camel at s1499 dot it dot kth dot se> <20130527121028 dot GB5751 at adacore dot com> <1369657278 dot 8127 dot 90 dot camel at s1499 dot it dot kth dot se> <1369662500 dot 8127 dot 97 dot camel at s1499 dot it dot kth dot se> <1369663027 dot 8127 dot 99 dot camel at s1499 dot it dot kth dot se> <20130527143053 dot GC5751 at adacore dot com> <1369670373 dot 8127 dot 116 dot camel at s1499 dot it dot kth dot se>
> 2013-05-27 Svante Signell <svante.signell@gmail.com>
>
> * nto-tdep.c (nto_init_solib_absolute_prefix): Solve build
> problems for systems not defining PATH_MAX by using xstrprintf
> followed by a cleanup.
As noticed by Thomas, he's right that we are introducing extra
quoting of the command's argument, and I don't think we should be
doing that in this patch. We can discuss the need to do so, but
it should be done separately.
Other than that, the patch looks good to me. Just give it a few more
days (say until Monday) before we commit the patch. Do you have an
FSF copyright assignment on file?
> --- a/gdb/nto-tdep.c
> +++ b/gdb/nto-tdep.c
> @@ -147,9 +147,10 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
> void
> nto_init_solib_absolute_prefix (void)
> {
> - char buf[PATH_MAX * 2], arch_path[PATH_MAX];
> + char *buf;
> char *nto_root, *endian;
> const char *arch;
> + struct cleanup *old_chain;
>
> nto_root = nto_target ();
> if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
> @@ -172,10 +173,11 @@ nto_init_solib_absolute_prefix (void)
> == BFD_ENDIAN_BIG ? "be" : "le";
> }
>
> - xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, endian);
> -
> - xsnprintf (buf, sizeof (buf), "set solib-absolute-prefix %s", arch_path);
> + buf = xstrprintf ("set solib-absolute-prefix \"%s/%s%s\"",
> + nto_root, arch, endian);
> + old_chain = make_cleanup (xfree, buf);
> execute_command (buf, 0);
> + do_cleanups (old_chain);
> }
>
> char **
--
Joel