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 2/6] allow to suppress more mi notification


On 07/27/2012 03:57 AM, Yao Qi wrote:
> On Thursday, July 26, 2012 04:30:18 PM Pedro Alves wrote:
>>> -extern int mi_suppress_breakpoint_notifications;
>>> +
>>> +enum MI_SUPRESS_NOTIFICATION { MI_SUPPRESS_BREAKPOINT };
>>> +extern int mi_suppress_notification[];
>>>
>>>  
>>
>> Quite frankly, I don't see how putting these in an array is better than
>> a separate global for each.  The memory used is the same, and with separate
>> globals, it's a little easier to debug from a top gdb (just print
>> mi_suppress_<TAB> to see the list of possibilities, etc.)  Are you planning
>> on doing something over the whole array, that is abstracted from the
>> semantics of each element of the array?
> 
> The intention of this change is to avoid introducing more global variables to 
> suppress different types of notification.  

More global variables, or more entries in a global array is really not very much
different..  And you still have to add global macros, one for each entry in
the array, so in the end, you end up with _more_ global symbols total.

> I plan to add more notifications
> here (for register change, memory change, trace experiment change, etc), and 
> we need more suppress flags for them.  Array makes sense here.
> 
> AFAICS, I don't do something over the whole array.

Array is really the worse choice.  Use it only when you have the need to iterate
over the elements.  Otherwise, it's just harder to debug.
"p mi_suppress_notification" will show you an array of integers.  Once you have a
few, that will just be cryptic output, and you'll have to
do "p mi_suppress_notification[...]" to make some sense out of it.

If you want to group the variables together, then the first choice should be
a struct instead.  Then you can still inspect the variables easily from
a top gdb.  E.g.,

struct
{
  int breakpoint : 1;
  int option_changed : 1;
  ...
} mi_suppress_notification;

And then you can have:

(gdb) p mi_suppress_notification
(gdb) p mi_suppress_notification.<TAB>
(gdb) p mi_suppress_notification.breakpoint

etc.

-- 
Pedro Alves


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