aboutsummaryrefslogtreecommitdiff
path: root/gdb/microblaze-tdep.c
diff options
context:
space:
mode:
authorMichael Eager <eager@eagercon.com>2014-07-19 17:47:52 -0700
committerMichael Eager <eager@eagercon.com>2014-07-19 17:47:52 -0700
commit164224e96ca270d6cbb61d3e326fc1b0453b30a6 (patch)
treeadbf24226a755d4d3a54cbca093af0db235cb75b /gdb/microblaze-tdep.c
parent57319490943d7ce425c515356f6758ff81bf6c58 (diff)
downloadgdb-164224e96ca270d6cbb61d3e326fc1b0453b30a6.zip
gdb-164224e96ca270d6cbb61d3e326fc1b0453b30a6.tar.gz
gdb-164224e96ca270d6cbb61d3e326fc1b0453b30a6.tar.bz2
Fix for remote G Packet message too long error for baremetal.
Prior to version MicroBlaze v8.10.a,EDK 13.1, XMD's gdbserver stub returned 57 registers in response to GDB's G request. Starting with version MicroBlaze v8.10.a, EDK 13.1, XMD added the slr and shr register, for a count of 59 registers. This patch adds these registers to the expected G response. This patch fixes the above problem for baremetal and also supports the backward compatibility. ChangeLog: 2014-07-02 Ajit Agarwal <ajitkum@xilinx.com> * microblaze-tdep.c (microblaze_register_names): Add the rshr and rslr register names. (microblaze_gdbarch_init): Use of tdesc_has_registers. Use of tdesc_find_feature. Use of tdesc_data_alloc. Use of tdesc_numbered_register. Use of microblaze_register_g_packet_guesses. Use of tdesc_use_registers. Use of set_gdbarch_register_type. (microblaze_register_g_packet_guesses): New. * microblaze-tdep.h (microblaze_reg_num): Add field MICROBLAZE_SLR_REGNUM MICROBLAZE_SHR_REGNUM MICROBLAZE_NUM_REGS and MICROBLAZE_NUM_CORE_REGS. (microblaze_frame_cache): Use of MICROBLAZE_NUM_REGS. * features/microblaze-core.xml: New file. * features/microblaze-stack-protect.xml: New file. * features/microblaze-with-stack-protect.c: New file. * features/microblaze-with-stack-protect.xml: New file. * features/microblaze.xml: New file. * features/microblaze.c: New file. * features/Makefile (microblaze-with-stack-protect): Add microblaze-with-stack-protect microblaze and microblaze-expedite. * regformats/microblaze-with-stack-protect.dat: New file. * regformats/microblaze.dat: New file. * doc/gdb.texinfo (MicroBlaze Features): New. Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
Diffstat (limited to 'gdb/microblaze-tdep.c')
-rw-r--r--gdb/microblaze-tdep.c61
1 files changed, 59 insertions, 2 deletions
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 14c1b52..7e89241 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -33,13 +33,16 @@
#include "frame-unwind.h"
#include "dwarf2-frame.h"
#include "osabi.h"
-
#include "gdb_assert.h"
#include <string.h>
#include "target-descriptions.h"
#include "opcodes/microblaze-opcm.h"
#include "opcodes/microblaze-dis.h"
#include "microblaze-tdep.h"
+#include "remote.h"
+
+#include "features/microblaze-with-stack-protect.c"
+#include "features/microblaze.c"
/* Instruction macros used for analyzing the prologue. */
/* This set of instruction macros need to be changed whenever the
@@ -73,7 +76,8 @@ static const char *microblaze_register_names[] =
"rpc", "rmsr", "rear", "resr", "rfsr", "rbtr",
"rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
"rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
- "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi"
+ "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
+ "rslr", "rshr"
};
#define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
@@ -664,16 +668,63 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
return dwarf2_to_reg_map[reg];
}
+static void
+microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
+{
+ register_remote_g_packet_guess (gdbarch,
+ 4 * MICROBLAZE_NUM_CORE_REGS,
+ tdesc_microblaze);
+
+ register_remote_g_packet_guess (gdbarch,
+ 4 * MICROBLAZE_NUM_REGS,
+ tdesc_microblaze_with_stack_protect);
+}
+
static struct gdbarch *
microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
+ struct tdesc_arch_data *tdesc_data = NULL;
+ const struct target_desc *tdesc = info.target_desc;
/* If there is already a candidate, use it. */
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
+ if (tdesc == NULL)
+ tdesc = tdesc_microblaze;
+
+ /* Check any target description for validity. */
+ if (tdesc_has_registers (tdesc))
+ {
+ const struct tdesc_feature *feature;
+ int valid_p;
+ int i;
+
+ feature = tdesc_find_feature (tdesc,
+ "org.gnu.gdb.microblaze.core");
+ if (feature == NULL)
+ return NULL;
+ tdesc_data = tdesc_data_alloc ();
+
+ valid_p = 1;
+ for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
+ valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
+ microblaze_register_names[i]);
+ feature = tdesc_find_feature (tdesc,
+ "org.gnu.gdb.microblaze.stack-protect");
+ if (feature != NULL)
+ {
+ valid_p = 1;
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
+ MICROBLAZE_SLR_REGNUM,
+ "rslr");
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
+ MICROBLAZE_SHR_REGNUM,
+ "rshr");
+ }
+ }
/* Allocate space for the new architecture. */
tdep = XNEW (struct gdbarch_tdep);
@@ -716,6 +767,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
+ microblaze_register_g_packet_guesses (gdbarch);
+
frame_base_set_default (gdbarch, &microblaze_frame_base);
/* Hook in ABI-specific overrides, if they have been registered. */
@@ -725,6 +778,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
dwarf2_append_unwinders (gdbarch);
frame_unwind_append_unwinder (gdbarch, &microblaze_frame_unwind);
frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
+ if (tdesc_data != NULL)
+ tdesc_use_registers (gdbarch, tdesc, tdesc_data);
return gdbarch;
}
@@ -737,6 +792,8 @@ _initialize_microblaze_tdep (void)
{
register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
+ initialize_tdesc_microblaze_with_stack_protect ();
+ initialize_tdesc_microblaze ();
/* Debug this files internals. */
add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
&microblaze_debug_flag, _("\