From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22010 invoked by alias); 7 Aug 2009 03:27:11 -0000 Received: (qmail 22001 invoked by uid 22791); 7 Aug 2009 03:27:10 -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 wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.174) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Aug 2009 03:27:03 +0000 Received: by wf-out-1314.google.com with SMTP id 23so529824wfg.24 for ; Thu, 06 Aug 2009 20:27:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.242.11 with SMTP id p11mr138196wfh.319.1249615621075; Thu, 06 Aug 2009 20:27:01 -0700 (PDT) In-Reply-To: <4A7B99B3.40407@vmware.com> References: <83ws5koinl.fsf@gnu.org> <83my6fo2pa.fsf@gnu.org> <4A78935B.5030508@vmware.com> <4A79F802.4060102@vmware.com> <83ab2docqi.fsf@gnu.org> <4A7B99B3.40407@vmware.com> From: Hui Zhu Date: Fri, 07 Aug 2009 03:29:00 -0000 Message-ID: Subject: Re: [RFA/RFC] Add dump and load command to process record and replay 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-08/txt/msg00098.txt.bz2 About it, I think keep the old one can make the function more flexible. I try it sometime. It can make two or more gdb_record files to one file. What about add a warning to there? When the record list is not empty, output a warning. Thanks, Hui On Fri, Aug 7, 2009 at 11:04, Michael Snyder wrote: > Hui Zhu wrote: > >> +/* Load the execution log from a file. =A0*/ >> + >> +static void >> +cmd_record_load (char *args, int from_tty) >> +{ >> + =A0int recfd; >> + =A0uint32_t magic; >> + =A0struct cleanup *old_cleanups; >> + =A0struct cleanup *old_cleanups2; >> + =A0struct record_entry *rec; >> + =A0int insn_number =3D 0; >> + >> + =A0if (current_target.to_stratum !=3D record_stratum) >> + =A0 =A0{ >> + =A0 =A0 =A0cmd_record_start (NULL, from_tty); >> + =A0 =A0 =A0printf_unfiltered (_("Auto start process record.\n")); >> + =A0 =A0} >> + >> + =A0if (!args || (args && !*args)) >> + =A0 =A0error (_("Argument for filename required.\n")); >> + >> + =A0/* Open the load file. =A0*/ >> + =A0recfd =3D open (args, O_RDONLY | O_BINARY); >> + =A0if (recfd < 0) >> + =A0 =A0error (_("Failed to open '%s' for loading execution records: %s= "), >> + =A0 =A0 =A0 =A0 =A0 args, strerror (errno)); >> + =A0old_cleanups =3D make_cleanup (cmd_record_fd_cleanups, &recfd); >> + >> + =A0/* Check the magic code. =A0*/ >> + =A0record_read_dump (args, recfd, &magic, 4); >> + =A0if (magic !=3D RECORD_FILE_MAGIC) >> + =A0 =A0error (_("'%s' is not a valid dump of execution records."), arg= s); >> + >> + =A0/* Load the entries in recfd to the record_arch_list_head and >> + =A0 =A0 record_arch_list_tail. =A0*/ >> + =A0record_arch_list_head =3D NULL; >> + =A0record_arch_list_tail =3D NULL; > > Hi Hui, > > It seems to me that you didn't discard the old recording entries > before loading the new ones -- you just added the new ones into > the existing list. > > I don't think that is safe. =A0We can't be sure that there is > any relationship between any existing recording entries and > the new entries from the file. =A0We certainly can't assume > that they are consecutive. > > I think you have to completely clear the record log at this point, > before you begin reading new entries from the dump file. > > What I would suggest is that we add these lines to > record_list_release -- and then we can just call that here. > > @@ -159,6 +159,11 @@ record_list_release (struct record_entry > > =A0 if (rec !=3D &record_first) > =A0 =A0 xfree (rec); > + > + =A0record_list =3D &record_first; > + =A0record_arch_list_tail =3D NULL; > + =A0record_arch_list_tail =3D NULL; > + =A0record_insn_num =3D 0; > =A0} > > >