From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 45432388210C for ; Thu, 13 Jun 2024 16:27:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45432388210C 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 45432388210C 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=1718296038; cv=none; b=PlVVstcF4hjvAjCdleoHK+HTJy4X3Ac6gXTJ0aNn77o/E0J+WetSea6dIWgRv5eC45f2CZ8Qoom6G5anXs5CtS7UDhX5GvTFPm6HW2Iy8dfPs2YIr5FGpZFriDCJI4MhKPzT3E6sgX3YR74Ug6wPAc0q6BczBruVZOGGdfy+4N8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718296038; c=relaxed/simple; bh=McyuNzlM//5mtFwWfeIXj+oRX3v2tUcTjZIKZ6tymqU=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:From:To; b=S10TpXZ84ah1uAdJ55p4sPU9Kri69A14ma4CN+mkX0Zk+WfIjCOak0V9un+QH5GgfreNC+/RGj9Tg5jow9dGzCrgD8igZwxyNmqavNLJtx+Yp/Mk5BqCz74JaZcNKtCyrWxafBodtfJDEDo8l54KjczvBNk5vOhlbI6WOq8RQZ0= 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 411195D587 for ; Thu, 13 Jun 2024 16:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718296035; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AeqvstpirGqzWQFPziAYah5sFKfVMz4x568c7mYJ+zE=; b=fiz9SJq19wsX5+L91P6wssruCIBl6FUjKS0P9lP/eL8gkmBrWAhkY72MsodoIdQzZeNc6Y PYdHw0z1i/ThQSWWTnVwB8htt1LibZVkhz1IKKAoS8D5ipesgtQmpkke6iBah3X0s9DS/X 1WfT3UFXPDwBE8UpzYiBcG5W0MCx+ug= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718296035; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AeqvstpirGqzWQFPziAYah5sFKfVMz4x568c7mYJ+zE=; b=mMMMbVqC0/wc1IMCozOoHoTSNzUKSlM6YZOJS1ZM8eNr6xqH+Sb3dwRxQGIXyh1t1lGY1I HZ1cjaDYM1oCPJBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718296035; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AeqvstpirGqzWQFPziAYah5sFKfVMz4x568c7mYJ+zE=; b=fiz9SJq19wsX5+L91P6wssruCIBl6FUjKS0P9lP/eL8gkmBrWAhkY72MsodoIdQzZeNc6Y PYdHw0z1i/ThQSWWTnVwB8htt1LibZVkhz1IKKAoS8D5ipesgtQmpkke6iBah3X0s9DS/X 1WfT3UFXPDwBE8UpzYiBcG5W0MCx+ug= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718296035; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AeqvstpirGqzWQFPziAYah5sFKfVMz4x568c7mYJ+zE=; b=mMMMbVqC0/wc1IMCozOoHoTSNzUKSlM6YZOJS1ZM8eNr6xqH+Sb3dwRxQGIXyh1t1lGY1I HZ1cjaDYM1oCPJBw== 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 2DB8713A7F for ; Thu, 13 Jun 2024 16:27:15 +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 GqXICeMda2bWcwAAD6G6ig (envelope-from ) for ; Thu, 13 Jun 2024 16:27:15 +0000 Message-ID: <9bf1882e-2a93-4bd4-989d-dc0805608b0f@suse.de> Date: Thu, 13 Jun 2024 18:27:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 03/11] [gdb/testsuite] Add test-case gdb.base/fission-macro-i.exp From: Tom de Vries To: gdb-patches@sourceware.org References: <20240521154415.9543-1-tdevries@suse.de> <20240521154415.9543-3-tdevries@suse.de> Content-Language: en-US In-Reply-To: <20240521154415.9543-3-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -4.29 X-Spam-Level: X-Spamd-Result: default: False [-4.29 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.996]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; 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]; FUZZY_BLOCKED(0.00)[rspamd.com]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; 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)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] 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 List-Id: On 5/21/24 17:44, Tom de Vries wrote: > 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. > I'm having second thoughts on this and the following 2 patches, all using gdb.base/fission-macro-i.i. While this adds a way to test gdb functionality in combination with gcc < 14, the actual use-cases for which the following two workaround patches will be useful will be severely limited, so I'm not sure it's worth the added complexity and maintenance burden of the workarounds. So, I'm considering dropping these 3. Thanks, - Tom > 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 (); > +}