This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Why do globals record.c:tmp_to_resume_ops, etc. exist?
- From: dje at google dot com (Doug Evans)
- To: msnyder at vmware dot com, teawater at gmail dot com
- Cc: gdb at sourceware dot org
- Date: Fri, 23 Oct 2009 09:48:38 -0700 (PDT)
- Subject: Why do globals record.c:tmp_to_resume_ops, etc. exist?
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."));