[PATCH v2] gdb: infrun: consume multiple events at each pass in stop_all_threads

Simon Marchi simon.marchi@efficios.com
Fri May 15 16:53:10 GMT 2020


On 2020-05-15 12:15 p.m., Pedro Alves wrote:
> On 5/15/20 5:06 PM, Simon Marchi wrote:
>> No, I haven't considered it, but I think I see what you mean.  To illustrate this case using
>> the remote target, I had to set "maintenance set target-non-stop on", while using
>> "target non-stop off". 
> 
> I think you meant "set non-stop off" in the last command.

Oops, yes.

>> Am I missing something, is there a more common scenario where
>> it gets called, using the remote target?
> 
> Nope, not missing it -- ideally "maintenance set target-non-stop" would
> default to "on", but we're not there yet, unfortunately.
> 
>>
>> With the above, when hitting a breakpoint, I do see the stops sent in sequence as part
>> of stop_all_threads:
>>
>> Sending packet: $vCont;t:p25a703.25a71c#86...Packet received: OK
>> Sending packet: $vCont;t:p25a703.25a71d#87...Packet received: OK
>> Sending packet: $vCont;t:p25a703.25a71e#88...Packet received: OK
>> Sending packet: $vCont;t:p25a703.25a71f#89...Packet received: OK
>> Sending packet: $vCont;t:p25a703.25a720#54...Packet received: OK
> 
> Exactly.
> 
>>
>> which could easily be coalesced.  I think a `target_commit_stop` approach that mimics
>> `target_commit_resume` would work, without being too invasive.  But maybe changing
>> the `target_stop` interface to accept multiple ptids would be a better approach for
>> the future, since it's more of a step towards the gdbserver-style interface that you
>> talked about.  In stop_all_threads, it would be quite easy to use: build a vector of
>> ptid in this loop:
>>
>> 4815           /* Go through all threads looking for threads that we need
>> 4816              to tell the target to stop.  */
>> 4817           for (thread_info *t : all_non_exited_threads ())
>>
>> and call target_stop once after the loop.
> 
> I actually forgot you're looking at a native-only target.  But even then,
> it may help if the debug API level can aggregate stop requests.  Otherwise,
> it probably wouldn't help you.

Exactly.  It's still nice to have a way to illustrate the problem with the remote protocol,
it makes it more obvious I think.

Simon


More information about the Gdb-patches mailing list