From patchwork Fri Apr 12 15:21:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 88437 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 2E4233858433 for ; Fri, 12 Apr 2024 15:21:57 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by sourceware.org (Postfix) with ESMTPS id DB0703858D38 for ; Fri, 12 Apr 2024 15:21:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB0703858D38 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 DB0703858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712935289; cv=none; b=i3GCZu3Q4Rr8ODCpe1xFVMHooJIbDGy/RIy4xUvb5mt0ILd5swfX2VexRskcPiPvGW8n05RJAjTDLtekxzAfLn3eAxIEwYscsOBuavcRNBh/oIMCkN3fm85SoE6NCZL4YcmGrV6UJt3zRV8uPi+u+9pAVKiV4PeimCrvZYN+7+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712935289; c=relaxed/simple; bh=/KdVVNGFmaIT+tMXQy9jSQdAlcCM0rt3KvbgmDAXESE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=d80xnQ8BexDpZEhiDbKlIjmw3WwggwK47Fwy1htzMLj7gQtX0/unThYmvxR8NsbOKrP6lsJixPGwBYEBUFzgpZ5tsCUN2yOdVbc5WHswLuGJfU2qutzM6pZIzj7X/LPzg1FcpJQykoVu0adIJf4t58Mu/+YTena4xe6bis2Pm8s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-418031b6110so3853935e9.3 for ; Fri, 12 Apr 2024 08:21:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712935285; x=1713540085; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xs17xhP/J7+/9Ip0cEAuk2TC1jXQlVelDH50d/6Et00=; b=MQrNjxxbi6egzbka62Z27rhZIjhTuVXaFB/g3UdqmQ+1jCE3Ui4CnO7ytXq4yYbkaB oaaijRMpPhw8v+FDjQ7W10zr5B+zogn2yoblzP5vhjvsLvb7tv0X+LqOLEdHxxIoxYIT MxwAtBejfPWPw/4Rpe8Wd8N6OoqJm7wtsDZ0h7hL3I+Bhu1H8il9lLglBTq3dTdnGXpN DN3sSlgTbMqgWZUz2fJBiFkE/r8lwiaA825dfg6RDhH7BDNgqv5ZA4CubarSH1H2fp7J dz5umTmr4GZiyd47sLQyqIvV5kRaa79QM/6ad+T/EZzWxOV7qj5cyiBz7kUad0Noz7Yn 5xZw== X-Gm-Message-State: AOJu0YyBCtfody1UwMctq5BABEMzQ0aFaLkC5EgtwO0zzbBgSoBnKvWe b5IuodgpQI8bGAlLHXtKfDSaL+tIxx+Eu8wGDoIUejw99UA3UgjhoIzmn8g1 X-Google-Smtp-Source: AGHT+IH0VZy6KWm8Na4jbR6mtCTBHJGRAmpHhI6bsTspF+thFnu1NAQpX2Umrct6hTt7Zu5vCInRGg== X-Received: by 2002:a05:600c:3106:b0:416:837f:14d7 with SMTP id g6-20020a05600c310600b00416837f14d7mr2358703wmo.19.1712935285363; Fri, 12 Apr 2024 08:21:25 -0700 (PDT) Received: from localhost ([2001:8a0:f93d:b900:ae52:9c19:14d0:4b50]) by smtp.gmail.com with UTF8SMTPSA id r10-20020a05600c35ca00b00415dfa709dasm5950915wmq.15.2024.04.12.08.21.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Apr 2024 08:21:24 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH] Cygwin/testsuite: Avoid infinite hang Date: Fri, 12 Apr 2024 16:21:21 +0100 Message-ID: <20240412152121.418780-1-pedro@palves.net> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, WEIRD_PORT 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 On Cygwin, the gdb.base/fork-no-detach-follow-child-dlopen.exp testcase hits a sequence of cascading FAILs: (gdb) run Starting program: ..../gdb.base/fork-no-detach-follow-child-dlopen/fork-no-detach-follow-child-dlopen [New Thread 12672.0x318c] [New Thread 12672.0x2844] [New Thread 12672.0x714] FAIL: gdb.base/fork-no-detach-follow-child-dlopen.exp: runto: run to add (timeout) frame FAIL: gdb.base/fork-no-detach-follow-child-dlopen.exp: frame (timeout) list FAIL: gdb.base/fork-no-detach-follow-child-dlopen.exp: list (timeout) And the test program never makes progress. ... and at this point, Cygwin is completely stuck. I can't run any other Cygwin program. However, if we run the test program outside DejaGnu, we see something different: (gdb) b add Function "add" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (add) pending. (gdb) r Starting program: ..../gdb.base/fork-no-detach-follow-child-dlopen/fork-no-detach-follow-child-dlopen [New Thread 10968.0x834] [New Thread 10968.0x29a4] [New Thread 10968.0x16b8] [New Thread 10968.0xf9c] [Switching to Thread 10968.0x16b8] Thread 4 "sig" hit Breakpoint 1.2, pending_signals::add (pack=..., this=0x7ffa1e748a40 ) at /usr/src/debug/cygwin-3.4.9-1/winsup/cygwin/sigproc.cc:1304 1304 se = sigs + pack.si.si_signo; (gdb) Ah, the test wanted to run to a global "add" function, but managed to stop at an internal Cygwin method called "add". And stopping there deadlocks everything Cygwin in the system. (I believe some cygwin1.dll mechanisms use cross-process synchronization or communication, we're probably blocking something like that.) Fix this by using "break -q". The tests FAIL because we don't support follow-fork for Cygwin, but at least we no longer deadlock the machine. Change-Id: I7181d8481c2ae1024b0d73e3bb194f9a4f0a7eb9 --- gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 02d02fc7924992ddd98073b95810b957efdc421a prerequisite-patch-id: f69cbdabf27c6a6b022b9bbb4244a313146c5d42 prerequisite-patch-id: ea1c719c5c15c52231fd0f75436a90b15f55ff40 prerequisite-patch-id: 7774d24814a00d54d128607cfb12e57aa095a15a diff --git a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp index d56148d79e8..de339c531bd 100644 --- a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp +++ b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp @@ -45,7 +45,7 @@ proc do_test {} { gdb_test_no_output "set follow-fork-mode child" gdb_test_no_output "set detach-on-fork off" - runto "add" allow-pending + runto "add" qualified allow-pending # Since we have debug info in the shlib, we should have the file name available. gdb_test "frame" "add \(.*\) at .*$::srcfile2:\[0-9\]+.*"