Re: [PATCH v3 4/5] gdb: generalize commit_resume, avoid commit-resuming when threads have pending statuses

Simon Marchi via Gdb-patches
2021-01-22T22:08:01Z

On 2021-01-11 3:28 p.m., Simon Marchi wrote:
> On 2021-01-09 3:34 p.m., Pedro Alves wrote:
>>> @@ -86,6 +77,35 @@ class process_stratum_target : public target_ops
>>>
>>> /* The connection number. Visible in "info connections". */
>>> int connection_number = 0;
>>> +
>>> + /* Whether resumed threads must be committed to the target.
>>> +
>>> + When true, resumed threads must be committed to the execution target.
>>> +
>>> + When false, the process stratum target may leave resumed threads stopped
>>> + when it's convenient or efficient to do so. When the core requires resumed
>>> + threads to be committed again, this is set back to true and calls the
>>> + `commit_resumed` method to allow the target to do so.
>>> +
>>> + To simplify the implementation of process stratum targets, the following
>>> + methods are guaranteed to be called with COMMIT_RESUMED_STATE set to
>>> + false:
>>> +
>>> + - resume
>>> + - stop
>>> + - wait
>>
>> Should we mention this in the documentation of each of these methods?
>
> Yeah that would be nice. Would you mention it in both places
> or just in those methods' documentation?

I just remembered why I put it there and not on the target methods.
Since commit-resumed is a concept specific to process targets, I don't
think that information belongs in struct target_ops, since it doesn't
make sense for other target_ops implementers.

Simon