aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2012-09-26 07:52:48 +0000
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2012-09-26 07:52:48 +0000
commit8f8a23a2c397294ab562c6cf7020679f85b921ec (patch)
tree778b8da141ef8d1736fcf57813d8350844636760 /gdb
parent8ae551cf475ac573cd7d43ad46cfb81c52e58f6e (diff)
downloadgdb-8f8a23a2c397294ab562c6cf7020679f85b921ec.zip
gdb-8f8a23a2c397294ab562c6cf7020679f85b921ec.tar.gz
gdb-8f8a23a2c397294ab562c6cf7020679f85b921ec.tar.bz2
* amd64-tdep.c (amd64_return_value): Use TYPE_LENGTH directly.
* bfin-tdep.c (bfin_extract_return_value): Likewise. (bfin_store_return_value): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. * hppa-tdep.c (hppa64_return_value): Likewise. * lm32-tdep.c (lm32_store_return_value): Likewise. * microblaze-tdep.c (microblaze_store_return_value): Likewise. * spu-tdep.c (spu_value_from_register): Likewise. * vax-tdep.c (vax_return_value): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/amd64-tdep.c2
-rw-r--r--gdb/bfin-tdep.c4
-rw-r--r--gdb/cris-tdep.c20
-rw-r--r--gdb/h8300-tdep.c9
-rw-r--r--gdb/hppa-tdep.c2
-rw-r--r--gdb/lm32-tdep.c10
-rw-r--r--gdb/microblaze-tdep.c7
-rw-r--r--gdb/spu-tdep.c5
-rw-r--r--gdb/vax-tdep.c11
10 files changed, 48 insertions, 36 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8d32192..33127a9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
2012-09-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+ * amd64-tdep.c (amd64_return_value): Use TYPE_LENGTH directly.
+ * bfin-tdep.c (bfin_extract_return_value): Likewise.
+ (bfin_store_return_value): Likewise.
+ * cris-tdep.c (cris_store_return_value): Likewise.
+ (cris_extract_return_value): Likewise.
+ * h8300-tdep.c (h8300_extract_return_value): Likewise.
+ * hppa-tdep.c (hppa64_return_value): Likewise.
+ * lm32-tdep.c (lm32_store_return_value): Likewise.
+ * microblaze-tdep.c (microblaze_store_return_value): Likewise.
+ * spu-tdep.c (spu_value_from_register): Likewise.
+ * vax-tdep.c (vax_return_value): Likewise.
+
+2012-09-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+
* breakpoint.c (invalidate_bp_value_on_memory_change): Expand
parameter LEN to ssize_t.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 8c5b6cc..16c3ee4 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -637,7 +637,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
}
gdb_assert (class[1] != AMD64_MEMORY);
- gdb_assert (len <= 16);
+ gdb_assert (TYPE_LENGTH (type) <= 16);
for (i = 0; len > 0; i++, len -= 8)
{
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 4eb5763..6d4859a 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -615,7 +615,7 @@ bfin_extract_return_value (struct type *type,
ULONGEST tmp;
int regno = BFIN_R0_REGNUM;
- gdb_assert (len <= 8);
+ gdb_assert (TYPE_LENGTH (type) <= 8);
while (len > 0)
{
@@ -643,7 +643,7 @@ bfin_store_return_value (struct type *type,
int len = TYPE_LENGTH (type);
int regno = BFIN_R0_REGNUM;
- gdb_assert (len <= 8);
+ gdb_assert (TYPE_LENGTH (type) <= 8);
while (len > 0)
{
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 6739037..48c8f94 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1662,20 +1662,20 @@ cris_store_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
- int len = TYPE_LENGTH (type);
- if (len <= 4)
+ if (TYPE_LENGTH (type) <= 4)
{
/* Put the return value in R10. */
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val);
}
- else if (len <= 8)
+ else if (TYPE_LENGTH (type) <= 8)
{
/* Put the return value in R10 and R11. */
val = extract_unsigned_integer (valbuf, 4, byte_order);
regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val);
- val = extract_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order);
+ val = extract_unsigned_integer ((char *)valbuf + 4,
+ TYPE_LENGTH (type) - 4, byte_order);
regcache_cooked_write_unsigned (regcache, ARG2_REGNUM, val);
}
else
@@ -1833,21 +1833,21 @@ cris_extract_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
- int len = TYPE_LENGTH (type);
- if (len <= 4)
+ if (TYPE_LENGTH (type) <= 4)
{
/* Get the return value from R10. */
regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val);
- store_unsigned_integer (valbuf, len, byte_order, val);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, val);
}
- else if (len <= 8)
+ else if (TYPE_LENGTH (type) <= 8)
{
/* Get the return value from R10 and R11. */
regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val);
store_unsigned_integer (valbuf, 4, byte_order, val);
regcache_cooked_read_unsigned (regcache, ARG2_REGNUM, &val);
- store_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order, val);
+ store_unsigned_integer ((char *)valbuf + 4, TYPE_LENGTH (type) - 4,
+ byte_order, val);
}
else
error (_("cris_extract_return_value: type length too large"));
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 4e98a8f..bcb5b34 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -751,12 +751,12 @@ h8300_extract_return_value (struct type *type, struct regcache *regcache,
int len = TYPE_LENGTH (type);
ULONGEST c, addr;
- switch (len)
+ switch (TYPE_LENGTH (type))
{
case 1:
case 2:
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
- store_unsigned_integer (valbuf, len, byte_order, c);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
break;
case 4: /* Needs two registers on plain H8/300 */
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
@@ -768,8 +768,9 @@ h8300_extract_return_value (struct type *type, struct regcache *regcache,
if (TYPE_CODE (type) == TYPE_CODE_INT)
{
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
- c = read_memory_unsigned_integer ((CORE_ADDR) addr, len, byte_order);
- store_unsigned_integer (valbuf, len, byte_order, c);
+ c = read_memory_unsigned_integer ((CORE_ADDR) addr,
+ TYPE_LENGTH (type), byte_order);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
}
else
{
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 581ffc7..d5798cf 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1160,7 +1160,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
int len = TYPE_LENGTH (type);
int regnum, offset;
- if (len > 16)
+ if (TYPE_LENGTH (type) > 16)
{
/* All return values larget than 128 bits must be aggregate
return values. */
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 725ce5b..dd5eae8 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -349,18 +349,18 @@ lm32_store_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
- int len = TYPE_LENGTH (type);
- if (len <= 4)
+ if (TYPE_LENGTH (type) <= 4)
{
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
}
- else if (len <= 8)
+ else if (TYPE_LENGTH (type) <= 8)
{
val = extract_unsigned_integer (valbuf, 4, byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
- val = extract_unsigned_integer (valbuf + 4, len - 4, byte_order);
+ val = extract_unsigned_integer (valbuf + 4, TYPE_LENGTH (type) - 4,
+ byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R2_REGNUM, val);
}
else
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 9658400..9b1ff46 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -590,22 +590,21 @@ static void
microblaze_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
gdb_byte buf[8];
memset (buf, 0, sizeof(buf));
/* Integral and pointer return values. */
- if (len > 4)
+ if (TYPE_LENGTH (type) > 4)
{
- gdb_assert (len == 8);
+ gdb_assert (TYPE_LENGTH (type) == 8);
memcpy (buf, valbuf, 8);
regcache_cooked_write (regcache, MICROBLAZE_RETVAL_REGNUM+1, buf + 4);
}
else
/* ??? Do we need to do any sign-extension here? */
- memcpy (buf + 4 - len, valbuf, len);
+ memcpy (buf + 4 - TYPE_LENGTH (type), valbuf, TYPE_LENGTH (type));
regcache_cooked_write (regcache, MICROBLAZE_RETVAL_REGNUM, buf);
}
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 8419a5a..619a947 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -316,11 +316,10 @@ spu_value_from_register (struct type *type, int regnum,
struct frame_info *frame)
{
struct value *value = default_value_from_register (type, regnum, frame);
- int len = TYPE_LENGTH (type);
- if (regnum < SPU_NUM_GPRS && len < 16)
+ if (regnum < SPU_NUM_GPRS && TYPE_LENGTH (type) < 16)
{
- int preferred_slot = len < 4 ? 4 - len : 0;
+ int preferred_slot = TYPE_LENGTH (type) < 4 ? 4 - TYPE_LENGTH (type) : 0;
set_value_offset (value, preferred_slot);
}
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 550b56b..e3ac15d 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -208,7 +208,6 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- int len = TYPE_LENGTH (type);
gdb_byte buf[8];
if (TYPE_CODE (type) == TYPE_CODE_STRUCT
@@ -224,7 +223,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
ULONGEST addr;
regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr);
- read_memory (addr, readbuf, len);
+ read_memory (addr, readbuf, TYPE_LENGTH (type));
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@@ -234,16 +233,16 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
{
/* Read the contents of R0 and (if necessary) R1. */
regcache_cooked_read (regcache, VAX_R0_REGNUM, buf);
- if (len > 4)
+ if (TYPE_LENGTH (type) > 4)
regcache_cooked_read (regcache, VAX_R1_REGNUM, buf + 4);
- memcpy (readbuf, buf, len);
+ memcpy (readbuf, buf, TYPE_LENGTH (type));
}
if (writebuf)
{
/* Read the contents to R0 and (if necessary) R1. */
- memcpy (buf, writebuf, len);
+ memcpy (buf, writebuf, TYPE_LENGTH (type));
regcache_cooked_write (regcache, VAX_R0_REGNUM, buf);
- if (len > 4)
+ if (TYPE_LENGTH (type) > 4)
regcache_cooked_write (regcache, VAX_R1_REGNUM, buf + 4);
}