Don't write to inferior_ptid in gdbarch-selftests.c, mock address_space too
Use switch_to_thread instead of writing to inferior_ptid. This
requires a couple of improvements to the mocking environment. One is
to mock a pspace too, and assigning it to the inferior. In turn, this
requires heap-allocating the address space, so that the regular
program_space dtor destroys the address space correctly.
(Note that new the mock program_space is allocated on the stack, and
thus depends on the previous patch that eliminated
delete_program_space.)
gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>
* gdbarch-selftests.c: Include "progspace-and-thread.h".
(register_to_value_test): Mock a program_space too. Heap-allocate
the address space. Don't write to inferior_ptid. Use
switch_to_thread instead.