From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7018 invoked by alias); 10 Aug 2012 09:13:20 -0000 Received: (qmail 6742 invoked by uid 22791); 10 Aug 2012 09:13:16 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Aug 2012 09:13:00 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SzlH9-0007fH-La from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 10 Aug 2012 02:12:59 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 10 Aug 2012 02:12:59 -0700 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Fri, 10 Aug 2012 02:12:57 -0700 From: Yao Qi To: Subject: [PATCH 3/3] remove TYPE_CODE_BITSTRING Date: Fri, 10 Aug 2012 09:13:00 -0000 Message-ID: <1344589936-2006-4-git-send-email-yao@codesourcery.com> In-Reply-To: <1344589936-2006-1-git-send-email-yao@codesourcery.com> References: <1344589936-2006-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00310.txt.bz2 gdb: 2012-08-10 Yao Qi * gdbtypes.h (enum type_code): Remove TYPE_CODE_BITSTRING. * 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. * python/py-type.c (pyty_codes): Remove ENTRY (TYPE_CODE_BITSTRING). * valarith.c (value_bitstring_subscript): Remove. (value_concat): Remove code handling TYPE_CODE_BITSTRING. * valops.c (value_slice): Likewise. * valprint.c (scalar_type_p): Likewise. * stabsread.c (read_type): Don't set TYPE_CODE (type) to TYPE_CODE_BITSTRING. --- gdb/arm-tdep.c | 1 - gdb/c-typeprint.c | 2 - gdb/eval.c | 6 ----- gdb/f-typeprint.c | 2 - gdb/gdbtypes.c | 4 --- gdb/gdbtypes.h | 4 --- gdb/infcall.c | 1 - gdb/m2-valprint.c | 16 ++----------- gdb/p-typeprint.c | 6 ----- gdb/p-valprint.c | 16 ++----------- gdb/python/py-type.c | 1 - gdb/stabsread.c | 4 +-- gdb/valarith.c | 55 +++++-------------------------------------------- gdb/valops.c | 34 +------------------------------ gdb/valprint.c | 1 - 15 files changed, 14 insertions(+), 139 deletions(-) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 568ace5..063c1db 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 a5892b5..29b27e9 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/eval.c b/gdb/eval.c index c0d9354..9fe7e38 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 a95ef84..c59e639 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 0ea4df1..3fa8b30 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2036,7 +2036,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 17bfbc5..253ac42 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -109,10 +109,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 1b2c3d6..1b92748 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 e92679f..3d3127e 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 a00f5b3..fceb97a 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 9f44617..b2287f2 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 98030a6..dc7af9f 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -98,7 +98,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 eb09c9d..1c288ee 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 96d5411..d0f31c4 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -221,46 +221,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 +695,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 +739,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 8167cd4..17696ee 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 fc5942d..6e651f6 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; -- 1.7.7.6