summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-12-15 12:33:08 +0000
committerAndrew Cagney <cagney@redhat.com>2000-12-15 12:33:08 +0000
commit6c698d4dacfb9d95597ce1e322630a95a5f38453 (patch)
treec029cb1c624a2d9efe739192919d6e82298bfad7
parenta0e5f9941ec20c747bb323245f84f6611a9b851f (diff)
downloadgdb-6c698d4dacfb9d95597ce1e322630a95a5f38453.tar.gz
Multi-arch REGISTER_BYTES_OK.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/gdbarch.c41
-rw-r--r--gdb/gdbarch.h29
-rwxr-xr-xgdb/gdbarch.sh1
-rw-r--r--gdb/remote.c5
5 files changed, 80 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index af1b2620eca..f3b7940486f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+Fri Dec 15 23:27:56 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote.c (remote_fetch_registers): Replace #ifdef
+ REGISTER_BYTES_OK with REGISTER_BYTES_OK_P.
+
+ * gdbarch.sh (REGISTER_BYTES_OK): Multi-arch.
+ * gdbarch.h, gdbarch.c: Re-generate.
+
Fri Dec 15 22:58:59 2000 Andrew Cagney <cagney@b1.cygnus.com>
* serial.c (serial_printf): Call xvasprintf instead of vasprintf.
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 5cef3ff50a4..d9c038d73a7 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -169,6 +169,7 @@ struct gdbarch
gdbarch_register_virtual_type_ftype *register_virtual_type;
gdbarch_do_registers_info_ftype *do_registers_info;
gdbarch_register_sim_regno_ftype *register_sim_regno;
+ gdbarch_register_bytes_ok_ftype *register_bytes_ok;
int use_generic_dummy_frames;
int call_dummy_location;
gdbarch_call_dummy_address_ftype *call_dummy_address;
@@ -314,6 +315,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
generic_get_saved_register,
0,
0,
@@ -463,7 +465,7 @@ void
gdbarch_free (struct gdbarch *arch)
{
/* At the moment, this is trivial. */
- xfree (arch);
+ free (arch);
}
@@ -547,6 +549,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
internal_error ("gdbarch: verify_gdbarch: register_virtual_type invalid");
/* Skip verify of do_registers_info, invalid_p == 0 */
/* Skip verify of register_sim_regno, invalid_p == 0 */
+ /* Skip verify of register_bytes_ok, has predicate */
if ((GDB_MULTI_ARCH >= 1)
&& (gdbarch->use_generic_dummy_frames == -1))
internal_error ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid");
@@ -943,6 +946,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"REGISTER_SIM_REGNO(reg_nr)",
XSTRING (REGISTER_SIM_REGNO (reg_nr)));
#endif
+#ifdef REGISTER_BYTES_OK
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "REGISTER_BYTES_OK(nr_bytes)",
+ XSTRING (REGISTER_BYTES_OK (nr_bytes)));
+#endif
#ifdef USE_GENERIC_DUMMY_FRAMES
fprintf_unfiltered (file,
"gdbarch_dump: USE_GENERIC_DUMMY_FRAMES # %s\n",
@@ -1605,6 +1614,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->register_sim_regno
/*REGISTER_SIM_REGNO ()*/);
#endif
+#ifdef REGISTER_BYTES_OK
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: REGISTER_BYTES_OK = 0x%08lx\n",
+ (long) current_gdbarch->register_bytes_ok
+ /*REGISTER_BYTES_OK ()*/);
+#endif
#ifdef USE_GENERIC_DUMMY_FRAMES
fprintf_unfiltered (file,
"gdbarch_dump: USE_GENERIC_DUMMY_FRAMES = %ld\n",
@@ -2764,6 +2780,29 @@ set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
}
int
+gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch)
+{
+ return gdbarch->register_bytes_ok != 0;
+}
+
+int
+gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes)
+{
+ if (gdbarch->register_bytes_ok == 0)
+ internal_error ("gdbarch: gdbarch_register_bytes_ok invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes_ok called\n");
+ return gdbarch->register_bytes_ok (nr_bytes);
+}
+
+void
+set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch,
+ gdbarch_register_bytes_ok_ftype register_bytes_ok)
+{
+ gdbarch->register_bytes_ok = register_bytes_ok;
+}
+
+int
gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch)
{
if (gdbarch->use_generic_dummy_frames == -1)
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 307bc5fe5a0..2ba93711887 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -621,6 +621,35 @@ extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_reg
#endif
#endif
+#if defined (REGISTER_BYTES_OK)
+/* Legacy for systems yet to multi-arch REGISTER_BYTES_OK */
+#define REGISTER_BYTES_OK_P() (1)
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTES_OK_P)
+#define REGISTER_BYTES_OK_P() (0)
+#endif
+
+extern int gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTES_OK_P)
+#define REGISTER_BYTES_OK_P() (gdbarch_register_bytes_ok_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTES_OK)
+#define REGISTER_BYTES_OK(nr_bytes) (internal_error ("REGISTER_BYTES_OK"), 0)
+#endif
+
+typedef int (gdbarch_register_bytes_ok_ftype) (long nr_bytes);
+extern int gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes);
+extern void set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch, gdbarch_register_bytes_ok_ftype *register_bytes_ok);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTES_OK)
+#define REGISTER_BYTES_OK(nr_bytes) (gdbarch_register_bytes_ok (current_gdbarch, nr_bytes))
+#endif
+#endif
+
extern int gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch);
extern void set_gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch, int use_generic_dummy_frames);
#if GDB_MULTI_ARCH
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 216a47f852a..167e55b3e0f 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -395,6 +395,7 @@ f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpre
# MAP a GDB RAW register number onto a simulator register number. See
# also include/...-sim.h.
f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::default_register_sim_regno::0
+F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes::0:0
#
v:1:USE_GENERIC_DUMMY_FRAMES:int:use_generic_dummy_frames::::0:-1
v:2:CALL_DUMMY_LOCATION:int:call_dummy_location::::0:0
diff --git a/gdb/remote.c b/gdb/remote.c
index f88c73c2861..902760d8b35 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3080,10 +3080,9 @@ remote_fetch_registers (int regno)
if (i != register_bytes_found)
{
register_bytes_found = i;
-#ifdef REGISTER_BYTES_OK
- if (!REGISTER_BYTES_OK (i))
+ if (REGISTER_BYTES_OK_P ()
+ && !REGISTER_BYTES_OK (i))
warning ("Remote reply is too short: %s", buf);
-#endif
}
supply_them: