aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2012-08-16 07:36:28 +0000
committerYao Qi <yao@codesourcery.com>2012-08-16 07:36:28 +0000
commit6b1755ce16be3fbe1630507651c73df2710da80f (patch)
tree1b9a902a1ff3598a7e0bf06002c2abbeaffb9790 /gdb/valarith.c
parent8acc40656214b647cd7f078e6d2c7a13321e2be5 (diff)
downloadgdb-6b1755ce16be3fbe1630507651c73df2710da80f.zip
gdb-6b1755ce16be3fbe1630507651c73df2710da80f.tar.gz
gdb-6b1755ce16be3fbe1630507651c73df2710da80f.tar.bz2
gdb/
* gdbtypes.h (enum type_code): Define TYPE_CODE_BITSTRING -1. * arm-tdep.c (arm_type_align): Remove code handling TYPE_CODE_BITSTRING. * c-typeprint.c (c_type_print_varspec_prefix): Likewise. (c_type_print_varspec_suffix): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * f-typeprint.c (f_type_print_varspec_prefix): Likewise. (f_type_print_varspec_suffix): Likewise. * gdbtypes.c (is_scalar_type): Likewise. (recursive_dump_type): Likewise. * infcall.c (value_arg_coerce): Likewise. * m2-valprint.c (m2_val_print): Likewise. * p-typeprint.c (pascal_type_print_varspec_prefix): Likewise. (pascal_type_print_varspec_suffix): Likewise. (pascal_type_print_base): Likewise. * p-valprint.c (pascal_val_print): Likewise. (pascal_val_print): Likewise. * valops.c (value_slice): Likewise. * valprint.c (scalar_type_p): Likewise. * valarith.c (value_bitstring_subscript): Remove. (value_concat): Remove code handling TYPE_CODE_BITSTRING. Remove comment on TYPE_CODE_BITSTRING. * stabsread.c (read_type): Don't set TYPE_CODE (type) to TYPE_CODE_BITSTRING. * python/py-type.c (pyty_codes): Move ENTRY (TYPE_CODE_BITSTRING) to slot 0. gdb/doc: * gdb.texinfo (Types In Python): Mention gdb.TYPE_CODE_BITSTRING is deprecated.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c56
1 files changed, 6 insertions, 50 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 96d5411..6858d2b 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -139,7 +139,6 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
ARRAY may be of type TYPE_CODE_ARRAY or TYPE_CODE_STRING. If the
current language supports C-style arrays, it may also be TYPE_CODE_PTR.
- To access TYPE_CODE_BITSTRING values, use value_bitstring_subscript.
See comments in value_coerce_array() for rationale for reason for
doing lower bounds adjustment here rather than there.
@@ -221,46 +220,6 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
return v;
}
-/* Return the value of BITSTRING[IDX] as (boolean) type TYPE. */
-
-struct value *
-value_bitstring_subscript (struct type *type,
- struct value *bitstring, LONGEST index)
-{
-
- struct type *bitstring_type, *range_type;
- struct value *v;
- int offset, byte, bit_index;
- LONGEST lowerbound, upperbound;
-
- bitstring_type = check_typedef (value_type (bitstring));
- gdb_assert (TYPE_CODE (bitstring_type) == TYPE_CODE_BITSTRING);
-
- range_type = TYPE_INDEX_TYPE (bitstring_type);
- get_discrete_bounds (range_type, &lowerbound, &upperbound);
- if (index < lowerbound || index > upperbound)
- error (_("bitstring index out of range"));
-
- index -= lowerbound;
- offset = index / TARGET_CHAR_BIT;
- byte = *((char *) value_contents (bitstring) + offset);
-
- bit_index = index % TARGET_CHAR_BIT;
- byte >>= (gdbarch_bits_big_endian (get_type_arch (bitstring_type)) ?
- TARGET_CHAR_BIT - 1 - bit_index : bit_index);
-
- v = value_from_longest (type, byte & 1);
-
- set_value_bitpos (v, bit_index);
- set_value_bitsize (v, 1);
- set_value_component_location (v, bitstring);
- VALUE_FRAME_ID (v) = VALUE_FRAME_ID (bitstring);
-
- set_value_offset (v, offset + value_offset (bitstring));
-
- return v;
-}
-
/* Check to see if either argument is a structure, or a reference to
one. This is called so we know whether to go ahead with the normal
@@ -735,10 +694,9 @@ value_concat (struct value *arg1, struct value *arg2)
}
outval = value_string (ptr, count * inval2len, char_type);
}
- else if (TYPE_CODE (type2) == TYPE_CODE_BITSTRING
- || TYPE_CODE (type2) == TYPE_CODE_BOOL)
+ else if (TYPE_CODE (type2) == TYPE_CODE_BOOL)
{
- error (_("unimplemented support for bitstring/boolean repeats"));
+ error (_("unimplemented support for boolean repeats"));
}
else
{
@@ -780,17 +738,15 @@ value_concat (struct value *arg1, struct value *arg2)
}
outval = value_string (ptr, inval1len + inval2len, char_type);
}
- else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
- || TYPE_CODE (type1) == TYPE_CODE_BOOL)
+ else if (TYPE_CODE (type1) == TYPE_CODE_BOOL)
{
/* We have two bitstrings to concatenate. */
- if (TYPE_CODE (type2) != TYPE_CODE_BITSTRING
- && TYPE_CODE (type2) != TYPE_CODE_BOOL)
+ if (TYPE_CODE (type2) != TYPE_CODE_BOOL)
{
- error (_("Bitstrings or booleans can only be concatenated "
+ error (_("Booleans can only be concatenated "
"with other bitstrings or booleans."));
}
- error (_("unimplemented support for bitstring/boolean concatenation."));
+ error (_("unimplemented support for boolean concatenation."));
}
else
{