From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31910 invoked by alias); 18 Oct 2009 07:26:49 -0000 Received: (qmail 31774 invoked by uid 22791); 18 Oct 2009 07:26:41 -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-f192.google.com (HELO mail-pz0-f192.google.com) (209.85.222.192) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Oct 2009 07:26:35 +0000 Received: by pzk30 with SMTP id 30so2835146pzk.24 for ; Sun, 18 Oct 2009 00:26:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.21.41 with SMTP id y41mr203975wfi.209.1255850794146; Sun, 18 Oct 2009 00:26:34 -0700 (PDT) In-Reply-To: <4AD9FA22.9050604@vmware.com> References: <4AD91CDB.5060002@vmware.com> <833a5iigxg.fsf@gnu.org> <4AD9FA22.9050604@vmware.com> From: Hui Zhu Date: Sun, 18 Oct 2009 07:26:00 -0000 Message-ID: Subject: Re: [RFA, 2 of 3] save/restore process record, part 2 (core ops target) To: Michael Snyder Cc: Eli Zaretskii , "gdb-patches@sourceware.org" Content-Type: multipart/mixed; boundary=00504502cb2479dbaf0476308c0b 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/msg00413.txt.bz2 --00504502cb2479dbaf0476308c0b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 23940 patch -p0 < ~/Desktop/tmp2b.diff patching file record.c Hunk #2 succeeded at 101 (offset -1 lines). Hunk #3 succeeded at 127 (offset -2 lines). Hunk #4 succeeded at 675 (offset -3 lines). Hunk #5 FAILED at 749. Hunk #6 succeeded at 940 (offset -4 lines). Hunk #7 succeeded at 1439 (offset -4 lines). Hunk #8 succeeded at 1735 (offset -21 lines). 1 out of 8 hunks FAILED -- saving rejects to file record.c.rej On Sun, Oct 18, 2009 at 01:08, Michael Snyder wrote: > Eli Zaretskii wrote: >>> >>> Date: Fri, 16 Oct 2009 18:24:43 -0700 >>> From: Michael Snyder >>> >>> + =A0if (!tmp_to_resume) >>> + =A0 =A0error (_("Process record can't get to_resume.")); >>> + =A0if (!tmp_to_wait) >>> + =A0 =A0error (_("Process record can't get to_wait.")); >>> + =A0if (!tmp_to_store_registers) >>> + =A0 =A0error (_("Process record can't get to_store_registers.")); >>> + =A0if (!tmp_to_insert_breakpoint) >>> + =A0 =A0error (_("Process record can't get to_insert_breakpoint.")); >>> + =A0if (!tmp_to_remove_breakpoint) >>> + =A0 =A0error (_("Process record can't get to_remove_breakpoint.")); >> >> Can we rephrase these to be more user-friendly? =A0As written, this text >> is okay for debug printouts, but not for user-level error messages, >> IMO. =A0(Yes, I know this text was in the old version, but still...) > > No problem, see revised diff (attached). =A0However, in the unlikely > event that these occur, there won't be anything that the user can > do about it. > > >>> + =A0//if (strcmp (current_target.to_shortname, "record_core") =3D=3D 0) >>> + =A0//record_load (); >> >> C++-style comments? > > It is just to comment out a reference to a function that will not > be present until the third patch. =A0I'll take it out. > > Thanks for your review. > > > 2009-10-16 =A0Hui Zhu =A0 > =A0 =A0 =A0 =A0 =A0 =A0Michael Snyder =A0 > > =A0 =A0 =A0 =A0* record.c (record_core_ops): New ops target vector. > =A0 =A0 =A0 =A0(record_core_open_1): New function. =A0Open core target. > =A0 =A0 =A0 =A0(record_open_1): New function. =A0Open normal process reco= rd. > =A0 =A0 =A0 =A0(record_open): Call one of the above. > =A0 =A0 =A0 =A0(record_close): Allow for both core and normal targets. > =A0 =A0 =A0 =A0(record_core_resume): New function. > =A0 =A0 =A0 =A0(record_core_kill): New function. > =A0 =A0 =A0 =A0(record_core_fetch_registers): New function. > =A0 =A0 =A0 =A0(record_core_prepare_to_store): New function. > =A0 =A0 =A0 =A0(record_core_store_registers): New function. > =A0 =A0 =A0 =A0(record_core_xfer_partial): New function. > =A0 =A0 =A0 =A0(record_core_insert_breakpoint): New function. > =A0 =A0 =A0 =A0(record_core_remove_breakpoint): New function. > =A0 =A0 =A0 =A0(record_core_has_execution): New function. > =A0 =A0 =A0 =A0(init_record_core_ops): New function. > =A0 =A0 =A0 =A0(_initialize_record): Call init_record_core_ops, add_targe= t. > > --- record.1b.c 2009-10-17 09:55:13.000000000 -0700 > +++ record.2.c =A02009-10-17 10:03:58.000000000 -0700 > @@ -23,6 +23,8 @@ > =A0#include "gdbthread.h" > =A0#include "event-top.h" > =A0#include "exceptions.h" > +#include "gdbcore.h" > +#include "exec.h" > =A0#include "record.h" > > =A0#include > @@ -100,6 +102,19 @@ struct record_entry > =A0/* This is the debug switch for process record. =A0*/ > =A0int record_debug =3D 0; > > +struct record_core_buf_entry > +{ > + =A0struct record_core_buf_entry *prev; > + =A0struct target_section *p; > + =A0bfd_byte *buf; > +}; > + > +/* Record buf with core target. =A0*/ > +static gdb_byte *record_core_regbuf =3D NULL; > +static struct target_section *record_core_start; > +static struct target_section *record_core_end; > +static struct record_core_buf_entry *record_core_buf_list =3D NULL; > + > =A0/* These list is for execution log. =A0*/ > =A0static struct record_entry record_first; > =A0static struct record_entry *record_list =3D &record_first; > @@ -114,6 +129,7 @@ static unsigned long long record_insn_co > > =A0/* The target_ops of process record. =A0*/ > =A0static struct target_ops record_ops; > +static struct target_ops record_core_ops; > > =A0/* The beneath function pointers. =A0*/ > =A0static struct target_ops *record_beneath_to_resume_ops; > @@ -662,8 +678,60 @@ record_exec_insn (struct regcache *regca > =A0 =A0 } > =A0} > > +static struct target_ops *tmp_to_resume_ops; > +static void (*tmp_to_resume) (struct target_ops *, ptid_t, int, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 enum target_sig= nal); > +static struct target_ops *tmp_to_wait_ops; > +static ptid_t (*tmp_to_wait) (struct target_ops *, ptid_t, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct target_w= aitstatus *, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int); > +static struct target_ops *tmp_to_store_registers_ops; > +static void (*tmp_to_store_registers) (struct target_ops *, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0struct regcache *, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0int regno); > +static struct target_ops *tmp_to_xfer_partial_ops; > +static LONGEST (*tmp_to_xfer_partial) (struct target_ops *ops, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0enum target_object object, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0const char *annex, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0gdb_byte *readbuf, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0const gdb_byte *writebuf, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0ULONGEST offset, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0LONGEST len); > +static int (*tmp_to_insert_breakpoint) (struct gdbarch *, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 struct bp_target_info *); > +static int (*tmp_to_remove_breakpoint) (struct gdbarch *, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 struct bp_target_info *); > + > +/* Open the process record target. =A0*/ > + > +static void > +record_core_open_1 (char *name, int from_tty) > +{ > + =A0struct regcache *regcache =3D get_current_regcache (); > + =A0int regnum =3D gdbarch_num_regs (get_regcache_arch (regcache)); > + =A0int i; > + > + =A0/* Get record_core_regbuf. =A0*/ > + =A0target_fetch_registers (regcache, -1); > + =A0record_core_regbuf =3D xmalloc (MAX_REGISTER_SIZE * regnum); > + =A0for (i =3D 0; i < regnum; i ++) > + =A0 =A0regcache_raw_collect (regcache, i, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 record_core_regbuf + MA= X_REGISTER_SIZE * i); > + > + =A0/* Get record_core_start and record_core_end. =A0*/ > + =A0if (build_section_table (core_bfd, &record_core_start, &record_core_= end)) > + =A0 =A0{ > + =A0 =A0 =A0xfree (record_core_regbuf); > + =A0 =A0 =A0record_core_regbuf =3D NULL; > + =A0 =A0 =A0error (_("\"%s\": Can't find sections: %s"), > + =A0 =A0 =A0 =A0 =A0 =A0bfd_get_filename (core_bfd), bfd_errmsg (bfd_get= _error ())); > + =A0 =A0} > + > + =A0push_target (&record_core_ops); > +} > + > =A0static void > -record_open (char *name, int from_tty) > +record_open_1 (char *name, int from_tty) > =A0{ > =A0 struct target_ops *t; > > @@ -684,76 +752,127 @@ record_open (char *name, int from_tty) > =A0 =A0 error (_("Process record: the current architecture doesn't suppor= t " > =A0 =A0 =A0 =A0 =A0 =A0 "record function.")); > > + =A0if (!tmp_to_resume) > + =A0 =A0error (_("Could not find 'to_resume' method on the target stack.= ")); > + =A0if (!tmp_to_wait) > + =A0 =A0error (_("Could not find 'to_wait' method on the target stack.")= ); > + =A0if (!tmp_to_store_registers) > + =A0 =A0error (_("Could not find 'to_store_registers' method on the targ= et > stack.")); > + =A0if (!tmp_to_insert_breakpoint) > + =A0 =A0error (_("Could not find 'to_insert_breakpoint' method on the ta= rget > stack.")); > + =A0if (!tmp_to_remove_breakpoint) > + =A0 =A0error (_("Could not find 'to_remove_breakpoint' method on the ta= rget > stack.")); > + > + =A0push_target (&record_ops); > +} > + > +static void > +record_open (char *name, int from_tty) > +{ > + =A0struct target_ops *t; > + > + =A0if (record_debug) > + =A0 =A0fprintf_unfiltered (gdb_stdlog, "Process record: record_open\n"); > + > =A0 /* Check if record target is already running. =A0*/ > =A0 if (current_target.to_stratum =3D=3D record_stratum) > =A0 =A0 error (_("Process record target already running. =A0Use \"record = stop\" to > " > =A0 =A0 =A0 =A0 =A0 =A0 =A0"stop record target first.")); > > - =A0/*Reset the beneath function pointers. =A0*/ > - =A0record_beneath_to_resume =3D NULL; > - =A0record_beneath_to_wait =3D NULL; > - =A0record_beneath_to_store_registers =3D NULL; > - =A0record_beneath_to_xfer_partial =3D NULL; > - =A0record_beneath_to_insert_breakpoint =3D NULL; > - =A0record_beneath_to_remove_breakpoint =3D NULL; > + =A0/* Reset the tmp beneath pointers. =A0*/ > + =A0tmp_to_resume_ops =3D NULL; > + =A0tmp_to_resume =3D NULL; > + =A0tmp_to_wait_ops =3D NULL; > + =A0tmp_to_wait =3D NULL; > + =A0tmp_to_store_registers_ops =3D NULL; > + =A0tmp_to_store_registers =3D NULL; > + =A0tmp_to_xfer_partial_ops =3D NULL; > + =A0tmp_to_xfer_partial =3D NULL; > + =A0tmp_to_insert_breakpoint =3D NULL; > + =A0tmp_to_remove_breakpoint =3D NULL; > > =A0 /* Set the beneath function pointers. =A0*/ > =A0 for (t =3D current_target.beneath; t !=3D NULL; t =3D t->beneath) > =A0 =A0 { > - =A0 =A0 =A0if (!record_beneath_to_resume) > + =A0 =A0 =A0if (!tmp_to_resume) > =A0 =A0 =A0 =A0 { > - =A0 =A0 =A0 =A0 record_beneath_to_resume =3D t->to_resume; > - =A0 =A0 =A0 =A0 record_beneath_to_resume_ops =3D t; > + =A0 =A0 =A0 =A0 tmp_to_resume =3D t->to_resume; > + =A0 =A0 =A0 =A0 tmp_to_resume_ops =3D t; > =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0if (!record_beneath_to_wait) > + =A0 =A0 =A0if (!tmp_to_wait) > =A0 =A0 =A0 =A0 { > - =A0 =A0 =A0 =A0 record_beneath_to_wait =3D t->to_wait; > - =A0 =A0 =A0 =A0 record_beneath_to_wait_ops =3D t; > + =A0 =A0 =A0 =A0 tmp_to_wait =3D t->to_wait; > + =A0 =A0 =A0 =A0 tmp_to_wait_ops =3D t; > =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0if (!record_beneath_to_store_registers) > + =A0 =A0 =A0if (!tmp_to_store_registers) > =A0 =A0 =A0 =A0 { > - =A0 =A0 =A0 =A0 record_beneath_to_store_registers =3D t->to_store_regis= ters; > - =A0 =A0 =A0 =A0 record_beneath_to_store_registers_ops =3D t; > + =A0 =A0 =A0 =A0 tmp_to_store_registers =3D t->to_store_registers; > + =A0 =A0 =A0 =A0 tmp_to_store_registers_ops =3D t; > =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0if (!record_beneath_to_xfer_partial) > + =A0 =A0 =A0if (!tmp_to_xfer_partial) > =A0 =A0 =A0 =A0 { > - =A0 =A0 =A0 =A0 record_beneath_to_xfer_partial =3D t->to_xfer_partial; > - =A0 =A0 =A0 =A0 record_beneath_to_xfer_partial_ops =3D t; > + =A0 =A0 =A0 =A0 tmp_to_xfer_partial =3D t->to_xfer_partial; > + =A0 =A0 =A0 =A0 tmp_to_xfer_partial_ops =3D t; > =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0if (!record_beneath_to_insert_breakpoint) > - =A0 =A0 =A0 record_beneath_to_insert_breakpoint =3D t->to_insert_breakp= oint; > - =A0 =A0 =A0if (!record_beneath_to_remove_breakpoint) > - =A0 =A0 =A0 record_beneath_to_remove_breakpoint =3D t->to_remove_breakp= oint; > + =A0 =A0 =A0if (!tmp_to_insert_breakpoint) > + =A0 =A0 =A0 tmp_to_insert_breakpoint =3D t->to_insert_breakpoint; > + =A0 =A0 =A0if (!tmp_to_remove_breakpoint) > + =A0 =A0 =A0 tmp_to_remove_breakpoint =3D t->to_remove_breakpoint; > =A0 =A0 } > - =A0if (!record_beneath_to_resume) > - =A0 =A0error (_("Process record can't get to_resume.")); > - =A0if (!record_beneath_to_wait) > - =A0 =A0error (_("Process record can't get to_wait.")); > - =A0if (!record_beneath_to_store_registers) > - =A0 =A0error (_("Process record can't get to_store_registers.")); > - =A0if (!record_beneath_to_xfer_partial) > + =A0if (!tmp_to_xfer_partial) > =A0 =A0 error (_("Process record can't get to_xfer_partial.")); > - =A0if (!record_beneath_to_insert_breakpoint) > - =A0 =A0error (_("Process record can't get to_insert_breakpoint.")); > - =A0if (!record_beneath_to_remove_breakpoint) > - =A0 =A0error (_("Process record can't get to_remove_breakpoint.")); > > - =A0push_target (&record_ops); > + =A0if (current_target.to_stratum =3D=3D core_stratum) > + =A0 =A0record_core_open_1 (name, from_tty); > + =A0else > + =A0 =A0record_open_1 (name, from_tty); > > =A0 /* Reset */ > =A0 record_insn_num =3D 0; > =A0 record_insn_count =3D 0; > =A0 record_list =3D &record_first; > =A0 record_list->next =3D NULL; > + > + =A0/* Set the tmp beneath pointers to beneath pointers. =A0*/ > + =A0record_beneath_to_resume_ops =3D tmp_to_resume_ops; > + =A0record_beneath_to_resume =3D tmp_to_resume; > + =A0record_beneath_to_wait_ops =3D tmp_to_wait_ops; > + =A0record_beneath_to_wait =3D tmp_to_wait; > + =A0record_beneath_to_store_registers_ops =3D tmp_to_store_registers_ops; > + =A0record_beneath_to_store_registers =3D tmp_to_store_registers; > + =A0record_beneath_to_xfer_partial_ops =3D tmp_to_xfer_partial_ops; > + =A0record_beneath_to_xfer_partial =3D tmp_to_xfer_partial; > + =A0record_beneath_to_insert_breakpoint =3D tmp_to_insert_breakpoint; > + =A0record_beneath_to_remove_breakpoint =3D tmp_to_remove_breakpoint; > =A0} > > =A0static void > =A0record_close (int quitting) > =A0{ > + =A0struct record_core_buf_entry *entry; > + > =A0 if (record_debug) > =A0 =A0 fprintf_unfiltered (gdb_stdlog, "Process record: record_close\n"); > > =A0 record_list_release (record_list); > + > + =A0/* Release record_core_regbuf. =A0*/ > + =A0if (record_core_regbuf) > + =A0 =A0{ > + =A0 =A0 =A0xfree (record_core_regbuf); > + =A0 =A0 =A0record_core_regbuf =3D NULL; > + =A0 =A0} > + > + =A0/* Release record_core_buf_list. =A0*/ > + =A0if (record_core_buf_list) > + =A0 =A0{ > + =A0 =A0 =A0for (entry =3D record_core_buf_list->prev; entry; entry =3D = entry->prev) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 xfree (record_core_buf_list); > + =A0 =A0 =A0 =A0 record_core_buf_list =3D entry; > + =A0 =A0 =A0 } > + =A0 =A0 =A0record_core_buf_list =3D NULL; > + =A0 =A0} > =A0} > > =A0static int record_resume_step =3D 0; > @@ -825,7 +944,7 @@ record_wait (struct target_ops *ops, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"record_resume_step =3D %d= \n", > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_resume_step); > > - =A0if (!RECORD_IS_REPLAY) > + =A0if (!RECORD_IS_REPLAY && ops !=3D &record_core_ops) > =A0 =A0 { > =A0 =A0 =A0 if (record_resume_error) > =A0 =A0 =A0 =A0{ > @@ -1324,6 +1443,190 @@ init_record_ops (void) > =A0} > > =A0static void > +record_core_resume (struct target_ops *ops, ptid_t ptid, int step, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0enum target_signal signal) > +{ > + =A0record_resume_step =3D step; > +} > + > +static void > +record_core_kill (struct target_ops *ops) > +{ > + =A0if (record_debug) > + =A0 =A0fprintf_unfiltered (gdb_stdlog, "Process record: record_core_kil= l\n"); > + > + =A0unpush_target (&record_core_ops); > +} > + > +static void > +record_core_fetch_registers (struct target_ops *ops, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct regcache= *regcache, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int regno) > +{ > + =A0if (regno < 0) > + =A0 =A0{ > + =A0 =A0 =A0int num =3D gdbarch_num_regs (get_regcache_arch (regcache)); > + =A0 =A0 =A0int i; > + > + =A0 =A0 =A0for (i =3D 0; i < num; i ++) > + =A0 =A0 =A0 =A0regcache_raw_supply (regcache, i, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 record_core_reg= buf + MAX_REGISTER_SIZE * i); > + =A0 =A0} > + =A0else > + =A0 =A0regcache_raw_supply (regcache, regno, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 record_core_regbuf + MA= X_REGISTER_SIZE * regno); > +} > + > +static void > +record_core_prepare_to_store (struct regcache *regcache) > +{ > +} > + > +static void > +record_core_store_registers (struct target_ops *ops, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct regcache= *regcache, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int regno) > +{ > + =A0if (record_gdb_operation_disable) > + =A0 =A0regcache_raw_collect (regcache, regno, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_core_regbuf += MAX_REGISTER_SIZE * regno); > + =A0else > + =A0 =A0error (_("You can't do that without a process to debug.")); > +} > + > +static LONGEST > +record_core_xfer_partial (struct target_ops *ops, enum target_object > object, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 const char *annex, gdb_= byte *readbuf, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 const gdb_byte *writebu= f, ULONGEST offset, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0LONGEST len) > +{ > + =A0 if (object =3D=3D TARGET_OBJECT_MEMORY) > + =A0 =A0 { > + =A0 =A0 =A0 if (record_gdb_operation_disable || !writebuf) > + =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 struct target_section *p; > + =A0 =A0 =A0 =A0 =A0 for (p =3D record_core_start; p < record_core_end; = p++) > + =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (offset >=3D p->addr) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct record_core_buf_entry *entry; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (offset >=3D p->endaddr) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (offset + len > p->endaddr) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D p->endaddr - offset; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 offset -=3D p->addr; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Read readbuf or write writebuf p= , offset, len. =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Check flags. =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (p->the_bfd_section->flags & SEC= _CONSTRUCTOR > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 || (p->the_bfd_section->fla= gs & SEC_HAS_CONTENTS) =3D=3D > 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (readbuf) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 memset (readbuf, 0, len= ); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Get record_core_buf_entry. =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (entry =3D record_core_buf_list= ; entry; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0entry =3D entry->prev) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (entry->p =3D=3D p) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (writebuf) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!entry) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Add a new entry.= =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 entry > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D (struct rec= ord_core_buf_entry *) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xmalloc > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (si= zeof (struct record_core_buf_entry)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 entry->p =3D p; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!bfd_malloc_and= _get_section (p->bfd, > + > =A0p->the_bfd_section, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&entry->buf)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xfree (entr= y); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 entry->prev =3D rec= ord_core_buf_list; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 record_core_buf_lis= t =3D entry; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0memcpy (entry->buf + off= set, writebuf, (size_t) > len); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!entry) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return record_beneath_t= o_xfer_partial > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(rec= ord_beneath_to_xfer_partial_ops, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 obj= ect, annex, readbuf, writebuf, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 off= set, len); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 memcpy (readbuf, entry->buf= + offset, (size_t) len); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 return -1; > + =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 error (_("You can't do that without a process to debug.= ")); > + =A0 =A0 } > + > + =A0return record_beneath_to_xfer_partial > (record_beneath_to_xfer_partial_ops, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 object, annex, readbuf, writebuf, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 offset, len); > +} > + > +static int > +record_core_insert_breakpoint (struct gdbarch *gdbarch, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct bp_ta= rget_info *bp_tgt) > +{ > + =A0return 0; > +} > + > +static int > +record_core_remove_breakpoint (struct gdbarch *gdbarch, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct bp_ta= rget_info *bp_tgt) > +{ > + =A0return 0; > +} > + > +int > +record_core_has_execution (struct target_ops *ops) > +{ > + =A0return 1; > +} > + > +static void > +init_record_core_ops (void) > +{ > + =A0record_core_ops.to_shortname =3D "record_core"; > + =A0record_core_ops.to_longname =3D "Process record and replay target"; > + =A0record_core_ops.to_doc =3D > + =A0 =A0"Log program while executing and replay execution from log."; > + =A0record_core_ops.to_open =3D record_open; > + =A0record_core_ops.to_close =3D record_close; > + =A0record_core_ops.to_resume =3D record_core_resume; > + =A0record_core_ops.to_wait =3D record_wait; > + =A0record_core_ops.to_kill =3D record_core_kill; > + =A0record_core_ops.to_fetch_registers =3D record_core_fetch_registers; > + =A0record_core_ops.to_prepare_to_store =3D record_core_prepare_to_store; > + =A0record_core_ops.to_store_registers =3D record_core_store_registers; > + =A0record_core_ops.to_xfer_partial =3D record_core_xfer_partial; > + =A0record_core_ops.to_insert_breakpoint =3D record_core_insert_breakpoi= nt; > + =A0record_core_ops.to_remove_breakpoint =3D record_core_remove_breakpoi= nt; > + =A0record_core_ops.to_can_execute_reverse =3D record_can_execute_revers= e; > + =A0record_core_ops.to_has_execution =3D record_core_has_execution; > + =A0record_core_ops.to_stratum =3D record_stratum; > + =A0record_core_ops.to_magic =3D OPS_MAGIC; > +} > + > +static void > =A0show_record_debug (struct ui_file *file, int from_tty, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct cmd_list_element *c, const cha= r *value) > =A0{ > @@ -1453,6 +1756,8 @@ _initialize_record (void) > > =A0 init_record_ops (); > =A0 add_target (&record_ops); > + =A0init_record_core_ops (); > + =A0add_target (&record_core_ops); > > =A0 add_setshow_zinteger_cmd ("record", no_class, &record_debug, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0_("Set debugging o= f record/replay feature."), > > --00504502cb2479dbaf0476308c0b Content-Type: application/octet-stream; name="record.c.rej" Content-Disposition: attachment; filename="record.c.rej" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g0xh3pzk1 Content-length: 9256 KioqKioqKioqKioqKioqIHJlY29yZF9vcGVuIChjaGFyICpuYW1lLCBpbnQg ZnJvbV90dHkpCioqKiA2ODEsNzU2ICoqKioKICAgICAgZXJyb3IgKF8oIlBy b2Nlc3MgcmVjb3JkOiB0aGUgY3VycmVudCBhcmNoaXRlY3R1cmUgZG9lc24n dCBzdXBwb3J0ICIKICAJICAgICAicmVjb3JkIGZ1bmN0aW9uLiIpKTsKICAK ICAgIC8qIENoZWNrIGlmIHJlY29yZCB0YXJnZXQgaXMgYWxyZWFkeSBydW5u aW5nLiAgKi8KICAgIGlmIChjdXJyZW50X3RhcmdldC50b19zdHJhdHVtID09 IHJlY29yZF9zdHJhdHVtKQogICAgICBlcnJvciAoXygiUHJvY2VzcyByZWNv cmQgdGFyZ2V0IGFscmVhZHkgcnVubmluZy4gIFVzZSBcInJlY29yZCBzdG9w XCIgdG8gIgogICAgICAgICAgICAgICAic3RvcCByZWNvcmQgdGFyZ2V0IGZp cnN0LiIpKTsKICAKLSAgIC8qUmVzZXQgdGhlIGJlbmVhdGggZnVuY3Rpb24g cG9pbnRlcnMuICAqLwotICAgcmVjb3JkX2JlbmVhdGhfdG9fcmVzdW1lID0g TlVMTDsKLSAgIHJlY29yZF9iZW5lYXRoX3RvX3dhaXQgPSBOVUxMOwotICAg cmVjb3JkX2JlbmVhdGhfdG9fc3RvcmVfcmVnaXN0ZXJzID0gTlVMTDsKLSAg IHJlY29yZF9iZW5lYXRoX3RvX3hmZXJfcGFydGlhbCA9IE5VTEw7Ci0gICBy ZWNvcmRfYmVuZWF0aF90b19pbnNlcnRfYnJlYWtwb2ludCA9IE5VTEw7Ci0g ICByZWNvcmRfYmVuZWF0aF90b19yZW1vdmVfYnJlYWtwb2ludCA9IE5VTEw7 CiA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wX3RvX3dhaXRfb3Bz ID0gTlVMTDsKKyAgIHRtcF90b193YWl0ID0gTlVMTDsKKyAgIHRtcF90b19z dG9yZV9yZWdpc3RlcnNfb3BzID0gTlVMTDsKKyAgIHRtcF90b19zdG9yZV9y ZWdpc3RlcnMgPSBOVUxMOworICAgdG1wX3RvX3hmZXJfcGFydGlhbF9vcHMg PSBOVUxMOworICAgdG1wX3RvX3hmZXJfcGFydGlhbCA9IE5VTEw7CisgICB0 bXBfdG9faW5zZXJ0X2JyZWFrcG9pbnQgPSBOVUxMOworICAgdG1wX3RvX3Jl bW92ZV9icmVha3BvaW50ID0gTlVMTDsKICAKICAgIC8qIFNldCB0aGUgYmVu ZWF0aCBmdW5jdGlvbiBwb2ludGVycy4gICovCiAgICBmb3IgKHQgPSBjdXJy ZW50X3RhcmdldC5iZW5lYXRoOyB0ICE9IE5VTEw7IHQgPSB0LT5iZW5lYXRo KQogICAgICB7CisgICAgICAgaWYgKCF0bXBfdG9fcmVzdW1lKQogICAgICAg ICAgeworIAkgIHRtcF90b19yZXN1bWUgPSB0LT50b19yZXN1bWU7CisgCSAg dG1wX3RvX3Jlc3VtZV9vcHMgPSB0OwogICAgICAgICAgfQorICAgICAgIGlm ICghdG1wX3RvX3dhaXQpCiAgICAgICAgICB7CisgCSAgdG1wX3RvX3dhaXQg PSB0LT50b193YWl0OworIAkgIHRtcF90b193YWl0X29wcyA9IHQ7CiAgICAg ICAgICB9CisgICAgICAgaWYgKCF0bXBfdG9fc3RvcmVfcmVnaXN0ZXJzKQog ICAgICAgICAgeworIAkgIHRtcF90b19zdG9yZV9yZWdpc3RlcnMgPSB0LT50 b19zdG9yZV9yZWdpc3RlcnM7CisgCSAgdG1wX3RvX3N0b3JlX3JlZ2lzdGVy c19vcHMgPSB0OwogICAgICAgICAgfQorICAgICAgIGlmICghdG1wX3RvX3hm ZXJfcGFydGlhbCkKICAgICAgICAgIHsKKyAJICB0bXBfdG9feGZlcl9wYXJ0 aWFsID0gdC0+dG9fe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b3JlX3JlZ2J1 ZiA9IE5VTEw7CisgICAgIH0KKyAKKyAgIC8qIFJlbGVhc2UgcmVjb3JkX2Nv cmVfYnVmX2xpc3QuICAqLworICAgaWYgKHJlY29yZF9jb3JlX2J1Zl9saXN0 KQorICAgICB7CisgICAgICAgZm9yIChlbnRyeSA9IHJlY29yZF9jb3JlX2J1 Zl9saXN0LT5wcmV2OyBlbnRyeTsgZW50cnkgPSBlbnRyeS0+cHJldikKKyAJ eworIAkgIHhmcmVlIChyZWNvcmRfY29yZV9idWZfbGlzdCk7CisgCSAgcmVj b3JkX2NvcmVfYnVmX2xpc3QgPSBlbnRyeTsKKyAJfQorICAgICAgIHJlY29y ZF9jb3JlX2J1Zl9saXN0ID0gTlVMTDsKKyAgICAgfQogIH0KICAKICBzdGF0 aWMgaW50IHJlY29yZF9yZXN1bWVfc3RlcCA9IDA7Cg== --00504502cb2479dbaf0476308c0b--