aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/linux-low.h
diff options
context:
space:
mode:
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>2022-08-18 18:21:18 +0000
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>2023-02-01 20:42:50 +0000
commit43e5fbd8b78848c89c1d0305396464039e452688 (patch)
treef6018863dffb0433fb0631109440ba8689e45d8a /gdbserver/linux-low.h
parentcbd02f9fa521a6cb21c04b15ee7671c8bb4be55b (diff)
downloadgdb-43e5fbd8b78848c89c1d0305396464039e452688.zip
gdb-43e5fbd8b78848c89c1d0305396464039e452688.tar.gz
gdb-43e5fbd8b78848c89c1d0305396464039e452688.tar.bz2
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>
Diffstat (limited to 'gdbserver/linux-low.h')
-rw-r--r--gdbserver/linux-low.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index aebfe05..e672855 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -178,7 +178,7 @@ public:
bool supports_read_auxv () override;
- int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
+ int read_auxv (int pid, CORE_ADDR offset, unsigned char *myaddr,
unsigned int len) override;
int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
@@ -941,22 +941,21 @@ bool thread_db_thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len);
extern int have_ptrace_getregset;
-/* Search for the value with type MATCH in the auxv vector with
- entries of length WORDSIZE bytes. If found, store the value in
- *VALP and return 1. If not found or if there is an error, return
- 0. */
+/* Search for the value with type MATCH in the auxv vector, with entries of
+ length WORDSIZE bytes, of process with pid PID. If found, store the
+ value in *VALP and return 1. If not found or if there is an error,
+ return 0. */
-int linux_get_auxv (int wordsize, CORE_ADDR match,
- CORE_ADDR *valp);
+int linux_get_auxv (int pid, int wordsize, CORE_ADDR match, CORE_ADDR *valp);
/* Fetch the AT_HWCAP entry from the auxv vector, where entries are length
- WORDSIZE. If no entry was found, return zero. */
+ WORDSIZE, of process with pid PID. If no entry was found, return 0. */
-CORE_ADDR linux_get_hwcap (int wordsize);
+CORE_ADDR linux_get_hwcap (int pid, int wordsize);
/* Fetch the AT_HWCAP2 entry from the auxv vector, where entries are length
- WORDSIZE. If no entry was found, return zero. */
+ WORDSIZE, of process with pid PID. If no entry was found, return 0. */
-CORE_ADDR linux_get_hwcap2 (int wordsize);
+CORE_ADDR linux_get_hwcap2 (int pid, int wordsize);
#endif /* GDBSERVER_LINUX_LOW_H */