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: [RFA 1/5] Remove some ui_out-related cleanups from Python


On Thu, Feb 9, 2017 at 4:51 AM, Pedro Alves <palves@redhat.com> wrote:
> On 02/09/2017 12:48 PM, Pedro Alves wrote:
>> Hi Matt,
>>
>> On 02/09/2017 04:34 AM, Matt Rice wrote:
>>
>>> Wondering if this would be a good opportunity to try and transition
>>> ui_out_list construction into a more type safe manner, e.g.
>>> result ==> variable "=" value
>>> list ==> "[]" | "[" value ( "," value )* "]" | "[" result ( "," result )* "]"
>>>
>>> currently when building a list, it didn't specify whether you were
>>> declaring a list of results or a list of values, unless/until the
>>> first value or result was added, and IIRC this | property wasn't
>>> really explicitly enforced.
>>
>> More type-safety sounds good to me.  :-)
>>
>> Can you give an example of a command that outputs a result list,
>> and an example of a command that outputs a value list?
>>

There is a good example of a command which outputs both in the
documentation (in the example below "The -break-insert command")

interpreter-exec mi -break-insert main
interpreter-exec mi -break-insert -t foo
interpreter-exec mi -break-list

in the output of the -break-list command there is a list of results of the form:
body=[bkpt=... , bkpt=...]

https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI-Breakpoint-Commands.html#g_t_002dbreak_002dinsert

I picked that one specifically because it shows the duplicate "bkpt" keys.
inside those bkpt={... thread-groups=["i1"] ... } should be a list of values.

interpreter-exec mi -list-thread-groups is a slightly easier to read
one that returns a list of values (tuples)
^done,groups=[tuple, ...]

Additionally of note is:
https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax
* New gdb/mi commands should only output lists containing values.

So, i suppose result_list should be some variation on
compat_only_result_list or some such...

>>> it'd be nice to migrate this to something like:
>>> result_list, value_list, deprecated_unspecified_list, It would be nice
>>> to know if/when you guys think it would be a convenient time to
>>> introduce such a change so I could get back up to speed...
>>
>> Simon has already C++-fyed ui_out in master, so this seems like
>> a good time to me.
>
> Though, to be clear, IIUC, you're talking about changing
> GDB internals without affecting the resulting MI output, right?

Yes, internals change only,


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