diff options
author | Tom Tromey <tromey@adacore.com> | 2021-09-17 07:46:03 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-09-23 09:30:54 -0600 |
commit | c80e29dba968beca5eee7210d2030d27fe7790c3 (patch) | |
tree | b6e08f09ecd225efa78aae2c6966994413a21b5e /gdb/sol-thread.c | |
parent | 96bbe3ef9653e23a17b2315627e0cab441815f2d (diff) | |
download | binutils-c80e29dba968beca5eee7210d2030d27fe7790c3.zip binutils-c80e29dba968beca5eee7210d2030d27fe7790c3.tar.gz binutils-c80e29dba968beca5eee7210d2030d27fe7790c3.tar.bz2 |
Change get_ada_task_ptid parameter type
get_ada_task_ptid currently takes a 'long' as its 'thread' parameter
type. However, on some platforms this is actually a pointer, and
using 'long' can sometimes end up with the value being sign-extended.
This sign extension can cause problems later, if the tid is then later
used as an address again.
This patch changes the parameter type to ULONGEST and updates all the
uses. This approach preserves sign extension on the targets where it
is apparently intended, while avoiding it on others.
Co-Authored-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/sol-thread.c')
-rw-r--r-- | gdb/sol-thread.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 18eacf1..513d030 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -88,7 +88,7 @@ public: void resume (ptid_t, int, enum gdb_signal) override; void mourn_inferior () override; std::string pid_to_str (ptid_t) override; - ptid_t get_ada_task_ptid (long lwp, long thread) override; + ptid_t get_ada_task_ptid (long lwp, ULONGEST thread) override; void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; @@ -1120,7 +1120,7 @@ info_solthreads (const char *args, int from_tty) static int thread_db_find_thread_from_tid (struct thread_info *thread, void *data) { - long *tid = (long *) data; + ULONGEST *tid = (ULONGEST *) data; if (thread->ptid.tid () == *tid) return 1; @@ -1129,7 +1129,7 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data) } ptid_t -sol_thread_target::get_ada_task_ptid (long lwp, long thread) +sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread) { struct thread_info *thread_info = iterate_over_threads (thread_db_find_thread_from_tid, &thread); |