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] Add "thread-group id" and "id in thread-group" info to -thread-info output


On 2017-02-24 15:22, Simon Marchi wrote:
While writing the documentation parts, these question popped to mind:

- The type of the id-in-tg field (a string) assumes that a thread
belongs to a single group.  Currently, the only kind of "thread-group"
we have is inferiors.  The thread-group terminology suggests that in
the future we might have other kinds of thread groups, like
user-defined arbitrary groups.  Otherwise, why would MI use "thread
group" instead of "inferior"?  Because of this, do you think that the
type of the field will be limiting?  For example, should we document
right that this field can be a list, when a thread is part of multiple
groups, for example?

- The format of the id-in-tg field is "1" for inferior/thread-group 1.
 In -list-thread-groups, the id is shown as "i1".  Again, if there are
other kinds of groups later, we can assume that we'll need to
differentiate the type, so just "1" won't work.  For this reason and
for consistency with the result of -list-thread-groups, should we show
"i1" here as well?

I thought about this a bit more, and I wonder if the solution is not to just use "inferior" here.

In MI, so far, the wording "thread-group" was used instead of inferior. An inferior is one kind (and the only one at the moment) of thread-group. Using "thread-group" instead of "inferior" allows to have new kinds of thread-groups in the future, and still have commands that make sense (e.g. -list-thread-groups, or the --thread-group switch).

However, in this case, the information we want to convey is specifically about inferiors, it will never be about other kinds of thread groups (if some ever exist). Since a thread always has exactly one parent inferior and exactly one id in this inferior, we don't have the single value vs list problem. So I think it would make sense to use "id-in-inf" or instead of "id-in-tg" and "inf-num"/"inf-id" instead of "tg-id".

And I think that also takes care of the format issue, "1" vs "i1". "i1" is the thread-group id. It is necessary to have the i in case other kinds of thread groups appear. But if the field is "inf-num" or "inf-id", then we no longer have the include the i.

Thoughts?

Simon


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