From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WfDxBtxTYWneajcAWB0awg (envelope-from ) for ; Fri, 09 Jan 2026 14:15:40 -0500 Received: by simark.ca (Postfix, from userid 112) id 1830A1E0B6; Fri, 09 Jan 2026 14:15:40 -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.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 A71391E08D for ; Fri, 09 Jan 2026 14:15:39 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 3D13A4BA2E20 for ; Fri, 9 Jan 2026 19:15:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D13A4BA2E20 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0883A4BA2E06 for ; Fri, 9 Jan 2026 19:14:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0883A4BA2E06 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0883A4BA2E06 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1767986083; cv=none; b=MAM8ZSqbDEzrFL1TBbJbbtvnRQcPMzsMyt3mPnht4dQ5ugyObdLs8zhttm6Ik5lny+ICoJVqiGpkSsxqrDmVGEwivpl3CEerEspNw5h489XhlqkF/537iyBdVTyjaHH5MGS4ObG8nEozRZZ3hEnGP5qNh3rHEknsGtiaLH+Nb/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1767986083; c=relaxed/simple; bh=Wl9cMkT8CC8rvkIrhDXW2Ql3Qh27yYarq2qQ0ZJ2mng=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=tnrNcC+1UKbiV0RR1c3kZTfbVZnj7NxS4z7R2TMlXNPFD7zWjwgVNl1P/ZroJL2R78o7GqJG0RZHPrTpuvfdEP25i4owrfAa26nLzM8PSrXiAn0HDF/KAvQgjKwZKpSc+xWFG15Yr5NxksyEktFqHpefcTP4dEoffOjaZgQxVNA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0883A4BA2E06 Received: by simark.ca (Postfix) id 535B21E0B6; Fri, 09 Jan 2026 14:14:42 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/3] gdb/coffread: simplify stab section detection Date: Fri, 9 Jan 2026 14:14:37 -0500 Message-ID: <20260109191441.486109-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109191441.486109-1-simon.marchi@efficios.com> References: <20260109191441.486109-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 We look for stab sections for the sole purpose of emitting a warning if we see one. Simplify this by using a boolean to indicate if we saw a stab section or not. Simplify the search to just look for sections starting with ".stab", it should be enough for this purpose. Also, remove the make_scoped_restore that would overwrite the stab section vector, I'm not sure why it's there. It seems to me like it would cause the warning to never be shown. Change-Id: I56323189ffdaa2d06a96d457cdd999b23efa5979 --- gdb/coffread.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/gdb/coffread.c b/gdb/coffread.c index 4fbe0fb9e461..5ab2e43a5aa0 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -47,7 +47,8 @@ struct coff_symfile_info file_ptr min_lineno_offset = 0; /* Where in file lowest line#s are. */ file_ptr max_lineno_offset = 0; /* 1+last byte of line#s in file. */ - std::vector *stabsects; /* .stab sections. */ + /* True if the symfile contains one section that starts with ".stab". */ + bool found_stab_section = false; }; /* Key for COFF-associated data. */ @@ -220,17 +221,7 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip) name = bfd_section_name (sectp); if (startswith (name, ".stab")) - { - const char *s; - - /* We can have multiple .stab sections if linked with - --split-by-reloc. */ - for (s = name + sizeof ".stab" - 1; *s != '\0'; s++) - if (!c_isdigit (*s)) - break; - if (*s == '\0') - csi->stabsects->push_back (sectp); - } + csi->found_stab_section = true; } struct coff_find_targ_sec_arg @@ -594,10 +585,6 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) info = coff_objfile_data_key.get (objfile); symfile_bfd = abfd; /* Kludge for swap routines. */ - std::vector stabsects; - scoped_restore restore_stabsects - = make_scoped_restore (&info->stabsects, &stabsects); - /* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */ num_symbols = bfd_get_symcount (abfd); /* How many syms */ symtab_offset = cdata->sym_filepos; /* Symbol table file offset */ @@ -676,7 +663,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) if (!(objfile->flags & OBJF_READNEVER)) bfd_map_over_sections (abfd, coff_locate_sections, (void *) info); - if (!info->stabsects->empty()) + if (info->found_stab_section) warning (_("stabs debug information is not supported.")); if (dwarf2_initialize_objfile (objfile)) -- 2.52.0