* 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.
+2012-08-16 Yao Qi <yao@codesourcery.com>
+
+ * 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.
+
2012-08-16 Yao Qi <yao@codesourcery.com>
* tracepoint.c (trace_find_none_command): Remove.
case TYPE_CODE_FLT:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_REF:
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
+2012-08-16 Yao Qi <yao@codesourcery.com>
+
+ * gdb.texinfo (Types In Python): Mention gdb.TYPE_CODE_BITSTRING
+ is deprecated.
+
2012-08-13 Doug Evans <dje@google.com>
* gdb.texinfo (Convenience Vars): Update text for "show convenience"
@findex TYPE_CODE_BITSTRING
@findex gdb.TYPE_CODE_BITSTRING
@item gdb.TYPE_CODE_BITSTRING
-A string of bits.
+A string of bits. It is deprecated.
@findex TYPE_CODE_ERROR
@findex gdb.TYPE_CODE_ERROR
arg1 = value_subscript (arg1, value_as_long (arg2));
break;
- case TYPE_CODE_BITSTRING:
- type = language_bool_type (exp->language_defn, exp->gdbarch);
- arg1 = value_bitstring_subscript (type, arg1,
- value_as_long (arg2));
- break;
-
default:
if (TYPE_NAME (type))
error (_("cannot subscript something of type `%s'"),
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_REF:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
case TYPE_CODE_UNION:
case TYPE_CODE_SET:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
return 0;
default:
return 1;
case TYPE_CODE_STRING:
printf_filtered ("(TYPE_CODE_STRING)");
break;
- case TYPE_CODE_BITSTRING:
- printf_filtered ("(TYPE_CODE_BITSTRING)");
- break;
case TYPE_CODE_ERROR:
printf_filtered ("(TYPE_CODE_ERROR)");
break;
enum type_code
{
- TYPE_CODE_UNDEF, /* Not used; catches errors */
+ TYPE_CODE_BITSTRING = -1, /* Deprecated */
+ TYPE_CODE_UNDEF = 0, /* Not used; catches errors */
TYPE_CODE_PTR, /* Pointer type */
/* Array type with lower & upper bounds.
a new type code. */
TYPE_CODE_STRING,
- /* String of bits; like TYPE_CODE_SET but prints differently (at
- least for (the deleted) CHILL). */
- TYPE_CODE_BITSTRING,
-
/* Unknown type. The length field is valid if we were able to
deduce that much about the type, or 0 if we don't even know that. */
TYPE_CODE_ERROR,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_ERROR:
case TYPE_CODE_MEMBERPTR:
case TYPE_CODE_METHODPTR:
options, NULL, 0);
break;
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_SET:
elttype = TYPE_INDEX_TYPE (type);
CHECK_TYPEDEF (elttype);
struct type *range = elttype;
LONGEST low_bound, high_bound;
int i;
- int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
int need_comma = 0;
- if (is_bitstring)
- fputs_filtered ("B'", stream);
- else
- fputs_filtered ("{", stream);
+ fputs_filtered ("{", stream);
i = get_discrete_bounds (range, &low_bound, &high_bound);
maybe_bad_bstring:
i = element;
goto maybe_bad_bstring;
}
- if (is_bitstring)
- fprintf_filtered (stream, "%d", element);
- else if (element)
+ if (element)
{
if (need_comma)
fputs_filtered (", ", stream);
}
}
done:
- if (is_bitstring)
- fputs_filtered ("'", stream);
- else
- fputs_filtered ("}", stream);
+ fputs_filtered ("}", stream);
}
break;
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types need no prefix. They are listed here so that
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types do not need a suffix. They are listed so that
show - 1, level);
break;
- case TYPE_CODE_BITSTRING:
- fputs_filtered ("BitString", stream);
- break;
-
case TYPE_CODE_STRING:
fputs_filtered ("String", stream);
break;
}
break;
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_SET:
elttype = TYPE_INDEX_TYPE (type);
CHECK_TYPEDEF (elttype);
struct type *range = elttype;
LONGEST low_bound, high_bound;
int i;
- int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
int need_comma = 0;
- if (is_bitstring)
- fputs_filtered ("B'", stream);
- else
- fputs_filtered ("[", stream);
+ fputs_filtered ("[", stream);
i = get_discrete_bounds (range, &low_bound, &high_bound);
if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0)
i = element;
goto maybe_bad_bstring;
}
- if (is_bitstring)
- fprintf_filtered (stream, "%d", element);
- else if (element)
+ if (element)
{
if (need_comma)
fputs_filtered (", ", stream);
}
}
done:
- if (is_bitstring)
- fputs_filtered ("'", stream);
- else
- fputs_filtered ("]", stream);
+ fputs_filtered ("]", stream);
}
break;
static struct pyty_code pyty_codes[] =
{
+ ENTRY (TYPE_CODE_BITSTRING),
ENTRY (TYPE_CODE_PTR),
ENTRY (TYPE_CODE_ARRAY),
ENTRY (TYPE_CODE_STRUCT),
ENTRY (TYPE_CODE_SET),
ENTRY (TYPE_CODE_RANGE),
ENTRY (TYPE_CODE_STRING),
- ENTRY (TYPE_CODE_BITSTRING),
ENTRY (TYPE_CODE_ERROR),
ENTRY (TYPE_CODE_METHOD),
ENTRY (TYPE_CODE_METHODPTR),
make_vector_type (type);
break;
- case 'S': /* Set or bitstring type */
+ case 'S': /* Set type */
type1 = read_type (pp, objfile);
type = create_set_type ((struct type *) NULL, type1);
- if (is_string)
- TYPE_CODE (type) = TYPE_CODE_BITSTRING;
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
break;
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.
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;
-}
-
\f
/* 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
}
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
{
}
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
{
array_type = check_typedef (value_type (array));
if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
- && TYPE_CODE (array_type) != TYPE_CODE_STRING
- && TYPE_CODE (array_type) != TYPE_CODE_BITSTRING)
+ && TYPE_CODE (array_type) != TYPE_CODE_STRING)
error (_("cannot take slice of non-array"));
range_type = TYPE_INDEX_TYPE (array_type);
TYPE_TARGET_TYPE (range_type),
lowbound,
lowbound + length - 1);
- if (TYPE_CODE (array_type) == TYPE_CODE_BITSTRING)
- {
- int i;
-
- slice_type = create_set_type ((struct type *) NULL,
- slice_range_type);
- TYPE_CODE (slice_type) = TYPE_CODE_BITSTRING;
- slice = value_zero (slice_type, not_lval);
- for (i = 0; i < length; i++)
- {
- int element = value_bit_index (array_type,
- value_contents (array),
- lowbound + i);
-
- if (element < 0)
- error (_("internal error accessing bitstring"));
- else if (element > 0)
- {
- int j = i % TARGET_CHAR_BIT;
-
- if (gdbarch_bits_big_endian (get_type_arch (array_type)))
- j = TARGET_CHAR_BIT - 1 - j;
- value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j);
- }
- }
- /* We should set the address, bitssize, and bitspos, so the
- slice can be used on the LHS, but that may require extensions
- to value_assign. For now, just leave as a non_lval.
- FIXME. */
- }
- else
{
struct type *element_type = TYPE_TARGET_TYPE (array_type);
LONGEST offset =
case TYPE_CODE_UNION:
case TYPE_CODE_SET:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
return 0;
default:
return 1;