From cc3afae25a4e37ed7a864a8f4eea1dc11b20d5fb Mon Sep 17 00:00:00 2001 From: Ajit Kumar Agarwal Date: Fri, 10 Oct 2014 18:07:06 +0100 Subject: [PATCH] Microblaze: Reject invalid target descriptions We currently validate the target description, but then forget to reject it if found invalid. Tested that incorrect descriptions are rejected and GDB warns about them. Tested the Microblaze Design with and without stack-protect registers. The gdb command "info registers" displayed the register correctly. If a stack protect design is not selected, only core registers are displayed. When the stack-protect registers are selected in the design, the core registers along with stack-protect registers are displayed. gdb/ 2014-10-10 Ajit Agarwal * microblaze-tdep.c (microblaze_gdbarch_init): If the description isn't valid, release the tdesc arch data and return NULL. --- gdb/ChangeLog | 5 +++++ gdb/microblaze-tdep.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f64bcc91db2..047413c0f0c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-10-10 Ajit Agarwal + + * microblaze-tdep.c (microblaze_gdbarch_init): If the description + isn't valid, release the tdesc arch data and return NULL. + 2014-10-10 Pedro Alves * linux-tdep.c: Include observer.h. diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 6a9f11fbcc2..f257b964c9a 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -722,7 +722,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) MICROBLAZE_SHR_REGNUM, "rshr"); } - } + + if (!valid_p) + { + tdesc_data_cleanup (tdesc_data); + return NULL; + } + } /* Allocate space for the new architecture. */ tdep = XNEW (struct gdbarch_tdep); -- 2.30.2