From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3325 invoked by alias); 6 Dec 2016 21:23:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3259 invoked by uid 89); 6 Dec 2016 21:23:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Dec 2016 21:23:28 +0000 Received: by simark.ca (Postfix, from userid 33) id 2090C1E18B; Tue, 6 Dec 2016 16:23:26 -0500 (EST) To: Luis Machado Subject: Re: [PATCH] Remove unnecessary inferior lookup in inferior_command X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 06 Dec 2016 21:23:00 -0000 From: Simon Marchi Cc: Simon Marchi , gdb-patches@sourceware.org In-Reply-To: <2efbaa89-3259-ab1e-056a-37f9320e06d0@codesourcery.com> References: <20161205223216.5443-1-simon.marchi@ericsson.com> <2efbaa89-3259-ab1e-056a-37f9320e06d0@codesourcery.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00182.txt.bz2 On 2016-12-05 17:34, Luis Machado wrote: > On 12/05/2016 04:32 PM, Simon Marchi wrote: >> In the case where we switch to a non-running inferior, we do a >> "find_inferior_id (num)", although we did the same call right before. >> We can >> safely remove it. >> >> gdb/ChangeLog: >> >> * inferior.c (inferior_command): Remove duplicate >> find_inferior_id call. >> --- >> gdb/inferior.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/gdb/inferior.c b/gdb/inferior.c >> index 0abd2c058e..9fcdbd3b83 100644 >> --- a/gdb/inferior.c >> +++ b/gdb/inferior.c >> @@ -763,9 +763,6 @@ inferior_command (char *args, int from_tty) >> } >> else >> { >> - struct inferior *inf; >> - >> - inf = find_inferior_id (num); >> set_current_inferior (inf); >> switch_to_thread (null_ptid); >> set_current_program_space (inf->pspace); >> > > Looks fairly obvious. Yeah, I wasn't sure if that would fall under the obvious rule. Sometimes, things that look obvious like that can end up being wrong. But in this case I really don't see how it could happen. Oh well, I decided to be wild and push it, we'll see. :)