public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com>
To: Michael Eager <eager@eagercon.com>,
	"gdb-patches@sourceware.org"	<gdb-patches@sourceware.org>,
	Yao Qi <yao@codesourcery.com>, Pedro Alves	<palves@redhat.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
	Vinod Kathail <vinodk@xilinx.com>,
	Vidhumouli Hunsigida <vidhum@xilinx.com>,
	Nagaraju Mekala	<nmekala@xilinx.com>
Subject: RE: [Patch, microblaze]: Add slr and shr regs
Date: Mon, 26 May 2014 10:04:00 -0000	[thread overview]
Message-ID: <2e5c185d-329c-46cf-930c-8cc2288891aa@BN1BFFO11FD019.protection.gbl> (raw)
In-Reply-To: <537FCEDA.9030504@eagercon.com>

[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]


Based on the feedback and incorporated all review comment, updated the patch.

 [Patch, microblaze]: Add slr and shr regs

   Prior to version x.xx, XMD's gdbserver stub returned 57 registers in
   response to GDB's G request.  Starting with version x.xx, XMD added the
   slr and shr register, for a count of 59 registers.  This patch adds
   these registers to the expected G response

ChangeLog:
2014-05-26 Ajit Agarwal <ajitkum@xilinx.com>

        * Makefile.in (microblaze-linux.c): New rule.

        * microblaze-tdep.c (microblaze_register_names): Add
        the rshr and rslr register names.

        * microblaze-tdep.h (microblaze_reg_num): Add
        field MICROBLAZE_SLR_REGNUM and MICROBLAZE_SHR_REGNUM
        MICROBLAZE_NUM_REGS.
        (microblaze_frame_cache): Use of MICROBLAZE_NUM_REGS.

        * features/microblaze-cpu.xml: New file.

        * features/microblaze-linux.c: New file.

        * features/microblaze-linux.xml: New file.

        * regformats/reg-microblaze.dat: New file.

        * features/Makefile (microblaze-linux): Add
        microblaze-linux and microblaze-expedite.

Signed-off-by:Ajit Agarwal ajitkum@xilinx.com

Thanks & Regards
Ajit
-----Original Message-----
From: Michael Eager [mailto:eager@eagercon.com] 
Sent: Saturday, May 24, 2014 4:13 AM
To: Ajit Kumar Agarwal; gdb-patches@sourceware.org
Cc: Joel Brobecker; Vinod Kathail; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Re: [Patch, microblaze]: Add slr and shr regs

On 05/23/14 02:46, Ajit Kumar Agarwal wrote:
>
>
>>> Let's try this one more time:  GDB is connected to something when you tell it to connect to the target with the "target remote" command.
>>> This is returning a different sized G packet.  What is it that you are connecting to?
>
> Here is the flow from GBD Client to XMD that's what is happening:
>
> 1. XMD connects to the hardware target through JTAG.
> 2. XMD Opens a GDB Server on the local host 1234.
> 3. GDB Client will connect to  the host:1234 through TCP, when the command "tar remote localhost:1234" is given.

Ajit --

Let me suggest this description of the problem:
   Prior to version x.xx, XMD's gdbserver stub returned 57 registers in
   response to GDB's G request.  Starting with version x.xx, XMD added the
   slr and shr register, for a count of 59 registers.  This patch adds
   these registers to the expected G response.

Please resubmit the patch, in full, with ChangeLog.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

