[binutils-gdb] Adjust gdb.python/py-events.exp for Cygwin/MinGW, "info proc" => "inferior"

Pedro Alves via Gdb-cvs <[email protected]> Fri, 12 Jun 2026 13:59:45 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2b675b263dfd5c780b8b77ae6b97543a6fb42d1c

commit 2b675b263dfd5c780b8b77ae6b97543a6fb42d1c
Author: Pedro Alves <[email protected]>
Date:   Wed May 20 11:22:56 2026 +0100

    Adjust gdb.python/py-events.exp for Cygwin/MinGW, "info proc" => "inferior"
    
    The testcase is using "info proc" to extract the inferior's process
    ID.  But "info proc" does not exist on all targets, including Windows.
    Switch to using the get_inferior_pid routine from lib/gdb.exp, which
    uses "inferior" instead.
    
    With this fixed, the testcase passes cleanly on Cygwin.  I haven't
    tested on MinGW (I'm not set up for Python testing there currently),
    but at least (since the previous patches) the test should be able to
    compile & run there now.
    
    Also tested on x86_64-unknown-linux-gnu.
    
    Change-Id: If6ff482ceb011d9afe5ed40ef7e4e2f2cad8cae8

Diff:
---
 gdb/testsuite/gdb.python/py-events.exp | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index a34a423c014..35681cb178e 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -203,19 +203,7 @@ gdb_test_multiple "continue" $test {
 
 gdb_test_no_output "delete $second_breakpoint"
 
-#test exited event.
-proc get_process_id {test} {
-    global gdb_prompt
-    gdb_test_multiple "info proc" $test {
-	-re "process (\\d+).*$gdb_prompt $" {
-	    set process_id $expect_out(1,string)
-	    pass $gdb_test_name
-	}
-    }
-    return ${process_id}
-}
-
-set process_id [get_process_id "get inferior process id"]
+set process_id [get_inferior_pid]
 gdb_test "continue" ".*event type: continue.*
 .*event type: exit.*
 .*exit code: 12.*