Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3 00/11] Windows non-stop mode
Date: Fri, 22 May 2026 01:22:22 +0100	[thread overview]
Message-ID: <2ffed18e-6960-4835-8238-b8e9ca0ba461@palves.net> (raw)
In-Reply-To: <8a20e6ce-0f71-4a00-b62f-14cfc2ea32d5@palves.net>

Hi!

On 2026-05-08 22:27, Pedro Alves wrote:
> On 2026-05-08 19:43, Tom Tromey wrote:
>> There's another test that adds some event listeners from Python like:
>>
>>         gdb.events.stop.connect(signal_stop_handler)
>>         gdb.events.stop.connect(breakpoint_stop_handler)
>>         gdb.events.exited.connect(exit_handler)
>>         gdb.events.cont.connect(continue_handler)
>>
>> These just print what happens.  The test started failing because what
>> exactly happens has changed:
>>
>>      --- Regression: K224-002__py-events:what_happened
>>      - Could not match
>>          event type: continue
>>          event type: stop
>>          event  !! FAILS HERE -> type: stop
>>          stop reason: breakpoint
>>          breakpoint number: @NUMBER
>>          all threads stopped
>>      - Against input line
>>          event type: continue
>>          event type: continue
>>          event type: stop
>>          event type: stop
>>          stop reason: breakpoint
>>          breakpoint number: 2
>>          all threads stopped
>>
>> That is, two stop events seem to be produced?
>>
> 
> I'm afraid I'm not able to parse the output above off hand.
> 
>> According to the notes this test is a port of gdb.python/py-events.exp,
>> though I am not sure if they have diverged.
> 

I was looking at the output of gdb.python/py-events.exp on Linux, and I see two stop events there:

 Breakpoint 2, first () at /home/pedro/rocm/gdb/src/gdb/testsuite/gdb.python/py-events.c:30
 30        for (i = 0; i < 2; i++)
 event type: stop
 event type: stop
 stop reason: breakpoint
 first breakpoint number: 2
 breakpoint number: 2
 breakpoint number: 3
 all threads stopped
 (gdb) PASS: gdb.python/py-events.exp: continue

Two stops seems to be what happens for every test in that testcase.  I noticed that the .exp file
matches with:

 # Test continue event and breakpoint stop event
 gdb_test "continue" ".*event type: continue.*
 .*event type: stop.*
 .*stop reason: breakpoint.*
 .*first breakpoint number: 2.*
 .*breakpoint number: 2.*
 .*breakpoint number: 3.*
 all threads stopped.*"

So if gdb prints two stop events by mistake, the testcase will still pass.

I went as further back as commit f1cc4f02cb558d513cb4575211dbbb690391618f (May 21 2023), and I saw
the same there, though.

Looking at gdb.python/-events.py, we have:

    def invoke(self, arg, from_tty):
        gdb.events.stop.connect(signal_stop_handler)
        gdb.events.stop.connect(breakpoint_stop_handler)

So we register two callbacks for the same event, so it's really expected.  With:

 diff --git i/gdb/testsuite/gdb.python/py-events.py w/gdb/testsuite/gdb.python/py-events.py
 index 2cb48e4eccf..a5ac083bfd4 100644
 --- i/gdb/testsuite/gdb.python/py-events.py
 +++ w/gdb/testsuite/gdb.python/py-events.py
 @@ -20,7 +20,7 @@ import gdb
 
  def signal_stop_handler(event):
      if isinstance(event, gdb.StopEvent):
 -        print("event type: stop")
 +        print("event type: stop (1)")
      if isinstance(event, gdb.SignalEvent):
          print("stop reason: signal")
          print("stop signal: %s" % (event.stop_signal))
 @@ -30,7 +30,7 @@ def signal_stop_handler(event):
  
  def breakpoint_stop_handler(event):
      if isinstance(event, gdb.StopEvent):
 -        print("event type: stop")
 +        print("event type: stop (2)")

I see:

 Breakpoint 2, first () at /home/pedro/rocm/gdb/src/gdb/testsuite/gdb.python/py-events.c:30
 30        for (i = 0; i < 2; i++)
 event type: stop (1)
 event type: stop (2)
 stop reason: breakpoint

So that seems totally expected, at least for gdb.python/py-events.exp.

I don't suppose that somehow your internal testcase does the same and somehow that
wasn't noticed before?

> Hmm, I'm cross compiling Cygwin gdb and that doesn't include Python support.
> I'll see if I can set things up to enable Python support and run
> gdb.python/py-events.exp with Cygwin.
> 

I managed to do this.  That exposed a number of pre-existing problems, as usual...

All fixed with this series:

  https://inbox.sourceware.org/gdb-patches/20260522001626.393908-1-pedro@palves.net/T/

Nothing related to the non-stop support, though.

Pedro Alves

  reply	other threads:[~2026-05-22  0:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 20:14 Pedro Alves
2026-04-29 20:14 ` [PATCH v3 01/11] Windows gdb+gdbserver: Check whether DBG_REPLY_LATER is available Pedro Alves
2026-04-29 20:14 ` [PATCH v3 02/11] linux-nat: Factor out get_detach_signal code to common code Pedro Alves
2026-04-29 20:14 ` [PATCH v3 03/11] Windows GDB: make windows_thread_info be private thread_info data Pedro Alves
2026-04-29 20:15 ` [PATCH v3 04/11] Introduce windows_nat::event_code_to_string Pedro Alves
2026-04-29 20:15 ` [PATCH v3 05/11] Windows gdb: Add non-stop support Pedro Alves
2026-04-29 20:15 ` [PATCH v3 06/11] Windows gdb: Watchpoints while running (internal vs external stops) Pedro Alves
2026-04-29 20:15 ` [PATCH v3 07/11] Windows gdb: extra thread info => show exiting Pedro Alves
2026-04-29 20:15 ` [PATCH v3 08/11] Add gdb.threads/leader-exit-schedlock.exp Pedro Alves
2026-04-29 20:15 ` [PATCH v3 09/11] infrun: with AS+NS, prefer process exit over thread exit Pedro Alves
2026-05-06 10:01   ` Bouhaouel, Mohamed
2026-05-08 21:37     ` Pedro Alves
2026-05-11 11:58       ` Bouhaouel, Mohamed
2026-04-29 20:15 ` [PATCH v3 10/11] Windows gdb: Always non-stop (default to "maint set target-non-stop on") Pedro Alves
2026-04-29 20:15 ` [PATCH v3 11/11] Mention Windows non-stop support in NEWS Pedro Alves
2026-04-30  5:55 ` [PATCH v3 00/11] Windows non-stop mode Eli Zaretskii
2026-04-30 10:13   ` Pedro Alves
2026-04-30 11:14     ` Eli Zaretskii
2026-04-30 12:01       ` Pedro Alves
2026-04-30 14:15         ` [PATCH] Clarify "maint set target-non-stop" in GDB manual (Re: [PATCH v3 00/11] Windows non-stop mode) Pedro Alves
2026-04-30 15:09           ` Eli Zaretskii
2026-04-30 16:18             ` [PATCH v2] " Pedro Alves
2026-04-30 16:27               ` Eli Zaretskii
2026-04-30 16:33                 ` Pedro Alves
2026-04-30 17:45 ` [PATCH v3 00/11] Windows non-stop mode Pedro Alves
2026-05-08 18:43 ` Tom Tromey
2026-05-08 21:27   ` Pedro Alves
2026-05-22  0:22     ` Pedro Alves [this message]
2026-06-02 19:00     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ffed18e-6960-4835-8238-b8e9ca0ba461@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox