From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114618 invoked by alias); 21 Aug 2015 21:22:57 -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 114541 invoked by uid 89); 21 Aug 2015 21:22:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 21 Aug 2015 21:22:54 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id CB67C7B for ; Fri, 21 Aug 2015 21:22:53 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7LLMqss016573 for ; Fri, 21 Aug 2015 17:22:53 -0400 Subject: [PATCH v12 20/32] symfile_bfd_open: Make it use openp_bfd() From: Jan Kratochvil To: gdb-patches@sourceware.org Date: Fri, 21 Aug 2015 21:22:00 -0000 Message-ID: <20150821212252.6673.28754.stgit@host1.jankratochvil.net> In-Reply-To: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> References: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00610.txt.bz2 Hi, another function gets converted to the new API. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * symfile.c (symfile_bfd_open): Use openp_bfd instead of openp and gdb_bfd_open. --- 0 files changed diff --git a/gdb/symfile.c b/gdb/symfile.c index c0eb4ce..1e34c5f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1721,41 +1721,33 @@ bfd * symfile_bfd_open (const char *name) { bfd *sym_bfd; - int desc = -1; struct cleanup *back_to = make_cleanup (null_cleanup, 0); - if (!is_target_filename (name)) + if (is_target_filename (name)) + sym_bfd = filename_to_bfd (name); + else { - char *expanded_name, *absolute_name; + char *expanded_name; expanded_name = tilde_expand (name); /* Returns 1st new malloc'd copy. */ + make_cleanup (xfree, expanded_name); + name = expanded_name; /* Look down path for it, allocate 2nd new malloc'd copy. */ - desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, - expanded_name, &absolute_name); + sym_bfd = openp_bfd (getenv ("PATH"), + OPF_TRY_CWD_FIRST | OPF_BFD_CANONICAL, + expanded_name); #if defined(__GO32__) || defined(_WIN32) || defined (__CYGWIN__) - if (desc < 0) + if (sym_bfd == NULL) { char *exename = alloca (strlen (expanded_name) + 5); strcat (strcpy (exename, expanded_name), ".exe"); - desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, - exename, &absolute_name); + sym_bfd = openp_bfd (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename); } #endif - if (desc < 0) - { - make_cleanup (xfree, expanded_name); - perror_with_name (expanded_name); - } - - xfree (expanded_name); - absolute_name = gdb_realpath_and_xfree (absolute_name); - make_cleanup (xfree, absolute_name); - name = absolute_name; } - sym_bfd = gdb_bfd_open (name, gnutarget, desc); if (!sym_bfd) error (_("`%s': can't open to read symbols: %s."), name, bfd_errmsg (bfd_get_error ())); @@ -1766,7 +1758,7 @@ symfile_bfd_open (const char *name) if (!bfd_check_format (sym_bfd, bfd_object)) { make_cleanup_bfd_unref (sym_bfd); - error (_("`%s': can't read symbols: %s."), name, + error (_("`%s': can't read symbols: %s."), bfd_get_filename (sym_bfd), bfd_errmsg (bfd_get_error ())); }