aboutsummaryrefslogtreecommitdiff
path: root/gdb/ia64-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-10-08 12:51:54 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-10-08 12:51:54 +0000
commit088568da7d2e32bd0919a62766c2bf21f320961e (patch)
treec3f5c6c9d88349a86b9efb99cba1d5c30a853bcd /gdb/ia64-tdep.c
parent464963c92cc07668165c0e503994b41cde3daa4b (diff)
downloadgdb-088568da7d2e32bd0919a62766c2bf21f320961e.zip
gdb-088568da7d2e32bd0919a62766c2bf21f320961e.tar.gz
gdb-088568da7d2e32bd0919a62766c2bf21f320961e.tar.bz2
2007-10-08 Markus Deuling <deuling@de.ibm.com>
* ia64-tdep.c (ia64_pseudo_register_read, ia64_pseudo_register_write): Replace current_gdbarch by gdbarch. * ia64-tdep.c (ia64_frame_prev_register (ia64_sigtramp_frame_prev_register) (ia64_libunwind_frame_prev_register): Use get_regcache_arch or get_frame_arch to get at the current architecture by regcache or by frame, respectively. * ia64-linux-nat.c (ia64_linux_fetch_register) (ia64_linux_fetch_registers, ia64_linux_store_register) (ia64_linux_store_registers): Likewise.
Diffstat (limited to 'gdb/ia64-tdep.c')
-rw-r--r--gdb/ia64-tdep.c71
1 files changed, 37 insertions, 34 deletions
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 8245798..dd938c9 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -715,10 +715,10 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
{
ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
reg = read_memory_integer ((CORE_ADDR)reg_addr, 8);
- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), reg);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), reg);
}
else
- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), 0);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), 0);
}
}
else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
@@ -727,7 +727,7 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
ULONGEST unat;
regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat);
unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), unatN_val);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), unatN_val);
}
else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
{
@@ -762,7 +762,7 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
natN_val = (nat_collection >> nat_bit) & 1;
}
- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), natN_val);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), natN_val);
}
else if (regnum == VBOF_REGNUM)
{
@@ -777,7 +777,7 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
/* The bsp points at the end of the register frame so we
subtract the size of frame from it to get beginning of frame. */
vbsp = rse_address_add (bsp, -(cfm & 0x7f));
- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), vbsp);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), vbsp);
}
else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
{
@@ -799,10 +799,10 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), prN_val);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), prN_val);
}
else
- memset (buf, 0, register_size (current_gdbarch, regnum));
+ memset (buf, 0, register_size (gdbarch, regnum));
}
static void
@@ -829,7 +829,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
{
ULONGEST unatN_val, unat, unatN_mask;
regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat);
- unatN_val = extract_unsigned_integer (buf, register_size (current_gdbarch, regnum));
+ unatN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum));
unatN_mask = (1LL << (regnum - IA64_NAT0_REGNUM));
if (unatN_val == 0)
unat &= ~unatN_mask;
@@ -853,7 +853,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
if ((cfm & 0x7f) > regnum - V32_REGNUM)
gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
- natN_val = extract_unsigned_integer (buf, register_size (current_gdbarch, regnum));
+ natN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum));
if (gr_addr != 0 && (natN_val == 0 || natN_val == 1))
{
@@ -882,7 +882,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
nat_collection |= natN_mask;
else
nat_collection &= ~natN_mask;
- store_unsigned_integer (nat_buf, register_size (current_gdbarch, regnum), nat_collection);
+ store_unsigned_integer (nat_buf, register_size (gdbarch, regnum), nat_collection);
write_memory (nat_addr, nat_buf, 8);
}
}
@@ -907,7 +907,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
regnum = VP16_REGNUM
+ ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
- prN_val = extract_unsigned_integer (buf, register_size (current_gdbarch, regnum));
+ prN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum));
prN_mask = (1LL << (regnum - VP0_REGNUM));
if (prN_val == 0)
pr &= ~prN_mask;
@@ -1600,6 +1600,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, gdb_byte *valuep)
{
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct ia64_frame_cache *cache =
ia64_frame_cache (next_frame, this_cache);
char dummy_valp[MAX_REGISTER_SIZE];
@@ -1620,12 +1621,12 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
if (!valuep)
valuep = dummy_valp;
- memset (valuep, 0, register_size (current_gdbarch, regnum));
+ memset (valuep, 0, register_size (gdbarch, regnum));
- if (regnum == gdbarch_sp_regnum (current_gdbarch))
+ if (regnum == gdbarch_sp_regnum (gdbarch))
{
/* Handle SP values for all frames but the topmost. */
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum),
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum),
cache->base);
}
else if (regnum == IA64_BSP_REGNUM)
@@ -1650,7 +1651,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
bsp = rse_address_add (cache->bsp, -(cache->sof));
prev_bsp = rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f));
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum),
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum),
prev_bsp);
}
else if (regnum == IA64_CFM_REGNUM)
@@ -1661,10 +1662,10 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, valuep, register_size (current_gdbarch, regnum));
+ read_memory (addr, valuep, register_size (gdbarch, regnum));
}
else if (cache->prev_cfm)
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), cache->prev_cfm);
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum), cache->prev_cfm);
else if (cache->frameless)
{
CORE_ADDR cfm = 0;
@@ -1678,7 +1679,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
above. If the function lacks one of these frame pointers, we can
still provide a value since we know the size of the frame. */
CORE_ADDR vfp = cache->base;
- store_unsigned_integer (valuep, register_size (current_gdbarch, IA64_VFP_REGNUM), vfp);
+ store_unsigned_integer (valuep, register_size (gdbarch, IA64_VFP_REGNUM), vfp);
}
else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
{
@@ -1702,7 +1703,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
}
prN_val = extract_bit_field ((unsigned char *) pr_valuep,
regnum - VP0_REGNUM, 1);
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), prN_val);
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum), prN_val);
}
else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
{
@@ -1716,7 +1717,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
&unat_optim, &unat_lval, &unat_addr, &unat_realnum, unat_valuep);
unatN_val = extract_bit_field ((unsigned char *) unat_valuep,
regnum - IA64_NAT0_REGNUM, 1);
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum),
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum),
unatN_val);
}
else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
@@ -1751,7 +1752,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
natval = (nat_collection >> nat_bit) & 1;
}
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), natval);
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum), natval);
}
else if (regnum == IA64_IP_REGNUM)
{
@@ -1762,7 +1763,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM));
+ read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
pc = extract_unsigned_integer (buf, 8);
}
else if (cache->frameless)
@@ -1791,7 +1792,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM));
+ read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
pc = extract_unsigned_integer (buf, 8);
}
else if (cache->frameless)
@@ -1813,7 +1814,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, buf, register_size (current_gdbarch, IA64_BR0_REGNUM));
+ read_memory (addr, buf, register_size (gdbarch, IA64_BR0_REGNUM));
br0 = extract_unsigned_integer (buf, 8);
}
store_unsigned_integer (valuep, 8, br0);
@@ -1829,7 +1830,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, valuep, register_size (current_gdbarch, regnum));
+ read_memory (addr, valuep, register_size (gdbarch, regnum));
}
else if (cache->frameless)
{
@@ -1853,7 +1854,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, valuep, register_size (current_gdbarch, regnum));
+ read_memory (addr, valuep, register_size (gdbarch, regnum));
}
}
else
@@ -1877,7 +1878,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, valuep, register_size (current_gdbarch, regnum));
+ read_memory (addr, valuep, register_size (gdbarch, regnum));
}
/* Otherwise, punt and get the current value of the register. */
else
@@ -2003,6 +2004,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *next_frame,
char dummy_valp[MAX_REGISTER_SIZE];
char buf[MAX_REGISTER_SIZE];
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct ia64_frame_cache *cache =
ia64_sigtramp_frame_cache (next_frame, this_cache);
@@ -2021,7 +2023,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *next_frame,
if (!valuep)
valuep = dummy_valp;
- memset (valuep, 0, register_size (current_gdbarch, regnum));
+ memset (valuep, 0, register_size (gdbarch, regnum));
if (regnum == IA64_IP_REGNUM)
{
@@ -2032,7 +2034,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *next_frame,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM));
+ read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
pc = extract_unsigned_integer (buf, 8);
}
pc &= ~0xf;
@@ -2049,7 +2051,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *next_frame,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, valuep, register_size (current_gdbarch, regnum));
+ read_memory (addr, valuep, register_size (gdbarch, regnum));
}
}
else
@@ -2060,7 +2062,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *next_frame,
{
*lvalp = lval_memory;
*addrp = addr;
- read_memory (addr, valuep, register_size (current_gdbarch, regnum));
+ read_memory (addr, valuep, register_size (gdbarch, regnum));
}
}
@@ -2701,6 +2703,7 @@ ia64_libunwind_frame_prev_register (struct frame_info *next_frame,
{
int reg = regnum;
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
reg = IA64_PR_REGNUM;
else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
@@ -2736,7 +2739,7 @@ ia64_libunwind_frame_prev_register (struct frame_info *next_frame,
}
prN_val = extract_bit_field ((unsigned char *) valuep,
regnum - VP0_REGNUM, 1);
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), prN_val);
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum), prN_val);
}
else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
{
@@ -2744,7 +2747,7 @@ ia64_libunwind_frame_prev_register (struct frame_info *next_frame,
unatN_val = extract_bit_field ((unsigned char *) valuep,
regnum - IA64_NAT0_REGNUM, 1);
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum),
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum),
unatN_val);
}
else if (regnum == IA64_BSP_REGNUM)
@@ -2766,7 +2769,7 @@ ia64_libunwind_frame_prev_register (struct frame_info *next_frame,
prev_cfm = extract_unsigned_integer (cfm_valuep, 8);
prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f));
- store_unsigned_integer (valuep, register_size (current_gdbarch, regnum),
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum),
prev_bsp);
}