From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10265 invoked by alias); 29 Jul 2017 23:56:23 -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 8759 invoked by uid 89); 29 Jul 2017 23:56:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 29 Jul 2017 23:56:21 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v6TNuEDR024448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 29 Jul 2017 19:56:19 -0400 Received: by simark.ca (Postfix, from userid 112) id 989CE1EA05; Sat, 29 Jul 2017 19:56:14 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id D3E5B1E043; Sat, 29 Jul 2017 19:56:02 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 29 Jul 2017 23:56:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA v2 04/24] Use gdb_file_up in fbsd-nat.c In-Reply-To: <20170725172107.9799-5-tom@tromey.com> References: <20170725172107.9799-1-tom@tromey.com> <20170725172107.9799-5-tom@tromey.com> Message-ID: <9c585dd8f427d6568c6461d0717a88db@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 29 Jul 2017 23:56:14 +0000 X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00438.txt.bz2 On 2017-07-25 19:20, Tom Tromey wrote: > 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-07-25 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 fc9d184..ab0a51f 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,5 +1,9 @@ > 2017-07-25 Tom Tromey > > + * fbsd-nat.c (fbsd_find_memory_regions): Update. > + > +2017-07-25 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; LGTM.