]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdbserver/linux-x86: make is_64bit_tdesc accept thread as a parameter
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 15 Nov 2022 21:48:41 +0000 (16:48 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 18 Nov 2022 16:11:42 +0000 (11:11 -0500)
commit4855cbdc3d8fba4f5f6f61865a40d557c4be6d2c
tree98659dd58763fc8c83ee00410566a70ddf6f7ec4
parentd4895ba2df3bbf38d64fce314f5933d05eb8990a
gdbserver/linux-x86: make is_64bit_tdesc accept thread as a parameter

ps_get_thread_area receives as a parameter the lwpid it must work on.
It then calls is_64bit_tdesc, which uses the current_thread as the
thread to work on.  However, it is not said that both are the same.

This became a problem when working in a following patch that makes
find_one_thread switch to a process but to no thread (current_thread ==
nullptr).  When libthread_db needed to get the thread area,
is_64bit_tdesc would try to get the regcache of a nullptr thread.

Fix that by making is_64bit_tdesc accept the thread to work on as a
parameter.  Find the right thread from the context, when possible (when
we know the lwpid to work on).  Otherwise, pass "current_thread", to
retain the existing behavior.

Reviewed-By: Andrew Burgess <aburgess@redhat.com>
Change-Id: I44394d6be92392fa28de71982fd04517ce8a3007
gdbserver/linux-x86-low.cc