Microblaze: Reject invalid target descriptions
authorAjit Kumar Agarwal <ajitkum@xilinx.com>
Fri, 10 Oct 2014 17:07:06 +0000 (18:07 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 10 Oct 2014 17:07:06 +0000 (18:07 +0100)
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  <ajitkum@xilinx.com>

* microblaze-tdep.c (microblaze_gdbarch_init): If the description
isn't valid, release the tdesc arch data and return NULL.

gdb/ChangeLog
gdb/microblaze-tdep.c

index f64bcc91db29add98ceef20ff681b24fbf90a580..047413c0f0c838e921b310c797b2e7b0e4606003 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-10  Ajit Agarwal  <ajitkum@xilinx.com>
+
+       * 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  <palves@redhat.com>
 
        * linux-tdep.c: Include observer.h.
index 6a9f11fbcc2462a6f6b92f8e697aaab2b0be8cd3..f257b964c9aed9a648ce7343cf1c58987d561834 100644 (file)
@@ -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);