From: Yao Qi Date: Thu, 16 Aug 2012 07:36:28 +0000 (+0000) Subject: gdb/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b1755ce16be3fbe1630507651c73df2710da80f;p=binutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 17b76515586..fd04d7ada55 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,33 @@ +2012-08-16 Yao Qi + + * 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 * tracepoint.c (trace_find_none_command): Remove. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 568ace59396..063c1db0787 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3285,7 +3285,6 @@ arm_type_align (struct type *t) 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: diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index a5892b50b8b..29b27e9a880 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -322,7 +322,6 @@ c_type_print_varspec_prefix (struct type *type, 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: @@ -679,7 +678,6 @@ c_type_print_varspec_suffix (struct type *type, 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: diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 661d933c7b5..cedc5f52d9a 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2012-08-16 Yao Qi + + * gdb.texinfo (Types In Python): Mention gdb.TYPE_CODE_BITSTRING + is deprecated. + 2012-08-13 Doug Evans * gdb.texinfo (Convenience Vars): Update text for "show convenience" diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 5cb8c8edf24..7dee642c3fa 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -23552,7 +23552,7 @@ language-defined string types; C strings are not represented this way. @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 diff --git a/gdb/eval.c b/gdb/eval.c index c0d935454c9..9fe7e388968 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -2323,12 +2323,6 @@ evaluate_subexp_standard (struct type *expect_type, 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'"), diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index a95ef8449c3..c59e639e277 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -131,7 +131,6 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream, 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: @@ -230,7 +229,6 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, 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: diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 3903edee59a..119a6588e38 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2034,7 +2034,6 @@ is_scalar_type (struct type *type) case TYPE_CODE_UNION: case TYPE_CODE_SET: case TYPE_CODE_STRING: - case TYPE_CODE_BITSTRING: return 0; default: return 1; @@ -3075,9 +3074,6 @@ recursive_dump_type (struct type *type, int spaces) 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; diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 17bfbc55b31..afe01039c38 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -58,7 +58,8 @@ typedef struct 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. @@ -109,10 +110,6 @@ enum type_code 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, diff --git a/gdb/infcall.c b/gdb/infcall.c index 1b2c3d6eb4c..1b927484671 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -213,7 +213,6 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, 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: diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index e92679faa14..3d3127ee621 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -409,7 +409,6 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, options, NULL, 0); break; - case TYPE_CODE_BITSTRING: case TYPE_CODE_SET: elttype = TYPE_INDEX_TYPE (type); CHECK_TYPEDEF (elttype); @@ -424,13 +423,9 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, 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: @@ -450,9 +445,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, 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); @@ -476,10 +469,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, } } done: - if (is_bitstring) - fputs_filtered ("'", stream); - else - fputs_filtered ("}", stream); + fputs_filtered ("}", stream); } break; diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index a00f5b32d9f..fceb97a07ee 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -289,7 +289,6 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream, 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 @@ -408,7 +407,6 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream, 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 @@ -792,10 +790,6 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, show - 1, level); break; - case TYPE_CODE_BITSTRING: - fputs_filtered ("BitString", stream); - break; - case TYPE_CODE_STRING: fputs_filtered ("String", stream); break; diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 9f4461723d9..b2287f2177d 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -334,7 +334,6 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, } break; - case TYPE_CODE_BITSTRING: case TYPE_CODE_SET: elttype = TYPE_INDEX_TYPE (type); CHECK_TYPEDEF (elttype); @@ -349,13 +348,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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) @@ -383,9 +378,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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); @@ -409,10 +402,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, } } done: - if (is_bitstring) - fputs_filtered ("'", stream); - else - fputs_filtered ("]", stream); + fputs_filtered ("]", stream); } break; diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 3d8ab293738..f20f97400ce 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -85,6 +85,7 @@ static PyObject *typy_make_iter (PyObject *self, enum gdbpy_iter_kind kind); static struct pyty_code pyty_codes[] = { + ENTRY (TYPE_CODE_BITSTRING), ENTRY (TYPE_CODE_PTR), ENTRY (TYPE_CODE_ARRAY), ENTRY (TYPE_CODE_STRUCT), @@ -98,7 +99,6 @@ static struct pyty_code pyty_codes[] = 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), diff --git a/gdb/stabsread.c b/gdb/stabsread.c index eb09c9d5997..1c288eedb05 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2024,11 +2024,9 @@ again: 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; diff --git a/gdb/valarith.c b/gdb/valarith.c index 96d54116a7d..6858d2b6c64 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 { diff --git a/gdb/valops.c b/gdb/valops.c index 8167cd49553..17696eef999 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3744,8 +3744,7 @@ value_slice (struct value *array, int lowbound, int length) 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); @@ -3762,38 +3761,7 @@ value_slice (struct value *array, int lowbound, int length) 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 = diff --git a/gdb/valprint.c b/gdb/valprint.c index fc5942da778..6e651f6ce84 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -252,7 +252,6 @@ scalar_type_p (struct type *type) case TYPE_CODE_UNION: case TYPE_CODE_SET: case TYPE_CODE_STRING: - case TYPE_CODE_BITSTRING: return 0; default: return 1;