From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UqB4CWbhT2owxAAAWB0awg (envelope-from ) for ; Thu, 09 Jul 2026 13:59:02 -0400 Received: by simark.ca (Postfix, from userid 112) id 13B9F1E0A3; Thu, 09 Jul 2026 13:59:02 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 46ED51E070 for ; Thu, 09 Jul 2026 13:59:01 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F31A4BA23E3 for ; Thu, 9 Jul 2026 17:59:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F31A4BA23E3 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by sourceware.org (Postfix) with ESMTPS id 76D0B4BA23E2 for ; Thu, 9 Jul 2026 17:58:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76D0B4BA23E2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 76D0B4BA23E2 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783619888; cv=none; b=io1vVF+aouFSgaP6qy4L2ZmNaYpJo9D32jspvR72iemJJf0SAYxhAIcA3RddJPzRP7YSFuC888qE0xGZxK9tBoIbrg01OF6QY1ik+M/WsWbT4nKFIp55AlRb2p4pcEh61C1cDo11cw7GA753Y3/YaQcVTfJsDfqrM+AJmp88onA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783619888; c=relaxed/simple; bh=FlIsi+VLd1zu/kpB/Wg3voGB/DGrRdGaeM+w+IBVs0A=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=FgKwGF04iPGMetdmDCCXx8J0lGa9LNqGvyhDzhXyZ1bQ9QR7E8EPOALoPdPNbODrBVQb+2Evn8q3mPj302CquHyM9Ub2KSyb8XDwswgm3ntEeGxWue84L4IGR08yJhnVdUuWJGAmZ5Xf7EPp3c9CctOIG68fJCnTE6zU4AqtcHI= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76D0B4BA23E2 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-471eeac43bfso138555f8f.3 for ; Thu, 09 Jul 2026 10:58:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783619887; x=1784224687; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=fmLY2X/o9SbVX1t/V1TnvGi+YKnwK+4AVlxFYcjzZPs=; b=hbRaifrhtEXRg6MVeojrhKizo5D2FqFb0cPiGd2PZqqZ4GBYsV/ZZjD1I3xvj/gMm4 TInGQMfBxCjCrxwY9Bz363VUaFKT0y5s4/WT9a6YOVQ+NYVKg/P79bs6mh+o5DNKdycM JRm9FCnGn3EJb+nTkwbyAAsG7AqP87FFBG1RYSl9iwED4pCpVdXuINAGHVeBp76yqmTN vT4OxaYieMASaJHeSINgj4aR0DvHTWjxVglvxAAPtgcF+eDCdpsrATs9D+gwXpDfdSP1 JL3syCW/KHYiRRXJ+NjBs2P/6zli3jB0q2KwEAL7LZC1mieCDyn6eSb+WvPKd7gUhNGf 8etA== X-Gm-Message-State: AOJu0YxSWJMdBsQwIl7m74FAYn4c2rdH1WZu6fgDgBL/UKUM6ygYdnMG bI5WmEbupw0H8G5hjrimzLGiRry8xhvI2oy617amR0xd4pk/A/EEPhoWa+pkH/CC X-Gm-Gg: AfdE7ckst69T4oawB63Q9pJ8Jam8909nD/F7jzGfd2oL14dQ+N+L5Ww4CukdCJ6UMOL lukrpLDYIILzzUOELmbYc+6kqwv0MZgXXOFU5wWXaPm+j+5F+4M0z83pOFG6Ezfi71KIH3BxDye B4jyY4YvHfsND9aQWQL3KShnZP+zm+XChjyqNe5nZbaED50Lwazv6O1XZxh4npHEYhbQyLgtxQJ i4GJ41BlKYbeDZVgmowoxDnmgGGIcVs8Yx6WhrsYL1F4Fy97KKh1mLbi+bu6z3K/IFL8gRXq3Ro oudQ2IOe9GrH8vPTeP8WXghs4UlXrLkbLW3U21TKScWK7ATqsIOUBOLgE1DZJZL7HoVnuXfJWJy 23wPdQ1EumsYQk/vc3nJQM25uyVL5BuOp1qeiRSA30rD1JPFWaose2YIVKLhYPtbW+zVVKSh6Mw znR5xLiqZlXg== X-Received: by 2002:a05:6000:25c8:b0:475:c946:36c5 with SMTP id ffacd0b85a97d-47df073aa66mr9117492f8f.9.1783619887293; Thu, 09 Jul 2026 10:58:07 -0700 (PDT) Received: from localhost ([2001:8a0:fae3:3700:fc87:ea6:fb9f:13e3]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-47aa039ae44sm50763503f8f.23.2026.07.09.10.58.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jul 2026 10:58:06 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH] gdb.base/execl-update-breakpoints.exp: Don't execl forever Date: Thu, 9 Jul 2026 18:58:04 +0100 Message-ID: <20260709175804.434105-1-pedro@palves.net> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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~public-inbox=simark.ca@sourceware.org execl-update-breakpoints.c is compiled as both execl-update-breakpoints1 and execl-update-breakpoints2. execl-update-breakpoints1 checks to see if the last character in its filename is '1', and if so, replace it with '2' and execl the result. On Windows, this fails to take into account that the filename may have an ".exe" extension. The result is that the execl-update-breakpoints1 executable execs itself forever. This patch fixes it by taking the .exe extension into account. (Note that neither native Windows nor Cygwin support following execs, and maybe the testcase will eventually be skipped there, but even then, if someone enables follow-exec testing there, we'd want it to handle the .exe extension, so I think it's better to adjust the testcase than not.) Now, on e.g. GNU/Linux, if you run execl-update-breakpoints1 manually, you'll see that it also execs forever, but this time, what happens is that execl-update-breakpoints1 execs execl-update-breakpoints2, and then it's execl-update-breakpoints2 that execs itself forever. There is no reason for execl-update-breakpoints2 to exec. It's just that the testcase is assuming that the process is killed when the testcase is over. It's just cleaner if execl-update-breakpoints1 execs execl-update-breakpoints2, and then execl-update-breakpoints2 just cleanly exits. The patch does that too. And then, the test program should really be erroring out if neither '1' nor '2' is found at the tail of the executable. Done too. Change-Id: Id88830cd8dff2c63dd69b827d4ba79743aa9ebca --- .../gdb.base/execl-update-breakpoints.c | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/execl-update-breakpoints.c b/gdb/testsuite/gdb.base/execl-update-breakpoints.c index e71efd097b1..c781b34f522 100644 --- a/gdb/testsuite/gdb.base/execl-update-breakpoints.c +++ b/gdb/testsuite/gdb.base/execl-update-breakpoints.c @@ -34,11 +34,21 @@ main (int argc, char **argv) len = strlen (argv[0]); bin = malloc (len + 1); memcpy (bin, argv[0], len + 1); - if (bin[len - 1] == '1') - bin[len - 1] = '2'; - execl (bin, bin, (char *) NULL); - perror ("execl failed"); - some_function (); - exit (1); + /* Account for the extension on Windows. */ + if (len > 4 && strcmp (bin + len - 4, ".exe") == 0) + len -= 4; + + if (bin[len - 1] == '1') + { + bin[len - 1] = '2'; + execl (bin, bin, (char *) NULL); + perror ("execl failed"); + some_function (); + exit (1); + } + else if (bin[len - 1] == '2') + exit (0); + else + exit (1); } base-commit: 4c4e1dd5a02c1a03e7eb408987404ffd1adfd1e4 -- 2.54.0