Re: [PATCH 3/3] gdb/python: new events.corefile_changed event

Eli Zaretskii
2026-03-30T17:07:05Z

> From: Andrew Burgess <aburgess@redhat.com>
> Cc: Andrew Burgess <aburgess@redhat.com>
> Date: Mon, 30 Mar 2026 16:30:53 +0100
>
> Add a new Python event registry, events.corefile_changed. This event
> is emitted each time the corefile within an inferior changes.
>
> The event object has a single 'inferior' attribute which is the
> gdb.Inferior object for which the core file changed. The user can
> then inspect Inferior.corefile to see details about the new core file,
> or this will be None if the core file was removed from the inferior.
>
> I've updated the existing test to cover this new event.
>
> The new test covers both the corefile_changed event, but also monitors
> the exited event. This ties in to the work done in the previous
> commit where we use whether the inferior has exited or not as a guard
> for whether core_target::exit_core_file_inferior should be called.
> Unloading a core file should result in a single corefile_changed event
> and a single exited event.
> ---
> gdb/NEWS | 5 +
> gdb/doc/python.texi | 11 ++
> gdb/python/py-all-events.def | 1 +
> gdb/python/py-corefile.c | 36 ++++++
> gdb/python/py-event-types.def | 5 +
> gdb/testsuite/gdb.python/py-corefile.exp | 140 ++++++++++++++++++++---
> gdb/testsuite/gdb.python/py-corefile.py | 117 +++++++++++++++++++
> 7 files changed, 296 insertions(+), 19 deletions(-)

Thanks, the documentation parts are okay.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>