aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppc-linux-nat.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-01-24 02:58:24 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-01-24 02:58:24 +0000
commitdc5cfeb6a3df1339bbf947aea732c9c2288ca0cb (patch)
tree0262e48a10f468d92ff3e3526d155a6a0618d5c0 /gdb/ppc-linux-nat.c
parent538cd60fbb681d40ab2e2990bd00f0b2acea7b24 (diff)
downloadgdb-dc5cfeb6a3df1339bbf947aea732c9c2288ca0cb.zip
gdb-dc5cfeb6a3df1339bbf947aea732c9c2288ca0cb.tar.gz
gdb-dc5cfeb6a3df1339bbf947aea732c9c2288ca0cb.tar.bz2
2002-01-23 Elena Zannoni <ezannoni@redhat.com>
* ppc-linux-nat.c (ppc_register_u_addr, supply_gregset, fill_gregset): Call gdbarch_tdep() just once, assign result to variable and use that, instead of calling the function several times.
Diffstat (limited to 'gdb/ppc-linux-nat.c')
-rw-r--r--gdb/ppc-linux-nat.c66
1 files changed, 28 insertions, 38 deletions
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index a967f48..dac59d4 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -73,10 +73,10 @@ static int
ppc_register_u_addr (int regno)
{
int u_addr = -1;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* General purpose registers occupy 1 slot each in the buffer */
- if (regno >= gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum
- && regno <= gdbarch_tdep (current_gdbarch)->ppc_gplast_regnum )
+ if (regno >= tdep->ppc_gp0_regnum && regno <= tdep->ppc_gplast_regnum )
u_addr = ((PT_R0 + regno) * 4);
/* Floating point regs: 2 slots each */
@@ -86,17 +86,17 @@ ppc_register_u_addr (int regno)
/* UISA special purpose registers: 1 slot each */
if (regno == PC_REGNUM)
u_addr = PT_NIP * 4;
- if (regno == gdbarch_tdep (current_gdbarch)->ppc_lr_regnum)
+ if (regno == tdep->ppc_lr_regnum)
u_addr = PT_LNK * 4;
- if (regno == gdbarch_tdep (current_gdbarch)->ppc_cr_regnum)
+ if (regno == tdep->ppc_cr_regnum)
u_addr = PT_CCR * 4;
- if (regno == gdbarch_tdep (current_gdbarch)->ppc_xer_regnum)
+ if (regno == tdep->ppc_xer_regnum)
u_addr = PT_XER * 4;
- if (regno == gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum)
+ if (regno == tdep->ppc_ctr_regnum)
u_addr = PT_CTR * 4;
- if (regno == gdbarch_tdep (current_gdbarch)->ppc_mq_regnum)
+ if (regno == tdep->ppc_mq_regnum)
u_addr = PT_MQ * 4;
- if (regno == gdbarch_tdep (current_gdbarch)->ppc_ps_regnum)
+ if (regno == tdep->ppc_ps_regnum)
u_addr = PT_MSR * 4;
return u_addr;
@@ -229,23 +229,18 @@ supply_gregset (gdb_gregset_t *gregsetp)
{
int regi;
register elf_greg_t *regp = (elf_greg_t *) gregsetp;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
for (regi = 0; regi < 32; regi++)
supply_register (regi, (char *) (regp + regi));
supply_register (PC_REGNUM, (char *) (regp + PT_NIP));
- supply_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum,
- (char *) (regp + PT_LNK));
- supply_register (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum,
- (char *) (regp + PT_CCR));
- supply_register (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum,
- (char *) (regp + PT_XER));
- supply_register (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum,
- (char *) (regp + PT_CTR));
- supply_register (gdbarch_tdep (current_gdbarch)->ppc_mq_regnum,
- (char *) (regp + PT_MQ));
- supply_register (gdbarch_tdep (current_gdbarch)->ppc_ps_regnum,
- (char *) (regp + PT_MSR));
+ supply_register (tdep->ppc_lr_regnum, (char *) (regp + PT_LNK));
+ supply_register (tdep->ppc_cr_regnum, (char *) (regp + PT_CCR));
+ supply_register (tdep->ppc_xer_regnum, (char *) (regp + PT_XER));
+ supply_register (tdep->ppc_ctr_regnum, (char *) (regp + PT_CTR));
+ supply_register (tdep->ppc_mq_regnum, (char *) (regp + PT_MQ));
+ supply_register (tdep->ppc_ps_regnum, (char *) (regp + PT_MSR));
}
void
@@ -253,6 +248,7 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
{
int regi;
elf_greg_t *regp = (elf_greg_t *) gregsetp;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
for (regi = 0; regi < 32; regi++)
{
@@ -263,29 +259,23 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
if ((regno == -1) || regno == PC_REGNUM)
regcache_collect (PC_REGNUM, regp + PT_NIP);
if ((regno == -1)
- || regno == gdbarch_tdep (current_gdbarch)->ppc_lr_regnum)
- regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum,
- regp + PT_LNK);
+ || regno == tdep->ppc_lr_regnum)
+ regcache_collect (tdep->ppc_lr_regnum, regp + PT_LNK);
if ((regno == -1)
- || regno == gdbarch_tdep (current_gdbarch)->ppc_cr_regnum)
- regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum,
- regp + PT_CCR);
+ || regno == tdep->ppc_cr_regnum)
+ regcache_collect (tdep->ppc_cr_regnum, regp + PT_CCR);
if ((regno == -1)
- || regno == gdbarch_tdep (current_gdbarch)->ppc_xer_regnum)
- regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum,
- regp + PT_XER);
+ || regno == tdep->ppc_xer_regnum)
+ regcache_collect (tdep->ppc_xer_regnum, regp + PT_XER);
if ((regno == -1)
- || regno == gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum)
- regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum,
- regp + PT_CTR);
+ || regno == tdep->ppc_ctr_regnum)
+ regcache_collect (tdep->ppc_ctr_regnum, regp + PT_CTR);
if ((regno == -1)
- || regno == gdbarch_tdep (current_gdbarch)->ppc_mq_regnum)
- regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_mq_regnum,
- regp + PT_MQ);
+ || regno == tdep->ppc_mq_regnum)
+ regcache_collect (tdep->ppc_mq_regnum, regp + PT_MQ);
if ((regno == -1)
- || regno == gdbarch_tdep (current_gdbarch)->ppc_ps_regnum)
- regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_ps_regnum,
- regp + PT_MSR);
+ || regno == tdep->ppc_ps_regnum)
+ regcache_collect (tdep->ppc_ps_regnum, regp + PT_MSR);
}
void