* [PATCH] Remove unnecessary inferior lookup in inferior_command
@ 2016-12-05 22:32 Simon Marchi
2016-12-05 22:34 ` Luis Machado
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2016-12-05 22:32 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
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);
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Remove unnecessary inferior lookup in inferior_command
2016-12-05 22:32 [PATCH] Remove unnecessary inferior lookup in inferior_command Simon Marchi
@ 2016-12-05 22:34 ` Luis Machado
2016-12-06 21:23 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Luis Machado @ 2016-12-05 22:34 UTC (permalink / raw)
To: Simon Marchi, gdb-patches
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Remove unnecessary inferior lookup in inferior_command
2016-12-05 22:34 ` Luis Machado
@ 2016-12-06 21:23 ` Simon Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2016-12-06 21:23 UTC (permalink / raw)
To: Luis Machado; +Cc: Simon Marchi, gdb-patches
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. :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-06 21:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-05 22:32 [PATCH] Remove unnecessary inferior lookup in inferior_command Simon Marchi
2016-12-05 22:34 ` Luis Machado
2016-12-06 21:23 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox