Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent
Date: Wed, 17 Sep 2025 15:51:50 -0400	[thread overview]
Message-ID: <17c08ef5-d8bc-4632-8c61-2f42ec5b124e@simark.ca> (raw)
In-Reply-To: <20250917145154.2690156-1-tromey@adacore.com>

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

  reply	other threads:[~2025-09-17 19:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 14:51 Tom Tromey
2025-09-17 19:51 ` Simon Marchi [this message]
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=17c08ef5-d8bc-4632-8c61-2f42ec5b124e@simark.ca \
    --to=simark@simark.ca \
    --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