summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorHui Zhu <teawater@gmail.com>2008-08-15 06:47:47 +0000
committerHui Zhu <teawater@gmail.com>2008-08-15 06:47:47 +0000
commite6d35bc5270a81e187cc1d45459912aa34025ac5 (patch)
tree18dddfba361e30869f0eaa8d4c3df660c809b852 /gdb
parent8a6376c29dadec6d70af5df9763dcde4370c76d6 (diff)
downloadgdb-e6d35bc5270a81e187cc1d45459912aa34025ac5.tar.gz
2008-08-10 Hui Zhu <teawater@gmail.com>
Add the real beneath function pointers for record target. * Makefile.in: Add record.h to depend of target.c. * record.c (record_beneath_to_resume, record_beneath_to_wait, record_beneath_to_prepare_to_store, record_beneath_to_xfer_partial, record_beneath_to_insert_breakpoint, record_beneath_to_remove_breakpoint): New function pointers. The real beneath function pointers. (record_resume): Change "record_ops.beneath->to_resume" to "record_beneath_to_resume". (record_wait): Change "record_ops.beneath->to_wait" to "record_beneath_to_wait". (record_prepare_to_store): Change "record_ops.beneath->to_prepare_to_store" to "record_beneath_to_prepare_to_store". (record_xfer_partial): Change "record_ops.beneath->to_xfer_partial" to "record_beneath_to_xfer_partial". (record_insert_breakpoint): Change "record_ops.beneath->to_insert_breakpoint" to "record_beneath_to_insert_breakpoint". (record_remove_breakpoint): Change "record_ops.beneath->to_remove_breakpoint" to "record_beneath_to_remove_breakpoint". * record.h (record_beneath_to_resume, record_beneath_to_wait, record_beneath_to_prepare_to_store, record_beneath_to_xfer_partial, record_beneath_to_insert_breakpoint, record_beneath_to_remove_breakpoint): Extern. * target.c: Add include of "record.h". (update_current_target): Set the real beneath function pointers.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog32
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/record.c47
-rw-r--r--gdb/record.h13
-rw-r--r--gdb/target.c36
5 files changed, 110 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 054854ea411..4b88dd1fc43 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,35 @@
+2008-08-10 Hui Zhu <teawater@gmail.com>
+
+ Add the real beneath function pointers for record target.
+
+ * Makefile.in: Add record.h to depend of target.c.
+ * record.c (record_beneath_to_resume, record_beneath_to_wait,
+ record_beneath_to_prepare_to_store, record_beneath_to_xfer_partial,
+ record_beneath_to_insert_breakpoint,
+ record_beneath_to_remove_breakpoint): New function pointers. The real
+ beneath function pointers.
+ (record_resume): Change "record_ops.beneath->to_resume" to
+ "record_beneath_to_resume".
+ (record_wait): Change "record_ops.beneath->to_wait" to
+ "record_beneath_to_wait".
+ (record_prepare_to_store): Change
+ "record_ops.beneath->to_prepare_to_store" to
+ "record_beneath_to_prepare_to_store".
+ (record_xfer_partial): Change "record_ops.beneath->to_xfer_partial" to
+ "record_beneath_to_xfer_partial".
+ (record_insert_breakpoint): Change
+ "record_ops.beneath->to_insert_breakpoint" to
+ "record_beneath_to_insert_breakpoint".
+ (record_remove_breakpoint): Change
+ "record_ops.beneath->to_remove_breakpoint" to
+ "record_beneath_to_remove_breakpoint".
+ * record.h (record_beneath_to_resume, record_beneath_to_wait,
+ record_beneath_to_prepare_to_store, record_beneath_to_xfer_partial,
+ record_beneath_to_insert_breakpoint,
+ record_beneath_to_remove_breakpoint): Extern.
+ * target.c: Add include of "record.h".
+ (update_current_target): Set the real beneath function pointers.
+
2008-08-05 Hui Zhu <teawater@gmail.com>
Support more ioctl requests in record target.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 2cf85d7483c..9552fc93cfc 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2922,7 +2922,7 @@ symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) $(gdbcore_h) \
- $(exceptions_h) $(target_descriptions_h) $(gdbthread_h)
+ $(exceptions_h) $(target_descriptions_h) $(gdbthread_h) $(record_h)
target-descriptions.o: target-descriptions.c $(defs_h) $(arch_utils_h) \
$(target_h) $(target_descriptions_h) $(vec_h) $(xml_tdesc_h) \
$(gdbcmd_h) $(gdb_assert_h) $(gdbtypes_h) $(reggroups_h) \
diff --git a/gdb/record.c b/gdb/record.c
index 36e7319c536..54d5c421c85 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -59,6 +59,19 @@ extern struct bp_location *bp_location_chain;
extern ptid_t displaced_step_ptid;
extern CORE_ADDR displaced_step_original, displaced_step_copy;
+/* The real beneath function pointers. */
+void (*record_beneath_to_resume) (ptid_t, int, enum target_signal);
+ptid_t (*record_beneath_to_wait) (ptid_t, struct target_waitstatus *);
+void (*record_beneath_to_prepare_to_store) (struct regcache *);
+LONGEST (*record_beneath_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);
+int (*record_beneath_to_insert_breakpoint) (struct bp_target_info *);
+int (*record_beneath_to_remove_breakpoint) (struct bp_target_info *);
+
static void
record_list_release (record_t * rec)
{
@@ -437,7 +450,7 @@ record_resume (ptid_t ptid, int step, enum target_signal siggnal)
if (!RECORD_IS_REPLAY)
{
record_message (current_gdbarch);
- return record_ops.beneath->to_resume (ptid, 1, siggnal);
+ record_beneath_to_resume (ptid, 1, siggnal);
}
}
@@ -482,7 +495,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
if (!RECORD_IS_REPLAY)
{
- return record_ops.beneath->to_wait (ptid, status);
+ return record_beneath_to_wait (ptid, status);
}
else
{
@@ -793,7 +806,7 @@ record_prepare_to_store (struct regcache *regcache)
record_registers_change (regcache, record_regcache_raw_write_regnum);
}
- record_ops.beneath->to_prepare_to_store (regcache);
+ record_beneath_to_prepare_to_store (regcache);
}
static LONGEST
@@ -840,7 +853,7 @@ record_xfer_partial (struct target_ops *ops, enum target_object object,
record_list = record_arch_list_tail;
}
- return record_ops.beneath->to_xfer_partial (ops, object, annex, readbuf,
+ return record_beneath_to_xfer_partial (ops, object, annex, readbuf,
writebuf, offset, len);
}
@@ -849,7 +862,7 @@ record_insert_breakpoint (struct bp_target_info *bp_tgt)
{
if (!RECORD_IS_REPLAY)
{
- return record_ops.beneath->to_insert_breakpoint (bp_tgt);
+ return record_beneath_to_insert_breakpoint (bp_tgt);
}
return 0;
@@ -860,7 +873,7 @@ record_remove_breakpoint (struct bp_target_info *bp_tgt)
{
if (!RECORD_IS_REPLAY)
{
- return record_ops.beneath->to_remove_breakpoint (bp_tgt);
+ return record_beneath_to_remove_breakpoint (bp_tgt);
}
return 0;
@@ -1015,7 +1028,8 @@ _initialize_record (void)
add_setshow_zinteger_cmd ("record", no_class, &record_debug,
_("Set debugging of record/replay feature."),
_("Show debugging of record/replay feature."),
- _("When enabled, debugging output for record/replay feature is displayed."),
+ _
+ ("When enabled, debugging output for record/replay feature is displayed."),
NULL, show_record_debug, &setdebuglist,
&showdebuglist);
@@ -1029,7 +1043,8 @@ _initialize_record (void)
other affect to GDB such as call function "no_shared_libraries".
So I add special commands to GDB. */
add_com ("delrecord", class_obscure, cmd_record_delete,
- _("When record target running in replay mode, delete the next running messages and begin to record the running message at current address."));
+ _
+ ("When record target running in replay mode, delete the next running messages and begin to record the running message at current address."));
add_com_alias ("dr", "delrecord", class_obscure, 1);
add_com ("stoprecord", class_obscure, cmd_record_stop,
_("Stop the record/replay target."));
@@ -1040,21 +1055,15 @@ _initialize_record (void)
add_setshow_zinteger_cmd ("record-auto-delete", no_class,
&record_insn_max_mode,
_("Set record/replay auto delete mode."),
- _("Show record/replay auto delete mode."),
- _("\
+ _("Show record/replay auto delete mode."), _("\
When enabled, if the record/replay buffer becomes full,\n\
-delete it and start new recording."),
- NULL, NULL, &setlist, &showlist);
+delete it and start new recording."), NULL, NULL, &setlist, &showlist);
add_setshow_zinteger_cmd ("record-insn-number-max", no_class,
&record_insn_max_num,
_("Set record/replay buffer limit."),
- _("Show record/replay buffer limit."),
- _("\
+ _("Show record/replay buffer limit."), _("\
Set the maximum number of instructions to be stored in the\n\
-record/replay buffer. Zero means unlimited (default 200000)."),
- set_record_insn_max_num, NULL, &setlist,
- &showlist);
- add_info ("record-insn-number", show_record_insn_number,
- _("\
+record/replay buffer. Zero means unlimited (default 200000)."), set_record_insn_max_num, NULL, &setlist, &showlist);
+ add_info ("record-insn-number", show_record_insn_number, _("\
Show the current number of instructions in the record/replay buffer."));
}
diff --git a/gdb/record.h b/gdb/record.h
index cbf4627ddb7..174697576ae 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -84,4 +84,17 @@ extern int record_arch_list_add_end (int need_dasm);
extern void record_message (struct gdbarch *gdbarch);
extern void record_not_record_set (void);
+extern void (*record_beneath_to_resume) (ptid_t, int, enum target_signal);
+extern ptid_t (*record_beneath_to_wait) (ptid_t, struct target_waitstatus *);
+extern void (*record_beneath_to_prepare_to_store) (struct regcache *);
+extern LONGEST (*record_beneath_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);
+extern int (*record_beneath_to_insert_breakpoint) (struct bp_target_info *);
+extern int (*record_beneath_to_remove_breakpoint) (struct bp_target_info *);
+
#endif /* _RECORD_H_ */
diff --git a/gdb/target.c b/gdb/target.c
index aa38eff1e43..c905bdc34be 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -40,6 +40,7 @@
#include "exceptions.h"
#include "target-descriptions.h"
#include "gdbthread.h"
+#include "record.h"
static void target_info (char *, int);
@@ -399,6 +400,12 @@ update_current_target (void)
if (!current_target.FIELD) \
current_target.FIELD = (TARGET)->FIELD
+ record_beneath_to_resume = NULL;
+ record_beneath_to_prepare_to_store = NULL;
+ record_beneath_to_xfer_partial = NULL;
+ record_beneath_to_insert_breakpoint = NULL;
+ record_beneath_to_remove_breakpoint = NULL;
+
for (t = target_stack; t; t = t->beneath)
{
INHERIT (to_shortname, t);
@@ -487,6 +494,35 @@ update_current_target (void)
/* Do not inherit to_memory_map. */
/* Do not inherit to_flash_erase. */
/* Do not inherit to_flash_done. */
+
+ /* Set the real beneath function pointers. */
+ if (t != &record_ops)
+ {
+ if (!record_beneath_to_resume)
+ {
+ record_beneath_to_resume = t->to_resume;
+ }
+ if (!record_beneath_to_wait)
+ {
+ record_beneath_to_wait = t->to_wait;
+ }
+ if (!record_beneath_to_prepare_to_store)
+ {
+ record_beneath_to_prepare_to_store = t->to_prepare_to_store;
+ }
+ if (!record_beneath_to_xfer_partial)
+ {
+ record_beneath_to_xfer_partial = t->to_xfer_partial;
+ }
+ if (!record_beneath_to_insert_breakpoint)
+ {
+ record_beneath_to_insert_breakpoint = t->to_insert_breakpoint;
+ }
+ if (!record_beneath_to_remove_breakpoint)
+ {
+ record_beneath_to_remove_breakpoint = t->to_remove_breakpoint;
+ }
+ }
}
#undef INHERIT