diff options
author | Andrew Cagney <cagney@redhat.com> | 2000-05-02 09:36:57 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2000-05-02 09:36:57 +0000 |
commit | 03863182248f30818d11417609a7e576fefe705b (patch) | |
tree | 527f6a6a9029f14d94119ada4dea5e53e25dc323 /gdb | |
parent | d7446e7568e7d6f5c49ed29f9184c94f09956a82 (diff) | |
download | gdb-03863182248f30818d11417609a7e576fefe705b.zip gdb-03863182248f30818d11417609a7e576fefe705b.tar.gz gdb-03863182248f30818d11417609a7e576fefe705b.tar.bz2 |
Multi-arch NPC_REGNUM NNPC_REGNUM.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/findvar.c | 4 | ||||
-rw-r--r-- | gdb/gdbarch.c | 46 | ||||
-rw-r--r-- | gdb/gdbarch.h | 26 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 2 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 6 | ||||
-rw-r--r-- | gdb/procfs.c | 8 |
7 files changed, 92 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3733750..2bf0f1f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/findvar.c b/gdb/findvar.c index 5ee099b..8f19608 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -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 diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 900e83e..17bed5c 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -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)) @@ -704,6 +712,12 @@ gdbarch_dump (void) "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 /*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) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index b142732..7ccad0a 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -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)) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 790db4f..892d61f 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -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 diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index cd078cc..2b632d6 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -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 diff --git a/gdb/procfs.c b/gdb/procfs.c index 686e4be..2dfde70 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -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 */ |