[PATCH 3/4] gdb: pass target to thread_ptid_changed observable

Pedro Alves pedro@palves.net
Wed Aug 5 22:29:12 GMT 2020


On 8/5/20 8:08 PM, Simon Marchi wrote:
> On 2020-08-05 10:50 a.m., Pedro Alves wrote:
>> I don't see why we shouldn't.
> 
> I'd say because it's not worth the trouble.

But there's really no trouble.

> 
>> Assuming that the regcaches are empty
>> like in the current patch can also fail is someone inserts some test
>> before this new test that ends up filling in the regcache.  I see it as
>> your new test being fragile because of that, and running the
>> "maint selftest" while some program is running is just a way
>> to trigger it.  To me, not allowing selftests while the
>> program is running is just an admission that the tests
>> aren't well isolated enough.
>>
> 
> I think it would make more sense to require that each test cleans up
> properly after itself.

scoped_mock_context creates a new inferior list, adds a new inferior
to it with its own test target, adds new thread, and switches to it.  
The destructor restores the previous state.  When we switch to the mock
context, the running inferior is not reachable in the inferior list.
Whether an inferior was running or not, it shouldn't make a difference.
Maybe it should be both scoped_mock_context's constructor and destructor
that call registers_changed.  But I do think we should put a call to
registers_changed somewhere, to maintain invariants properly.

> But anyhow, I'll do as you suggest, I don't mind.

Thanks.


More information about the Gdb-patches mailing list