[PATCH] gdb: move some variables to an inner scope in save_waitstatus

Simon Marchi simon.marchi@polymtl.ca
Thu Apr 29 14:17:26 GMT 2021


On 2021-04-29 3:46 a.m., Andrew Burgess wrote:
> * Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> [2021-04-28 23:54:51 -0400]:
> 
>> These two variables:
>>
>>       struct regcache *regcache = get_thread_regcache (tp);
>>       const address_space *aspace = regcache->aspace ();
>>
>> are only needed inside the "if".  Getting a thread's regcache is a
>> somewhat expensive operation, so it's good to avoid it if not necessary.
>> Move the variable declarations and their initialization to the "if"
>> scope.
>>
>> gdb/ChangeLog:
>>
>> 	* infrun.c (save_waitstatus): Move variables to inner scope.
> 
> LGTM.
> 
> Thanks,
> Andrew

Pushed, thanks.

Simon


More information about the Gdb-patches mailing list