From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14433 invoked by alias); 27 May 2013 12:10:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14422 invoked by uid 89); 27 May 2013 12:10:36 -0000 X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,TW_XS autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 27 May 2013 12:10:36 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 705D42ED09; Mon, 27 May 2013 08:10:34 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DbUg2qelrp1C; Mon, 27 May 2013 08:10:34 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A45852ECF7; Mon, 27 May 2013 08:10:33 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 251D0C26EE; Mon, 27 May 2013 16:10:28 +0400 (RET) Date: Mon, 27 May 2013 12:10:00 -0000 From: Joel Brobecker To: Svante Signell Cc: Sergio Durigan Junior , Pedro Alves , gdb-patches@sourceware.org Subject: Re: Small patch to enable build of gdb-7.6 for GNU/Hurd Message-ID: <20130527121028.GB5751@adacore.com> References: <1369326967.8127.33.camel@s1499.it.kth.se> <20130524042734.GG4017@adacore.com> <519F2A7A.4050002@redhat.com> <1369386446.8127.51.camel@s1499.it.kth.se> <1369654913.8127.84.camel@s1499.it.kth.se> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline In-Reply-To: <1369654913.8127.84.camel@s1499.it.kth.se> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Found: No X-SW-Source: 2013-05/txt/msg00947.txt.bz2 --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 778 > 2013-05-27 Svante Signell > > * nto-tdep.c (nto_init_solib_absolute_prefix): Solve build > problems for systems not defining PATH_MAX by using xstrprintf and > a cleanup. Is the domain name above really valid? > Attached is an updated patch for the build problems on systems where > PATH_MAX is not defined. In this case, I think you need to use what we call a "cleanup", because execute_command might trigger an "error" (GDB's poor man's exception mechanism), thus prevening the last xfree from releasing buf. A formatting nit: The GNU Coding Standard, which we follow in GDB, requires a space before opening parens. While looking at this code, I don't think you'll need 2 xstrprintf either. Can you try the attached patch? -- Joel --+HP7ph2BbKc20aGI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="nto-tdep.diff" Content-length: 997 diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index 748869f..cf4fd60 100644 --- 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); + make_cleanup (old_chain); } char ** --+HP7ph2BbKc20aGI--