[binutils-gdb] Remove unnecessary inferior lookup in infrun:handle_one

Pedro Alves palves@sourceware.org
Mon Mar 7 16:29:07 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3db1354160aa48995ff37f032310213f0b1cf768

commit 3db1354160aa48995ff37f032310213f0b1cf768
Author: Pedro Alves <pedro@palves.net>
Date:   Mon Mar 7 16:09:41 2022 +0000

    Remove unnecessary inferior lookup in infrun:handle_one
    
    infrun.c:handle_one calls find_inferior_ptid unnecessarily, since we
    already have a thread pointer handy, and the thread has a pointer to
    the inferior.  This commit removes the unnecessary lookup.
    
    Change-Id: I2ae18601dd75346c6c91068e9a4f9a6484fb3339

Diff:
---
 gdb/infrun.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 85d8404f5b3..e3c1db73749 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4845,8 +4845,7 @@ handle_one (const wait_one_event &event)
 
       /* This may be the first time we see the inferior report
 	 a stop.  */
-      inferior *inf = find_inferior_ptid (event.target, event.ptid);
-      if (inf->needs_setup)
+      if (t->inf->needs_setup)
 	{
 	  switch_to_thread_no_regs (t);
 	  setup_inferior (0);


More information about the Gdb-cvs mailing list