This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [2/6] Remove macro REGISTER_SIM_REGNO
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Tue, 12 Jun 2007 18:05:00 +0200
- Subject: [rfc] [2/6] Remove macro REGISTER_SIM_REGNO
Hello,
this patch removes REGISTER_SIM_REGNO macro from gdbarch.sh
ChangeLog:
* gdbarch.sh (REGISTER_SIM_REGNO): Replace by
gdbarch_register_sim_regno.
* sim-regno.h (sim_regno): Likewise (comment).
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.
Is this ok to commit?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c 2007-06-11 11:31:56.000000000 +0200
+++ dev/gdb/gdbarch.c 2007-06-11 19:45:30.000000000 +0200
@@ -1146,12 +1146,6 @@
fprintf_unfiltered (file,
"gdbarch_dump: register_reggroup_p = <0x%lx>\n",
(long) current_gdbarch->register_reggroup_p);
-#ifdef REGISTER_SIM_REGNO
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "REGISTER_SIM_REGNO(reg_nr)",
- XSTRING (REGISTER_SIM_REGNO (reg_nr)));
-#endif
fprintf_unfiltered (file,
"gdbarch_dump: register_sim_regno = <0x%lx>\n",
(long) current_gdbarch->register_sim_regno);
diff -urN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h 2007-06-11 11:31:56.000000000 +0200
+++ dev/gdb/gdbarch.h 2007-06-11 19:45:30.000000000 +0200
@@ -490,12 +490,6 @@
typedef int (gdbarch_register_sim_regno_ftype) (int reg_nr);
extern int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr);
extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno);
-#if !defined (GDB_TM_FILE) && defined (REGISTER_SIM_REGNO)
-#error "Non multi-arch definition of REGISTER_SIM_REGNO"
-#endif
-#if !defined (REGISTER_SIM_REGNO)
-#define REGISTER_SIM_REGNO(reg_nr) (gdbarch_register_sim_regno (current_gdbarch, reg_nr))
-#endif
typedef int (gdbarch_cannot_fetch_register_ftype) (int regnum);
extern int gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum);
diff -urN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh 2007-06-11 11:31:56.000000000 +0200
+++ dev/gdb/gdbarch.sh 2007-06-11 19:46:27.000000000 +0200
@@ -479,7 +479,7 @@
M::void:print_vector_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
# MAP a GDB RAW register number onto a simulator register number. See
# also include/...-sim.h.
-f:=:int:register_sim_regno:int reg_nr:reg_nr::legacy_register_sim_regno::0
+f::int:register_sim_regno:int reg_nr:reg_nr::legacy_register_sim_regno::0
f::int:cannot_fetch_register:int regnum:regnum::cannot_register_not::0
f::int:cannot_store_register:int regnum:regnum::cannot_register_not::0
# setjmp/longjmp support.
diff -urN src/gdb/remote-sim.c dev/gdb/remote-sim.c
--- src/gdb/remote-sim.c 2007-06-11 11:31:58.000000000 +0200
+++ dev/gdb/remote-sim.c 2007-06-11 19:47:58.000000000 +0200
@@ -288,7 +288,7 @@
return;
}
- switch (REGISTER_SIM_REGNO (regno))
+ switch (gdbarch_register_sim_regno (current_gdbarch, regno))
{
case LEGACY_SIM_REGNO_IGNORE:
break;
@@ -311,14 +311,18 @@
gdb_assert (regno >= 0 && regno < gdbarch_num_regs (current_gdbarch));
memset (buf, 0, MAX_REGISTER_SIZE);
nr_bytes = sim_fetch_register (gdbsim_desc,
- REGISTER_SIM_REGNO (regno),
- buf, register_size (current_gdbarch, regno));
+ gdbarch_register_sim_regno
+ (current_gdbarch, regno),
+ buf,
+ register_size (current_gdbarch, regno));
if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno) && warn_user)
{
fprintf_unfiltered (gdb_stderr,
"Size of register %s (%d/%d) incorrect (%d instead of %d))",
gdbarch_register_name (current_gdbarch, regno),
- regno, REGISTER_SIM_REGNO (regno),
+ regno,
+ gdbarch_register_sim_regno
+ (current_gdbarch, regno),
nr_bytes, register_size (current_gdbarch, regno));
warn_user = 0;
}
@@ -349,13 +353,14 @@
gdbsim_store_register (regcache, regno);
return;
}
- else if (REGISTER_SIM_REGNO (regno) >= 0)
+ else if (gdbarch_register_sim_regno (current_gdbarch, regno) >= 0)
{
char tmp[MAX_REGISTER_SIZE];
int nr_bytes;
regcache_cooked_read (regcache, regno, tmp);
nr_bytes = sim_store_register (gdbsim_desc,
- REGISTER_SIM_REGNO (regno),
+ gdbarch_register_sim_regno
+ (current_gdbarch, regno),
tmp, register_size (current_gdbarch, regno));
if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno))
internal_error (__FILE__, __LINE__,
diff -urN src/gdb/sim-regno.h dev/gdb/sim-regno.h
--- src/gdb/sim-regno.h 2007-01-09 18:58:58.000000000 +0100
+++ dev/gdb/sim-regno.h 2007-06-11 19:45:30.000000000 +0200
@@ -24,7 +24,7 @@
#ifndef SIM_REGNO_H
#define SIM_REGNO_H
-/* The REGISTER_SIM_REGNO(REGNUM) method, when there is a
+/* The gdbarch_register_sim_regno (REGNUM) method, when there is a
corresponding simulator register, returns that register number as a
cardinal. When there is no corresponding register, it returns a
negative value. */