aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-09-13 16:48:51 +0100
committerAlan Hayward <alan.hayward@arm.com>2018-09-13 16:48:51 +0100
commit182f44d67243a3270ec540e92a8ba6ea327ba004 (patch)
tree213ef4b0ee0994961c0fbf412398d7a465b6bdf9
parentc749ff472db05b55b183eac3de5a0edd75798a56 (diff)
downloadfsf-binutils-gdb-182f44d67243a3270ec540e92a8ba6ea327ba004.zip
fsf-binutils-gdb-182f44d67243a3270ec540e92a8ba6ea327ba004.tar.gz
fsf-binutils-gdb-182f44d67243a3270ec540e92a8ba6ea327ba004.tar.bz2
Add gdbserver target methods target_validate_tdesc and arch_setup
target_validate_tdesc () is added as a new target function. This function checks current target description is still valid for the current inferior, returning false if not. On SVE, we need to check if the vector length has changed - if it has then the current target descriptor will need to be switched to a valid one. The existing arch_setup () is extended to be a target function. This will later allow it to be called from get_thread_regcache () in gdbserver/regcache.c. This call is required to generate a new target descriptor if we have decided the current one is no longer valid. 2018-09-13 Alan Hayward <alan.hayward@arm.com> gdbserver/ * linux-aarch64-low.c (int aarch64_validate_tdesc): New function. (struct linux_target_ops): Add aarch64_validate_tdesc. * linux-low.c (linux_validate_tdesc): New function. (linux_target_ops): Add linux_arch_setup and linux_validate_tdesc. * linux-low.h (linux_target_ops): Add validate_tdesc. * target.h (struct target_ops): Likewise. (target_arch_setup) New macro. (target_validate_tdesc) New macro.
-rw-r--r--gdb/gdbserver/linux-aarch64-low.c10
-rw-r--r--gdb/gdbserver/linux-low.c11
-rw-r--r--gdb/gdbserver/linux-low.h3
-rw-r--r--gdb/gdbserver/target.h18
4 files changed, 42 insertions, 0 deletions
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 1d34e31..dcc19ce 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -3037,6 +3037,14 @@ aarch64_supports_hardware_single_step (void)
return 1;
}
+/* Implementation of the linux_target_ops method "validate_tdesc ". */
+
+static bool
+aarch64_validate_tdesc (struct thread_info *thread)
+{
+ return true;
+}
+
struct linux_target_ops the_low_target =
{
aarch64_arch_setup,
@@ -3075,6 +3083,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.c b/gdb/gdbserver/linux-low.c
index 984464f..7153242 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6576,6 +6576,15 @@ linux_get_ipa_tdesc_idx (void)
return (*the_low_target.get_ipa_tdesc_idx) ();
}
+static bool
+linux_validate_tdesc (struct thread_info *thread)
+{
+ if (the_low_target.validate_tdesc == NULL)
+ return true;
+
+ return (*the_low_target.validate_tdesc) (thread);
+}
+
static int
linux_supports_tracepoints (void)
{
@@ -7526,6 +7535,8 @@ static struct target_ops linux_target_ops = {
#else
NULL,
#endif
+ linux_arch_setup,
+ linux_validate_tdesc,
};
#ifdef HAVE_LINUX_REGSETS
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 79b3311..a99e6fc 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -256,6 +256,9 @@ struct linux_target_ops
/* See target.h. */
int (*get_ipa_tdesc_idx) (void);
+
+ /* See target.h. */
+ bool (*validate_tdesc) (struct thread_info *thread);
};
extern struct linux_target_ops the_low_target;
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index fce54e0..dfa74ec 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -478,6 +478,16 @@ struct target_ops
false for failure. Return pointer to thread handle via HANDLE
and the handle's length via HANDLE_LEN. */
bool (*thread_handle) (ptid_t ptid, gdb_byte **handle, int *handle_len);
+
+ /* Call the target arch_setup function on the current thread. */
+ void (*arch_setup) (void);
+
+ /* Check that the current target description is still valid for the current
+ inferior, returning false if not. For example, if the size of some
+ registers (see aarch64 SVE), or the number of registers, had changed.
+ This check does not include the contents of the registers. Default
+ implementation will always return true. */
+ bool (*validate_tdesc) (struct thread_info *thread);
};
extern struct target_ops *the_target;
@@ -565,6 +575,14 @@ int kill_inferior (process_info *proc);
(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) : true)
+
#define thread_stopped(thread) \
(*the_target->thread_stopped) (thread)