Multi-arch NPC_REGNUM NNPC_REGNUM.
authorAndrew Cagney <cagney@redhat.com>
Tue, 2 May 2000 09:36:57 +0000 (09:36 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 2 May 2000 09:36:57 +0000 (09:36 +0000)
gdb/ChangeLog
gdb/findvar.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbserver/remote-utils.c
gdb/procfs.c

index 37337503d4934b2e7fc0a780d49ca4d264aee347..2bf0f1feaa025d7ff76355dbeaf7ce1a764a6581 100644 (file)
@@ -1,3 +1,16 @@
+Tue May  2 19:07:20 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * gdbarch.sh (NPC_REGNUM, NNPC_REGNUM): Add.
+       * gdbarch.h, gdbarch.c: Re-generate.
+
+       * gdbserver/remote-utils.c (prepare_resume_reply): Change #ifdef
+       NPC_REGNUM to run-time test.
+       * findvar.c (generic_target_write_pc): Change #ifdef NPC_REGNUM
+       and NNPC_REGNUM to run-time test.
+       * procfs.c (procfs_fetch_registers): Change #ifdef NPC_REGNUM to
+       run-time test.
+       (procfs_store_registers): Ditto.
+
 Tue May  2 18:48:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * gdbarch.sh: Provide non- multi-arch defaults by direct
index 5ee099ba9463d72806f3f4a714e1af4a08534ed1..8f1960890fd8a0c12e04a1b0b7ffae456419ca5b 100644 (file)
@@ -1082,14 +1082,10 @@ generic_target_write_pc (pc, pid)
 #ifdef PC_REGNUM
   if (PC_REGNUM >= 0)
     write_register_pid (PC_REGNUM, pc, pid);
-#ifdef NPC_REGNUM
   if (NPC_REGNUM >= 0)
     write_register_pid (NPC_REGNUM, pc + 4, pid);
-#ifdef NNPC_REGNUM
   if (NNPC_REGNUM >= 0)
     write_register_pid (NNPC_REGNUM, pc + 8, pid);
-#endif
-#endif
 #else
   internal_error ("generic_target_write_pc");
 #endif
index 900e83e49ca84affee61fcdad477fec8d2caf43d..17bed5cab32da5296cd9e3cdce017fa04470c576 100644 (file)
@@ -146,6 +146,8 @@ struct gdbarch
   int sp_regnum;
   int fp_regnum;
   int pc_regnum;
+  int npc_regnum;
+  int nnpc_regnum;
   gdbarch_register_name_ftype *register_name;
   int register_size;
   int register_bytes;
@@ -279,6 +281,8 @@ struct gdbarch startup_gdbarch = {
   0,
   0,
   0,
+  0,
+  0,
   generic_get_saved_register,
   0,
   0,
@@ -349,6 +353,8 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->sp_regnum = -1;
   gdbarch->fp_regnum = -1;
   gdbarch->pc_regnum = -1;
+  gdbarch->npc_regnum = -1;
+  gdbarch->nnpc_regnum = -1;
   gdbarch->register_name = legacy_register_name;
   gdbarch->register_size = -1;
   gdbarch->register_bytes = -1;
@@ -466,6 +472,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->pc_regnum == -1))
     internal_error ("gdbarch: verify_gdbarch: pc_regnum invalid");
+  /* Skip verify of npc_regnum, invalid_p == 0 */
+  /* Skip verify of nnpc_regnum, invalid_p == 0 */
   /* Skip verify of register_name, invalid_p == 0 */
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->register_size == -1))
@@ -703,6 +711,12 @@ gdbarch_dump (void)
   fprintf_unfiltered (gdb_stdlog,
                       "gdbarch_update: PC_REGNUM = %ld\n",
                       (long) PC_REGNUM);
+  fprintf_unfiltered (gdb_stdlog,
+                      "gdbarch_update: NPC_REGNUM = %ld\n",
+                      (long) NPC_REGNUM);
+  fprintf_unfiltered (gdb_stdlog,
+                      "gdbarch_update: NNPC_REGNUM = %ld\n",
+                      (long) NNPC_REGNUM);
   fprintf_unfiltered (gdb_stdlog,
                       "gdbarch_update: REGISTER_NAME = 0x%08lx\n",
                       (long) current_gdbarch->register_name
@@ -1334,6 +1348,38 @@ set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
   gdbarch->pc_regnum = pc_regnum;
 }
 
