Multi-arch NPC_REGNUM NNPC_REGNUM.

This commit is contained in:
Andrew Cagney 2000-05-02 09:36:57 +00:00
parent d7446e7568
commit 0386318224
7 changed files with 92 additions and 13 deletions

View 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

View 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

View 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)
{

View 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))

View file

@ -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

View 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

View 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 */