[PATCH 4/4] Fix solib-display.exp remote check

Pedro Alves palves@redhat.com
Mon Apr 11 21:38:00 GMT 2016


On 04/11/2016 10:32 PM, Pedro Alves wrote:
> On 04/11/2016 08:26 PM, Simon Marchi wrote:
>> On 2016-04-11 14:27, Pedro Alves wrote:
>>> On 04/06/2016 04:15 AM, Simon Marchi wrote:
>>
> 
> ...
> 
>>> Why did you move the check to within the loop?  I thought one
>>> could check [target_info exists use_gdb_stub] at the top?
>>> I'd find the patch OK with that.  It'd be nicer to avoid
>>> gdb_start_cmd in the first place, but use_gdb_stub is still
>>> an improvement.
>>
>> You're right, I didn't think to check [target_info exists use_gdb_stub]
>> directly.  The global variable use_gdb_stub is only available after
>> having spawned gdb, which is why I moved it.
> 
> Maybe it's be simpler for users to wrap this in a proc, like:
> 
> proc use_gdb_stub {} {
>   global use_gdb_stub
> 
>   if [target_info exists use_gdb_stub] {
>      return $use_gdb_stub
>   }
>   return 0
> }
> 
> Then consistently use the proc.

Or rather:

proc use_gdb_stub {} {
  global use_gdb_stub

  if [info exists use_gdb_stub] {
     return $use_gdb_stub
  }
  return [target_info exists use_gdb_stub]
}

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list