Fix IA-64 GNU/Linux build (Re: [PATCH v2 18/24] Multi-target support)

Pedro Alves
2020-05-16T11:33:32Z

On 5/16/20 9:16 AM, Andreas Schwab wrote:
> ../../gdb/ia64-linux-nat.c: In function ‘void enable_watchpoints_in_psr(ptid_t)’:
> ../../gdb/ia64-linux-nat.c:535:56: error: no matching function for call to ‘get_thread_regcache(ptid_t&)’
> struct regcache *regcache = get_thread_regcache (ptid);
> ^
> In file included from ../../gdb/ia64-linux-nat.c:25:0:
> ../../gdb/regcache.h:35:25: note: candidate: regcache* get_thread_regcache(process_stratum_target*, ptid_t)
> extern struct regcache *get_thread_regcache (process_stratum_target *target,
> ^
> ../../gdb/regcache.h:35:25: note: candidate expects 2 arguments, 1 provided
> ../../gdb/regcache.h:39:25: note: candidate: regcache* get_thread_regcache(thread_info*)
> extern struct regcache *get_thread_regcache (thread_info *thread);
> ^
> ../../gdb/regcache.h:39:25: note: no known conversion for argument 1 from ‘ptid_t’ to ‘thread_info*’

I don't have an IA-64 cross compiler handy, but I believe the below
should fix it. I went ahead and merged it.

From 9bf058f09457de5efd094b87081b7d031ce96cbc Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Sat, 16 May 2020 12:26:56 +0100
Subject: [PATCH] Fix IA64 GNU/Linux build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit should fix:

../../gdb/ia64-linux-nat.c: In function ‘void enable_watchpoints_in_psr(ptid_t)’:
../../gdb/ia64-linux-nat.c:535:56: error: no matching function for call to ‘get_thread_regcache(ptid_t&)’
struct regcache *regcache = get_thread_regcache (ptid);
^
In file included from ../../gdb/ia64-linux-nat.c:25:0:
../../gdb/regcache.h:35:25: note: candidate: regcache* get_thread_regcache(process_stratum_target*, ptid_t)
extern struct regcache *get_thread_regcache (process_stratum_target *target,
^
../../gdb/regcache.h:35:25: note: candidate expects 2 arguments, 1 provided
../../gdb/regcache.h:39:25: note: candidate: regcache* get_thread_regcache(thread_info*)
extern struct regcache *get_thread_regcache (thread_info *thread);
^
../../gdb/regcache.h:39:25: note: no known conversion for argument 1 from ‘ptid_t’ to ‘thread_info*’

gdb/ChangeLog:
2020-05-16 Pedro Alves <palves@redhat.com>

* ia64-linux-nat.c
(ia64_linux_nat_target) <enable_watchpoints_in_psr(ptid_t)>:
Declare method.
(enable_watchpoints_in_psr): Now a method of ia64_linux_nat_target.
---
gdb/ChangeLog | 7 +++++++
gdb/ia64-linux-nat.c | 8 +++++---
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0e8e47d8d22..1c4dc5c94c2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-16 Pedro Alves <palves@redhat.com>
+
+ * ia64-linux-nat.c
+ (ia64_linux_nat_target) <enable_watchpoints_in_psr(ptid_t)>:
+ Declare method.
+ (enable_watchpoints_in_psr): Now a method of ia64_linux_nat_target.
+
2020-05-15 Simon Marchi <simon.marchi@efficios.com>

* sparc64-tdep.c (adi_stat_t): Remove typedef (leaving struct).
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 01cfa0decd5..8f36ea78e76 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -80,6 +80,8 @@ class ia64_linux_nat_target final : public linux_nat_target
/* Override linux_nat_target low methods. */
void low_new_thread (struct lwp_info *lp) override;
bool low_status_is_event (int status) override;
+
+ void enable_watchpoints_in_psr (ptid_t ptid);
};

static ia64_linux_nat_target the_ia64_linux_nat_target;
@@ -529,10 +531,10 @@ fill_fpregset (const struct regcache *regcache,
#define IA64_PSR_DB (1UL << 24)
#define IA64_PSR_DD (1UL << 39)

-static void
-enable_watchpoints_in_psr (ptid_t ptid)
+void
+ia64_linux_nat_target::enable_watchpoints_in_psr (ptid_t ptid)
{
- struct regcache *regcache = get_thread_regcache (ptid);
+ struct regcache *regcache = get_thread_regcache (this, ptid);
ULONGEST psr;

regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);

base-commit: 8bbf03947dd594262e672c1fbc3462a81c811b6f
--
2.14.5