From patchwork Thu Aug 22 13:30:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 96309 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 624423871035 for ; Thu, 22 Aug 2024 13:30:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 1B001386074B for ; Thu, 22 Aug 2024 13:29:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1B001386074B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1B001386074B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333379; cv=none; b=eF6JwCHPZt6KMCjCEmpZxHTvJMXfC0qrhIlSwpbfvrPd/EH2Cf74muspzAqke9xevWuGOKxmHUbATO3Qe1eafH7k1Ob6DWOJBcv7rb9PvI76DmnIY2StoBFSAnPMKp51gksW5PTlkddtPD+ihxosOAoI/T6ULgNLwFRegAZb9SQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333379; c=relaxed/simple; bh=bWhDpZsXs8EUsMlWTd1RBUBnUYkM+Ew8wp09hEnJYBw=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=G0B3N8z7Hr9MUVNGg477bKuKsdIx9rlki5CRqoGJwq+683BgDvx2MmJ4Y0lTo4vqv48+hWQy7kywDrQHUGOwdy6ibIiI9W+MyygteIC+AZQMwq0HmAnQS97Yd7L0iEvKdRHc2ZGL6PA2ZQFmWaPAPX9IlaNhbMwoa99PV2P4jkY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 18122201CD for ; Thu, 22 Aug 2024 13:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gdj55xOfxjChGJm3XUYfU1EbhG+yFwm2G/UyT6ywfc8=; b=deDUFbZ5+9lu3Qb6Uefqr6+YRHrluJeo8ATSw+BsyGG9Cc9q/YS0qgoAljAmMnLvARSfoe YK8iymy0eTLQkVDrt4qJnGECAU8qn5XdaWgmVc2VhZq3IV4vkOCpu9ceSbOo+Fag1CNQt7 279PfoZ1KlW+cUInI0ftVROmosMEDXE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gdj55xOfxjChGJm3XUYfU1EbhG+yFwm2G/UyT6ywfc8=; b=86T21Pkmed7hKivrU1VUjeEO8M6HWSNctDxnQX7ix4SFuDlEsRbqrsMNbKZW0ok25Lnnkg 56svDsTlfaoOfvBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=deDUFbZ5; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=86T21Pkm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gdj55xOfxjChGJm3XUYfU1EbhG+yFwm2G/UyT6ywfc8=; b=deDUFbZ5+9lu3Qb6Uefqr6+YRHrluJeo8ATSw+BsyGG9Cc9q/YS0qgoAljAmMnLvARSfoe YK8iymy0eTLQkVDrt4qJnGECAU8qn5XdaWgmVc2VhZq3IV4vkOCpu9ceSbOo+Fag1CNQt7 279PfoZ1KlW+cUInI0ftVROmosMEDXE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gdj55xOfxjChGJm3XUYfU1EbhG+yFwm2G/UyT6ywfc8=; b=86T21Pkmed7hKivrU1VUjeEO8M6HWSNctDxnQX7ix4SFuDlEsRbqrsMNbKZW0ok25Lnnkg 56svDsTlfaoOfvBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 023CF13297 for ; Thu, 22 Aug 2024 13:29:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ka7wOj89x2b/TQAAD6G6ig (envelope-from ) for ; Thu, 22 Aug 2024 13:29:35 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 1/4] [gdb/symtab] Use [in module %s] notation more consistently in dwarf errors Date: Thu, 22 Aug 2024 15:30:26 +0200 Message-Id: <20240822133029.11921-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Rspamd-Queue-Id: 18122201CD X-Spam-Score: -5.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-5.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:dkim]; RCVD_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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~patchwork=sourceware.org@sourceware.org In gdb/dwarf2/read.c, I found a few strings "in module %s": ... $ grep "in module %s" gdb/dwarf2/read.c | fgrep -v '[' "DIE at %s in module %s"), error (_("Dwarf Error: Dummy CU at %s referenced in module %s"), error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"), error (_("Dwarf Error: DIE at %s referenced in module %s " error (_("Dwarf Error: Dummy CU at %s referenced in module %s"), error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"), ... that are not using the commonly used "[in module %s]" notation. Fix these. In one case, the string was also used in the middle rather than at the end of the message, so fix that as well. Tested on x86_64-linux. --- gdb/dwarf2/read.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) base-commit: 573d8bb08bfff4638405add40a6a61868af1f2a4 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 04a53980569..be79a3b0ba7 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -17697,7 +17697,7 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c str = attr->as_string (); if (str == nullptr) complaint (_("string type expected for attribute %s for " - "DIE at %s in module %s"), + "DIE at %s [in module %s]"), dwarf_attr_name (name), sect_offset_str (die->sect_off), objfile_name (cu->per_objfile->objfile)); } @@ -20390,13 +20390,13 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, { /* We shouldn't get here for a dummy CU, but don't crash on the user. Instead just throw an error, not much else we can do. */ - error (_("Dwarf Error: Dummy CU at %s referenced in module %s"), + error (_("Dwarf Error: Dummy CU at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); } die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"), + error (_("Dwarf Error: Cannot find DIE at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); attr = dwarf2_attr (die, DW_AT_location, cu); @@ -20455,8 +20455,8 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, else { if (!attr->form_is_block ()) - error (_("Dwarf Error: DIE at %s referenced in module %s " - "is neither DW_FORM_block* nor DW_FORM_exprloc"), + error (_("Dwarf Error: DIE at %s is neither DW_FORM_block* nor" + " DW_FORM_exprloc [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); struct dwarf_block *block = attr->as_block (); @@ -20529,13 +20529,13 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off, { /* We shouldn't get here for a dummy CU, but don't crash on the user. Instead just throw an error, not much else we can do. */ - error (_("Dwarf Error: Dummy CU at %s referenced in module %s"), + error (_("Dwarf Error: Dummy CU at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); } die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"), + error (_("Dwarf Error: Cannot find DIE at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); attr = dwarf2_attr (die, DW_AT_const_value, cu); From patchwork Thu Aug 22 13:30:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 96310 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 633283875409 for ; Thu, 22 Aug 2024 13:30:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 81AF03860778 for ; Thu, 22 Aug 2024 13:29:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81AF03860778 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 81AF03860778 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333379; cv=none; b=blmP++mfS/eLAwihOlxR2gA9K/qqN3qQNzmtVOHTmzNanIZWLXYnrV9Vudp5pjFornxE3d+JHZ6F/8rrOHnQ/20fVwM1wljzMwlpbZqnqpGxT1XGGUGBuT2M95OuIvp+AvA9NkqIs9XxJQj1+L2iaQCwqgCt8QJiRxAMseukECo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333379; c=relaxed/simple; bh=MHn7ds3X5xPBEvOULffUsMydfga/JMBWY+LEuLjjwlQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=HqmMOzZ6yrBIfSDMvd/kk+eaKv0hcrOFdAFPFoftDdLB5Y8kRhWO4V6B5vmKIZq6EsSUzZ+W2QY6/rwcilEBUKbiBC5Sa5KAfL5BSMcU0zDwkH7GKZ+XE8/bOePsZ9Yv9xv34Cu0/xHjoAtcDt0dfDUgC4TQi8bEk6uW76szQ3k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3B3AD201D0 for ; Thu, 22 Aug 2024 13:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A4OUG5K+BKvdbp1LRoGmtOhglahqwtrfo7n5F5icvP4=; b=EXV4rzT8u3H4oH6Kh+K/H0tM4ewijyjoeElUUN7BQFrPalEwx80ZHOFz9kincesYXGR+i6 TQ8XA4IfeaLT9YIQP1PSm1L5Q8C4VdFinAtzEFpEa4u9aPGKZE97FFWPckrcBpLpNmK2eG qO9uz2zhV4tkXGPae9txr5i9olwAyow= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A4OUG5K+BKvdbp1LRoGmtOhglahqwtrfo7n5F5icvP4=; b=morYeOKf23vX89vL4q4vu9bO6FWAooIlAUnKfCcZ+QyHetTb0GxZ+WA9dpOoV4ACIH8n9+ 2+n/oSgiL7imfhCg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EXV4rzT8; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=morYeOKf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A4OUG5K+BKvdbp1LRoGmtOhglahqwtrfo7n5F5icvP4=; b=EXV4rzT8u3H4oH6Kh+K/H0tM4ewijyjoeElUUN7BQFrPalEwx80ZHOFz9kincesYXGR+i6 TQ8XA4IfeaLT9YIQP1PSm1L5Q8C4VdFinAtzEFpEa4u9aPGKZE97FFWPckrcBpLpNmK2eG qO9uz2zhV4tkXGPae9txr5i9olwAyow= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A4OUG5K+BKvdbp1LRoGmtOhglahqwtrfo7n5F5icvP4=; b=morYeOKf23vX89vL4q4vu9bO6FWAooIlAUnKfCcZ+QyHetTb0GxZ+WA9dpOoV4ACIH8n9+ 2+n/oSgiL7imfhCg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1C75A13ABC for ; Thu, 22 Aug 2024 13:29:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qKS8BUA9x2b/TQAAD6G6ig (envelope-from ) for ; Thu, 22 Aug 2024 13:29:36 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 2/4] [gdb/symtab] Add gdb/dwarf2/error.h Date: Thu, 22 Aug 2024 15:30:27 +0200 Message-Id: <20240822133029.11921-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240822133029.11921-1-tdevries@suse.de> References: <20240822133029.11921-1-tdevries@suse.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3B3AD201D0 X-Spam-Level: X-Spamd-Result: default: False [-4.09 / 50.00]; BAYES_HAM(-2.08)[95.53%]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,gnu.org:url,suse.de:dkim,suse.de:mid]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -4.09 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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~patchwork=sourceware.org@sourceware.org Add a new header file gdb/dwarf2/error.h, containing macros: - DWARF_ERROR, and - DWARF_ERROR_PREFIX. The DWARF_ERROR_PREFIX is to be used in dwarf errors in a follow-up patch. No functional changes. Tested on x86_64-linux. --- gdb/dwarf2/error.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gdb/dwarf2/error.h diff --git a/gdb/dwarf2/error.h b/gdb/dwarf2/error.h new file mode 100644 index 00000000000..33146240aba --- /dev/null +++ b/gdb/dwarf2/error.h @@ -0,0 +1,29 @@ +/* DWARF error handling utilities. + + Copyright (C) 2024 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_DWARF2_ERROR_H +#define GDB_DWARF2_ERROR_H + +/* Canonical capitalization of "dwarf error". */ +#define DWARF_ERROR "Dwarf Error" + +/* Prefix to be used in dwarf errors. */ +#define DWARF_ERROR_PREFIX DWARF_ERROR ": " + +#endif /* GDB_DWARF2_ERROR_H */ From patchwork Thu Aug 22 13:30:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 96312 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52AAE3871037 for ; Thu, 22 Aug 2024 13:30:48 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 3D4C63860755 for ; Thu, 22 Aug 2024 13:29:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D4C63860755 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3D4C63860755 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333381; cv=none; b=BXITehXajI7e8dP/IOd2BdYIr4By7rUFfgMR+f0OiASMMKtMGySxIdOdZWYVt+cf2ZRGnyW+jSoLSabNAR66ZmMVDgX3/99PPS0V0a4yvOvJLRgDzolMns8lDTxGoqn3c7fH4HbhaUukuohBQU0l0GXNPGFHix46UQD9qXs1CUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333381; c=relaxed/simple; bh=zk2MlIPDQtiJkJ4AFddBrzDujf8ufzVBP05wG/3pF80=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=KEjkLOXcWRBlA7sMg9Ai4ZlG8gZPOETXR8dpvY6+dLHQqhOYWfbRE7ZJo+ym6HxdjNao7eAbqfsbohVtAjVbGgOYYwlWBdh1wqJNlrLhrq7Urf91AoshAnet+MMM9H86nsU9omWvLp8vHPPzfIPUZ7y2UzLUIoONMpkAnM/eMf0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 508C422098 for ; Thu, 22 Aug 2024 13:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7aNztPRFGaJwdAmDn6C10yZqkyTi8TITJicHCGgX6wA=; b=1Upi6hKe3XhWZ1n9iR5QkjqbPF+4UFbhu5Kxo2YYaEpu4Hv9bIqgNxHEPrxRbuOPUaEb4K 6wiHOTGTsRLf/qPmZw+O+Ir5lu+AuxW8G09JhyD+gNWF+zP3PcIhk9HC0ymQbOIIHpFGLV kLYwte4UZu50pEPac+x1JeVBYcmLDJk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7aNztPRFGaJwdAmDn6C10yZqkyTi8TITJicHCGgX6wA=; b=LSCu88QN3vOYLY8xQpT3yiBHRuYnGOmWOI/nKq4DOyrjCpXt1GThdUKJSSR4cFidwfaNA9 Ufx/1a6XjxwpwhAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7aNztPRFGaJwdAmDn6C10yZqkyTi8TITJicHCGgX6wA=; b=1Upi6hKe3XhWZ1n9iR5QkjqbPF+4UFbhu5Kxo2YYaEpu4Hv9bIqgNxHEPrxRbuOPUaEb4K 6wiHOTGTsRLf/qPmZw+O+Ir5lu+AuxW8G09JhyD+gNWF+zP3PcIhk9HC0ymQbOIIHpFGLV kLYwte4UZu50pEPac+x1JeVBYcmLDJk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7aNztPRFGaJwdAmDn6C10yZqkyTi8TITJicHCGgX6wA=; b=LSCu88QN3vOYLY8xQpT3yiBHRuYnGOmWOI/nKq4DOyrjCpXt1GThdUKJSSR4cFidwfaNA9 Ufx/1a6XjxwpwhAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 362DB13AE0 for ; Thu, 22 Aug 2024 13:29:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id WBcMDEA9x2b/TQAAD6G6ig (envelope-from ) for ; Thu, 22 Aug 2024 13:29:36 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 3/4] [gdb/symtab] Use DWARF_ERROR_PREFIX Date: Thu, 22 Aug 2024 15:30:28 +0200 Message-Id: <20240822133029.11921-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240822133029.11921-1-tdevries@suse.de> References: <20240822133029.11921-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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~patchwork=sourceware.org@sourceware.org Result of: ... $ sed -i 's/"Dwarf Error: /DWARF_ERROR_PREFIX\n"/' gdb/dwarf2/* ... and manually fixing indentation. No functional changes. Tested on x86_64-linux. --- gdb/dwarf2/comp-unit-head.c | 37 ++++--- gdb/dwarf2/read.c | 205 +++++++++++++++++++++--------------- gdb/dwarf2/section.c | 16 +-- 3 files changed, 155 insertions(+), 103 deletions(-) diff --git a/gdb/dwarf2/comp-unit-head.c b/gdb/dwarf2/comp-unit-head.c index a26a6c0cd58..14139718ed2 100644 --- a/gdb/dwarf2/comp-unit-head.c +++ b/gdb/dwarf2/comp-unit-head.c @@ -29,6 +29,7 @@ #include "dwarf2/read.h" #include "dwarf2/section.h" #include "dwarf2/stringify.h" +#include "dwarf2/error.h" /* See comp-unit-head.h. */ @@ -49,8 +50,9 @@ read_comp_unit_head (struct comp_unit_head *cu_header, info_ptr += bytes_read; unsigned version = read_2_bytes (abfd, info_ptr); if (version < 2 || version > 5) - error (_("Dwarf Error: wrong version in compilation unit header " - "(is %d, should be 2, 3, 4 or 5) [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "wrong version in compilation unit header " + "(is %d, should be 2, 3, 4 or 5) [in module %s]"), version, filename); cu_header->version = version; info_ptr += 2; @@ -78,8 +80,9 @@ read_comp_unit_head (struct comp_unit_head *cu_header, case DW_UT_skeleton: case DW_UT_split_compile: if (section_kind != rcuh_kind::COMPILE) - error (_("Dwarf Error: wrong unit_type in compilation unit header " - "(is %s, should be %s) [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "wrong unit_type in compilation unit header " + "(is %s, should be %s) [in module %s]"), dwarf_unit_type_name (cu_header->unit_type), dwarf_unit_type_name (DW_UT_type), filename); break; @@ -88,10 +91,11 @@ read_comp_unit_head (struct comp_unit_head *cu_header, section_kind = rcuh_kind::TYPE; break; default: - error (_("Dwarf Error: wrong unit_type in compilation unit header " - "(is %#04x, should be one of: %s, %s, %s, %s or %s) " - "[in module %s]"), cu_header->unit_type, - dwarf_unit_type_name (DW_UT_compile), + error (_(DWARF_ERROR_PREFIX + "wrong unit_type in compilation unit header " + "(is %#04x, should be one of: %s, %s, %s, %s or %s) " + "[in module %s]"), + cu_header->unit_type, dwarf_unit_type_name (DW_UT_compile), dwarf_unit_type_name (DW_UT_skeleton), dwarf_unit_type_name (DW_UT_split_compile), dwarf_unit_type_name (DW_UT_type), @@ -131,9 +135,10 @@ read_comp_unit_head (struct comp_unit_head *cu_header, info_ptr += bytes_read; cu_header->type_cu_offset_in_tu = (cu_offset) type_offset; if (to_underlying (cu_header->type_cu_offset_in_tu) != type_offset) - error (_("Dwarf Error: Too big type_offset in compilation unit " - "header (is %s) [in module %s]"), plongest (type_offset), - filename); + error (_(DWARF_ERROR_PREFIX + "Too big type_offset in compilation unit " + "header (is %s) [in module %s]"), + plongest (type_offset), filename); } return info_ptr; @@ -153,8 +158,9 @@ error_check_comp_unit_head (dwarf2_per_objfile *per_objfile, if (to_underlying (header->abbrev_sect_off) >= abbrev_section->get_size (per_objfile->objfile)) - error (_("Dwarf Error: bad offset (%s) in compilation unit header " - "(offset %s + 6) [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad offset (%s) in compilation unit header " + "(offset %s + 6) [in module %s]"), sect_offset_str (header->abbrev_sect_off), sect_offset_str (header->sect_off), filename); @@ -163,8 +169,9 @@ error_check_comp_unit_head (dwarf2_per_objfile *per_objfile, avoid potential 32-bit overflow. */ if (((ULONGEST) header->sect_off + header->get_length_with_initial ()) > section->size) - error (_("Dwarf Error: bad length (0x%x) in compilation unit header " - "(offset %s + 0) [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad length (0x%x) in compilation unit header " + "(offset %s + 0) [in module %s]"), header->get_length_without_initial (), sect_offset_str (header->sect_off), filename); } diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index be79a3b0ba7..46ea1f17168 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -96,6 +96,7 @@ #include "gdbsupport/thread-pool.h" #include "run-on-main-thread.h" #include "dwarf2/parent-map.h" +#include "dwarf2/error.h" /* When == 1, print basic high level tracing messages. When > 1, be more verbose. @@ -3811,8 +3812,9 @@ read_cutu_die_from_dwo (dwarf2_cu *cu, /* This is not an assert because it can be caused by bad debug info. */ if (sig_type->signature != cu->header.signature) { - error (_("Dwarf Error: signature mismatch %s vs %s while reading" - " TU at offset %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "signature mismatch %s vs %s while reading TU at offset %s" + " [in module %s]"), hex_string (sig_type->signature), hex_string (cu->header.signature), sect_offset_str (dwo_unit->sect_off), @@ -3909,7 +3911,8 @@ lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name) std::optional signature = lookup_dwo_id (cu, comp_unit_die); if (!signature.has_value ()) - error (_("Dwarf Error: missing dwo_id for dwo_name %s" + error (_(DWARF_ERROR_PREFIX + "missing dwo_id for dwo_name %s" " [in module %s]"), dwo_name, bfd_get_filename (per_cu->per_bfd->obfd)); @@ -5082,7 +5085,8 @@ create_all_units (dwarf2_per_objfile *per_objfile) per_objfile->per_bfd->all_units.clear (); /* See enhancement PR symtab/30838. */ - error (_("Dwarf Error: .debug_types section not supported in dwz file")); + error (_(DWARF_ERROR_PREFIX + ".debug_types section not supported in dwz file")); } } @@ -5124,8 +5128,9 @@ peek_die_abbrev (const die_reader_specs &reader, = reader.abbrev_table->lookup_abbrev (abbrev_number); if (!abbrev) { - error (_("Dwarf Error: Could not find abbrev number %d in %s" - " at offset %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Could not find abbrev number %d in %s at offset %s" + " [in module %s]"), abbrev_number, cu->per_cu->is_debug_types ? "TU" : "CU", sect_offset_str (cu->header.sect_off), bfd_get_filename (abfd)); } @@ -5309,8 +5314,8 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr, goto skip_attribute; default: - error (_("Dwarf Error: Cannot handle %s " - "in DWARF reader [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Cannot handle %s in DWARF reader [in module %s]"), dwarf_form_name (form), bfd_get_filename (abfd)); } @@ -6165,7 +6170,8 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language) case DW_TAG_type_unit: break; default: - error (_("Dwarf Error: unexpected tag '%s' at offset %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "unexpected tag '%s' at offset %s [in module %s]"), dwarf_tag_name (cu->dies->tag), sect_offset_str (cu->per_cu->sect_off), objfile_name (per_objfile->objfile)); @@ -6329,8 +6335,9 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) /* For now we don't handle imported units in type units. */ if (cu->per_cu->is_debug_types) { - error (_("Dwarf Error: DW_TAG_imported_unit is not" - " supported in type units [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "DW_TAG_imported_unit is not supported in type units" + " [in module %s]"), objfile_name (cu->per_objfile->objfile)); } @@ -7786,8 +7793,9 @@ create_dwo_cu_reader (const struct die_reader_specs *reader, std::optional signature = lookup_dwo_id (cu, comp_unit_die); if (!signature.has_value ()) { - complaint (_("Dwarf Error: debug entry at offset %s is missing" - " its dwo_id [in module %s]"), + complaint (_(DWARF_ERROR_PREFIX + "debug entry at offset %s is missing its dwo_id" + " [in module %s]"), sect_offset_str (sect_off), dwo_file->dwo_name.c_str ()); return; } @@ -8064,14 +8072,15 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, if (version != 1 && version != 2 && version != 5) { - error (_("Dwarf Error: unsupported DWP file version (%s)" - " [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "unsupported DWP file version (%s) [in module %s]"), pulongest (version), dwp_file->name); } if (nr_slots != (nr_slots & -nr_slots)) { - error (_("Dwarf Error: number of slots in DWP hash table (%s)" - " is not power of 2 [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "number of slots in DWP hash table (%s) is not power of 2" + " [in module %s]"), pulongest (nr_slots), dwp_file->name); } @@ -8118,14 +8127,16 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, if (nr_columns < 2) { - error (_("Dwarf Error: bad DWP hash table, too few columns" - " in section table [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, too few columns in section table" + " [in module %s]"), dwp_file->name); } if (nr_columns > MAX_NR_V2_DWO_SECTIONS) { - error (_("Dwarf Error: bad DWP hash table, too many columns" - " in section table [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, too many columns in section table" + " [in module %s]"), dwp_file->name); } memset (ids, 255, sizeof_ids); @@ -8136,13 +8147,15 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, if (id < DW_SECT_MIN || id > DW_SECT_MAX) { - error (_("Dwarf Error: bad DWP hash table, bad section id %d" - " in section table [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, bad section id %d in section table" + " [in module %s]"), id, dwp_file->name); } if (ids_seen[id] != -1) { - error (_("Dwarf Error: bad DWP hash table, duplicate section" + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, duplicate section" " id %d in section table [in module %s]"), id, dwp_file->name); } @@ -8154,15 +8167,17 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, + (ids_seen[DW_SECT_TYPES] != -1)) != 1) { - error (_("Dwarf Error: bad DWP hash table, missing/duplicate" + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, missing/duplicate" " DWO info/types section [in module %s]"), dwp_file->name); } /* Must have an abbrev section. */ if (ids_seen[DW_SECT_ABBREV] == -1) { - error (_("Dwarf Error: bad DWP hash table, missing DWO abbrev" - " section [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, missing DWO abbrev section" + " [in module %s]"), dwp_file->name); } htab->section_pool.v2.offsets = ids_ptr + sizeof (uint32_t) * nr_columns; @@ -8173,8 +8188,8 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, * nr_units * nr_columns)) > index_end) { - error (_("Dwarf Error: DWP index section is corrupt (too small)" - " [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "DWP index section is corrupt (too small) [in module %s]"), dwp_file->name); } } @@ -8188,14 +8203,16 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, if (nr_columns < 2) { - error (_("Dwarf Error: bad DWP hash table, too few columns" - " in section table [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, too few columns in section table" + " [in module %s]"), dwp_file->name); } if (nr_columns > MAX_NR_V5_DWO_SECTIONS) { - error (_("Dwarf Error: bad DWP hash table, too many columns" - " in section table [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, too many columns in section table" + " [in module %s]"), dwp_file->name); } memset (ids, 255, sizeof_ids); @@ -8206,13 +8223,15 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, if (id < DW_SECT_MIN || id > DW_SECT_MAX_V5) { - error (_("Dwarf Error: bad DWP hash table, bad section id %d" - " in section table [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, bad section id %d in section table" + " [in module %s]"), id, dwp_file->name); } if (ids_seen[id] != -1) { - error (_("Dwarf Error: bad DWP hash table, duplicate section" + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, duplicate section" " id %d in section table [in module %s]"), id, dwp_file->name); } @@ -8222,15 +8241,17 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, /* Must have seen an info section. */ if (ids_seen[DW_SECT_INFO_V5] == -1) { - error (_("Dwarf Error: bad DWP hash table, missing/duplicate" + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, missing/duplicate" " DWO info/types section [in module %s]"), dwp_file->name); } /* Must have an abbrev section. */ if (ids_seen[DW_SECT_ABBREV_V5] == -1) { - error (_("Dwarf Error: bad DWP hash table, missing DWO abbrev" - " section [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, missing DWO abbrev section" + " [in module %s]"), dwp_file->name); } htab->section_pool.v5.offsets = ids_ptr + sizeof (uint32_t) * nr_columns; @@ -8241,8 +8262,8 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile, * nr_units * nr_columns)) > index_end) { - error (_("Dwarf Error: DWP index section is corrupt (too small)" - " [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "DWP index section is corrupt (too small) [in module %s]"), dwp_file->name); } } @@ -8385,7 +8406,8 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile, break; if (section_nr >= dwp_file->num_sections) { - error (_("Dwarf Error: bad DWP hash table, section number too large" + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, section number too large" " [in module %s]"), dwp_file->name); } @@ -8393,8 +8415,8 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile, sectp = dwp_file->elf_sections[section_nr]; if (! locate_v1_virtual_dwo_sections (sectp, §ions)) { - error (_("Dwarf Error: bad DWP hash table, invalid section found" - " [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, invalid section found [in module %s]"), dwp_file->name); } } @@ -8403,14 +8425,14 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile, || sections.info_or_types.empty () || sections.abbrev.empty ()) { - error (_("Dwarf Error: bad DWP hash table, missing DWO sections" - " [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, missing DWO sections [in module %s]"), dwp_file->name); } if (i == MAX_NR_V1_DWO_SECTIONS) { - error (_("Dwarf Error: bad DWP hash table, too many DWO sections" - " [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, too many DWO sections [in module %s]"), dwp_file->name); } @@ -8508,8 +8530,9 @@ create_dwp_v2_or_v5_section (dwarf2_per_objfile *per_objfile, if (sectp == NULL || offset + size > bfd_section_size (sectp)) { - error (_("Dwarf Error: Bad DWP V2 or V5 section info, doesn't fit" - " in section %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Bad DWP V2 or V5 section info, doesn't fit in section %s" + " [in module %s]"), sectp ? bfd_section_name (sectp) : "", objfile_name (per_objfile->objfile)); } @@ -8926,8 +8949,8 @@ lookup_dwo_unit_in_dwp (dwarf2_per_objfile *per_objfile, hash = (hash + hash2) & mask; } - error (_("Dwarf Error: bad DWP hash table, lookup didn't terminate" - " [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "bad DWP hash table, lookup didn't terminate [in module %s]"), dwp_file->name); } @@ -9399,8 +9422,9 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile) /* Technically speaking, we should try to limp along, but this is pretty bizarre. We use pulongest here because that's the established portability solution (e.g, we cannot use %u for uint32_t). */ - error (_("Dwarf Error: DWP file CU version %s doesn't match" - " TU version %s [in DWP file %s]"), + error (_(DWARF_ERROR_PREFIX + "DWP file CU version %s doesn't match TU version %s" + " [in DWP file %s]"), pulongest (dwp_file->cus->version), pulongest (dwp_file->tus->version), dwp_name.c_str ()); } @@ -15886,7 +15910,8 @@ read_full_die_1 (const struct die_reader_specs *reader, abbrev = reader->abbrev_table->lookup_abbrev (abbrev_number); if (!abbrev) - error (_("Dwarf Error: could not find abbrev number %d [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "could not find abbrev number %d [in module %s]"), abbrev_number, bfd_get_filename (abfd)); @@ -17249,7 +17274,8 @@ read_attribute_value (const struct die_reader_specs *reader, } break; default: - error (_("Dwarf Error: Cannot handle %s in DWARF reader [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Cannot handle %s in DWARF reader [in module %s]"), dwarf_form_name (form), bfd_get_filename (abfd)); } @@ -19522,8 +19548,10 @@ die_containing_type (struct die_info *die, struct dwarf2_cu *cu) type_attr = dwarf2_attr (die, DW_AT_containing_type, cu); if (!type_attr) - error (_("Dwarf Error: Problem turning containing type into gdb type " - "[in module %s]"), objfile_name (objfile)); + error (_(DWARF_ERROR_PREFIX + "Problem turning containing type into gdb type " + "[in module %s]"), + objfile_name (objfile)); return lookup_die_type (die, type_attr, cu); } @@ -19590,8 +19618,8 @@ lookup_die_type (struct die_info *die, const struct attribute *attr, } else { - complaint (_("Dwarf Error: Bad type attribute %s in DIE" - " at %s [in module %s]"), + complaint (_(DWARF_ERROR_PREFIX + "Bad type attribute %s in DIE at %s [in module %s]"), dwarf_attr_name (attr->name), sect_offset_str (die->sect_off), objfile_name (objfile)); return build_error_marker_type (cu, die); @@ -20258,7 +20286,8 @@ follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr, else { src_die->error_dump (); - error (_("Dwarf Error: Expected reference attribute [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Expected reference attribute [in module %s]"), objfile_name ((*ref_cu)->per_objfile->objfile)); } @@ -20360,8 +20389,8 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr, || cu->per_cu->is_dwz), ref_cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at %s referenced from DIE " - "at %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Cannot find DIE at %s referenced from DIE at %s [in module %s]"), sect_offset_str (sect_off), sect_offset_str (src_die->sect_off), objfile_name (cu->per_objfile->objfile)); @@ -20390,13 +20419,15 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, { /* We shouldn't get here for a dummy CU, but don't crash on the user. Instead just throw an error, not much else we can do. */ - error (_("Dwarf Error: Dummy CU at %s referenced [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Dummy CU at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); } die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at %s referenced [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Cannot find DIE at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); attr = dwarf2_attr (die, DW_AT_location, cu); @@ -20455,8 +20486,9 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, else { if (!attr->form_is_block ()) - error (_("Dwarf Error: DIE at %s is neither DW_FORM_block* nor" - " DW_FORM_exprloc [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "DIE at %s is neither DW_FORM_block* nor DW_FORM_exprloc" + " [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); struct dwarf_block *block = attr->as_block (); @@ -20529,13 +20561,15 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off, { /* We shouldn't get here for a dummy CU, but don't crash on the user. Instead just throw an error, not much else we can do. */ - error (_("Dwarf Error: Dummy CU at %s referenced [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Dummy CU at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); } die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); if (!die) - error (_("Dwarf Error: Cannot find DIE at %s referenced [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Cannot find DIE at %s referenced [in module %s]"), sect_offset_str (sect_off), objfile_name (objfile)); attr = dwarf2_attr (die, DW_AT_const_value, cu); @@ -20751,8 +20785,9 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr, the debug info. */ if (sig_type == NULL) { - error (_("Dwarf Error: Cannot find signatured DIE %s referenced" - " from DIE at %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Cannot find signatured DIE %s referenced from DIE at %s" + " [in module %s]"), hex_string (signature), sect_offset_str (src_die->sect_off), objfile_name ((*ref_cu)->per_objfile->objfile)); } @@ -20761,8 +20796,9 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr, if (die == NULL) { src_die->error_dump (); - error (_("Dwarf Error: Problem reading signatured DIE %s referenced" - " from DIE at %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Problem reading signatured DIE %s referenced from DIE at %s" + " [in module %s]"), hex_string (signature), sect_offset_str (src_die->sect_off), objfile_name ((*ref_cu)->per_objfile->objfile)); } @@ -20788,8 +20824,9 @@ get_signatured_type (struct die_info *die, ULONGEST signature, the debug info. */ if (sig_type == NULL) { - complaint (_("Dwarf Error: Cannot find signatured DIE %s referenced" - " from DIE at %s [in module %s]"), + complaint (_(DWARF_ERROR_PREFIX + "Cannot find signatured DIE %s referenced from DIE at %s" + " [in module %s]"), hex_string (signature), sect_offset_str (die->sect_off), objfile_name (per_objfile->objfile)); return build_error_marker_type (cu, die); @@ -20810,7 +20847,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature, type = read_type_die (type_die, type_cu); if (type == NULL) { - complaint (_("Dwarf Error: Cannot build signatured type %s" + complaint (_(DWARF_ERROR_PREFIX + "Cannot build signatured type %s" " referenced from DIE at %s [in module %s]"), hex_string (signature), sect_offset_str (die->sect_off), objfile_name (per_objfile->objfile)); @@ -20819,7 +20857,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature, } else { - complaint (_("Dwarf Error: Problem reading signatured DIE %s referenced" + complaint (_(DWARF_ERROR_PREFIX + "Problem reading signatured DIE %s referenced" " from DIE at %s [in module %s]"), hex_string (signature), sect_offset_str (die->sect_off), objfile_name (per_objfile->objfile)); @@ -20854,8 +20893,9 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr, { dwarf2_per_objfile *per_objfile = cu->per_objfile; - complaint (_("Dwarf Error: DW_AT_signature has bad form %s in DIE" - " at %s [in module %s]"), + complaint (_(DWARF_ERROR_PREFIX + "DW_AT_signature has bad form %s in DIE at %s" + " [in module %s]"), dwarf_form_name (attr->form), sect_offset_str (die->sect_off), objfile_name (per_objfile->objfile)); return build_error_marker_type (cu, die); @@ -21464,8 +21504,8 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, if (this_cu->is_dwz != offset_in_dwz || this_cu->sect_off > sect_off) { if (low == 0 || this_cu->is_dwz != offset_in_dwz) - error (_("Dwarf Error: could not find CU containing " - "offset %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "could not find CU containing offset %s [in module %s]"), sect_offset_str (sect_off), bfd_get_filename (per_bfd->obfd)); @@ -21591,7 +21631,8 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die, cu->per_cu->set_unit_type (DW_UT_type); break; default: - error (_("Dwarf Error: unexpected tag '%s' at offset %s"), + error (_(DWARF_ERROR_PREFIX + "unexpected tag '%s' at offset %s"), dwarf_tag_name (comp_unit_die->tag), sect_offset_str (cu->per_cu->sect_off)); } diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c index 6aab0b9aee9..e0b63fd0e08 100644 --- a/gdb/dwarf2/section.c +++ b/gdb/dwarf2/section.c @@ -28,6 +28,7 @@ #include "gdb_bfd.h" #include "objfiles.h" #include "complaints.h" +#include "dwarf2/error.h" void dwarf2_section_info::overflow_complaint () const @@ -140,8 +141,9 @@ dwarf2_section_info::read (struct objfile *objfile) gdb_assert (sectp != NULL); if ((sectp->flags & SEC_RELOC) != 0) { - error (_("Dwarf Error: DWP format V2 with relocations is not" - " supported in section %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "DWP format V2 with relocations is not supported" + " in section %s [in module %s]"), get_name (), get_file_name ()); } containing_section->read (objfile); @@ -183,8 +185,8 @@ dwarf2_section_info::read (struct objfile *objfile) if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 || bfd_read (buf, size, abfd) != size) { - error (_("Dwarf Error: Can't read DWARF data" - " in section %s [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "Can't read DWARF data in section %s [in module %s]"), bfd_section_name (sectp), bfd_get_filename (abfd)); } } @@ -197,10 +199,12 @@ dwarf2_section_info::read_string (struct objfile *objfile, LONGEST str_offset, if (buffer == NULL) { if (get_bfd_section () == nullptr) - error (_("Dwarf Error: %s used without required section"), + error (_(DWARF_ERROR_PREFIX + "%s used without required section"), form_name); else - error (_("Dwarf Error: %s used without %s section [in module %s]"), + error (_(DWARF_ERROR_PREFIX + "%s used without %s section [in module %s]"), form_name, get_name (), get_file_name ()); } if (str_offset >= size) From patchwork Thu Aug 22 13:30:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 96311 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 29A0F3871032 for ; Thu, 22 Aug 2024 13:30:48 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id ADB4C3870C25 for ; Thu, 22 Aug 2024 13:29:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADB4C3870C25 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ADB4C3870C25 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333379; cv=none; b=Ki95gZYjLumhgxECQEJSMuAlQxmb5sFn/OXe+dCwbdxjV4c8is/e5fsZurY3PR218x/w/DQ79k9zK/Fz+pdU58BGvh8izoJTtL7Brv7efIb18W3O+gBD+4lVKKUwTq+fYMfJFM/0Ksxr3VzrFcZYcjn3974kJvtnyqkDg9yYyHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724333379; c=relaxed/simple; bh=NcTNZeKfG5kMMW+/lfFRYWxzyTg+gKnl7s265AnH02Q=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=nY1xVayhpyGVWWL9tPl1Ey0gjZJfS7mnmqag6gkpFr2Jg4Uwi4cy01EvD1dsYiHoMRMxzrJJa2ps7mA+e4QiHlpVleStqsbbUKwRk+qyjYUq6B9kHJUA1k4/hqzPwIWzRFA+973rNdGS1tX2X4nYlrjpX5iOkvG7KOkThpDjLso= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6A052201D2 for ; Thu, 22 Aug 2024 13:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNz8VltzCWQgpQMxw5od61wfDWy/63Dy11megbt61Ok=; b=LQGo+u2T+N84tiiMKLNRdWDtuYx16HL/SzOGzctMi+je9MDM6XGzyo8xnRVToVksEK5YE9 FpqZvZ5ZAfaMM0lvDDkSZkOYLFm4+1BUMe9aKzJN6kYDVjN3jSeHujLUaFs5rusc81soVH Nbx9M4C3ZUs9DX7IxTqUyn4n39XrOaU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNz8VltzCWQgpQMxw5od61wfDWy/63Dy11megbt61Ok=; b=hFuTw42zTbPVtH3Zcq0VE6QMpVpx6CjKSMoTTPtv8MN1eN6SHmYNgwf8lJmYa2AxLLdMdE ewGAFughNBoFBMBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNz8VltzCWQgpQMxw5od61wfDWy/63Dy11megbt61Ok=; b=LQGo+u2T+N84tiiMKLNRdWDtuYx16HL/SzOGzctMi+je9MDM6XGzyo8xnRVToVksEK5YE9 FpqZvZ5ZAfaMM0lvDDkSZkOYLFm4+1BUMe9aKzJN6kYDVjN3jSeHujLUaFs5rusc81soVH Nbx9M4C3ZUs9DX7IxTqUyn4n39XrOaU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724333376; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNz8VltzCWQgpQMxw5od61wfDWy/63Dy11megbt61Ok=; b=hFuTw42zTbPVtH3Zcq0VE6QMpVpx6CjKSMoTTPtv8MN1eN6SHmYNgwf8lJmYa2AxLLdMdE ewGAFughNBoFBMBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 55E3D13297 for ; Thu, 22 Aug 2024 13:29:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kIbBE0A9x2b/TQAAD6G6ig (envelope-from ) for ; Thu, 22 Aug 2024 13:29:36 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 4/4] [gdb/symtab] Change DWARF_ERROR from Dwarf Error to DWARF Error Date: Thu, 22 Aug 2024 15:30:29 +0200 Message-Id: <20240822133029.11921-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240822133029.11921-1-tdevries@suse.de> References: <20240822133029.11921-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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~patchwork=sourceware.org@sourceware.org It was suggested here [1] that the canonical prefix for dwarf errors should not be "Dwarf Error: ", given that the canonical spelling is DWARF instead of Dwarf. Fix this by using "DWARF Error: " instead. Given the use of DWARF_ERROR_PREFIX, that needs to be changed only in a single location. Tested on x86_64-linux. Suggested-By: Tom Tromey [1] https://sourceware.org/pipermail/gdb-patches/2024-August/211258.html --- gdb/dwarf2/error.h | 2 +- gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp | 2 +- gdb/testsuite/gdb.dwarf2/dw2-error.exp | 2 +- gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp | 4 ++-- gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 2 +- gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/dwarf2/error.h b/gdb/dwarf2/error.h index 33146240aba..f8861f21e9a 100644 --- a/gdb/dwarf2/error.h +++ b/gdb/dwarf2/error.h @@ -21,7 +21,7 @@ #define GDB_DWARF2_ERROR_H /* Canonical capitalization of "dwarf error". */ -#define DWARF_ERROR "Dwarf Error" +#define DWARF_ERROR "DWARF Error" /* Prefix to be used in dwarf errors. */ #define DWARF_ERROR_PREFIX DWARF_ERROR ": " diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp index 547ab819f53..d6b8d2e6f52 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp @@ -28,7 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != " clean_restart $executable # The first access (as we do not use -readnow) prints some: -# Dwarf Error: Cannot find DIE at 0x0 referenced from DIE at 0x29 [in module ...] +# DWARF Error: Cannot find DIE at 0x0 referenced from DIE at 0x29 [in module ...] with_test_prefix "first" { gdb_test "ptype f" } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp index 8081e7fc7cd..526b39416a9 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp @@ -37,7 +37,7 @@ set host_binfile [gdb_remote_download host $binfile] # First test that reading symbols fails. gdb_test "file $host_binfile" \ - {Reading symbols.*Dwarf Error: wrong version in compilation unit header \(is 153, should be 2, 3, 4 or 5\).*} \ + {Reading symbols.*DWARF Error: wrong version in compilation unit header \(is 153, should be 2, 3, 4 or 5\).*} \ "file $testfile" # We can't use proc readnow, because the PR makes it return 0. diff --git a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp index 3eadeb27d9c..f84142ab353 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp @@ -56,7 +56,7 @@ gdb_test_no_output "maint set dwarf synchronous on" set pattern1 \ [multi_line \ "Reading symbols from \[^\r\n\]+" \ - "Dwarf Error: unexpected tag 'DW_TAG_subprogram' at offset $hex"] + "DWARF Error: unexpected tag 'DW_TAG_subprogram' at offset $hex"] # This pattern is hit when GDB does use -readnow (e.g. running with # --target_board=readnow). @@ -64,7 +64,7 @@ set pattern2 \ [multi_line \ "Reading symbols from \[^\r\n\]+" \ "Expanding full symbols from \[^\r\n\]+" \ - "Dwarf Error: unexpected tag 'DW_TAG_subprogram' at offset $hex"] + "DWARF Error: unexpected tag 'DW_TAG_subprogram' at offset $hex"] # Load the executable, we expect an error from the DWARF parser. gdb_test_multiple "file $host_binfile" "file $testfile" { diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp index cd3dd0b26b8..c84a5300745 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp @@ -131,7 +131,7 @@ clean_restart gdb_test_no_output "maint set dwarf synchronous on" set line1 "Reading symbols from \[^\r\n\]+" -set dwarf_error "Dwarf Error: DW_FORM_strp used without required section" +set dwarf_error "DWARF Error: DW_FORM_strp used without required section" # This pattern is hit when GDB does not use -readnow (i.e. the default # behaviour). diff --git a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp index 111de438bda..00af7251f9d 100644 --- a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp +++ b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp @@ -128,5 +128,5 @@ save_vars { GDBFLAGS } { } } -set re "Dwarf Error: .debug_types section not supported in dwz file" +set re "DWARF Error: .debug_types section not supported in dwz file" gdb_assert { [regexp $re $gdb_file_cmd_msg] } "Dwarf Error message"