Re: [PATCH 02/23] Don't rely on inferior_ptid in record_full_wait

Simon Marchi
2020-08-03T00:08:56Z

On 2020-08-02 1:52 p.m., Tom Tromey wrote:
> No, I didn't notice that the wait_as function sets the kind at the
> start. So some minus_one_ptid returns seem to use
> TARGET_WAITKIND_IGNORE.

That's fine. But FWIW, I think it's not right to see the ptid as the "main" thing
the wait methods return. They primarily return a "waitkind", and depending on that
waitkind's kind, there may be a payload attached to it.

If you return TARGET_WAITKIND_IGNORE, there's no payload attached to it.

If you return TARGET_WAITKIND_EXITED, then there must be a ptid (in ecs->ptid)
as well as an exit code (in ecs->ws.value.integer).

If you return TARGET_WAITKIND_STOPPED, then there must be a ptid (in ecs->ptid)
as well as a signal number (in ecs->ws.value.sig).

And so on.

I think that the fact that the wait methods return a ptid is an historical quirk, but
my intuition is that it's not that important, and not the central piece of what "wait"
returns.

Simon