This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 08/34] Always run async signal handlers in the main UI


On 16-05-26 02:13 PM, Pedro Alves wrote:
> On 05/19/2016 08:28 PM, Simon Marchi wrote:
>> On 16-05-06 08:34 AM, Pedro Alves wrote:
> 
>>> -/* The main UI.  This is the UI that is bound to stdin/stdout/stderr.
>>> -   It always exists and is created automatically when GDB starts
>>> -   up.  */
>>> +/* The main UI.  */
>>>  static struct ui main_ui_;
>>>  
>>> +struct ui *main_ui = &main_ui_;
>>
>> I'd suggest making the pointer const, to show (and make sure) that the main ui
>> never changes throughout the lifetime of the gdb instance:
>>
>>   +struct ui * const main_ui = &main_ui_;
> 
> Hmm, that wouldn't work, because later on the series, main_ui
> becomes heap allocated:
> 
>   https://sourceware.org/ml/gdb-patches/2016-05/msg00125.html
> 
> Guess we could instead have:
> 
>  struct ui *get_main_ui (void);
> 
> To make it clearer that this is not supposed to be an lvalue.
> 
> And likewise maybe:
> 
>  struct ui *get_current_ui (void);
>  void set_current_ui (struct ui *);
> 
> Though unless I'm in for some other major rework of the series,
> at this point I'd rather defer that to a follow up patch.
> I've gone through renaming these objects throughout the whole
> series a few times already, and it's quite painful.  WDYT?

No problem, I mentioned that without seeing the big picture, so you know better.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]