Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Why do globals record.c:tmp_to_resume_ops, etc. exist?
@ 2009-10-24  3:30 Doug Evans
  2009-10-24  5:38 ` Hui Zhu
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2009-10-24  3:30 UTC (permalink / raw)
  To: msnyder, teawater; +Cc: gdb

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."));


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Why do globals record.c:tmp_to_resume_ops, etc. exist?
  2009-10-24  3:30 Why do globals record.c:tmp_to_resume_ops, etc. exist? Doug Evans
@ 2009-10-24  5:38 ` Hui Zhu
  0 siblings, 0 replies; 2+ messages in thread
From: Hui Zhu @ 2009-10-24  5:38 UTC (permalink / raw)
  To: Doug Evans; +Cc: msnyder, gdb

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 <dje@google.com> 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,
>                              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."));
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-24  3:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-24  3:30 Why do globals record.c:tmp_to_resume_ops, etc. exist? Doug Evans
2009-10-24  5:38 ` Hui Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox