This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/RFC Prec] Add process record skip 4/6 (gdbarch.sh)


Add a interface process_record_open for arch, when record_open, it
will be called.
Each arch can use this interface do some arch special work for prec.

2008-08-19  Hui Zhu  <teawater@gmail.com>

	* gdbarch.sh (process_record_open): New interface.

---
 gdbarch.c  |   33 +++++++++++++++++++++++++++++++++
 gdbarch.h  |    8 ++++++++
 gdbarch.sh |    3 +++
 3 files changed, 44 insertions(+)

--- a/gdbarch.c
+++ b/gdbarch.c
@@ -240,6 +240,7 @@ struct gdbarch
   gdbarch_static_transform_name_ftype *static_transform_name;
   int sofun_address_maybe_missing;
   gdbarch_process_record_ftype *process_record;
+  gdbarch_process_record_open_ftype *process_record_open;
   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;
@@ -377,6 +378,7 @@ struct gdbarch startup_gdbarch =
   0,  /* static_transform_name */
   0,  /* sofun_address_maybe_missing */
   0,  /* process_record */
+  0,  /* process_record_open */
   default_target_signal_from_host,  /* target_signal_from_host */
   default_target_signal_to_host,  /* target_signal_to_host */
   0,  /* get_siginfo_type */
@@ -633,6 +635,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* 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 process_record_open, 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 */
@@ -962,6 +965,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: process_record = <%s>\n",
                       host_address_to_string (gdbarch->process_record));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_process_record_open_p() = %d\n",
+                      gdbarch_process_record_open_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: process_record_open = <%s>\n",
+                      host_address_to_string (gdbarch->process_record_open));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: ps_regnum = %s\n",
                       plongest (gdbarch->ps_regnum));
   fprintf_unfiltered (file,
@@ -3298,6 +3307,30 @@ set_gdbarch_process_record (struct gdbar
   gdbarch->process_record = process_record;
 }

+int
+gdbarch_process_record_open_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->process_record_open != NULL;
+}
+
+void
+gdbarch_process_record_open (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->process_record_open != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record_open called\n");
+  gdbarch->process_record_open (gdbarch);
+}
+
+void
+set_gdbarch_process_record_open (struct gdbarch *gdbarch,
+                                 gdbarch_process_record_open_ftype
process_record_open)
+{
+  gdbarch->process_record_open = process_record_open;
+}
+
 enum target_signal
 gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo)
 {
--- a/gdbarch.h
+++ b/gdbarch.h
@@ -821,6 +821,14 @@ typedef int (gdbarch_process_record_ftyp
 extern int gdbarch_process_record (struct gdbarch *gdbarch, struct
regcache *regcache, CORE_ADDR addr);
 extern void set_gdbarch_process_record (struct gdbarch *gdbarch,
gdbarch_process_record_ftype *process_record);

+/* Open architecture process record. */
+
+extern int gdbarch_process_record_open_p (struct gdbarch *gdbarch);
+
+typedef void (gdbarch_process_record_open_ftype) (struct gdbarch *gdbarch);
+extern void gdbarch_process_record_open (struct gdbarch *gdbarch);
+extern void set_gdbarch_process_record_open (struct gdbarch *gdbarch,
gdbarch_process_record_open_ftype *process_record_open);
+
 /* Signal translation: translate inferior's signal (host's) number into
    GDB's representation. */

--- a/gdbarch.sh
+++ b/gdbarch.sh
@@ -709,6 +709,9 @@ v:int:sofun_address_maybe_missing:::0:0:
 # Return -1 if something goes wrong, 0 otherwise.
 M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr

+# Open architecture process record.
+M:void:process_record_open:void:
+
 # 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

Attachment: 4-skip-record-gdbarch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]