From patchwork Mon Oct 14 14:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinevere Larsen X-Patchwork-Id: 98874 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 9E5CF3857022 for ; Mon, 14 Oct 2024 14:12:17 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id ED289385829B for ; Mon, 14 Oct 2024 14:11:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED289385829B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ED289385829B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728915111; cv=none; b=Ghofhddg8Lyz8qjr9GnHKT9iH9FNVoJIT4RnFPbCA1flmbVJhiVgRZE0/K4/j4E8nSln5bB8V5/Uj90WImatH7hphA5Rz2EAjZCAMJm2A8J20ZsROrhL96e3bBJpSZk25P7S5MsJrG+UWfTQLUGzpP0w5hq9SAS3WqiJZub7ZEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728915111; c=relaxed/simple; bh=hU41eeK2i+FldFKk4QNL6h9mD83ednbcYO5/OXWPb6g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=afILx7F7nBlP9FjJtmIzBTV/OQg7d4+FeN0l/H68dtdnXINjakSKXPhlf6DcY1WHE74UU4lyPgCjt/NWlJL6Cc11Yl0A0IPaLci2t1+T0LfbCKSJO/N6aU9RvycGJA2z0PKUo01T4HgNSXMx4s8HN4E0ocYCKhJUdH+rMK9D5SQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728915101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kxgyeb4VtnI0kOLU14pNYlj94ZyvEwppmnuRQE927VU=; b=Z6e4yQDaAWEo5cEvUUD5L8VN+ELHUN/6afuE8NxXubGaKSW2DEmFJwSIR2a+9bpXe5P4JU XyWmyeTAv7RZacNYFj8/QOKmD6zVipXTWVgNuDw5ZPO4iQ+kLa+xf7L154xTAy5N7hKA3d dEa3e6CUHzh9ghWk6fbkZshecndzl3k= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-8klcXyyNOX6qoljGG_BUOA-1; Mon, 14 Oct 2024 10:11:37 -0400 X-MC-Unique: 8klcXyyNOX6qoljGG_BUOA-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 141EC1956048 for ; Mon, 14 Oct 2024 14:11:37 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.65]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8C78430001A5; Mon, 14 Oct 2024 14:11:35 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH] gdb/testsuite: fix gdb.multi/inferior-specific-bp.exp Date: Mon, 14 Oct 2024 11:11:28 -0300 Message-ID: <20241014141128.1623238-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, 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 A recent commit, "16a6f7d2ee3 gdb: avoid breakpoint::clear_locations calls in update_breakpoint_locations", started checking if GDB correctly relocates a breakpoint from inferior 1's declaration of the function "bar" to inferior 2's declaration. Unfortunately, inferior 2 never calls bar in its regular execution, and because of that, clang would optimize that whole function away, making it so there is no location for the breakpoint to be relocated to. This commit changes the .c file so that the function is not optimized away and the test fully passes with clang. It is important to actually call bar instead of using __attribute__((used)) because the latter causes the breakpoint locations to be inverted, 3.1 belongs to inferior 2 and 3.2 belongs to inferior 1, which will cause an unrelated failure. --- gdb/testsuite/gdb.multi/inferior-specific-bp-2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c b/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c index bde6fbf8224..3a45c21034f 100644 --- a/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c +++ b/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c @@ -30,7 +30,8 @@ main (void) { int ret = baz (); stop_breakpt (); - return ret; + /* We have to call bar here, otherwise it might be optimized away. */ + return ret + bar (); } static int