This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 08/34] Always run async signal handlers in the main UI
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Pedro Alves <palves at redhat dot com>, <gdb-patches at sourceware dot org>
- Date: Thu, 26 May 2016 14:15:13 -0400
- Subject: Re: [PATCH v3 08/34] Always run async signal handlers in the main UI
- Authentication-results: sourceware.org; auth=none
- References: <1462538104-19109-1-git-send-email-palves at redhat dot com> <1462538104-19109-9-git-send-email-palves at redhat dot com> <573E13D0 dot 7010104 at ericsson dot com> <fe3b1df5-3533-3ae0-5cee-e953225a3abf at redhat dot com>
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