diff options
author | Pedro Alves <palves@redhat.com> | 2020-01-10 20:05:48 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2020-01-10 20:05:48 +0000 |
commit | f3f8ece4b1c77c925d1f1566df0bf632790a4d24 (patch) | |
tree | 6ded291c77a7b5e3d235093c573275247425e4e3 /gdb/infrun.h | |
parent | db2d40f7d0b8477ca5ad9e305b8137a085434c97 (diff) | |
download | gdb-f3f8ece4b1c77c925d1f1566df0bf632790a4d24.zip gdb-f3f8ece4b1c77c925d1f1566df0bf632790a4d24.tar.gz gdb-f3f8ece4b1c77c925d1f1566df0bf632790a4d24.tar.bz2 |
switch inferior/thread before calling target methods
Once each inferior has its own target stack, we'll need to make sure
that the right inferior is selected before we call into target
methods.
It kind of sounds worse than it is in practice. Not that many places
need to be concerned.
In thread.c, we add a new switch_to_thread_if_alive function that
centralizes the switching before calls to target_thread_alive. Other
cases are handled with explicit switching.
gdb/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
* gdbthread.h (scoped_restore_current_thread)
<dont_restore, restore, m_dont_restore>: Declare.
* thread.c (thread_alive): Add assertion. Return bool.
(switch_to_thread_if_alive): New.
(prune_threads): Switch inferior/thread.
(print_thread_info_1): Switch thread before calling target methods.
(scoped_restore_current_thread::restore): New, factored out from
...
(scoped_restore_current_thread::~scoped_restore_current_thread):
... this.
(scoped_restore_current_thread::scoped_restore_current_thread):
Add assertion.
(thread_apply_all_command, thread_select): Use
switch_to_thread_if_alive.
* infrun.c (proceed, restart_threads, handle_signal_stop)
(switch_back_to_stepped_thread): Switch current thread before
calling target methods.
Diffstat (limited to 'gdb/infrun.h')
0 files changed, 0 insertions, 0 deletions