summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-24 14:35:14 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-24 14:35:14 +0000
commitc61ea56d06e2d050f2ab0970068cf384b9593400 (patch)
treeae687eec460bc703e4f840b52c2737122085e502 /gdb
parent1ad9dbdcf4cbe29128cdb16184e60a19b9ffbb2b (diff)
downloadgdb-c61ea56d06e2d050f2ab0970068cf384b9593400.tar.gz
2000-07-24 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* gdbarch.sh: Add FETCH_PSEUDO_REGISTER and STORE_PSEUDO_REGISTER to the gdbarch structure. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * inferior.h (FETCH_PSEUDO_REGISTER, STORE_PSEUDO_REGISTER): Delete macros. * regcache.c (write_register, read_register, write_register_bytes, write_register_gen, read_register_bytes, read_register_gen): Rename ARCH_FECTH_PSEUDO_REGISTERS to FETCH_PSEUDO_REGISTERS and ARCH_STORE_PSEUDO_REGISTER to STORE_PSEUDO_REGISTER.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/gdbarch.c68
-rw-r--r--gdb/gdbarch.h28
-rwxr-xr-xgdb/gdbarch.sh8
-rw-r--r--gdb/inferior.h14
-rw-r--r--gdb/regcache.c12
6 files changed, 123 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d03e54a219f..1ff13d84419 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
2000-07-24 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
+ * gdbarch.sh: Add FETCH_PSEUDO_REGISTER and STORE_PSEUDO_REGISTER
+ to the gdbarch structure.
+ * gdbarch.c: Regenerate.
+ * gdbarch.h: Regenerate.
+ * inferior.h (FETCH_PSEUDO_REGISTER, STORE_PSEUDO_REGISTER):
+ Delete macros.
+ * regcache.c (write_register, read_register, write_register_bytes,
+ write_register_gen, read_register_bytes, read_register_gen):
+ Rename ARCH_FECTH_PSEUDO_REGISTERS to FETCH_PSEUDO_REGISTERS and
+ ARCH_STORE_PSEUDO_REGISTER to STORE_PSEUDO_REGISTER.
+
+2000-07-24 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
+
* gdbarch.sh: Add NUM_PSEUDO_REGS to the gdbarch structure.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index e0953ff4eb1..31fb37fe053 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -182,6 +182,8 @@ struct gdbarch
gdbarch_register_convertible_ftype *register_convertible;
gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual;
gdbarch_register_convert_to_raw_ftype *register_convert_to_raw;
+ gdbarch_fetch_pseudo_register_ftype *fetch_pseudo_register;
+ gdbarch_store_pseudo_register_ftype *store_pseudo_register;
gdbarch_pointer_to_address_ftype *pointer_to_address;
gdbarch_address_to_pointer_ftype *address_to_pointer;
gdbarch_return_value_on_stack_ftype *return_value_on_stack;
@@ -342,6 +344,8 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
+ 0,
/* startup_gdbarch() */
};
@@ -564,6 +568,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of register_convertible, invalid_p == 0 */
/* Skip verify of register_convert_to_virtual, invalid_p == 0 */
/* Skip verify of register_convert_to_raw, invalid_p == 0 */
+ /* Skip verify of fetch_pseudo_register, invalid_p == 0 */
+ /* Skip verify of store_pseudo_register, invalid_p == 0 */
/* Skip verify of pointer_to_address, invalid_p == 0 */
/* Skip verify of address_to_pointer, invalid_p == 0 */
/* Skip verify of return_value_on_stack, invalid_p == 0 */
@@ -980,6 +986,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"REGISTER_CONVERT_TO_RAW(type, regnum, from, to)",
XSTRING (REGISTER_CONVERT_TO_RAW (type, regnum, from, to)));
#endif
+#if defined (FETCH_PSEUDO_REGISTER) && GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FETCH_PSEUDO_REGISTER(regnum)",
+ XSTRING (FETCH_PSEUDO_REGISTER (regnum)));
+#endif
+#if defined (STORE_PSEUDO_REGISTER) && GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "STORE_PSEUDO_REGISTER(regnum)",
+ XSTRING (STORE_PSEUDO_REGISTER (regnum)));
+#endif
#ifdef POINTER_TO_ADDRESS
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1569,6 +1589,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->register_convert_to_raw
/*REGISTER_CONVERT_TO_RAW ()*/);
#endif
+#ifdef FETCH_PSEUDO_REGISTER
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: FETCH_PSEUDO_REGISTER = 0x%08lx\n",
+ (long) current_gdbarch->fetch_pseudo_register
+ /*FETCH_PSEUDO_REGISTER ()*/);
+#endif
+#ifdef STORE_PSEUDO_REGISTER
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: STORE_PSEUDO_REGISTER = 0x%08lx\n",
+ (long) current_gdbarch->store_pseudo_register
+ /*STORE_PSEUDO_REGISTER ()*/);
+#endif
#ifdef POINTER_TO_ADDRESS
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
@@ -2800,6 +2834,40 @@ set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch,
gdbarch->register_convert_to_raw = register_convert_to_raw;
}
+void
+gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, int regnum)
+{
+ if (gdbarch->fetch_pseudo_register == 0)
+ internal_error ("gdbarch: gdbarch_fetch_pseudo_register invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pseudo_register called\n");
+ gdbarch->fetch_pseudo_register (regnum);
+}
+
+void
+set_gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch,
+ gdbarch_fetch_pseudo_register_ftype fetch_pseudo_register)
+{
+ gdbarch->fetch_pseudo_register = fetch_pseudo_register;
+}
+
+void
+gdbarch_store_pseudo_register (struct gdbarch *gdbarch, int regnum)
+{
+ if (gdbarch->store_pseudo_register == 0)
+ internal_error ("gdbarch: gdbarch_store_pseudo_register invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_store_pseudo_register called\n");
+ gdbarch->store_pseudo_register (regnum);
+}
+
+void
+set_gdbarch_store_pseudo_register (struct gdbarch *gdbarch,
+ gdbarch_store_pseudo_register_ftype store_pseudo_register)
+{
+ gdbarch->store_pseudo_register = store_pseudo_register;
+}
+
CORE_ADDR
gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 556141758b1..51c83aa160a 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -604,6 +604,34 @@ extern void set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarc
#endif
/* Default (function) for non- multi-arch platforms. */
+#if (GDB_MULTI_ARCH == 0) && !defined (FETCH_PSEUDO_REGISTER)
+#define FETCH_PSEUDO_REGISTER(regnum) (internal_error ("FETCH_PSEUDO_REGISTER"), 0)
+#endif
+
+typedef void (gdbarch_fetch_pseudo_register_ftype) (int regnum);
+extern void gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, int regnum);
+extern void set_gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, gdbarch_fetch_pseudo_register_ftype *fetch_pseudo_register);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > 1) || !defined (FETCH_PSEUDO_REGISTER)
+#define FETCH_PSEUDO_REGISTER(regnum) (gdbarch_fetch_pseudo_register (current_gdbarch, regnum))
+#endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (GDB_MULTI_ARCH == 0) && !defined (STORE_PSEUDO_REGISTER)
+#define STORE_PSEUDO_REGISTER(regnum) (internal_error ("STORE_PSEUDO_REGISTER"), 0)
+#endif
+
+typedef void (gdbarch_store_pseudo_register_ftype) (int regnum);
+extern void gdbarch_store_pseudo_register (struct gdbarch *gdbarch, int regnum);
+extern void set_gdbarch_store_pseudo_register (struct gdbarch *gdbarch, gdbarch_store_pseudo_register_ftype *store_pseudo_register);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > 1) || !defined (STORE_PSEUDO_REGISTER)
+#define STORE_PSEUDO_REGISTER(regnum) (gdbarch_store_pseudo_register (current_gdbarch, regnum))
+#endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
#if (GDB_MULTI_ARCH == 0) && !defined (POINTER_TO_ADDRESS)
#define POINTER_TO_ADDRESS(type, buf) (unsigned_pointer_to_address (type, buf))
#endif
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index b7c592cc5ef..5925ecd294a 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -338,6 +338,14 @@ f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized,
f:1:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0
f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0
f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int regnum, char *from, char *to:type, regnum, from, to:::0::0
+#This function is called when the value of a pseudo-register needs
+#to be updated. Typically it will be defined on a per-architecture
+#basis.
+f:2:FETCH_PSEUDO_REGISTER:void:fetch_pseudo_register:int regnum:regnum:::0::0
+#This function is called when the value of a pseudo-register needs
+#to be set or stored. Typically it will be defined on a per-architecture
+#basis.
+f:2:STORE_PSEUDO_REGISTER:void:store_pseudo_register:int regnum:regnum:::0::0
#
f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, void *buf:type, buf:::unsigned_pointer_to_address::0
f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0
diff --git a/gdb/inferior.h b/gdb/inferior.h
index eb947d1bf37..0281d249c57 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -59,20 +59,6 @@ extern void write_inferior_status_register (struct inferior_status
#define ARCH_NUM_REGS NUM_REGS
#endif
-/* This function is called when the value of a pseudo-register needs
- to be updated. Typically it will be defined on a per-architecture
- basis. FIXME: move into gdbarch.[ch]. */
-#ifndef ARCH_FETCH_PSEUDO_REGISTERS
-#define ARCH_FETCH_PSEUDO_REGISTERS(REGNUM) /* no-op */
-#endif
-
-/* This function is called when the value of a pseudo-register needs
- to be set or stored. Typically it will be defined on a per-architecture
- basis. FIXME: move into gdbarch.[ch]. */
-#ifndef ARCH_STORE_PSEUDO_REGISTERS
-#define ARCH_STORE_PSEUDO_REGISTERS(REGNUM) /* no-op */
-#endif
-
extern void set_sigint_trap (void);
extern void clear_sigint_trap (void);
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 13cded2a7af..f449189795e 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -378,7 +378,7 @@ read_register_bytes (int inregbyte, char *myaddr, int inlen)
if (regno < NUM_REGS)
target_fetch_registers (regno);
else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
- ARCH_FETCH_PSEUDO_REGISTERS (regno);
+ FETCH_PSEUDO_REGISTER (regno);
if (!register_valid[regno])
error ("read_register_bytes: Couldn't update register %d.", regno);
@@ -407,7 +407,7 @@ read_register_gen (int regno, char *myaddr)
if (regno < NUM_REGS)
target_fetch_registers (regno);
else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
- ARCH_FETCH_PSEUDO_REGISTERS (regno);
+ FETCH_PSEUDO_REGISTER (regno);
}
memcpy (myaddr, &registers[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE (regno));
@@ -456,7 +456,7 @@ write_register_gen (int regno, char *myaddr)
if (regno < NUM_REGS)
target_store_registers (regno);
else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
- ARCH_STORE_PSEUDO_REGISTERS (regno);
+ STORE_PSEUDO_REGISTER (regno);
}
/* Copy INLEN bytes of consecutive data from memory at MYADDR
@@ -510,7 +510,7 @@ write_register_bytes (int myregstart, char *myaddr, int inlen)
if (regno < NUM_REGS)
target_store_registers (regno);
else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
- ARCH_STORE_PSEUDO_REGISTERS (regno);
+ STORE_PSEUDO_REGISTER (regno);
}
}
}
@@ -533,7 +533,7 @@ read_register (int regno)
if (regno < NUM_REGS)
target_fetch_registers (regno);
else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
- ARCH_FETCH_PSEUDO_REGISTERS (regno);
+ FETCH_PSEUDO_REGISTER (regno);
}
return (extract_unsigned_integer (&registers[REGISTER_BYTE (regno)],
@@ -639,7 +639,7 @@ write_register (int regno, LONGEST val)
if (regno < NUM_REGS)
target_store_registers (regno);
else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
- ARCH_STORE_PSEUDO_REGISTERS (regno);
+ STORE_PSEUDO_REGISTER (regno);
}
void