* Re: [PATCH] Multiarch NUM_PSEUDO_REGS
[not found] ` <14711.42626.347443.785983@kwikemart.cygnus.com>
@ 2000-07-20 20:53 ` Andrew Cagney
[not found] ` <14712.26544.243265.405030@kwikemart.cygnus.com>
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cagney @ 2000-07-20 20:53 UTC (permalink / raw)
To: Elena Zannoni; +Cc: Michael Snyder, gdb-patches
Elena Zannoni wrote:
>
> Michael Snyder writes:
> > Elena Zannoni wrote:
> > >
> > > This is needed for some sh work I am doing....
> >
> > Thanks, I'm off the hook for THAT one... ;-)
>
> If the patch is correct, that is. I am having second thoughts.
>
> Elena
Yes, you'll probably want to tweek gdbarch.sh - IEEE_FLOAT would be a
good example.
Andrew
From ezannoni@cygnus.com Fri Jul 21 08:09:00 2000
From: Elena Zannoni <ezannoni@cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Elena Zannoni <ezannoni@cygnus.com>, Michael Snyder <msnyder@cygnus.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Multiarch NUM_PSEUDO_REGS
Date: Fri, 21 Jul 2000 08:09:00 -0000
Message-id: <14712.26544.243265.405030@kwikemart.cygnus.com>
References: <14711.41227.66134.188775@kwikemart.cygnus.com> <3977A5F3.2B9D@cygnus.com> <14711.42626.347443.785983@kwikemart.cygnus.com> <3977C918.85738463@cygnus.com>
X-SW-Source: 2000-07/msg00205.html
Content-length: 5868
Andrew Cagney writes:
> Elena Zannoni wrote:
> >
> > Michael Snyder writes:
> > > Elena Zannoni wrote:
> > > >
> > > > This is needed for some sh work I am doing....
> > >
> > > Thanks, I'm off the hook for THAT one... ;-)
> >
> > If the patch is correct, that is. I am having second thoughts.
> >
> > Elena
>
> Yes, you'll probably want to tweek gdbarch.sh - IEEE_FLOAT would be a
> good example.
>
> Andrew
Yes, forget the other patch, this one should be right.
2000-07-21 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* gdbarch.sh: Add NUM_PSEUDO_REGS to the gdbarch structure.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* inferior.h (NUM_PSEUDO_REGS): Delete macro.
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.29
diff -c -u -p -r1.29 gdbarch.c
--- gdbarch.c 2000/06/12 00:35:33 1.29
+++ gdbarch.c 2000/07/21 14:54:20
@@ -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;
@@ -292,6 +293,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
generic_get_saved_register,
0,
0,
@@ -479,6 +481,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
if ((GDB_MULTI_ARCH >= 2)
&& (gdbarch->num_regs == -1))
internal_error ("gdbarch: verify_gdbarch: num_regs invalid");
+ /* Skip verify of num_pseudo_regs, invalid_p == 0 */
if ((GDB_MULTI_ARCH >= 2)
&& (gdbarch->sp_regnum == -1))
internal_error ("gdbarch: verify_gdbarch: sp_regnum invalid");
@@ -775,6 +778,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 +1356,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 +2179,22 @@ set_gdbarch_num_regs (struct gdbarch *gd
int num_regs)
{
gdbarch->num_regs = num_regs;
+}
+
+int
+gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
+{
+ /* Skip verify of num_pseudo_regs, invalid_p == 0 */
+ 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
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.23
diff -c -u -p -r1.23 gdbarch.h
--- gdbarch.h 2000/06/10 05:37:47 1.23
+++ gdbarch.h 2000/07/21 14:54:20
@@ -239,6 +239,19 @@ extern void set_gdbarch_num_regs (struct
#endif
#endif
+/* Default (value) for non- multi-arch platforms. */
+#if (GDB_MULTI_ARCH == 0) && !defined (NUM_PSEUDO_REGS)
+#define NUM_PSEUDO_REGS (0)
+#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.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.29
diff -c -u -p -r1.29 gdbarch.sh
--- gdbarch.sh 2000/06/12 00:35:34 1.29
+++ gdbarch.sh 2000/07/21 14:54:21
@@ -294,6 +294,11 @@ f:1:TARGET_READ_SP:CORE_ADDR:read_sp:voi
f:1:TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:0
#
v:2:NUM_REGS:int:num_regs::::0:-1
+# This macro gives the number of pseudo-registers that live in the
+# register namespace but do not get fetched or stored on the target.
+# These pseudo-registers may be aliases for other registers,
+# combinations of other registers, or they may be computed by GDB.
+v:2:NUM_PSEUDO_REGS:int:num_pseudo_regs::::0:0::0:::
v:2:SP_REGNUM:int:sp_regnum::::0:-1
v:2:FP_REGNUM:int:fp_regnum::::0:-1
v:2:PC_REGNUM:int:pc_regnum::::0:-1
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.8
diff -c -u -p -r1.8 inferior.h
--- inferior.h 2000/07/12 22:01:17 1.8
+++ inferior.h 2000/07/21 14:54:22
@@ -59,15 +59,6 @@ extern void write_inferior_status_regist
#define ARCH_NUM_REGS NUM_REGS
#endif
-/* This macro gives the number of pseudo-registers that live in the
- register namespace but do not get fetched or stored on the target.
- These pseudo-registers may be aliases for other registers,
- combinations of other registers, or they may be computed by GDB.
- FIXME: move into gdbarch.[ch] */
-#ifndef NUM_PSEUDO_REGS
-#define NUM_PSEUDO_REGS 0
-#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]. */
^ permalink raw reply [flat|nested] 2+ messages in thread