From patchwork Thu Aug 25 15:07:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 14931 Received: (qmail 36117 invoked by alias); 25 Aug 2016 15:07:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 36079 invoked by uid 89); 25 Aug 2016 15:07:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=flat, 2426, xsb, 2017 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Aug 2016 15:07:10 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7PF4KVU055996 for ; Thu, 25 Aug 2016 11:07:09 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 251b8s2axr-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 25 Aug 2016 11:07:08 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Aug 2016 16:07:07 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Aug 2016 16:07:06 +0100 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: uweigand@de.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8AB8A1B08069 for ; Thu, 25 Aug 2016 16:08:45 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7PF75FH55378058 for ; Thu, 25 Aug 2016 15:07:05 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7PF75so013849 for ; Thu, 25 Aug 2016 09:07:05 -0600 Received: from oc7340732750.ibm.com (icon-9-164-148-136.megacenter.de.ibm.com [9.164.148.136]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u7PF75Qt013830 for ; Thu, 25 Aug 2016 09:07:05 -0600 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 459DEC9FB; Thu, 25 Aug 2016 17:07:04 +0200 (CEST) Subject: [5/9] Remove obsolete TYPE_FLAG_... values To: gdb-patches@sourceware.org Date: Thu, 25 Aug 2016 17:07:04 +0200 (CEST) From: "Ulrich Weigand" MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082515-0040-0000-0000-000002C5C1AC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082515-0041-0000-0000-00001CB4F4DF Message-Id: <20160825150704.459DEC9FB@oc7340732750.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-25_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608250181 Hello, now that init_type no longer takes a FLAGS argument, there is no user of the TYPE_FLAGS_... enum values left. This patch removes them (and all references to them in comments as well). This is mostly a no-op, except for a change to the Python type printer, which attempted to use them before. (As best as I can tell, this wasn't really needed anyway, since it was only used to pretty-print type *instance* flags, which only use the instance flags.) Bye, Ulrich ChangeLog: * gdbtypes.h (enum type_flag_value): Remove. Remove references to TYPE_FLAG_... in comments throughout. * gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_... flags, print the corresponding TYPE_... access macro names. Remove references to TYPE_FLAG_... in comments throughout. * infcall.c: Remove references to TYPE_FLAG_... in comments. * valprint.c: Likewise. * gdb-gdb.py (class TypeFlag): No longer consider TYPE_FLAG_... values, only TYPE_INSTANCE_FLAG_... values. (class TypeFlagsPrinter): Likewise. testsuite/ChangeLog: * gdb.cp/hang.exp: Remove reference to TYPE_FLAG_STUB in comment. Index: binutils-gdb/gdb/gdbtypes.h =================================================================== --- binutils-gdb.orig/gdb/gdbtypes.h 2016-08-25 13:11:49.256836269 +0200 +++ binutils-gdb/gdb/gdbtypes.h 2016-08-25 13:11:50.002839537 +0200 @@ -184,35 +184,8 @@ enum type_code TYPE_CODE_XMETHOD }; -/* * Some constants representing each bit field in the main_type. See - the bit-field-specific macros, below, for documentation of each - constant in this enum. These enum values are only used with - init_type. Note that the values are chosen not to conflict with - type_instance_flag_value; this lets init_type error-check its - input. */ - -enum type_flag_value -{ - TYPE_FLAG_UNSIGNED = (1 << 9), - TYPE_FLAG_NOSIGN = (1 << 10), - TYPE_FLAG_STUB = (1 << 11), - TYPE_FLAG_TARGET_STUB = (1 << 12), - TYPE_FLAG_STATIC = (1 << 13), - TYPE_FLAG_PROTOTYPED = (1 << 14), - TYPE_FLAG_INCOMPLETE = (1 << 15), - TYPE_FLAG_VARARGS = (1 << 16), - TYPE_FLAG_VECTOR = (1 << 17), - TYPE_FLAG_FIXED_INSTANCE = (1 << 18), - TYPE_FLAG_STUB_SUPPORTED = (1 << 19), - TYPE_FLAG_GNU_IFUNC = (1 << 20), - - /* * Used for error-checking. */ - TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED -}; - /* * Some bits for the type's instance_flags word. See the macros - below for documentation on each bit. Note that if you add a value - here, you must update the enum type_flag_value as well. */ + below for documentation on each bit. */ enum type_instance_flag_value { @@ -228,7 +201,7 @@ enum type_instance_flag_value }; /* * Unsigned integer type. If this is not set for a TYPE_CODE_INT, - the type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */ + the type is signed (unless TYPE_NOSIGN (below) is set). */ #define TYPE_UNSIGNED(t) (TYPE_MAIN_TYPE (t)->flag_unsigned) @@ -370,11 +343,11 @@ enum type_instance_flag_value architecture's two (or more) address spaces, but this is an extension of the architecture's model. - If TYPE_FLAG_INST is set, an object of the corresponding type + If TYPE_INSTANCE_FLAG_CODE_SPACE is set, an object of the corresponding type resides in instruction memory, even if its address (in the extended flat address space) does not reflect this. - Similarly, if TYPE_FLAG_DATA is set, then an object of the + Similarly, if TYPE_INSTANCE_FLAG_DATA_SPACE is set, then an object of the corresponding type resides in the data memory space, even if this is not indicated by its (flat address space) address. @@ -390,7 +363,7 @@ enum type_instance_flag_value /* * Address class flags. Some environments provide for pointers whose size is different from that of a normal pointer or address types where the bits are interpreted differently than normal - addresses. The TYPE_FLAG_ADDRESS_CLASS_n flags may be used in + addresses. The TYPE_INSTANCE_FLAG_ADDRESS_CLASS_n flags may be used in target specific ways to represent these different types of address classes. */ @@ -685,7 +658,7 @@ struct main_type This is used for printing only, except by poorly designed C++ code. For looking up a name, look for a symbol in the STRUCT_DOMAIN. - One more legitimate use is that if TYPE_FLAG_STUB is set, this is + One more legitimate use is that if TYPE_STUB is set, this is the name to use to look for definitions in other files. */ const char *tag_name; Index: binutils-gdb/gdb/gdbtypes.c =================================================================== --- binutils-gdb.orig/gdb/gdbtypes.c 2016-08-25 13:11:49.259836281 +0200 +++ binutils-gdb/gdb/gdbtypes.c 2016-08-25 13:11:50.006839555 +0200 @@ -1119,7 +1119,7 @@ create_array_type_with_stride (struct ty if (bit_stride > 0) TYPE_FIELD_BITSIZE (result_type, 0) = bit_stride; - /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays. */ + /* TYPE_TARGET_STUB will take care of zero length arrays. */ if (TYPE_LENGTH (result_type) == 0) TYPE_TARGET_STUB (result_type) = 1; @@ -4325,77 +4325,77 @@ recursive_dump_type (struct type *type, TYPE_INSTANCE_FLAGS (type)); if (TYPE_CONST (type)) { - puts_filtered (" TYPE_FLAG_CONST"); + puts_filtered (" TYPE_CONST"); } if (TYPE_VOLATILE (type)) { - puts_filtered (" TYPE_FLAG_VOLATILE"); + puts_filtered (" TYPE_VOLATILE"); } if (TYPE_CODE_SPACE (type)) { - puts_filtered (" TYPE_FLAG_CODE_SPACE"); + puts_filtered (" TYPE_CODE_SPACE"); } if (TYPE_DATA_SPACE (type)) { - puts_filtered (" TYPE_FLAG_DATA_SPACE"); + puts_filtered (" TYPE_DATA_SPACE"); } if (TYPE_ADDRESS_CLASS_1 (type)) { - puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_1"); + puts_filtered (" TYPE_ADDRESS_CLASS_1"); } if (TYPE_ADDRESS_CLASS_2 (type)) { - puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2"); + puts_filtered (" TYPE_ADDRESS_CLASS_2"); } if (TYPE_RESTRICT (type)) { - puts_filtered (" TYPE_FLAG_RESTRICT"); + puts_filtered (" TYPE_RESTRICT"); } if (TYPE_ATOMIC (type)) { - puts_filtered (" TYPE_FLAG_ATOMIC"); + puts_filtered (" TYPE_ATOMIC"); } puts_filtered ("\n"); printfi_filtered (spaces, "flags"); if (TYPE_UNSIGNED (type)) { - puts_filtered (" TYPE_FLAG_UNSIGNED"); + puts_filtered (" TYPE_UNSIGNED"); } if (TYPE_NOSIGN (type)) { - puts_filtered (" TYPE_FLAG_NOSIGN"); + puts_filtered (" TYPE_NOSIGN"); } if (TYPE_STUB (type)) { - puts_filtered (" TYPE_FLAG_STUB"); + puts_filtered (" TYPE_STUB"); } if (TYPE_TARGET_STUB (type)) { - puts_filtered (" TYPE_FLAG_TARGET_STUB"); + puts_filtered (" TYPE_TARGET_STUB"); } if (TYPE_STATIC (type)) { - puts_filtered (" TYPE_FLAG_STATIC"); + puts_filtered (" TYPE_STATIC"); } if (TYPE_PROTOTYPED (type)) { - puts_filtered (" TYPE_FLAG_PROTOTYPED"); + puts_filtered (" TYPE_PROTOTYPED"); } if (TYPE_INCOMPLETE (type)) { - puts_filtered (" TYPE_FLAG_INCOMPLETE"); + puts_filtered (" TYPE_INCOMPLETE"); } if (TYPE_VARARGS (type)) { - puts_filtered (" TYPE_FLAG_VARARGS"); + puts_filtered (" TYPE_VARARGS"); } /* This is used for things like AltiVec registers on ppc. Gcc emits an attribute for the array type, which tells whether or not we have a vector, instead of a regular array. */ if (TYPE_VECTOR (type)) { - puts_filtered (" TYPE_FLAG_VECTOR"); + puts_filtered (" TYPE_VECTOR"); } if (TYPE_FIXED_INSTANCE (type)) { Index: binutils-gdb/gdb/infcall.c =================================================================== --- binutils-gdb.orig/gdb/infcall.c 2016-08-25 13:11:37.177783377 +0200 +++ binutils-gdb/gdb/infcall.c 2016-08-25 13:11:50.008839565 +0200 @@ -61,10 +61,9 @@ Unfortunately, on certain older platforms, the debug info doesn't indicate reliably how each function was defined. A function type's - TYPE_FLAG_PROTOTYPED flag may be clear, even if the function was - defined in prototype style. When calling a function whose - TYPE_FLAG_PROTOTYPED flag is clear, GDB consults this flag to - decide what to do. + TYPE_PROTOTYPED flag may be clear, even if the function was defined + in prototype style. When calling a function whose TYPE_PROTOTYPED + flag is clear, GDB consults this flag to decide what to do. For modern targets, it is proper to assume that, if the prototype flag is clear, that can be trusted: `float' arguments should be Index: binutils-gdb/gdb/testsuite/gdb.cp/hang.exp =================================================================== --- binutils-gdb.orig/gdb/testsuite/gdb.cp/hang.exp 2016-08-25 13:11:37.177783377 +0200 +++ binutils-gdb/gdb/testsuite/gdb.cp/hang.exp 2016-08-25 13:11:50.010839573 +0200 @@ -58,8 +58,8 @@ if {[prepare_for_testing $testfile.exp $ # # Since `hang2.o''s psymtab lists `hang1.o' as a dependency, GDB first # reads `hang1.o''s symbols. When GDB sees `(1,3)=xsB:', it creates a -# type object for `struct B', sets its TYPE_FLAG_STUB flag, and -# records it as type number `(1,3)'. +# type object for `struct B', sets its TYPE_STUB flag, and records it +# as type number `(1,3)'. # # When GDB finds the definition of `struct C::B', since the stabs # don't indicate that the type is nested within C, it treats it as Index: binutils-gdb/gdb/valprint.c =================================================================== --- binutils-gdb.orig/gdb/valprint.c 2016-08-25 13:11:37.177783377 +0200 +++ binutils-gdb/gdb/valprint.c 2016-08-25 13:11:50.014839589 +0200 @@ -999,10 +999,9 @@ generic_val_print (struct type *type, co break; case TYPE_CODE_UNDEF: - /* This happens (without TYPE_FLAG_STUB set) on systems which - don't use dbx xrefs (NO_DBX_XREFS in gcc) if a file has a - "struct foo *bar" and no complete type for struct foo in that - file. */ + /* This happens (without TYPE_STUB set) on systems which don't use + dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar" + and no complete type for struct foo in that file. */ fprintf_filtered (stream, _("")); break; Index: binutils-gdb/gdb/gdb-gdb.py =================================================================== --- binutils-gdb.orig/gdb/gdb-gdb.py 2016-08-25 13:11:37.177783377 +0200 +++ binutils-gdb/gdb/gdb-gdb.py 2016-08-25 13:11:50.018839608 +0200 @@ -24,29 +24,26 @@ class TypeFlag: In the GDB sources, struct type has a component called instance_flags in which the value is the addition of various flags. These flags are - defined by two enumerates: type_flag_value, and type_instance_flag_value. - This class helps us recreate a list with all these flags that is - easy to manipulate and sort. Because all flag names start with either - TYPE_FLAG_ or TYPE_INSTANCE_FLAG_, a short_name attribute is provided - that strips this prefix. + defined by the enumerates type_instance_flag_value. This class helps us + recreate a list with all these flags that is easy to manipulate and sort. + Because all flag names start with TYPE_INSTANCE_FLAG_, a short_name + attribute is provided that strips this prefix. ATTRIBUTES - name: The enumeration name (eg: "TYPE_FLAG_UNSIGNED"). + name: The enumeration name (eg: "TYPE_INSTANCE_FLAG_CONST"). value: The associated value. short_name: The enumeration name, with the suffix stripped. """ def __init__(self, name, value): self.name = name self.value = value - self.short_name = name.replace("TYPE_FLAG_", '') - if self.short_name == name: - self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '') + self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '') def __cmp__(self, other): """Sort by value order.""" return self.value.__cmp__(other.value) -# A list of all existing TYPE_FLAGS_* and TYPE_INSTANCE_FLAGS_* -# enumerations, stored as TypeFlags objects. Lazy-initialized. +# A list of all existing TYPE_INSTANCE_FLAGS_* enumerations, +# stored as TypeFlags objects. Lazy-initialized. TYPE_FLAGS = None class TypeFlagsPrinter: @@ -86,24 +83,13 @@ class TypeFlagsPrinter: global TYPE_FLAGS TYPE_FLAGS = [] try: - flags = gdb.lookup_type("enum type_flag_value") - except: - print("Warning: Cannot find enum type_flag_value type.") - print(" `struct type' pretty-printer will be degraded") - return - try: iflags = gdb.lookup_type("enum type_instance_flag_value") except: print("Warning: Cannot find enum type_instance_flag_value type.") print(" `struct type' pretty-printer will be degraded") return - # Note: TYPE_FLAG_MIN is a duplicate of TYPE_FLAG_UNSIGNED, - # so exclude it from the list we are building. TYPE_FLAGS = [TypeFlag(field.name, field.enumval) - for field in flags.fields() - if field.name != 'TYPE_FLAG_MIN'] - TYPE_FLAGS += [TypeFlag(field.name, field.enumval) - for field in iflags.fields()] + for field in iflags.fields()] TYPE_FLAGS.sort() class StructTypePrettyPrinter: