From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32025 invoked by alias); 20 Oct 2009 20:03:30 -0000 Received: (qmail 31957 invoked by uid 22791); 20 Oct 2009 20:03:30 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Oct 2009 20:03:26 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id AE7AB4B022; Tue, 20 Oct 2009 13:03:24 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost3.vmware.com (Postfix) with ESMTP id 9B864CDABE; Tue, 20 Oct 2009 13:03:24 -0700 (PDT) Message-ID: <4ADE1612.9040708@vmware.com> Date: Tue, 20 Oct 2009 20:03:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Hui Zhu CC: Eli Zaretskii , "gdb-patches@sourceware.org" Subject: Re: [RFA, 3 of 3] save/restore process record, part 3 (save/restore) References: <4AD91D72.1030802@vmware.com> <831vl2ifui.fsf@gnu.org> <4ADA0EB3.60104@vmware.com> <83my3phjew.fsf@gnu.org> <4ADA4191.4060404@vmware.com> <83k4ytgxh5.fsf@gnu.org> <4ADA93C9.5040601@vmware.com> <4ADCA7DC.5040006@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2009-10/txt/msg00477.txt.bz2 Hui Zhu wrote: > On Tue, Oct 20, 2009 at 01:54, Michael Snyder wrote: >> Hui Zhu wrote: >>> Hi Michael, >>> >>> + do_cleanups (old_cleanups); >>> >>> This line will remove the record file that we just save. >>> >>> I change some code: >>> static void >>> record_save_cleanups (void *data) >>> { >>> bfd *obfd = data; >>> //char *pathname = xstrdup (bfd_get_filename (obfd)); >>> bfd_close (obfd); >>> //unlink (pathname); >>> //xfree (pathname); >>> } >>> >>> I think you want unlink the gdb_record when save get some error. It >>> maybe need "discard_cleanups" the old_cleanups and bfd_close (obfd); >>> >>> After change the code, everything is OK. >> Yes. Thanks. Like this: >> + if (record_list->prev) >> + record_list = record_list->prev; >> + } >> + >> + do_cleanups (set_cleanups); >> + bfd_close (obfd); >> + discard_cleanups (old_cleanups); >> + >> + /* Succeeded. */ > > > I suggest: > + discard_cleanups (old_cleanups); > + bfd_close (obfd); The reason I did the bfd_close first is because I wasn't sure if it was safe to delete the file first. In any way, it seems more logical to close the file before delete it. What do you think? > BTW, the record.c update by Pedro, > http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/record.c.diff?r1=1.24&r2=1.25&cvsroot=src > > Maybe the record save patch need some update. Hmmm. Yes, I'm sure it will. ;-)