+int
+gdbarch_npc_regnum (struct gdbarch *gdbarch)
+{
+  /* Skip verify of npc_regnum, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_npc_regnum called\n");
+  return gdbarch->npc_regnum;
+}
+
+void
+set_gdbarch_npc_regnum (struct gdbarch *gdbarch,
+                        int npc_regnum)
+{
+  gdbarch->npc_regnum = npc_regnum;
+}
+
+int
+gdbarch_nnpc_regnum (struct gdbarch *gdbarch)
+{
+  /* Skip verify of nnpc_regnum, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_nnpc_regnum called\n");
+  return gdbarch->nnpc_regnum;
+}
+
+void
+set_gdbarch_nnpc_regnum (struct gdbarch *gdbarch,
+                         int nnpc_regnum)
+{
+  gdbarch->nnpc_regnum = nnpc_regnum;
+}
+
 char *
 gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
 {
index b1427328da8169dee338f73de9d633ba0ced4c93..7ccad0a1184231ba3242a1e93e4561add8b38edb 100644 (file)
@@ -263,6 +263,32 @@ extern void set_gdbarch_pc_regnum (struct gdbarch *gdbarch, int pc_regnum);
 #endif
 #endif
 
+/* Default (value) for non- multi-arch platforms. */
+#if (GDB_MULTI_ARCH == 0) && !defined (NPC_REGNUM)
+#define NPC_REGNUM (-1)
+#endif
+
+extern int gdbarch_npc_regnum (struct gdbarch *gdbarch);
+extern void set_gdbarch_npc_regnum (struct gdbarch *gdbarch, int npc_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > 1) || !defined (NPC_REGNUM)
+#define NPC_REGNUM (gdbarch_npc_regnum (current_gdbarch))
+#endif
+#endif
+
+/* Default (value) for non- multi-arch platforms. */
+#if (GDB_MULTI_ARCH == 0) && !defined (NNPC_REGNUM)
+#define NNPC_REGNUM (-1)
+#endif
+
+extern int gdbarch_nnpc_regnum (struct gdbarch *gdbarch);
+extern void set_gdbarch_nnpc_regnum (struct gdbarch *gdbarch, int nnpc_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > 1) || !defined (NNPC_REGNUM)
+#define NNPC_REGNUM (gdbarch_nnpc_regnum (current_gdbarch))
+#endif
+#endif
+
 /* Default (function) for non- multi-arch platforms. */
 #if (GDB_MULTI_ARCH == 0) && !defined (REGISTER_NAME)
 #define REGISTER_NAME(regnr) (legacy_register_name (regnr))
index 790db4ffc338e7258bb52a26dabfaa238ed7272b..892d61f86ac0cf1aa17ac77e1129f8fc4af33fd0 100755 (executable)
@@ -241,6 +241,8 @@ v:2:NUM_REGS:int:num_regs::::0:-1
 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
+v:2:NPC_REGNUM:int:npc_regnum::::0:-1:0
+v:2:NNPC_REGNUM:int:nnpc_regnum::::0:-1:0
 f:2:REGISTER_NAME:char *:register_name:int regnr:regnr:::legacy_register_name:0
 v:2:REGISTER_SIZE:int:register_size::::0:-1
 v:2:REGISTER_BYTES:int:register_bytes::::0:-1
index cd078ccddc933a0b8fb7f536ce74428e4a9fe62c..2b632d6c1fddec140f1e7a7391fad29e348a1200 100644 (file)
@@ -33,6 +33,7 @@
 #include <fcntl.h>
 
 int remote_debug = 0;
+struct ui_file *gdb_stdlog;
 
 static int remote_desc;
 
@@ -487,9 +488,8 @@ prepare_resume_reply (buf, status, signo)
       buf = outreg (PC_REGNUM, buf);
       buf = outreg (FP_REGNUM, buf);
       buf = outreg (SP_REGNUM, buf);
-#ifdef NPC_REGNUM
-      buf = outreg (NPC_REGNUM, buf);
-#endif
+      if (NPC_REGNUM >= 0)
+       buf = outreg (NPC_REGNUM, buf);
 #ifdef O7_REGNUM
       buf = outreg (O7_REGNUM, buf);
 #endif
index 686e4bedee9edd976e1fa8dc8c6af0b5f08ddbf3..2dfde70e5c1459c99f95fb2af55af0ec66c6fe26 100644 (file)
@@ -3531,9 +3531,7 @@ procfs_fetch_registers (regno)
 #if defined (FP0_REGNUM)       /* need floating point? */
   if ((regno >= 0 && regno < FP0_REGNUM) ||
       regno == PC_REGNUM  ||
-#ifdef NPC_REGNUM
-      regno == NPC_REGNUM ||
-#endif
+      (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
       regno == FP_REGNUM  ||
       regno == SP_REGNUM)
     return;                    /* not a floating point register */
@@ -3607,9 +3605,7 @@ procfs_store_registers (regno)
 #if defined (FP0_REGNUM)       /* need floating point? */
   if ((regno >= 0 && regno < FP0_REGNUM) ||
       regno == PC_REGNUM  ||
-#ifdef NPC_REGNUM
-      regno == NPC_REGNUM ||
-#endif
+      (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
       regno == FP_REGNUM  ||
       regno == SP_REGNUM)
     return;                    /* not a floating point register */
This page took 0.034542 seconds and 4 git commands to generate.