Re: [PATCH] Per-inferior thread IDs

Pedro Alves
2015-12-18T18:47:35Z

On 12/18/2015 05:53 PM, Joel Brobecker wrote:
>> However, before I dig deeper, I thought I'd post this for feedback.
>
> FWIW, I think that this is a fairly nice way of addressing the problem!
>
> The only question I have is that I'm a little unclear as to what
> it will look like with GDB/MI. From what I can tell, there is no
> real change at all, meaning that the "thread-id" is the thread's
> global ID.

Exactly, no change at all.

> But perhaps it wouuld be nice to add an extra field
> giving the thread's ID in string form. Newer IDEs knowing about
> this new feature would then have an easy way to present the list
> of threads using the same representation as the one we see with
> the CLI interface. Just a thought...

Yeah.

>
> Another way would be to provide the per-inferior-thread-id in numeric
> form, which should be sufficient, since I think the inferior-id is
> already provided. It has a cleaner feel to it, but on the other hand,
> it forces the IDEs to rebuild the thread ID by hand - which is not so
> simple, since we have this exception where if there is one inferior
> whose ID is 1, we don't use the composite thread ID.

Indeed, hadn't thought of that point.

In an earlier revision of the patch I followed the numeric approach.
I had a couple new fields to -thread-info output, like:

- ^done,threads=[{id="6", ...} ...
+ ^done,threads=[{thread-group="i2", per-tg-id="3",id="6", ...} ...

and:

- =thread-created,id=3,group-id="i2"
+ =thread-created,id=3,group-id="i2",per-tg-id="3"

But after chatting with Marc Khouzam (Eclipse CDT) about the whole
change's impact, we came to the conclusion that we can add this later
when we find a needed. So I left that out of the patch for now.

Maybe we should need the new field in the =thread-created event,
not sure. Or we go through everywhere and make sure we're consistent.
I'm just dodging thinking about all that for now. :-)

>
> That being said, maybe the IDEs don't even (need to) display
> that ID... So we could also leave that question open for debate
> when the need actually materializes...
>

That's my hope. :-)

Thanks,
Pedro Alves