Re: [PATCHv8] gdb: Restore previously selected thread when switching inferior

Eli Zaretskii via Gdb-patches
2021-03-23T11:43:03Z

> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Tue, 23 Mar 2021 11:13:36 +0000
>
> gdb/ChangeLog:
>
> * NEWS: Mention new feature and new Python event.
> * data-directory/Makefile.in (PYTHON_FILE_LIST): Add
> restore-thread.py.
> * inferior.c (switch_to_inferior_no_thread): Move declaration of
> some variables into more inner block. Get the current inferior in
> the top function scope. After switching inferior, call the new
> observable.
> * observable.c (inferior_changed): Define new observable.
> * observable.h (inferior_changed): Declare new observable.
> * python/lib/gdb/command/restore-thread.py: New file.
> * python/py-all-events.def (inferior_changed): Declare.
> * python/py-event-types.def (inferior_changed): Declare.
> * python/py-inferior.c (python_inferior_changed): New function.
> (gdbpy_initialize_inferior): Register with inferior_changed
> observer.
>
> gdb/doc/ChangeLog:
>
> * gdb.texinfo (Inferiors Connections and Programs): Mention thread
> tracking within the inferior command.
> (Threads): Mention thread tracking in the general thread
> discussion.
> * python.texinfo (Events In Python): Document new
> gdb.InferiorChangedEvent.
>
> gdb/testsuite/ChangeLog:
>
> * gdb.threads/restore-thread.c: New file.
> * gdb.threads/restore-thread.exp: New file.

The documentation parts are okay, assuming that the following not is
taken care of:

> +@defvar InferiorChangedEvent.from_inferior
> +The gdb.Inferior (@pxref{Inferiors In Python}) that used to be
> +selected, but no longer is.
> +@end defvar
> +
> +@defvar InferiorChangedEvent.to_inferior
> +The gdb.Inferior (@pxref{Inferiors In Python}) that is now the current
> +inferior.
> +@end defvar

There's no need to have more than one copy of the same @pxref so close
to one another; it's enough to have only the first of these.

Thanks.