[-- Attachment #2: 0001-Patch-microblaze-Add-slr-and-shr-regs.patch --]
[-- Type: application/octet-stream, Size: 12151 bytes --]

From ff851b0339cf98a14ca6f0b7b91c78182a8bb5cc Mon Sep 17 00:00:00 2001
From: Ajit Kumar Agarwal <ajitkum@xhdspdgnu.(none)>
Date: Mon, 26 May 2014 14:55:43 +0530
Subject: [PATCH] [Patch, microblaze]: Add slr and shr regs

   Prior to version x.xx, XMD's gdbserver stub returned 57 registers in
   response to GDB's G request.  Starting with version x.xx, XMD added the
   slr and shr register, for a count of 59 registers.  This patch adds
   these registers to the expected G response

ChangeLog:
2014-05-26 Ajit Agarwal <ajitkum@xilinx.com>

	* Makefile.in (microblaze-linux.c): New rule.

	* microblaze-tdep.c (microblaze_register_names): Add
	the rshr and rslr register names.

	* microblaze-tdep.h (microblaze_reg_num): Add
	field MICROBLAZE_SLR_REGNUM and MICROBLAZE_SHR_REGNUM
	MICROBLAZE_NUM_REGS.
	(microblaze_frame_cache): Use of MICROBLAZE_NUM_REGS.

	* features/microblaze-cpu.xml: New file.

	* features/microblaze-linux.c: New file.

	* features/microblaze-linux.xml: New file.

	* regformats/reg-microblaze.dat: New file.

	* features/Makefile (microblaze-linux): Add
	microblaze-linux and microblaze-expedite.

Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
---
 gdb/features/Makefile             |    2 +
 gdb/features/microblaze-cpu.xml   |   49 ++++++++++++++++++++++++++++++
 gdb/features/microblaze-linux.c   |   60 +++++++++++++++++++++++++++++++++++++
 gdb/features/microblaze-linux.xml |   13 ++++++++
 gdb/gdbserver/Makefile.in         |    5 ++-
 gdb/microblaze-tdep.c             |    3 +-
 gdb/microblaze-tdep.h             |   48 +++++++++++++++--------------
 gdb/regformats/reg-microblaze.dat |   42 ++++++++++++++++++++++++++
 8 files changed, 197 insertions(+), 25 deletions(-)
 create mode 100644 gdb/features/microblaze-cpu.xml
 create mode 100644 gdb/features/microblaze-linux.c
 create mode 100644 gdb/features/microblaze-linux.xml
 create mode 100644 gdb/regformats/reg-microblaze.dat

diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index dbf4963..5e9ea70 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -46,6 +46,7 @@ WHICH = aarch64 \
 	i386/x32-avx i386/x32-avx-linux \
 	i386/x32-avx512 i386/x32-avx512-linux \
 	mips-linux mips-dsp-linux \
+	microblaze-linux \
 	mips64-linux mips64-dsp-linux \
 	nios2-linux \
 	rs6000/powerpc-32 \
@@ -90,6 +91,7 @@ mips-expedite = r29,pc
 mips-dsp-expedite = r29,pc
 mips64-expedite = r29,pc
 mips64-dsp-expedite = r29,pc
+microblaze-expedite = r1,pc
 nios2-linux-expedite = sp,pc
 powerpc-expedite = r1,pc
 rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4
diff --git a/gdb/features/microblaze-cpu.xml b/gdb/features/microblaze-cpu.xml
new file mode 100644
index 0000000..7f2b5b4
--- /dev/null
+++ b/gdb/features/microblaze-cpu.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.MicroBlaze.cpu">
+  <reg name="r0" bitsize="32" regnum="0"/>
+  <reg name="r1" bitsize="32"/>
+  <reg name="r2" bitsize="32"/>
+  <reg name="r3" bitsize="32"/>
+  <reg name="r4" bitsize="32"/>
+  <reg name="r5" bitsize="32"/>
+  <reg name="r6" bitsize="32"/>
+  <reg name="r7" bitsize="32"/>
+  <reg name="r8" bitsize="32"/>
+  <reg name="r9" bitsize="32"/>
+  <reg name="r10" bitsize="32"/>
+  <reg name="r11" bitsize="32"/>
+  <reg name="r12" bitsize="32"/>
+  <reg name="r13" bitsize="32"/>
+  <reg name="r14" bitsize="32"/>
+  <reg name="r15" bitsize="32"/>
+  <reg name="r16" bitsize="32"/>
+  <reg name="r17" bitsize="32"/>
+  <reg name="r18" bitsize="32"/>
+  <reg name="r19" bitsize="32"/>
+  <reg name="r20" bitsize="32"/>
+  <reg name="r21" bitsize="32"/>
+  <reg name="r22" bitsize="32"/>
+  <reg name="r23" bitsize="32"/>
+  <reg name="r24" bitsize="32"/>
+  <reg name="r25" bitsize="32"/>
+  <reg name="r26" bitsize="32"/>
+  <reg name="r27" bitsize="32"/>
+  <reg name="r28" bitsize="32"/>
+  <reg name="r29" bitsize="32"/>
+  <reg name="r30" bitsize="32"/>
+  <reg name="r31" bitsize="32"/>
+
+  <reg name="msr" bitsize="32"/>
+  <reg name="ear" bitsize="32"/>
+  <reg name="esr" bitsize="32"/>
+  <reg name="fsr" bitsize="32"/>
+  <reg name="slr" bitsize="32"/>
+  <reg name="shr" bitsize="32"/>
+</feature>
diff --git a/gdb/features/microblaze-linux.c b/gdb/features/microblaze-linux.c
new file mode 100644
index 0000000..5923763
--- /dev/null
+++ b/gdb/features/microblaze-linux.c
@@ -0,0 +1,60 @@
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: microblaze-linux.xml */
+
+#include "defs.h"
+#include "osabi.h"
+#include "target-descriptions.h"
+
+struct target_desc *tdesc_microblaze_linux;
+static void
+initialize_tdesc_microblaze_linux (void)
+{
+  struct target_desc *result = allocate_target_description ();
+  struct tdesc_feature *feature;
+
+  set_tdesc_architecture (result, bfd_scan_arch ("MicroBlaze"));
+
+  set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.MicroBlaze.cpu");
+  tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "msr", 32, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "ear", 33, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "esr", 34, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "fsr", 35, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "slr", 36, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "shr", 37, 1, NULL, 32, "int");
+
+  tdesc_microblaze_linux = result;
+}
diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
new file mode 100644
index 0000000..2ae73e7
--- /dev/null
+++ b/gdb/features/microblaze-linux.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+  <architecture>MicroBlaze</architecture>
+  <osabi>GNU/Linux</osabi>
+  <xi:include href="microblaze-cpu.xml"/>
+</target>
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index f773fa2..2454003 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -348,7 +348,8 @@ clean:
 	rm -f amd64-avx.c amd64-avx-linux.c
 	rm -f amd64-mpx.c amd64-mpx-linux.c
 	rm -f amd64-avx512.c amd64-avx512-linux.c
