From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51428 invoked by alias); 3 May 2017 22:46:35 -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 51344 invoked by uid 89); 3 May 2017 22:46:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy6.mail.unifiedlayer.com Received: from gproxy6-pub.mail.unifiedlayer.com (HELO gproxy6.mail.unifiedlayer.com) (67.222.39.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 May 2017 22:46:33 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy6.mail.unifiedlayer.com (Postfix) with ESMTP id 918011E06E3 for ; Wed, 3 May 2017 16:46:34 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id FymX1v00R2f2jeq01ymaKh; Wed, 03 May 2017 16:46:34 -0600 X-Authority-Analysis: v=2.2 cv=K+5SJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=tJ8p9aeEuA8A:10 a=zstS-IiYAAAA:8 a=zDB89MSnaF2FIN2aWdEA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-63-71.hlrn.qwest.net ([75.166.63.71]:53090 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1d632V-00051x-7M; Wed, 03 May 2017 16:46:31 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 04/23] Use gdb_file_up in fbsd-nat.c Date: Wed, 03 May 2017 22:46:00 -0000 Message-Id: <20170503224626.2818-5-tom@tromey.com> In-Reply-To: <20170503224626.2818-1-tom@tromey.com> References: <20170503224626.2818-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1d632V-00051x-7M X-Source-Sender: 75-166-63-71.hlrn.qwest.net (bapiya.Home) [75.166.63.71]:53090 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2017-05/txt/msg00074.txt.bz2 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. 2017-05-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 76c53be..799b727 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-05-02 Tom Tromey + * fbsd-nat.c (fbsd_find_memory_regions): Update. + +2017-05-02 Tom Tromey + * cli/cli-cmds.c (find_and_open_script): Return gdb_file_p. Remove "streamp" argument. Change "full_path" to a unique_xmalloc_ptr. diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index ef5ad1e..3a84abc 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -160,7 +160,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; @@ -168,17 +167,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; -- 2.9.3