From c2169756a8401d39c336250819099c1fbc9e5091 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 6 Apr 2002 20:50:10 +0000 Subject: [PATCH] * gdbarch.sh (PS_REGNUM): Add. Document. Default to -1. * gdbarch.c, gdbarch.h: Re-generate. --- gdb/ChangeLog | 5 +++++ gdb/gdbarch.c | 28 ++++++++++++++++++++++++++++ gdb/gdbarch.h | 22 ++++++++++++++++++++++ gdb/gdbarch.sh | 7 +++++++ 4 files changed, 62 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fc0ad95c584..ce646ae473d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-04-06 Andrew Cagney + + * gdbarch.sh (PS_REGNUM): Add. Document. Default to -1. + * gdbarch.c, gdbarch.h: Re-generate. + 2002-04-06 Andrew Cagney * symtab.c (lookup_symtab): Remove ``const'' from ``rp'' diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 90118d6e41f..fa9054bc57f 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -151,6 +151,7 @@ struct gdbarch int sp_regnum; int fp_regnum; int pc_regnum; + int ps_regnum; int fp0_regnum; int npc_regnum; int nnpc_regnum; @@ -296,6 +297,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + -1, 0, 0, 0, @@ -459,6 +461,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->sp_regnum = -1; current_gdbarch->fp_regnum = -1; current_gdbarch->pc_regnum = -1; + current_gdbarch->ps_regnum = -1; current_gdbarch->fp0_regnum = -1; current_gdbarch->npc_regnum = -1; current_gdbarch->nnpc_regnum = -1; @@ -592,6 +595,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->pc_regnum == -1)) fprintf_unfiltered (log, "\n\tpc_regnum"); + /* Skip verify of ps_regnum, invalid_p == 0 */ /* Skip verify of fp0_regnum, invalid_p == 0 */ /* Skip verify of npc_regnum, invalid_p == 0 */ /* Skip verify of nnpc_regnum, invalid_p == 0 */ @@ -1532,6 +1536,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->prologue_frameless_p /*PROLOGUE_FRAMELESS_P ()*/); #endif +#ifdef PS_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: PS_REGNUM # %s\n", + XSTRING (PS_REGNUM)); + fprintf_unfiltered (file, + "gdbarch_dump: PS_REGNUM = %d\n", + PS_REGNUM); +#endif #ifdef PUSH_ARGUMENTS fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2586,6 +2598,22 @@ set_gdbarch_pc_regnum (struct gdbarch *gdbarch, gdbarch->pc_regnum = pc_regnum; } +int +gdbarch_ps_regnum (struct gdbarch *gdbarch) +{ + /* Skip verify of ps_regnum, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_ps_regnum called\n"); + return gdbarch->ps_regnum; +} + +void +set_gdbarch_ps_regnum (struct gdbarch *gdbarch, + int ps_regnum) +{ + gdbarch->ps_regnum = ps_regnum; +} + int gdbarch_fp0_regnum (struct gdbarch *gdbarch) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index ed87fa0bc16..039ba597735 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -456,6 +456,12 @@ extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo #endif #endif +/* GDB's standard (or well known) register numbers. These can map onto + a real register or a pseudo (computed) register or not be defined at + all (-1). FIXME: cagney/2002-04-05: As of the time of writing, only + the PS_REGNUM was optional - code still depends on the others (fp, + pc, sp) designating registers. */ + extern int gdbarch_sp_regnum (struct gdbarch *gdbarch); extern void set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SP_REGNUM) @@ -489,6 +495,22 @@ 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) && !defined (PS_REGNUM) +#define PS_REGNUM (-1) +#endif + +extern int gdbarch_ps_regnum (struct gdbarch *gdbarch); +extern void set_gdbarch_ps_regnum (struct gdbarch *gdbarch, int ps_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PS_REGNUM) +#error "Non multi-arch definition of PS_REGNUM" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PS_REGNUM) +#define PS_REGNUM (gdbarch_ps_regnum (current_gdbarch)) +#endif +#endif + /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (FP0_REGNUM) #define FP0_REGNUM (-1) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 950dcf81d52..9c35694c14d 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -431,9 +431,16 @@ v:2:NUM_REGS:int:num_regs::::0:-1 # 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::: + +# GDB's standard (or well known) register numbers. These can map onto +# a real register or a pseudo (computed) register or not be defined at +# all (-1). FIXME: cagney/2002-04-05: As of the time of writing, only +# the PS_REGNUM was optional - code still depends on the others (fp, +# pc, sp) designating registers. 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:PS_REGNUM:int:ps_regnum::::-1:-1::0 v:2:FP0_REGNUM:int:fp0_regnum::::0:-1::0 v:2:NPC_REGNUM:int:npc_regnum::::0:-1::0 v:2:NNPC_REGNUM:int:nnpc_regnum::::0:-1::0 -- 2.30.2