Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent
Date: Wed, 17 Sep 2025 08:51:54 -0600	[thread overview]
Message-ID: <20250917145154.2690156-1-tromey@adacore.com> (raw)

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


             reply	other threads:[~2025-09-17 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 14:51 Tom Tromey [this message]
2025-09-17 19:51 ` Simon Marchi
2025-09-18 14:10   ` Tom Tromey
2025-09-18 14:16   ` 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=20250917145154.2690156-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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