From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12054 invoked by alias); 21 Oct 2009 02:36:16 -0000 Received: (qmail 12045 invoked by uid 22791); 21 Oct 2009 02:36:15 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f189.google.com (HELO mail-pz0-f189.google.com) (209.85.222.189) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Oct 2009 02:36:10 +0000 Received: by pzk27 with SMTP id 27so2512505pzk.12 for ; Tue, 20 Oct 2009 19:36:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.21.41 with SMTP id y41mr477657wfi.209.1256092569092; Tue, 20 Oct 2009 19:36:09 -0700 (PDT) In-Reply-To: <4ADE167F.2020309@vmware.com> References: <4AD91D72.1030802@vmware.com> <83my3phjew.fsf@gnu.org> <4ADA4191.4060404@vmware.com> <83k4ytgxh5.fsf@gnu.org> <4ADA93C9.5040601@vmware.com> <4ADCA7DC.5040006@vmware.com> <4ADE1612.9040708@vmware.com> <4ADE167F.2020309@vmware.com> From: Hui Zhu Date: Wed, 21 Oct 2009 02:36:00 -0000 Message-ID: Subject: Re: [RFA, 3 of 3] save/restore process record, part 3 (save/restore) To: Michael Snyder Cc: Eli Zaretskii , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00489.txt.bz2 On Wed, Oct 21, 2009 at 03:58, Michael Snyder wrote: > Michael Snyder wrote: >> >> Hui Zhu wrote: >>> >>> On Tue, Oct 20, 2009 at 01:54, Michael Snyder wrot= e: >>>> >>>> Hui Zhu wrote: >>>>> >>>>> Hi Michael, >>>>> >>>>> I think you want unlink the gdb_record when save get some error. =A0It >>>>> maybe need "discard_cleanups" the old_cleanups and bfd_close (obfd); >>>>> >>>>> After change the code, everything is OK. >>>> >>>> Yes. =A0Thanks. =A0Like this: >>>> + =A0 =A0 =A0if (record_list->prev) >>>> + =A0 =A0 =A0 =A0record_list =3D record_list->prev; >>>> + =A0 =A0} >>>> + >>>> + =A0do_cleanups (set_cleanups); >>>> + =A0bfd_close (obfd); >>>> + =A0discard_cleanups (old_cleanups); >>>> + >>>> + =A0/* Succeeded. =A0*/ >>> >>> I suggest: >>> + =A0discard_cleanups (old_cleanups); >>> + =A0bfd_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. =A0In any way, >> it seems more logical to close the file before delete it. > > Oh, oops, never mind. =A0My head's fuzzy today. > > Why do you suggest to change the order? > Just curious, I don't have an issue with it... > Sorry I didn't talk the function very clear. >>>> + bfd_close (obfd); >>>> + discard_cleanups (old_cleanups); Before "discard_cleanups (old_cleanups);", the "record_save_cleanups" will be call sometime. "record_save_cleanups" will call "bfd_close (obfd)". If the record_save_cleanups will happen after "bfd_close (obfd)". "bfd_close (obfd)" will be call twice. Of curse, most of time it will not happen. So I just suggest. :) Thanks, Hui