This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Multiarch NUM_PSEUDO_REGS
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH] Multiarch NUM_PSEUDO_REGS
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Thu, 20 Jul 2000 21:02:03 -0400 (EDT)
This is needed for some sh work I am doing....
Elena
2000-07-20 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* gdbarch.c (struct gdbarch): Add num_pseudo_regs field.
(gdbarch_dump): Add NUM_PSEUDO_REGS to the dumped info.
(gdbarch_num_pseudo_regs): New function.
(set_gdbarch_num_pseudo_regs): New function.
* gdbarch.h: Define NUM_PSEUDO_REGS as a gdbarch function.
(gdbarch_num_pseudo_regs): Export.
(set_gdbarch_num_pseudo_regs): Export.
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.23
diff -u -p -r1.23 gdbarch.h
cvs server: conflicting specifications of output style
--- gdbarch.h 2000/06/10 05:37:47 1.23
+++ gdbarch.h 2000/07/21 00:56:12
@@ -239,6 +239,14 @@ extern void set_gdbarch_num_regs (struct
#endif
#endif
+extern int gdbarch_num_pseudo_regs (struct gdbarch *gdbarch);
+extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > 1) || !defined (NUM_PSEUDO_REGS)
+#define NUM_PSEUDO_REGS (gdbarch_num_pseudo_regs (current_gdbarch))
+#endif
+#endif
+
extern int gdbarch_sp_regnum (struct gdbarch *gdbarch);
extern void set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum);
#if GDB_MULTI_ARCH
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.29
diff -c -p -u -r1.29 gdbarch.c
cvs server: conflicting specifications of output style
--- gdbarch.c 2000/06/12 00:35:33 1.29
+++ gdbarch.c 2000/07/21 01:01:03
@@ -145,6 +145,7 @@ struct gdbarch
gdbarch_read_sp_ftype *read_sp;
gdbarch_write_sp_ftype *write_sp;
int num_regs;
+ int num_pseudo_regs;
int sp_regnum;
int fp_regnum;
int pc_regnum;
@@ -775,6 +776,11 @@ gdbarch_dump (struct gdbarch *gdbarch, s
"gdbarch_dump: NUM_REGS # %s\n",
XSTRING (NUM_REGS));
#endif
+#ifdef NUM_PSEUDO_REGS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: NUM_PSEUDO_REGS # %s\n",
+ XSTRING (NUM_PSEUDO_REGS));
+#endif
#ifdef SP_REGNUM
fprintf_unfiltered (file,
"gdbarch_dump: SP_REGNUM # %s\n",
@@ -1348,6 +1354,11 @@ gdbarch_dump (struct gdbarch *gdbarch, s
"gdbarch_dump: NUM_REGS = %ld\n",
(long) NUM_REGS);
#endif
+#ifdef NUM_PSEUDO_REGS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: NUM_PSEUDO_REGS = %ld\n",
+ (long) NUM_PSEUDO_REGS);
+#endif
#ifdef SP_REGNUM
fprintf_unfiltered (file,
"gdbarch_dump: SP_REGNUM = %ld\n",
@@ -2166,6 +2177,23 @@ set_gdbarch_num_regs (struct gdbarch *gd
int num_regs)
{
gdbarch->num_regs = num_regs;
+}
+
+int
+gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
+{
+ if (gdbarch->num_pseudo_regs == -1)
+ internal_error ("gdbarch: gdbarch_num_pseudo_regs invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_num_pseudo_regs called\n");
+ return gdbarch->num_pseudo_regs;
+}
+
+void
+set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
+ int num_pseudo_regs)
+{
+ gdbarch->num_pseudo_regs = num_pseudo_regs;
}
int