gdbserver: Add PID parameter to linux_get_auxv and linux_get_hwcap
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>
Thu, 18 Aug 2022 18:21:18 +0000 (18:21 +0000)
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>
Wed, 1 Feb 2023 20:42:50 +0000 (20:42 +0000)
commit43e5fbd8b78848c89c1d0305396464039e452688
treef6018863dffb0433fb0631109440ba8689e45d8a
parentcbd02f9fa521a6cb21c04b15ee7671c8bb4be55b
gdbserver: Add PID parameter to linux_get_auxv and linux_get_hwcap

This patch doesn't change gdbserver behaviour, but after later changes are
made it avoids a null pointer dereference when HWCAP needs to be obtained
for a specific process while current_thread is nullptr.

Fixing linux_read_auxv, linux_get_hwcap and linux_get_hwcap2 to take a PID
parameter seems more correct than setting current_thread in one particular
code path.

Changes are propagated to allow passing the new parameter through the call
chain.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdbserver/linux-aarch64-low.cc
gdbserver/linux-arm-low.cc
gdbserver/linux-low.cc
gdbserver/linux-low.h
gdbserver/linux-ppc-low.cc
gdbserver/linux-s390-low.cc
gdbserver/netbsd-low.cc
gdbserver/netbsd-low.h
gdbserver/server.cc
gdbserver/target.cc
gdbserver/target.h