-	rm -f i386-mmx.c i386-mmx-linux.c
+	rm -f i386-mmx.c i386-mmx-linux.c 
+	rm -f microblaze-linux.c
 	rm -f x32.c x32-linux.c
 	rm -f x32-avx.c x32-avx-linux.c
 	rm -f x32-avx512.c x32-avx512-linux.c
@@ -614,6 +615,8 @@ reg-cf.c : $(srcdir)/../regformats/reg-cf.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-cf.dat reg-cf.c
 mips-linux.c : $(srcdir)/../regformats/mips-linux.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/mips-linux.dat mips-linux.c
+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat mips-linux.c
 mips-dsp-linux.c : $(srcdir)/../regformats/mips-dsp-linux.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/mips-dsp-linux.dat mips-dsp-linux.c
 mips64-linux.c : $(srcdir)/../regformats/mips64-linux.dat $(regdat_sh)
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 14c1b52..4d63909 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -73,7 +73,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)
diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
index a532092..8658bc5 100644
--- a/gdb/microblaze-tdep.h
+++ b/gdb/microblaze-tdep.h
@@ -26,28 +26,6 @@ struct gdbarch_tdep
 {
 };
 
-struct microblaze_frame_cache
-{
-  /* Base address.  */
-  CORE_ADDR base;
-  CORE_ADDR pc;
-
-  /* Do we have a frame?  */
-  int frameless_p;
-
-  /* Frame size.  */
-  int framesize;
-
-  /* Frame register.  */
-  int fp_regnum;
-
-  /* Offsets to saved registers.  */
-  int register_offsets[57];	/* Must match MICROBLAZE_NUM_REGS.  */
-
-  /* Table of saved registers.  */
-  struct trad_frame_saved_reg *saved_regs;
-};
-
 /* Register numbers.  */
 enum microblaze_regnum 
 {
@@ -107,9 +85,33 @@ enum microblaze_regnum
   MICROBLAZE_RTLBX_REGNUM,
   MICROBLAZE_RTLBSX_REGNUM,
   MICROBLAZE_RTLBLO_REGNUM,
-  MICROBLAZE_RTLBHI_REGNUM
+  MICROBLAZE_RTLBHI_REGNUM,
+  MICROBLAZE_SLR_REGNUM,
+  MICROBLAZE_SHR_REGNUM,
+  MICROBLAZE_NUM_REGS
 };
 
