From patchwork Tue May 21 15:44:07 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: 90611 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 D291F3858429 for ; Tue, 21 May 2024 15:43:55 +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 3D7F93858C62 for ; Tue, 21 May 2024 15:43:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D7F93858C62 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 3D7F93858C62 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=1716306187; cv=none; b=hkbbx6yXa0g3eR8Wxw9C+vgCORT0HeMsbNfTrjMJzIlINGrPpSJ5pJfgKJoP9Z7whkGPFQWl8hsF0ObLOZdob6tCruSzJ2NVSNAn6VtA9sIgvRulSdieUgyBj61UC8c6BDAjvQagMYq1yZSk0AC48GtgKsj2wu8bdMMThmmvk+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716306187; c=relaxed/simple; bh=Xv++Po5ChgjEatjh4v1+35gf42NhW8GoL2G4zkg/V5Y=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=iYemFN9m5BGKY4A9GwhBvmZ1ZmoiieMIoI6070psIsD/G5gMz6TjuPt1nslud6VP/dDLA6swhrDwhLDc8J+E0MfawpvxiZC/OBurvOoDrogc05lEAAXyaN8chW7igjsGUHtVPlVluItMToFPnN8ASOHPCuBHjSfEcqCRhGVycQI= 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 468775C291 for ; Tue, 21 May 2024 15:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1716306183; 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=OJBNb6Y9vvdyqt2d/UPpJ7pWtKRsWghy4Fh00KD4TgA=; b=qLE9TE8L+j2ho3gSbkRJR3d8AYMmeQCdP2idMylx5jsZYTbH5/cH5ADT+mmK5LPwNEz5YR 1j/AKwmm7jKp8vYfjqj7BE4IXsNUFmHkDnh/RklUAZszUP9kmxB4/KoiottTynyUbnqkHU EybedjyeKEinopVIwJjW1BJWaq4o0d0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1716306183; 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=OJBNb6Y9vvdyqt2d/UPpJ7pWtKRsWghy4Fh00KD4TgA=; b=2RfCW/IqsFRiIRuq4eHIovKv75glSweuwE1S3K+MQbxNiZY5xsuhjrxpShixmJNXEgLLOn 5P3miucc9vgZxECQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=qLE9TE8L; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="2RfCW/Iq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1716306183; 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=OJBNb6Y9vvdyqt2d/UPpJ7pWtKRsWghy4Fh00KD4TgA=; b=qLE9TE8L+j2ho3gSbkRJR3d8AYMmeQCdP2idMylx5jsZYTbH5/cH5ADT+mmK5LPwNEz5YR 1j/AKwmm7jKp8vYfjqj7BE4IXsNUFmHkDnh/RklUAZszUP9kmxB4/KoiottTynyUbnqkHU EybedjyeKEinopVIwJjW1BJWaq4o0d0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1716306183; 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=OJBNb6Y9vvdyqt2d/UPpJ7pWtKRsWghy4Fh00KD4TgA=; b=2RfCW/IqsFRiIRuq4eHIovKv75glSweuwE1S3K+MQbxNiZY5xsuhjrxpShixmJNXEgLLOn 5P3miucc9vgZxECQ== 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 2E07413A75 for ; Tue, 21 May 2024 15:43:03 +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 yE7pCQfBTGbJGwAAD6G6ig (envelope-from ) for ; Tue, 21 May 2024 15:43:03 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 03/11] [gdb/testsuite] Add test-case gdb.base/fission-macro-i.exp Date: Tue, 21 May 2024 17:44:07 +0200 Message-Id: <20240521154415.9543-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240521154415.9543-1-tdevries@suse.de> References: <20240521154415.9543-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; 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)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 468775C291 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -3.01 X-Spam-Status: No, score=-12.3 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 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 We can exercise test-case gdb.base/fission-macro.exp using gcc release 14. We cannot use the test-case with a gcc release earlier than gcc 14, because it's missing gcc commit 80048aa13a6 ("debug/111409 - don't generate COMDAT macro sections for split DWARF"). A way to work around this is to use a .i file instead of a .c file. Add a test-case using this approach. This allows use to excercise gcc 11-13 in addition. Tested on x86_64-linux. Tested test-case using a current gcc trunk build and gcc 11-14. --- gdb/testsuite/gdb.base/fission-macro-i-2.i | 27 ++++++++ gdb/testsuite/gdb.base/fission-macro-i.exp | 77 ++++++++++++++++++++++ gdb/testsuite/gdb.base/fission-macro-i.i | 27 ++++++++ 3 files changed, 131 insertions(+) create mode 100644 gdb/testsuite/gdb.base/fission-macro-i-2.i create mode 100644 gdb/testsuite/gdb.base/fission-macro-i.exp create mode 100644 gdb/testsuite/gdb.base/fission-macro-i.i diff --git a/gdb/testsuite/gdb.base/fission-macro-i-2.i b/gdb/testsuite/gdb.base/fission-macro-i-2.i new file mode 100644 index 00000000000..fb088c8bfaf --- /dev/null +++ b/gdb/testsuite/gdb.base/fission-macro-i-2.i @@ -0,0 +1,27 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2024 Free Software Foundation, Inc. + + 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 . */ + +#define THIRD 3 +#define FOURTH 4 + +extern int foo (void); + +int +foo (void) +{ + return 0; +} diff --git a/gdb/testsuite/gdb.base/fission-macro-i.exp b/gdb/testsuite/gdb.base/fission-macro-i.exp new file mode 100644 index 00000000000..bf1ca206a6c --- /dev/null +++ b/gdb/testsuite/gdb.base/fission-macro-i.exp @@ -0,0 +1,77 @@ +# Copyright 2024 Free Software Foundation, Inc. + +# 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 . */ + +# Gcc 11 is the first release containing the fix for PR debug/99319. +require {expr [gcc_major_version] >= 11} + +# Use a .i file instead of a .c file, to make sure that we only generate one +# .debug_macros section, working around gcc PR debug/111409. +standard_testfile .i -2.i + +proc do_tests { dwarf_version dwarf_bits strict_dwarf } { + set opts {} + lappend opts debug + lappend opts quiet + lappend opts additional_flags=-gsplit-dwarf + lappend opts macros + + if { $dwarf_bits == 64 } { + lappend opts additional_flags=-gdwarf64 + } + + if { $strict_dwarf } { + lappend opts additional_flags=-gstrict-dwarf + } + + lappend opts additional_flags=-gdwarf-$dwarf_version + + set id v$dwarf_version-b$dwarf_bits-s$strict_dwarf + + set srcfiles [list $::srcfile $::srcfile2] + if { [build_executable "failed to prepare" $::testfile-$id $srcfiles $opts] } { + return -1 + } + + clean_restart + + gdb_load_no_complaints $::binfile-$id + + if {![runto_main]} { + return 0 + } + + gdb_test "p FIRST" " = 1" + gdb_test "p SECOND" " = 2" + + gdb_test "info macro FIRST" "#define FIRST 1" + gdb_test "info macro SECOND" "#define SECOND 2" + + gdb_breakpoint foo + gdb_continue_to_breakpoint "foo" + + gdb_test "p THIRD" " = 3" + gdb_test "p FOURTH" " = 4" + + gdb_test "info macro THIRD" "#define THIRD 3" + gdb_test "info macro FOURTH" "#define FOURTH 4" +} + +foreach_with_prefix dwarf_version {5} { + foreach_with_prefix dwarf_bits {32 64} { + foreach_with_prefix strict_dwarf {0 1} { + do_tests $dwarf_version $dwarf_bits $strict_dwarf + } + } +} diff --git a/gdb/testsuite/gdb.base/fission-macro-i.i b/gdb/testsuite/gdb.base/fission-macro-i.i new file mode 100644 index 00000000000..9c8cbece5c5 --- /dev/null +++ b/gdb/testsuite/gdb.base/fission-macro-i.i @@ -0,0 +1,27 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2024 Free Software Foundation, Inc. + + 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 . */ + +#define FIRST 1 +#define SECOND 2 + +extern int foo (void); + +int +main (void) +{ + return foo (); +}