From c80e29dba968beca5eee7210d2030d27fe7790c3 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 17 Sep 2021 07:46:03 -0600 Subject: 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 --- gdb/linux-thread-db.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/linux-thread-db.c') diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 3929589..bfb3bd6 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -102,7 +102,7 @@ public: CORE_ADDR load_module_addr, CORE_ADDR offset) override; const char *extra_thread_info (struct thread_info *) override; - ptid_t get_ada_task_ptid (long lwp, long thread) override; + ptid_t get_ada_task_ptid (long lwp, ULONGEST thread) override; thread_info *thread_handle_to_thread_info (const gdb_byte *thread_handle, int handle_len, @@ -1839,7 +1839,7 @@ thread_db_target::get_thread_local_address (ptid_t ptid, /* Implement the to_get_ada_task_ptid target method for this target. */ ptid_t -thread_db_target::get_ada_task_ptid (long lwp, long thread) +thread_db_target::get_ada_task_ptid (long lwp, ULONGEST thread) { /* NPTL uses a 1:1 model, so the LWP id suffices. */ return ptid_t (inferior_ptid.pid (), lwp); -- cgit v1.1