From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YddwG/agFGqnIBoAWB0awg (envelope-from ) for ; Mon, 25 May 2026 15:20:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 6DD9F1E0A3; Mon, 25 May 2026 15:20:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 BCE711E024 for ; Mon, 25 May 2026 15:20:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5AC764BA798C for ; Mon, 25 May 2026 19:20:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5AC764BA798C Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by sourceware.org (Postfix) with ESMTPS id C22064BA7980 for ; Mon, 25 May 2026 19:18:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C22064BA7980 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 C22064BA7980 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779736735; cv=none; b=Iac743HoPLKABfRlVoeeLLGAUAsqVJMaNsCjQ185mYXjCMckeYqikbdXdpWR8RoPJ1QLd8XvV1tl7gxBeUotjj7UpK7UyTj8XHa9MT8xIymijgjnACMzmvAaMt8BsgI88gYQiuRPiBJ92lt4FTIfwuyHqxZrg4zVGXFPuIN9+NE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779736735; c=relaxed/simple; bh=ZJ+H2DT/1norlxbdqE+gLmaCPdSuBPmn+1fTwjK3WvM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=GAfMg/3v4gzINqJGBuh1b4yK7aERICCCtVfcHS2zsujIW/SS1EnjdXzCNDnwoy+CeebocmP56iTA6jOLZ/RBDdadW2Co/SzPjLs6cbZkuxuVTSP9gLcXGSN5UMLnTm4+Y65El2+MKqUOjH9hQH8P/pSGDQ4AFcIGSiSOdczHHGM= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C22064BA7980 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4906869f0cbso10295215e9.1 for ; Mon, 25 May 2026 12:18:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779736734; x=1780341534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=gsIbbtO/KJs7GCTDOP6TPZT/D3PXgTtjADR+dh6foQw=; b=iPGprKd4a2BJsMAHVG0I4lSwk17xmEz7YDjNUxG1qhWABJr3tVd0cW4VJYuv2hxsTg 95S5QQ5hyEANjD1y34nKE9CKMKvIJzoHwtBrBQCPyGZdVo0Bp4n/4tFKcjfagU4P7ZnU 1jWqz+tsRuneFrLKa3YyfIZUJ2HOsgw0/gnje42otY4ig93CmrB/sTd1KhTog+J2ud/U AbE0h8F7wUhQVBYGo6ArSOqLRXqruuah4K6zCV0Lrit8SVVHSTNaFYEqcXL95DDwJuD6 0CWKN7+8qWwZDRz+ZU2qCCj9aCheZLoyB2qRgrhhsjchJgSGDO6i9ddLNwb9p/hcTIPw ACLw== X-Gm-Message-State: AOJu0YznCf9YhKF2RGMrXD+Olaw1sRmXsnqm0IrKtLuM/7k+d6VlVAoQ K584HfkUx8ljye9nYcg65ZU4DYO+EzDBlRdygofMkNp2RDBebCjSmELBr/4Msg== X-Gm-Gg: Acq92OFIsEYF1BGWcLYYlg1+WvpP8wtg1fgvh5wzHZ6orslJEJQ4NXhLPx0wTU0/bzm K9nzLuE3xvIj2qI5OHJ8zEfS4wkyD1hIspM+TJREmP+FkbFJE7ZXcnicFSCOS5YtMeM3qZVFLWB 6d3jI91CWTZ4zXdeFiQr5dbaUvIuwHmt95mY/3XJ2RrM5LzkwsVeJINoyzVaFSykZSzJW9uOUJ2 64dnkuT3JQ2bE4R4a0oFjwV/XXeos4HTQ+EAU8WCXSbeoJhWlsyyi9Gj6B73e43xZj/oIrbGieU sIQg3YAcJt/Hup1Z1x2GGu/enjr/BKlwJeM9hA4hMTwOJ+VF4/rsegp7QxzGNiwuVu3XPCiv87/ zOTE680cmop7dq9rDpSAWtq9s3gWCo9vpWoNbAW0uXOEOpMDKOvqWyD/n1bptI8g/Yugk7HfHzW M67eOkWPD01H+xmBRZrno9aYOWIJlQ1s7L X-Received: by 2002:a05:600c:4ecc:b0:490:3a07:c467 with SMTP id 5b1f17b1804b1-490426cf642mr247878655e9.22.1779736733512; Mon, 25 May 2026 12:18:53 -0700 (PDT) Received: from localhost ([2001:8a0:fae3:2600:dc16:ec0f:632c:5ba7]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-490454ea134sm299266755e9.8.2026.05.25.12.18.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 May 2026 12:18:53 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 10/11] Adjust gdb.python/py-events.exp for Cygwin/MinGW, no fork Date: Mon, 25 May 2026 20:18:28 +0100 Message-ID: <20260525191829.984105-11-pedro@palves.net> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260525191829.984105-1-pedro@palves.net> References: <20260525191829.984105-1-pedro@palves.net> 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 The gdb.python/py-events.exp testcase currently uses fork, and relies on "set detach-on-fork off". Cygwin does support the fork syscall, but GDB can't follow forks there, so "detach-on-fork off" has no effect. And also, there is no fork on native Windows, which makes the testcase unusable on MinGW currently. I don't see any reason the testcase needs to use fork or multiple inferiors. We can replace what those parts were testing by more focused tests: - The clear_objfiles event was tested via following a fork. Instead, test a more directed "file" command. - Two-inferior quit was being used to test that gdb.ExitedEvent has no "exit_code". Quitting while an inferior is being debugged makes GDB kill the inferior. What's really being tested is the kill path, so write an explicit (single-inferior) kill test. Tested on x86_64-unknown-linux-gnu. Change-Id: I21ee8af7b52653c6fdff9b4c1596cdde3cfe751a commit-id: de2bf164 --- gdb/testsuite/gdb.python/py-events.c | 3 -- gdb/testsuite/gdb.python/py-events.exp | 59 +++++++++++++------------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/gdb/testsuite/gdb.python/py-events.c b/gdb/testsuite/gdb.python/py-events.c index b1910f75ed9..6a0b407042a 100644 --- a/gdb/testsuite/gdb.python/py-events.c +++ b/gdb/testsuite/gdb.python/py-events.c @@ -15,12 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include - extern void do_nothing (void); int second(){ - fork() ; return 12; } diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp index b07eb2ec9b0..a34a423c014 100644 --- a/gdb/testsuite/gdb.python/py-events.exp +++ b/gdb/testsuite/gdb.python/py-events.exp @@ -45,8 +45,6 @@ gdb_breakpoint "main" {temporary} gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "new objfile notification" -gdb_test_no_output "set detach-on-fork off" "" - gdb_test "test-events" "Event testers registered." gdb_breakpoint "first" @@ -217,24 +215,13 @@ proc get_process_id {test} { return ${process_id} } -set process_id [get_process_id "get inferior 1 process id"] +set process_id [get_process_id "get inferior process id"] gdb_test "continue" ".*event type: continue.* -.*clear_objfiles\[\r\n\]*progspace: .*py-events.* .*event type: exit.* .*exit code: 12.* .*exit inf: 1.* .*exit pid: $process_id.* -dir ok: True.*" "Inferior 1 terminated." - -gdb_test "inferior 2" ".*Switching to inferior 2.*" -set process_id [get_process_id "get inferior 2 process id"] -gdb_test "continue" ".*event type: continue.* -.*event type: exit.* -.*exit code: 12.* -.*exit inf: 2.* -.*exit pid: $process_id.* -dir ok: True.*" "Inferior 2 terminated." - +dir ok: True.*" "inferior terminated" # Test before_prompt event. gdb_test_multiline "define new user command" \ @@ -286,29 +273,30 @@ with_test_prefix "inferior continue exit" { gdb_test "print \$_foo" "= 2" "check foo after start continue" } -# Check that when GDB exits, we see gdb.ExitedEvent objects with no -# 'exit_code' attribute, and that a gdb.GdbExitingEvent is emitted. -with_test_prefix "gdb exiting: normal" { +# Check that when GDB kills an inferior, we see gdb.ExitedEvent +# objects with no 'exit_code' attribute. +with_test_prefix "kill inferior" { + if {![runto_main]} { + return + } gdb_test "test-exiting-event normal" "GDB exiting event registered\\." + gdb_test "with confirm off -- kill" \ + "event type: exit\r\nexit code: not-present\r\nexit inf: $decimal\r\nexit pid: $decimal\r\ndir ok: False\r\n.*" \ + "exit code not present" +} + +# Check that when GDB exits, we see that a gdb.GdbExitingEvent is +# emitted. +with_test_prefix "gdb exiting: normal" { set saw_exiting_event 0 - set saw_inferior_exit 0 - gdb_test_multiple "quit" "" { - -re "Quit anyway\\? \\(y or n\\) $" { - send_gdb "y\n" - exp_continue - } + gdb_test_multiple "with confirm off -- quit" "quit" { -re "event type: gdb-exiting\r\nexit code: $decimal" { incr saw_exiting_event exp_continue } - -re "event type: exit\r\nexit code: not-present\r\nexit inf: $decimal\r\nexit pid: $decimal\r\ndir ok: False\r\n" { - incr saw_inferior_exit - exp_continue - } eof { gdb_assert { $saw_exiting_event == 1 } - gdb_assert { $saw_inferior_exit == 2 } pass $gdb_test_name } } @@ -354,3 +342,16 @@ with_test_prefix "gdb exiting: error" { } } } + +# Test clear_objfiles event. + +with_test_prefix "clear_objfiles" { + clean_restart ${testfile} + + gdb_test_no_output "source ${pyfile}" "load python file" + gdb_test "test-objfile-events" "Object file events registered." + + gdb_test "with confirm off -- file" \ + "event type: clear_objfiles\r\nprogspace: None\r\n.*" \ + "file cleared" +} -- 2.53.0