Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: gdb-patches@sourceware.org
Cc: openrisc@lists.librecores.org, Stafford Horne <shorne@gmail.com>
Subject: [PATCH 18/18] gdb: or1k: Refactor to new bp_kind_from_pc and pb_from_kind
Date: Wed, 23 Nov 2016 22:23:00 -0000	[thread overview]
Message-ID: <1479939044-1341-19-git-send-email-shorne@gmail.com> (raw)
In-Reply-To: <1479939044-1341-1-git-send-email-shorne@gmail.com>

Updates to mirror refactorings by Yao Qi in cd6c3b4ffc.

New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind

gdb/ChangeLog:

	* or1k-tdep.c (or1k_breakpoint_kind_from_pc): New function
	(or1k_sw_breakpoint_from_kind): New function
	(or1k_breakpoint_from_pc): Remove
---
 gdb/or1k-tdep.c | 52 +++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 9 deletions(-)

diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 5aa0e7c..dfaee96 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -124,6 +124,14 @@
 
 \f
 
+/* Enum describing different kinds of breakpoints for or1k */
+
+enum or1k_breakpoint_kind
+{
+  /* 32-bit standard OpenRISC breakpoint */
+  OR1K_BP_KIND_OR1K = 2,
+};
+
 /* The gdbarch_tdep structure.  */
 
 /*! OR1K specific per-architecture information. Replaces
@@ -526,6 +534,25 @@ or1k_return_value (struct gdbarch  *gdbarch,
 }	/* or1k_return_value() */
 
 
+
+/*----------------------------------------------------------------------------*/
+/*!Determine the kind of breakpoint based on the current pc
+
+   Given the pc address, return the type of breapoint that should be used.
+   For or1k we only use one type which is a 32-bit trap instruction.
+
+   @param[in]  gdbarch  The GDB architecture being used
+   @param[in]  pcptr    The program counter address in question
+
+   @return  The breakpoint type */
+/*----------------------------------------------------------------------------*/
+
+static int
+or1k_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
+{
+  return OR1K_BP_KIND_OR1K;
+}	/* or1k_breakpoint_kind_from_pc() */
+
 /*----------------------------------------------------------------------------*/
 /*!Determine the instruction to use for a breakpoint.
 
@@ -543,16 +570,22 @@ or1k_return_value (struct gdbarch  *gdbarch,
 /*---------------------------------------------------------------------------*/
 
 static const gdb_byte *
-or1k_breakpoint_from_pc (struct gdbarch *gdbarch,
-			 CORE_ADDR      *bp_addr,
-			 int            *bp_size)
+or1k_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
 {
-  static const gdb_byte breakpoint[] = OR1K_BRK_INSTR_STRUCT;
 
-  *bp_size = OR1K_INSTLEN;
-  return breakpoint;
-
-}	/* or1k_breakpoint_from_pc() */
+  switch (kind)
+    {
+    case OR1K_BP_KIND_OR1K:
+      {
+        static const gdb_byte breakpoint[] = OR1K_BRK_INSTR_STRUCT;
+        
+        *size = OR1K_INSTLEN;
+        return breakpoint;
+      }
+    default:
+      gdb_assert_not_reached ("unexpected or1k breakpoint kind");
+    };
+}	/* or1k_sw_breakpoint_from_kind() */
 
 
 /*----------------------------------------------------------------------------*/
@@ -2056,7 +2089,8 @@ or1k_gdbarch_init (struct gdbarch_info  info,
 
   /* Information about the target architecture */
   set_gdbarch_return_value          (gdbarch, or1k_return_value);
-  set_gdbarch_breakpoint_from_pc    (gdbarch, or1k_breakpoint_from_pc);
+  set_gdbarch_breakpoint_kind_from_pc (gdbarch, or1k_breakpoint_kind_from_pc);
+  set_gdbarch_sw_breakpoint_from_kind (gdbarch, or1k_sw_breakpoint_from_kind);
   set_gdbarch_have_nonsteppable_watchpoint
                                     (gdbarch, 1);
 
-- 
2.7.4


  parent reply	other threads:[~2016-11-23 22:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 22:11 [PATCH 00/18] gdb: Port for OpenRISC Stafford Horne
2016-11-23 22:11 ` [PATCH 15/18] gdb: or1k: Update calling conventions to help pass tests Stafford Horne
2016-11-23 22:11 ` [PATCH 16/18] gdb: Remove corelow object from or1k linux build Stafford Horne
2016-11-23 22:11 ` [PATCH 09/18] gdb: or1k: Silence gcc warning Stafford Horne
2016-11-23 22:11 ` [PATCH 03/18] gdb: or1k: Add or1k_push_dummy_code and use it Stafford Horne
2016-11-23 22:11 ` [PATCH 05/18] gdb: handle arbitrary strings in tdesc_register_in_reggroup_p Stafford Horne
2016-11-23 22:11 ` [PATCH 17/18] gdb: or1k: Updates for compiler type checking Stafford Horne
2016-11-23 22:11 ` [PATCH 04/18] gdb: add tdesc_find_register functions Stafford Horne
2016-11-23 22:11 ` [PATCH 13/18] gdb: Add OpenRISC to texinfo menu Stafford Horne
2016-11-23 22:13 ` [PATCH 08/18] gdb: or1k: change or1k_push_dummy_code stack alignment Stafford Horne
2016-11-23 22:13 ` [PATCH 10/18] gdb: or1k: Fixes for things that broke after upstream merge Stafford Horne
2016-11-23 22:13 ` [PATCH 12/18] gdb: or1k: Apply changes of the last two years Stafford Horne
2016-11-23 22:13 ` [PATCH 01/18] gdb: add or1k and or1knd target support Stafford Horne
2016-11-23 22:14 ` [PATCH 06/18] gdb: or1k: set gdbarch num regs to gpr + spr regs Stafford Horne
2016-11-23 22:14 ` [PATCH 14/18] gdb: testsuite: Add or1k l.nop inscruction Stafford Horne
2016-11-23 22:14 ` [PATCH 07/18] gdb: or1k: add target descriptor support Stafford Horne
2016-11-23 22:16 ` [PATCH 02/18] gdb: or1k: Add a check for NULL ptr in or1k_skip_prologue Stafford Horne
2016-11-23 22:16 ` [PATCH 11/18] Add gdb for or1k build Stafford Horne
2016-11-23 22:23 ` Stafford Horne [this message]
2016-11-24 20:37 ` [PATCH 00/18] gdb: Port for OpenRISC Yao Qi
2016-11-25 22:50   ` Stafford Horne

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=1479939044-1341-19-git-send-email-shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=openrisc@lists.librecores.org \
    /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