From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 2EA31385483C for ; Tue, 23 Mar 2021 11:42:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2EA31385483C Received: from fencepost.gnu.org ([2001:470:142:3::e]:52280) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOfR4-0005bW-N1; Tue, 23 Mar 2021 07:42:58 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2511 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lOfR0-0005sd-Ef; Tue, 23 Mar 2021 07:42:58 -0400 Date: Tue, 23 Mar 2021 13:43:00 +0200 Message-Id: <834kh285a3.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess Cc: gdb-patches@sourceware.org In-Reply-To: <20210323111336.149124-1-andrew.burgess@embecosm.com> (message from Andrew Burgess on Tue, 23 Mar 2021 11:13:36 +0000) Subject: Re: [PATCHv8] gdb: Restore previously selected thread when switching inferior References: <20210323111336.149124-1-andrew.burgess@embecosm.com> X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Mar 2021 11:43:01 -0000 > From: Andrew Burgess > 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.