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

Svante Signell
2013-05-27T15:59:39Z

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

On Mon, 2013-05-27 at 18:30 +0400, Joel Brobecker wrote:
> > Additionally, I think the char buf; statement should read char *buf; in
> > the patch.
>
> Clearly lots of errors in the patch I sent. Can you apply the changes
> you suggested, recompile to make sure it at least builds, and post
> again here. Because there is no testing involved, I'd like more people
> to have a chance to review it before it gets checked in.
>
> Thank you,

Ok, updated patch and ChangeLog entry attached.

[-- Attachment #2: ChangeLog.solve_PATH_MAX_issue --]
[-- Type: text/plain, Size: 206 bytes --]

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.

[-- Attachment #3: solve_PATH_MAX_issue.patch --]
[-- Type: text/x-patch, Size: 922 bytes --]

--- 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 **