From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aUzJCNZMiWm4AzEAWB0awg (envelope-from ) for ; Sun, 08 Feb 2026 21:56:22 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=K39Tj8MQ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E682B1E089; Sun, 08 Feb 2026 21:56:21 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5EF781E089 for ; Sun, 08 Feb 2026 21:56:19 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id C1F7148EEBD1 for ; Mon, 9 Feb 2026 02:56:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1F7148EEBD1 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=K39Tj8MQ Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 10E5C4BA2E09 for ; Mon, 9 Feb 2026 02:55:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10E5C4BA2E09 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 10E5C4BA2E09 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770605749; cv=none; b=jagmUFDXmsRuLQ0bzYBqxe0/jV7lnlwtD4A2VQKETeX1s6yxOohh7fx8FMmL6Ai1R0ADKqLCrdFeHwKCUMETAcJ5XPMF4UkRkFSq+lLE7fw6k6t70rS3nsjlVZnBjaNPw7+CNAvZMhMui6+gxRAqeqsF8sD68xM6kXvzEKlL/tQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770605749; c=relaxed/simple; bh=NIBN2siOIU6d/vK3DW0mqAqU2J9mTmkAwwVmf14x3EY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GDSFtTasTOX7eF3nl7xc5vkCPOVMkYtHmn5WHMBoBLOmwSuFHl9BGLIpUjD7tcHpbCQUwe6B/r2xMawDpqV6VcX1vCa277s6h0mZX98m0EkUutfep+5HFvZAtCVptM5rNt8i6D+79xyDYbGgNio/ZftfnigYuT7ZFFeHbyQiJOg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10E5C4BA2E09 Received: from eig-obgw-5003b.ext.cloudfilter.net ([10.0.29.155]) by cmsmtp with ESMTPS id pEh9vzUnqipkCpHREvHBGQ; Mon, 09 Feb 2026 02:55:48 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id pHRCveOoW2l0kpHRDvqAtM; Mon, 09 Feb 2026 02:55:47 +0000 X-Authority-Analysis: v=2.4 cv=UfRRSLSN c=1 sm=1 tr=0 ts=69894cb3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=HzLeVaNsDn8A:10 a=ItBw4LHWJt0A:10 a=Vdfo4wpqO71JFTepSFAA:9 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yDjGHV4oXashPge/PwHrNLlwGR7jvyJmEm9vPYOS2i0=; b=K39Tj8MQGNh4REg/R4gsrVmHh1 vCSj6wDstWNl1aBcrZzYVDVdyvAEhHxWhrkaGfuVe3sbQ0uFsPglLtnJZs2RJpZhAIYgz39RBcF2q BwhZgDxUufLkGVZekI/AqbVwP; Received: from 97-118-49-200.hlrn.qwest.net ([97.118.49.200]:51028 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vpHRC-00000002yHQ-1wOw; Sun, 08 Feb 2026 19:55:46 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove TYPE_FN_FIELD_STUB Date: Sun, 8 Feb 2026 19:55:35 -0700 Message-ID: <20260209025535.3597458-1-tom@tromey.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.49.200 X-Source-L: No X-Exim-ID: 1vpHRC-00000002yHQ-1wOw X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-49-200.hlrn.qwest.net (localhost.localdomain) [97.118.49.200]:51028 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfD32oDGub1pm/Kwc1a1BgtizHjivhlLarSOrS5mC983IpGt1UeAjjezAXBH9y5sQ6aAn6jRHYqcluWGMleSF7wdOPJYxbosa2DJ0qupPKUrxd+lE31QX OkfbHxFhnXxMa8OL9g789LHyfB+Dtj28VewVCHkeFe0d97WmFkob75cL1AyE/tlQA54eNUf9h1ciwmu7/3szPeieikwGIT8vzhE= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Nothing sets TYPE_FN_FIELD_STUB any more -- I suspect it was a stabs thing, but didn't look. This patch removes this macro and supporting code. Regression tested on x86-64 Fedora 40. --- gdb/c-typeprint.c | 36 +++------- gdb/gdbtypes.c | 167 ---------------------------------------------- gdb/gdbtypes.h | 20 +----- gdb/gnu-v3-abi.c | 1 - gdb/linespec.c | 2 - gdb/valops.c | 6 -- 6 files changed, 14 insertions(+), 218 deletions(-) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 683517a2176..cfacf48fe2d 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1105,7 +1105,6 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, for (j = 0; j < len2; j++) { - const char *mangled_name; gdb::unique_xmalloc_ptr mangled_name_holder; const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); int is_full_physname_constructor = @@ -1151,14 +1150,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, gdb_puts (" ", stream); } - if (TYPE_FN_FIELD_STUB (f, j)) - { - /* Build something we can demangle. */ - mangled_name_holder.reset (gdb_mangle_name (type, i, j)); - mangled_name = mangled_name_holder.get (); - } - else - mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j); + + const char *mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j); gdb::unique_xmalloc_ptr demangled_name = gdb_demangle (mangled_name, @@ -1170,22 +1163,15 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, arguments, the demangling will fail. Let's try to reconstruct the function signature from the symbol information. */ - if (!TYPE_FN_FIELD_STUB (f, j)) - { - int staticp = TYPE_FN_FIELD_STATIC_P (f, j); - struct type *mtype = TYPE_FN_FIELD_TYPE (f, j); - - cp_type_print_method_args (mtype, - "", - method_name, - staticp, - stream, language, - &local_flags); - } - else - fprintf_styled (stream, metadata_style.style (), - _(""), - mangled_name); + int staticp = TYPE_FN_FIELD_STATIC_P (f, j); + struct type *mtype = TYPE_FN_FIELD_TYPE (f, j); + + cp_type_print_method_args (mtype, + "", + method_name, + staticp, + stream, language, + &local_flags); } else { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 848c5f6153a..f0729bece59 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3145,171 +3145,6 @@ check_typedef (struct type *type) return type; } -/* Parse a type expression in the string [P..P+LENGTH). If an error - occurs, silently return a void type. */ - -static struct type * -safe_parse_type (struct gdbarch *gdbarch, const char *p, int length) -{ - struct type *type = NULL; /* Initialize to keep gcc happy. */ - - /* Suppress error messages. */ - scoped_restore saved_gdb_stderr = make_scoped_restore (&gdb_stderr, - &null_stream); - - /* Call parse_and_eval_type() without fear of longjmp()s. */ - try - { - type = parse_and_eval_type (p, length); - } - catch (const gdb_exception_error &except) - { - type = builtin_type (gdbarch)->builtin_void; - } - - return type; -} - -/* Ugly hack to convert method stubs into method types. - - He ain't kiddin'. This demangles the name of the method into a - string including argument types, parses out each argument type, - generates a string casting a zero to that type, evaluates the - string, and stuffs the resulting type into an argtype vector!!! - Then it knows the type of the whole function (including argument - types for overloading), which info used to be in the stab's but was - removed to hack back the space required for them. */ - -static void -check_stub_method (struct type *type, int method_id, int signature_id) -{ - struct gdbarch *gdbarch = type->arch (); - struct fn_field *f; - char *mangled_name = gdb_mangle_name (type, method_id, signature_id); - gdb::unique_xmalloc_ptr demangled_name - = gdb_demangle (mangled_name, DMGL_PARAMS | DMGL_ANSI); - char *argtypetext, *p; - int depth = 0, argcount = 1; - struct field *argtypes; - struct type *mtype; - - /* Make sure we got back a function string that we can use. */ - if (demangled_name) - p = strchr (demangled_name.get (), '('); - else - p = NULL; - - if (demangled_name == NULL || p == NULL) - error (_("Internal: Cannot demangle mangled name `%s'."), - mangled_name); - - /* Now, read in the parameters that define this type. */ - p += 1; - argtypetext = p; - while (*p) - { - if (*p == '(' || *p == '<') - { - depth += 1; - } - else if (*p == ')' || *p == '>') - { - depth -= 1; - } - else if (*p == ',' && depth == 0) - { - argcount += 1; - } - - p += 1; - } - - /* If we read one argument and it was ``void'', don't count it. */ - if (startswith (argtypetext, "(void)")) - argcount -= 1; - - /* We need one extra slot, for the THIS pointer. */ - - argtypes = (struct field *) - TYPE_ZALLOC (type, (argcount + 1) * sizeof (struct field)); - p = argtypetext; - - /* Add THIS pointer for non-static methods. */ - f = TYPE_FN_FIELDLIST1 (type, method_id); - if (TYPE_FN_FIELD_STATIC_P (f, signature_id)) - argcount = 0; - else - { - argtypes[0].set_type (lookup_pointer_type (type)); - argcount = 1; - } - - if (*p != ')') /* () means no args, skip while. */ - { - depth = 0; - while (*p) - { - if (depth <= 0 && (*p == ',' || *p == ')')) - { - /* Avoid parsing of ellipsis, they will be handled below. - Also avoid ``void'' as above. */ - if (strncmp (argtypetext, "...", p - argtypetext) != 0 - && strncmp (argtypetext, "void", p - argtypetext) != 0) - { - argtypes[argcount].set_type - (safe_parse_type (gdbarch, argtypetext, p - argtypetext)); - argcount += 1; - } - argtypetext = p + 1; - } - - if (*p == '(' || *p == '<') - { - depth += 1; - } - else if (*p == ')' || *p == '>') - { - depth -= 1; - } - - p += 1; - } - } - - TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name; - - /* Now update the old "stub" type into a real type. */ - mtype = TYPE_FN_FIELD_TYPE (f, signature_id); - /* MTYPE may currently be a function (TYPE_CODE_FUNC). - We want a method (TYPE_CODE_METHOD). */ - smash_to_method_type (mtype, type, mtype->target_type (), - gdb::make_array_view (argtypes, argcount), - p[-2] == '.'); - mtype->set_is_stub (false); - TYPE_FN_FIELD_STUB (f, signature_id) = 0; -} - -/* This is the external interface to check_stub_method, above. This - function unstubs all of the signatures for TYPE's METHOD_ID method - name. After calling this function TYPE_FN_FIELD_STUB will be - cleared for each signature and TYPE_FN_FIELDLIST_NAME will be - correct. - - This function unfortunately can not die until stabs do. */ - -void -check_stub_method_group (struct type *type, int method_id) -{ - int len = TYPE_FN_FIELDLIST_LENGTH (type, method_id); - struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id); - - for (int j = 0; j < len; j++) - { - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (type, method_id, j); - } -} - /* Ensure it is in .rodata (if available) by working around GCC PR 44690. */ const struct cplus_struct_type cplus_struct_default = { }; @@ -4992,8 +4827,6 @@ dump_fn_fieldlists (struct type *type, int spaces) TYPE_FN_FIELD_PRIVATE (f, overload_idx)); gdb_printf ("%*sis_protected %d\n", spaces + 8, "", TYPE_FN_FIELD_PROTECTED (f, overload_idx)); - gdb_printf ("%*sis_stub %d\n", spaces + 8, "", - TYPE_FN_FIELD_STUB (f, overload_idx)); gdb_printf ("%*sdefaulted %d\n", spaces + 8, "", TYPE_FN_FIELD_DEFAULTED (f, overload_idx)); gdb_printf ("%*sis_deleted %d\n", spaces + 8, "", diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 8ba314eb663..2d1f9937b4e 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1624,15 +1624,9 @@ struct fn_fieldlist struct fn_field { - /* * If is_stub is clear, this is the mangled name which we can look - up to find the address of the method (FIXME: it would be cleaner - to have a pointer to the struct symbol here instead). - - If is_stub is set, this is the portion of the mangled name which - specifies the arguments. For example, "ii", if there are two int - arguments, or "" if there are no arguments. See gdb_mangle_name - for the conversion from this format to the one used if is_stub is - clear. */ + /* * This is the mangled name which we can look up to find the + address of the method (FIXME: it would be cleaner to have a + pointer to the struct symbol here instead). */ const char *physname; @@ -1655,11 +1649,6 @@ struct fn_field unsigned int is_volatile:1; unsigned int is_artificial:1; - /* * A stub method only has some fields valid (but they are enough - to reconstruct the rest of the fields). */ - - unsigned int is_stub:1; - /* * True if this function is a constructor, false otherwise. */ unsigned int is_constructor : 1; @@ -2005,7 +1994,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define TYPE_FN_FIELD_PROTECTED(thisfn, n) \ ((thisfn)[n].accessibility == accessibility::PROTECTED) #define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial) -#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub) #define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n) ((thisfn)[n].is_constructor) #define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext) #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2) @@ -2693,8 +2681,6 @@ extern void apply_bit_offset_to_field (struct field &field, extern struct type *check_typedef (struct type *); -extern void check_stub_method_group (struct type *, int); - extern char *gdb_mangle_name (struct type *, int, int); /* Lookup a typedef or primitive type named NAME, visible in lexical block diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 3d519eaa971..1ea9d29c0b9 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -544,7 +544,6 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset, f = TYPE_FN_FIELDLIST1 (domain, i); len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i); - check_stub_method_group (domain, i); for (j = 0; j < len2; j++) if (TYPE_FN_FIELD_VOFFSET (f, j) == voffset) return TYPE_FN_FIELD_PHYSNAME (f, j); diff --git a/gdb/linespec.c b/gdb/linespec.c index edd5f917f3a..4376a769e49 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1252,8 +1252,6 @@ find_methods (struct type *t, enum language t_lang, const char *name, const char *phys_name; f = TYPE_FN_FIELDLIST1 (t, method_counter); - if (TYPE_FN_FIELD_STUB (f, field_counter)) - continue; phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter); result_names->push_back (phys_name); } diff --git a/gdb/valops.c b/gdb/valops.c index 568f8f84a9e..c89e5c4adc8 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2209,7 +2209,6 @@ search_struct_method (const char *name, struct value **arg1p, struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); name_matched = 1; - check_stub_method_group (type, i); if (j > 0 && !args.has_value ()) error (_("cannot resolve overloaded method " "`%s': no arguments supplied"), name); @@ -2510,9 +2509,6 @@ find_method_list (struct value **argp, const char *method, *basetype = type; *boffset = offset; - /* Resolve any stub methods. */ - check_stub_method_group (type, i); - break; } } @@ -3649,8 +3645,6 @@ value_struct_elt_for_reference (struct type *domain, int offset, int len = TYPE_FN_FIELDLIST_LENGTH (t, i); struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i); - check_stub_method_group (t, i); - if (intype) { for (j = 0; j < len; ++j) -- 2.49.0