[RFA] Submit process record and replay fourth time, 1/8
Hui Zhu
teawater@gmail.com
Sat Mar 21 16:00:00 GMT 2009
This patch is add two function pointers interface to GDB architecture
support layer for process record and replay.
This time, I include gdbarch.c and gdbarch.h to patch because I got
some mails about get error in compile about can't find
"process_record".
And "process_record_dasm" was removed according to Pedro's idea
because don't have any arch code (MIPS use it, but MIPS code was
removed in before) use it. Maybe it will be added back in the future.
2009-03-21 Hui Zhu <teawater@gmail.com>
GDBARCH interface for process record and replay.
* gdbarch.sh (process_record): This interface point to the
function that records the inferior execute log.
(process_record_dasm): This interface points to the function
that will be called to set inferior status according to the
instruction in replay mode.
2008-12-28 Michael Snyder <msnyder@vmware.com>
* Comments, spelling, white space clean-ups.
-------------- next part --------------
---
gdbarch.c | 33 +++++++++++++++++++++++++++++++++
gdbarch.h | 11 +++++++++++
gdbarch.sh | 6 ++++++
3 files changed, 50 insertions(+)
--- a/gdbarch.c
+++ b/gdbarch.c
@@ -239,6 +239,7 @@ struct gdbarch
gdbarch_core_read_description_ftype *core_read_description;
gdbarch_static_transform_name_ftype *static_transform_name;
int sofun_address_maybe_missing;
+ gdbarch_process_record_ftype *process_record;
gdbarch_target_signal_from_host_ftype *target_signal_from_host;
gdbarch_target_signal_to_host_ftype *target_signal_to_host;
gdbarch_get_siginfo_type_ftype *get_siginfo_type;
@@ -374,6 +375,7 @@ struct gdbarch startup_gdbarch =
0, /* core_read_description */
0, /* static_transform_name */
0, /* sofun_address_maybe_missing */
+ 0, /* process_record */
default_target_signal_from_host, /* target_signal_from_host */
default_target_signal_to_host, /* target_signal_to_host */
0, /* get_siginfo_type */
@@ -630,6 +632,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of core_read_description, has predicate */
/* Skip verify of static_transform_name, has predicate */
/* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
+ /* Skip verify of process_record, has predicate */
/* Skip verify of target_signal_from_host, invalid_p == 0 */
/* Skip verify of target_signal_to_host, invalid_p == 0 */
/* Skip verify of get_siginfo_type, has predicate */
@@ -946,6 +949,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s
"gdbarch_dump: print_vector_info = <%s>\n",
host_address_to_string (gdbarch->print_vector_info));
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_process_record_p() = %d\n",
+ gdbarch_process_record_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: process_record = <%s>\n",
+ host_address_to_string (gdbarch->process_record));
+ fprintf_unfiltered (file,
"gdbarch_dump: ps_regnum = %s\n",
plongest (gdbarch->ps_regnum));
fprintf_unfiltered (file,
@@ -3250,6 +3259,30 @@ set_gdbarch_sofun_address_maybe_missing
gdbarch->sofun_address_maybe_missing = sofun_address_maybe_missing;
}
+int
+gdbarch_process_record_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->process_record != NULL;
+}
+
+int
+gdbarch_process_record (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->process_record != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record called\n");
+ return gdbarch->process_record (gdbarch, addr);
+}
+
+void
+set_gdbarch_process_record (struct gdbarch *gdbarch,
+ gdbarch_process_record_ftype process_record)
+{
+ gdbarch->process_record = process_record;
+}
+
enum target_signal
gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo)
{
--- a/gdbarch.h
+++ b/gdbarch.h
@@ -807,6 +807,17 @@ extern void set_gdbarch_static_transform
extern int gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch);
extern void set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, int sofun_address_maybe_missing);
+/* Parse the instruction at ADDR storing in the record execution log
+ the registers and memory ranges that will be affected when the
+ instruction executes, along with their current values. Return -1
+ if something goes wrong, 0 otherwise. */
+
+extern int gdbarch_process_record_p (struct gdbarch *gdbarch);
+
+typedef int (gdbarch_process_record_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
+extern int gdbarch_process_record (struct gdbarch *gdbarch, CORE_ADDR addr);
+extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record);
+
/* Signal translation: translate inferior's signal (host's) number into
GDB's representation. */
--- a/gdbarch.sh
+++ b/gdbarch.sh
@@ -709,6 +709,12 @@ F:char *:static_transform_name:char *nam
# Set if the address in N_SO or N_FUN stabs may be zero.
v:int:sofun_address_maybe_missing:::0:0::0
+# Parse the instruction at ADDR storing in the record execution log
+# the registers and memory ranges that will be affected when the
+# instruction executes, along with their current values. Return -1
+# if something goes wrong, 0 otherwise.
+M:int:process_record:CORE_ADDR addr:addr
+
# Signal translation: translate inferior's signal (host's) number into
# GDB's representation.
m:enum target_signal:target_signal_from_host:int signo:signo::default_target_signal_from_host::0
More information about the Gdb-patches
mailing list