From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30953 invoked by alias); 27 May 2013 16:03:22 -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 30943 invoked by uid 89); 27 May 2013 16:03:22 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS,TW_XS autolearn=ham version=3.3.1 Received: from mail-bk0-f51.google.com (HELO mail-bk0-f51.google.com) (209.85.214.51) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 27 May 2013 16:03:21 +0000 Received: by mail-bk0-f51.google.com with SMTP id ji1so1657226bkc.10 for ; Mon, 27 May 2013 09:03:19 -0700 (PDT) X-Received: by 10.204.225.209 with SMTP id it17mr12293608bkb.17.1369670599763; Mon, 27 May 2013 09:03:19 -0700 (PDT) Received: from [130.237.20.66] (s1499.it.kth.se. [130.237.20.66]) by mx.google.com with ESMTPSA id i15sm8648734bkz.12.2013.05.27.09.03.18 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 27 May 2013 09:03:19 -0700 (PDT) Message-ID: <1369670598.8127.118.camel@s1499.it.kth.se> Subject: New patch: Re: Small patch to enable build of gdb-7.6 for GNU/Hurd From: Svante Signell To: Joel Brobecker Cc: Sergio Durigan Junior , Pedro Alves , gdb-patches@sourceware.org Date: Mon, 27 May 2013 16:03:00 -0000 In-Reply-To: <20130527143053.GC5751@adacore.com> References: <20130524042734.GG4017@adacore.com> <519F2A7A.4050002@redhat.com> <1369386446.8127.51.camel@s1499.it.kth.se> <1369654913.8127.84.camel@s1499.it.kth.se> <20130527121028.GB5751@adacore.com> <1369657278.8127.90.camel@s1499.it.kth.se> <1369662500.8127.97.camel@s1499.it.kth.se> <1369663027.8127.99.camel@s1499.it.kth.se> <20130527143053.GC5751@adacore.com> Content-Type: multipart/mixed; boundary="=-LH4OHkUH231Y4cFUrFjW" Mime-Version: 1.0 X-Virus-Found: No X-SW-Source: 2013-05/txt/msg00956.txt.bz2 --=-LH4OHkUH231Y4cFUrFjW Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 793 On Mon, 2013-05-27 at 18:30 +0400, Joel Brobecker wrote: > 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, Note: Separate patch for another function: find_and_open_solib as requested. Attaching a patch and Chengelog entry for the function nto_find_and_open_solib preceding nto_init_solib_absolute_prefix. There I did not see any use of the make_cleanup/do_cleanups functions (assuming open and openp always return). Therefore xfree is used directly. (Maybe line break of the first xsnprintf statement is not correctly placed, what does GCS say here?) --=-LH4OHkUH231Y4cFUrFjW Content-Disposition: attachment; filename="ChangeLog.use_xstrprintf" Content-Type: text/plain; name="ChangeLog.use_xstrprintf"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 219 2013-05-27 Svante Signell * nto-dep.c (nto_find_and_open_solib): Use xstrprintf followed by a cleanup instead of alloca to be consistent with function (nto_init_solib_absolute_prefix). --=-LH4OHkUH231Y4cFUrFjW Content-Disposition: attachment; filename="use_xstrprintf.patch" Content-Type: text/x-patch; name="use_xstrprintf.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 1663 --- a/gdb/nto-tdep.c 2013-05-27 15:58:07.000000000 +0200 +++ b/gdb/nto-tdep.c 2013-05-27 16:23:50.000000000 +0200 @@ -89,9 +89,7 @@ nto_find_and_open_solib (char *solib, un char *buf, *arch_path, *nto_root, *endian; const char *base; const char *arch; - int arch_len, len, ret; -#define PATH_FMT \ - "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll" + int ret; nto_root = nto_target (); if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0) @@ -117,22 +115,20 @@ nto_find_and_open_solib (char *solib, un /* In case nto_root is short, add strlen(solib) so we can reuse arch_path below. */ - arch_len = (strlen (nto_root) + strlen (arch) + strlen (endian) + 2 - + strlen (solib)); - arch_path = alloca (arch_len); - xsnprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian); + arch_path = xstrprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian); - len = strlen (PATH_FMT) + strlen (arch_path) * 5 + 1; - buf = alloca (len); - xsnprintf (buf, len, PATH_FMT, arch_path, arch_path, arch_path, arch_path, + buf = xstrprintf ("\"%s\"/lib:\"%s\"/usr/lib:\"%s\"/usr/photon/lib:\"%s\"/usr/photon/dll:\"%s\"/lib/dll", arch_path, arch_path, arch_path, arch_path, arch_path); + xfree (arch_path); base = lbasename (solib); ret = openp (buf, 1, base, o_flags, temp_pathname); + xfree (buf); if (ret < 0 && base != solib) { - xsnprintf (arch_path, arch_len, "/%s", solib); + arch_path = xstrprintf ("/%s", solib); ret = open (arch_path, o_flags, 0); + xfree (arch_path); if (temp_pathname) { if (ret >= 0) --=-LH4OHkUH231Y4cFUrFjW--