diff options
author | Pedro Alves <pedro@palves.net> | 2023-12-01 13:31:00 +0000 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2023-12-20 21:18:55 +0000 |
commit | 249d08128787e4e0a977079aa09516d73f196f77 (patch) | |
tree | 45bc735bae678089f08110cbdbbf7cc7ace28440 /gdb/regcache.c | |
parent | d0b591497952db37ed7a5545ced7aad64433f79a (diff) | |
download | gdb-249d08128787e4e0a977079aa09516d73f196f77.zip gdb-249d08128787e4e0a977079aa09516d73f196f77.tar.gz gdb-249d08128787e4e0a977079aa09516d73f196f77.tar.bz2 |
displaced_step_finish: Don't fetch the regcache of exited threads
displaced_step_finish can be called with event_status.kind ==
TARGET_WAITKIND_THREAD_EXITED, and in that case it is not possible to
get at the already-exited thread's registers.
This patch moves the get_thread_regcache calls to branches that
actually need it, where we know the thread is still alive.
It also adds an assertion to get_thread_regcache, to help catching
these broken cases sooner.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I63b5eacb3e02a538fc5087c270d8025adfda88c3
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r-- | gdb/regcache.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c index 6140a05..1217fe7 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -430,6 +430,8 @@ get_thread_regcache (process_stratum_target *target, ptid_t ptid) struct regcache * get_thread_regcache (thread_info *thread) { + gdb_assert (thread->state != THREAD_EXITED); + return get_thread_regcache (thread->inf->process_target (), thread->ptid); } |