From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4726 invoked by alias); 24 Oct 2009 03:30:32 -0000 Received: (qmail 4712 invoked by uid 22791); 24 Oct 2009 03:30:31 -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-px0-f175.google.com (HELO mail-px0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 24 Oct 2009 03:30:24 +0000 Received: by pxi5 with SMTP id 5so5583129pxi.12 for ; Fri, 23 Oct 2009 20:30:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.6.2 with SMTP id 2mr534279wff.90.1256355023138; Fri, 23 Oct 2009 20:30:23 -0700 (PDT) In-Reply-To: <20091023164838.573AE84384@ruffy.mtv.corp.google.com> References: <20091023164838.573AE84384@ruffy.mtv.corp.google.com> From: Hui Zhu Date: Sat, 24 Oct 2009 05:38:00 -0000 Message-ID: Subject: Re: Why do globals record.c:tmp_to_resume_ops, etc. exist? To: Doug Evans Cc: msnyder@vmware.com, gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-10/txt/msg00348.txt.bz2 Thanks Doug. record_open_1 and record_open use them. Just record target need "record_beneath_to_resume_ops" and ... But record_core don't need them. So these check in record_open_1. Thanks, Hui On Sat, Oct 24, 2009 at 00:48, Doug Evans wrote: > Hi. > I don't understand why these globals exist. > > 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 =A0enum target_si= gnal); > 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 =A0struct target_= waitstatus *, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0int); > 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 = =A0 struct regcache *, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 int 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 = =A0 enum target_object object, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 const char *annex, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 gdb_byte *readbuf, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 const gdb_byte *writebuf, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 ULONGEST offset, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 LONGEST 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 =A0struct 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 =A0struct bp_target_info *); > > > The error checking in record_open_1 could just as easily > be done in the caller and then AFAICT these globals > could be moved to record_open. =A0That's a lot of globals to nuke. > Am I missing something? > > =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 target= stack.")); > =A0if (!tmp_to_insert_breakpoint) > =A0 =A0error (_("Could not find 'to_insert_breakpoint' method on the targ= et stack.")); > =A0if (!tmp_to_remove_breakpoint) > =A0 =A0error (_("Could not find 'to_remove_breakpoint' method on the targ= et stack.")); >