From patchwork Wed Aug 2 15:02:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 21864 Received: (qmail 36601 invoked by alias); 2 Aug 2017 15:03:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 36532 invoked by uid 89); 2 Aug 2017 15:03:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy6-pub.mail.unifiedlayer.com Received: from gproxy6-pub.mail.unifiedlayer.com (HELO gproxy6-pub.mail.unifiedlayer.com) (67.222.39.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Aug 2017 15:03:37 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy6.mail.unifiedlayer.com (Postfix) with ESMTP id 7FBF71E162E for ; Wed, 2 Aug 2017 09:02:35 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id sF2Y1v01C2f2jeq01F2beA; Wed, 02 Aug 2017 09:02:35 -0600 X-Authority-Analysis: v=2.2 cv=XMVAcUpE c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=KeKAF7QvOSUA:10 a=zstS-IiYAAAA:8 a=p-3l0jf0X3mlRyBjcKcA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-29-39-24.hlrn.qwest.net ([174.29.39.24]:54692 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dcvAO-002dpC-7e; Wed, 02 Aug 2017 09:02:32 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v3 04/23] Use gdb_file_up in fbsd-nat.c Date: Wed, 2 Aug 2017 09:02:08 -0600 Message-Id: <20170802150227.24460-5-tom@tromey.com> In-Reply-To: <20170802150227.24460-1-tom@tromey.com> References: <20170802150227.24460-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dcvAO-002dpC-7e X-Source-Sender: 174-29-39-24.hlrn.qwest.net (bapiya.Home) [174.29.39.24]:54692 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This updates fbsd-nat.c to use gdb_file_up. This removes a use of a cleanup, and helps remove make_cleanup_fclose in a later patch. I have no way to test this patch. ChangeLog 2017-08-02 Tom Tromey * fbsd-nat.c (fbsd_find_memory_regions): Update. --- gdb/ChangeLog | 4 ++++ gdb/fbsd-nat.c | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c976483..e3ff571 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-08-02 Tom Tromey + * fbsd-nat.c (fbsd_find_memory_regions): Update. + +2017-08-02 Tom Tromey + * cli/cli-cmds.c (find_and_open_script): Change return type. Remove "streamp" and "full_path" parameters. (source_script_with_search): Update. diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 85f5605..833f460 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -161,7 +161,6 @@ fbsd_find_memory_regions (struct target_ops *self, { pid_t pid = ptid_get_pid (inferior_ptid); char *mapfilename; - FILE *mapfile; unsigned long start, end, size; char protection[4]; int read, write, exec; @@ -169,17 +168,16 @@ fbsd_find_memory_regions (struct target_ops *self, mapfilename = xstrprintf ("/proc/%ld/map", (long) pid); cleanup = make_cleanup (xfree, mapfilename); - mapfile = fopen (mapfilename, "r"); + gdb_file_up mapfile = fopen (mapfilename, "r"); if (mapfile == NULL) error (_("Couldn't open %s."), mapfilename); - make_cleanup_fclose (mapfile); if (info_verbose) fprintf_filtered (gdb_stdout, "Reading memory regions from %s\n", mapfilename); /* Now iterate until end-of-file. */ - while (fbsd_read_mapping (mapfile, &start, &end, &protection[0])) + while (fbsd_read_mapping (mapfile.get (), &start, &end, &protection[0])) { size = end - start;