Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent
@ 2025-09-17 14:51 Tom Tromey
  2025-09-17 19:51 ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2025-09-17 14:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The documentation says that ThreadExitedEvent is derived from
ThreadEvent, but the code does not actually implement this.

This patch fixes the problem.  I propose applying this to gdb 17 as
well.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33444
---
 gdb/python/py-event-types.def                | 2 +-
 gdb/testsuite/gdb.python/py-thread-exited.py | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/python/py-event-types.def b/gdb/python/py-event-types.def
index 15cd9faae69..83167f36163 100644
--- a/gdb/python/py-event-types.def
+++ b/gdb/python/py-event-types.def
@@ -54,7 +54,7 @@ GDB_PY_DEFINE_EVENT_TYPE (new_thread,
 GDB_PY_DEFINE_EVENT_TYPE (thread_exited,
 			  "ThreadExitedEvent",
 			  "GDB thread exited event object",
-			  event_object_type);
+			  thread_event_object_type);
 
 GDB_PY_DEFINE_EVENT_TYPE (new_inferior,
 			  "NewInferiorEvent",
diff --git a/gdb/testsuite/gdb.python/py-thread-exited.py b/gdb/testsuite/gdb.python/py-thread-exited.py
index ef5a2441b8e..f725bd585c9 100644
--- a/gdb/testsuite/gdb.python/py-thread-exited.py
+++ b/gdb/testsuite/gdb.python/py-thread-exited.py
@@ -26,6 +26,8 @@ def thread_exited_handler(event):
     global threadOneExit, threadTwoExit, mainThreadExit
     print("{}".format(event))
     assert isinstance(event, gdb.ThreadExitedEvent)
+    # Also check the inheritance.
+    assert isinstance(event, gdb.ThreadEvent)
     if threadOneExit == "":
         threadOneExit = "event type: thread-exited. global num: {}".format(
             event.inferior_thread.global_num

base-commit: 311378bc3b871b199f439152c39debb7ec02e21c
-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent
  2025-09-17 14:51 [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent Tom Tromey
@ 2025-09-17 19:51 ` Simon Marchi
  2025-09-18 14:10   ` Tom Tromey
  2025-09-18 14:16   ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Marchi @ 2025-09-17 19:51 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 9/17/25 10:51 AM, Tom Tromey wrote:
> The documentation says that ThreadExitedEvent is derived from
> ThreadEvent, but the code does not actually implement this.
> 
> This patch fixes the problem.  I propose applying this to gdb 17 as
> well.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33444
> ---
>  gdb/python/py-event-types.def                | 2 +-
>  gdb/testsuite/gdb.python/py-thread-exited.py | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/python/py-event-types.def b/gdb/python/py-event-types.def
> index 15cd9faae69..83167f36163 100644
> --- a/gdb/python/py-event-types.def
> +++ b/gdb/python/py-event-types.def
> @@ -54,7 +54,7 @@ GDB_PY_DEFINE_EVENT_TYPE (new_thread,
>  GDB_PY_DEFINE_EVENT_TYPE (thread_exited,
>  			  "ThreadExitedEvent",
>  			  "GDB thread exited event object",
> -			  event_object_type);
> +			  thread_event_object_type);
>  
>  GDB_PY_DEFINE_EVENT_TYPE (new_inferior,
>  			  "NewInferiorEvent",
> diff --git a/gdb/testsuite/gdb.python/py-thread-exited.py b/gdb/testsuite/gdb.python/py-thread-exited.py
> index ef5a2441b8e..f725bd585c9 100644
> --- a/gdb/testsuite/gdb.python/py-thread-exited.py
> +++ b/gdb/testsuite/gdb.python/py-thread-exited.py
> @@ -26,6 +26,8 @@ def thread_exited_handler(event):
>      global threadOneExit, threadTwoExit, mainThreadExit
>      print("{}".format(event))
>      assert isinstance(event, gdb.ThreadExitedEvent)
> +    # Also check the inheritance.
> +    assert isinstance(event, gdb.ThreadEvent)
>      if threadOneExit == "":
>          threadOneExit = "event type: thread-exited. global num: {}".format(
>              event.inferior_thread.global_num
> 
> base-commit: 311378bc3b871b199f439152c39debb7ec02e21c
> -- 
> 2.51.0
> 

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Did you quickly go through the other event types to make sure there
aren't others which have the same problem?

Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent
  2025-09-17 19:51 ` Simon Marchi
@ 2025-09-18 14:10   ` Tom Tromey
  2025-09-18 14:16   ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2025-09-18 14:10 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Tom Tromey, gdb-patches

Simon> Did you quickly go through the other event types to make sure there
Simon> aren't others which have the same problem?

Yeah.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent
  2025-09-17 19:51 ` Simon Marchi
  2025-09-18 14:10   ` Tom Tromey
@ 2025-09-18 14:16   ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2025-09-18 14:16 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Tom Tromey, gdb-patches

>> This patch fixes the problem.  I propose applying this to gdb 17 as
>> well.

FYI I'm applying this to the gdb 17 branch as well.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-18 14:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-17 14:51 [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent Tom Tromey
2025-09-17 19:51 ` Simon Marchi
2025-09-18 14:10   ` Tom Tromey
2025-09-18 14:16   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox