From patchwork Tue May 21 15:44:05 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: 90609 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 4C866384AB77 for ; Tue, 21 May 2024 15:43:38 +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 27F163858D3C for ; Tue, 21 May 2024 15:43:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27F163858D3C 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 27F163858D3C 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=1716306186; cv=none; b=vsxZKYt8BVbnZwlY9F59khBoMDz1EgGNMchQeuBmMV+9BtMryjX2VSOI5fIa9r9slSxQ9ZpvG7yz+q0TXqoa5wwp4EgAmnQjlwnXVkVN2p7nbKis5yeUiIb+r1N8vw8AmRWd2izo3D7w8NjjNq/Nzi2VzHHGWmRC29MVBXzeD/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716306186; c=relaxed/simple; bh=bKaMMVKYOUU3HHkq45p6Nn2zxLXTnv7+iHoRPYV/bjk=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=dUjdhv2kjUEQSVSu6EBv/WTLWPxzUt1+8LW3TBbbbSn0MC46O5vnL16StZvjzP75sIs+Q6E8SjhbUblfW46m1AXZV/hIIGCfxRx7ufBUvVdQsOjIoLt87lg04OkddoyFz/BVdSKdFO+9plAp2hak6NcZwT6Cs+MlG8n/KwDHzD0= 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 097AA5C28F 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; bh=8FE6L4W8dIns311ZkUfe3QLO8CiHDDnEi8evDPV/cz8=; b=iG4nnZdceYAAAEK0UgK7o4szrWvOslfkW4T3fBNmR6lKzPQV7N/mh25pp8aaCItc09oDMo CE8qRjN/eqrRpzRH02zVoHQB4Qc+VUVHIwhb0grdM24/T8WFfeetCdF66fmCxb3jRbj+Cx ykXRYqIKJUBGbVOdIHrazfIZ3tRY7os= 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; bh=8FE6L4W8dIns311ZkUfe3QLO8CiHDDnEi8evDPV/cz8=; b=ktWOKXx8XTJuM/FcXTe6RVOR3yGlZ7YpfiJVytQcjRiTcAnCurs5UjgAbf4tP5aKS2rpYc x5kL1yTip1+r3MCg== Authentication-Results: smtp-out2.suse.de; none 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; bh=8FE6L4W8dIns311ZkUfe3QLO8CiHDDnEi8evDPV/cz8=; b=iG4nnZdceYAAAEK0UgK7o4szrWvOslfkW4T3fBNmR6lKzPQV7N/mh25pp8aaCItc09oDMo CE8qRjN/eqrRpzRH02zVoHQB4Qc+VUVHIwhb0grdM24/T8WFfeetCdF66fmCxb3jRbj+Cx ykXRYqIKJUBGbVOdIHrazfIZ3tRY7os= 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; bh=8FE6L4W8dIns311ZkUfe3QLO8CiHDDnEi8evDPV/cz8=; b=ktWOKXx8XTJuM/FcXTe6RVOR3yGlZ7YpfiJVytQcjRiTcAnCurs5UjgAbf4tP5aKS2rpYc x5kL1yTip1+r3MCg== 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 E6C2B13685 for ; Tue, 21 May 2024 15:43:02 +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 Q/bjNgbBTGbJGwAAD6G6ig (envelope-from ) for ; Tue, 21 May 2024 15:43:02 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 01/11] [gdb/testsuite] Add gdb.base/fission-macro.exp Date: Tue, 21 May 2024 17:44:05 +0200 Message-Id: <20240521154415.9543-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 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)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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 Starting with gcc commit 80048aa13a6 ("debug/111409 - don't generate COMDAT macro sections for split DWARF"), available from release gcc 14.1 onwards, gcc produces a usable dwarf-5 32-bit .debug_macro.dwo section. Add a test-case excercising this. Tested on x86_64-linux. Tested test-case using a current gcc trunk build, and gcc 14. --- gdb/testsuite/gdb.base/fission-macro-2.c | 27 +++++++++ gdb/testsuite/gdb.base/fission-macro.c | 27 +++++++++ gdb/testsuite/gdb.base/fission-macro.exp | 75 ++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 gdb/testsuite/gdb.base/fission-macro-2.c create mode 100644 gdb/testsuite/gdb.base/fission-macro.c create mode 100644 gdb/testsuite/gdb.base/fission-macro.exp base-commit: 05887e360ad3db3265e3dc2f7a845660d1d3c02f diff --git a/gdb/testsuite/gdb.base/fission-macro-2.c b/gdb/testsuite/gdb.base/fission-macro-2.c new file mode 100644 index 00000000000..fb088c8bfaf --- /dev/null +++ b/gdb/testsuite/gdb.base/fission-macro-2.c @@ -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.c b/gdb/testsuite/gdb.base/fission-macro.c new file mode 100644 index 00000000000..9c8cbece5c5 --- /dev/null +++ b/gdb/testsuite/gdb.base/fission-macro.c @@ -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 (); +} diff --git a/gdb/testsuite/gdb.base/fission-macro.exp b/gdb/testsuite/gdb.base/fission-macro.exp new file mode 100644 index 00000000000..705e3dd0c4b --- /dev/null +++ b/gdb/testsuite/gdb.base/fission-macro.exp @@ -0,0 +1,75 @@ +# 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 14 is the first release containing the fix for PR debug/111409. +require {expr [gcc_major_version] >= 14} + +standard_testfile .c -2.c + +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} { + foreach_with_prefix strict_dwarf {0 1} { + do_tests $dwarf_version $dwarf_bits $strict_dwarf + } + } +}