diff mbox

[3/8] AARCH64 SVE: Add gdbserver target methods

Message ID D46B0DAE.154E9%alan.hayward@arm.com
State New
Headers show

Commit Message

Alan Hayward Dec. 5, 2016, 12:27 p.m. UTC
This is part of a series adding AARCH64 SVE support to gdb and gdbserver.

This patch changes target methods for gdbserver, specifically:
Adds validate_tdesc (by default returns true)
Makes arch_setup into target function.

These methods will remain unused until a later patch in the series.

Tested on x86 and aarch64.
Ok to commit?

Alan.
diff mbox

Patch

diff --git a/gdb/gdbserver/linux-aarch64-low.c
b/gdb/gdbserver/linux-aarch64-low.c
index 
ae80cddf30694619a115d2ff22e40fd463fc6006..a4cf4746285683e1529142b0073f58b68
eed9cf3 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -2967,6 +2967,13 @@  aarch64_supports_hardware_single_step (void)
   return 1;
 }

+/* Check the regcache and target descriptor are still valid.  */
+
+int aarch64_validate_tdesc (struct thread_info *thread)
+{
+  return 1;
+}
+
 struct linux_target_ops the_low_target =
 {
   aarch64_arch_setup,
@@ -3003,6 +3010,8 @@  struct linux_target_ops the_low_target =
   aarch64_breakpoint_kind_from_current_state,
   aarch64_supports_hardware_single_step,
   aarch64_get_syscall_trapinfo,
+  NULL, /* get_ipa_tdesc_idx.  */
+  aarch64_validate_tdesc,
 };

 void
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 
476816db4821f3ef9a49b1afd407fea2586c7394..b5ac8de5ccee13866d6b74a34d3db8741
2537e66 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -247,6 +247,9 @@  struct linux_target_ops

   /* See target.h.  */
   int (*get_ipa_tdesc_idx) (void);
+
+  /* See target.h.  */
+  int (*validate_tdesc) (struct thread_info *thread);
 };

 extern struct linux_target_ops the_low_target;
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 
e3e372cb9c51ade793a3ffd1915e879fd1a1da42..602f7376c60a9b7b23496e4e0dea437e9
85f7c71 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6721,6 +6721,15 @@  linux_get_ipa_tdesc_idx (void)
 }

 static int
+linux_validate_tdesc (struct thread_info *thread)
+{
+  if (the_low_target.validate_tdesc == NULL)
+    return 1;
+
+  return (*the_low_target.validate_tdesc) (thread);
+}
+
+static int
 linux_supports_tracepoints (void)
 {
   if (*the_low_target.supports_tracepoints == NULL)
@@ -7698,6 +7707,8 @@  static struct target_ops linux_target_ops = {
   linux_supports_software_single_step,
   linux_supports_catch_syscall,
   linux_get_ipa_tdesc_idx,
+  linux_arch_setup,
+  linux_validate_tdesc,
 };

 #ifdef HAVE_LINUX_REGSETS
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 
d098a92efef2adcf8ced2d292facda8e2e62db03..de880b41a0ee2de48e56432e87f29353a
e369aa9 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -474,6 +474,13 @@  struct target_ops

   /* Return tdesc index for IPA.  */
   int (*get_ipa_tdesc_idx) (void);
+
+  /* Call the target arch_setup function on the current thread.  */
+  void (*arch_setup) (void);
+
+  /* Check that the target descriptor and regcache are still valid.
+     Fix them up if they are not.  */
+  int (*validate_tdesc) (struct thread_info *thread);
 };

 extern struct target_ops *the_target;
@@ -561,6 +568,14 @@  int kill_inferior (int);
   (the_target->get_min_fast_tracepoint_insn_len		\
    ? (*the_target->get_min_fast_tracepoint_insn_len) () : 0)

+#define target_arch_setup(thread)			\
+  if (the_target->arch_setup)				\
+    (*the_target->arch_setup) ();
+
+#define target_validate_tdesc(thread)			\
+  (the_target->validate_tdesc				\
+    ? (*the_target->validate_tdesc) (thread) : 1)
+
 #define thread_stopped(thread) \
   (*the_target->thread_stopped) (thread)