From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10804 invoked by alias); 23 Oct 2009 16:48:56 -0000 Received: (qmail 10795 invoked by uid 22791); 23 Oct 2009 16:48:54 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Oct 2009 16:48:47 +0000 Received: from zps76.corp.google.com (zps76.corp.google.com [172.25.146.76]) by smtp-out.google.com with ESMTP id n9NGmfKN027125; Fri, 23 Oct 2009 17:48:42 +0100 Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.118.116]) by zps76.corp.google.com with ESMTP id n9NGmc5c007962; Fri, 23 Oct 2009 09:48:38 -0700 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id 573AE84384; Fri, 23 Oct 2009 09:48:38 -0700 (PDT) To: msnyder@vmware.com, teawater@gmail.com cc: gdb@sourceware.org Subject: Why do globals record.c:tmp_to_resume_ops, etc. exist? Message-Id: <20091023164838.573AE84384@ruffy.mtv.corp.google.com> Date: Sat, 24 Oct 2009 03:30:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true 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/msg00347.txt.bz2 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, enum target_signal); static struct target_ops *tmp_to_wait_ops; static ptid_t (*tmp_to_wait) (struct target_ops *, ptid_t, struct target_waitstatus *, int); static struct target_ops *tmp_to_store_registers_ops; static void (*tmp_to_store_registers) (struct target_ops *, struct regcache *, int regno); static struct target_ops *tmp_to_xfer_partial_ops; static LONGEST (*tmp_to_xfer_partial) (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len); static int (*tmp_to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *); static int (*tmp_to_remove_breakpoint) (struct gdbarch *, struct 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. That's a lot of globals to nuke. Am I missing something? if (!tmp_to_resume) error (_("Could not find 'to_resume' method on the target stack.")); if (!tmp_to_wait) error (_("Could not find 'to_wait' method on the target stack.")); if (!tmp_to_store_registers) error (_("Could not find 'to_store_registers' method on the target stack.")); if (!tmp_to_insert_breakpoint) error (_("Could not find 'to_insert_breakpoint' method on the target stack.")); if (!tmp_to_remove_breakpoint) error (_("Could not find 'to_remove_breakpoint' method on the target stack."));