+struct microblaze_frame_cache
+{
+  /* Base address.  */
+  CORE_ADDR base;
+  CORE_ADDR pc;
+
+  /* Do we have a frame?  */
+  int frameless_p;
+
+  /* Frame size.  */
+  int framesize;
+
+  /* Frame register.  */
+  int fp_regnum;
+
+  /* Offsets to saved registers.  */
+  int register_offsets[MICROBLAZE_NUM_REGS];    /* Must match MICROBLAZE_NUM_REGS.  */
+
+  /* Table of saved registers.  */
+  struct trad_frame_saved_reg *saved_regs;
+};
 /* All registers are 32 bits.  */
 #define MICROBLAZE_REGISTER_SIZE 4
 
diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
new file mode 100644
index 0000000..b3bad0a
--- /dev/null
+++ b/gdb/regformats/reg-microblaze.dat
@@ -0,0 +1,42 @@
+# DO NOT EDIT: generated from microblaze-linux.xml
+name:microblaze_linux
+xmltarget:microblaze-linux.xml
+expedite:r1,pc
+32:r0
+32:r1
+32:r2
+32:r3
+32:r4
+32:r5
+32:r6
+32:r7
+32:r8
+32:r9
+32:r10
+32:r11
+32:r12
+32:r13
+32:r14
+32:r15
+32:r16
+32:r17
+32:r18
+32:r19
+32:r20
+32:r21
+32:r22
+32:r23
+32:r24
+32:r25
+32:r26
+32:r27
+32:r28
+32:r29
+32:r30
+32:r31
+32:msr
+32:ear
+32:esr
+32:fsr
+32:slr
+32:shr
-- 
1.7.1


  reply	other threads:[~2014-05-26 10:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  6:54 Ajit Kumar Agarwal
2014-05-23  7:34 ` Michael Eager
2014-05-23  9:47   ` Ajit Kumar Agarwal
2014-05-23 22:42     ` Michael Eager
2014-05-26 10:04       ` Ajit Kumar Agarwal [this message]
2014-05-27  6:34         ` Michael Eager
2014-05-27  7:46           ` Ajit Kumar Agarwal
2014-05-27  8:53             ` Pedro Alves
2014-06-09 17:26               ` Ajit Kumar Agarwal
2014-06-09 17:57                 ` Pedro Alves
2014-06-09 19:35                   ` Ajit Kumar Agarwal
2014-05-29  7:20             ` Michael Eager
2014-06-05 15:54             ` Michael Eager
2014-06-09 17:26               ` Ajit Kumar Agarwal
2014-06-09 18:28                 ` Michael Eager
2014-06-09 19:31                   ` Ajit Kumar Agarwal
2014-06-09 20:06                     ` Michael Eager
2014-06-10 13:51                       ` Ajit Kumar Agarwal
2014-06-10 14:12                         ` Michael Eager
2014-06-10 14:49                           ` Ajit Kumar Agarwal
2014-06-10 15:27                             ` Michael Eager
2014-06-12  8:34                               ` Ajit Kumar Agarwal
2014-05-23  8:32 ` Yao Qi
2014-05-23 20:33   ` Ajit Kumar Agarwal
2014-05-23  8:44 ` Pedro Alves
2014-05-23 20:36   ` Ajit Kumar Agarwal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e5c185d-329c-46cf-930c-8cc2288891aa@BN1BFFO11FD019.protection.gbl \
    --to=ajit.kumar.agarwal@xilinx.com \
    --cc=brobecker@adacore.com \
    --cc=eager@eagercon.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nmekala@xilinx.com \
    --cc=palves@redhat.com \
    --cc=vidhum@xilinx.com \
    --cc=vinodk@xilinx.com \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).