This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove v850_dbtrap_breakpoint_from_pc


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ff12a6593a1675aa9ba5340aa2984af19cf8966c

commit ff12a6593a1675aa9ba5340aa2984af19cf8966c
Author: Yao Qi <yao.qi@linaro.org>
Date:   Mon Oct 10 10:28:30 2016 +0100

    Remove v850_dbtrap_breakpoint_from_pc
    
    v850 has two functions to install to gdbarch_breakpoint_from_pc,
    and it selects one according to info.bfd_arch_info->mach.  However,
    we can select the kind/length of breakpoint instruction inside
    v850_breakpoint_from_pc by gdbarch_bfd_arch_info (gdbarch)->mach.
    This patch is to do that, and remove v850_dbtrap_breakpoint_from_pc.
    
    gdb:
    
    2016-08-30  Yao Qi  <yao.qi@linaro.org>
    
    	* v850-tdep.c (v850_breakpoint_from_pc): Use the right
    	breakpoint instruction.
    	(v850_dbtrap_breakpoint_from_pc): Remove.
    	(v850_gdbarch_init): Update.

Diff:
---
 gdb/ChangeLog   |  7 +++++++
 gdb/v850-tdep.c | 49 +++++++++++++++++++++++--------------------------
 2 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b293515..1b76940 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2016-10-10  Yao Qi  <yao.qi@linaro.org>
+
+	* v850-tdep.c (v850_breakpoint_from_pc): Use the right
+	breakpoint instruction.
+	(v850_dbtrap_breakpoint_from_pc): Remove.
+	(v850_gdbarch_init): Update.
+
 2016-10-08  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* ui-out.c (push_level): Remove "id" parameter.
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 0b50580..d03334e 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1170,26 +1170,33 @@ v850_return_value (struct gdbarch *gdbarch, struct value *function,
 
 static const unsigned char *
 v850_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
-                         int *lenptr)
+			 int *lenptr)
 {
-  static unsigned char breakpoint[] = { 0x85, 0x05 };
+  *lenptr = 2;
 
-  *lenptr = sizeof (breakpoint);
-  return breakpoint;
-}
+  switch (gdbarch_bfd_arch_info (gdbarch)->mach)
+    {
+    case bfd_mach_v850e2:
+    case bfd_mach_v850e2v3:
+    case bfd_mach_v850e3v5:
+      {
+	/* Implement software breakpoints by using the dbtrap instruction.
+	   Older architectures had no such instruction.  For those, an
+	   unconditional branch to self instruction is used.  */
 
-/* Implement software breakpoints by using the dbtrap instruction. 
-   Older architectures had no such instruction.  For those, an
-   unconditional branch to self instruction is used.  */
+	static unsigned char dbtrap_breakpoint[] = { 0x40, 0xf8 };
 
-static const unsigned char *
-v850_dbtrap_breakpoint_from_pc (struct gdbarch *gdbarch,
-                                CORE_ADDR *pcptr, int *lenptr)
-{
-  static unsigned char breakpoint[] = { 0x40, 0xf8 };
+	return dbtrap_breakpoint;
+      }
+      break;
+    default:
+      {
+	static unsigned char breakpoint[] = { 0x85, 0x05 };
 
-  *lenptr = sizeof (breakpoint);
-  return breakpoint;
+	return breakpoint;
+      }
+      break;
+    }
 }
 
 static struct v850_frame_cache *
@@ -1440,18 +1447,8 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
 
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
-  switch (info.bfd_arch_info->mach)
-    {
-    case bfd_mach_v850e2:
-    case bfd_mach_v850e2v3:
-    case bfd_mach_v850e3v5:
-      set_gdbarch_breakpoint_from_pc (gdbarch, v850_dbtrap_breakpoint_from_pc);
-      break;
-    default:
-      set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc);
-      break;
-    }
 
+  set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc);
   set_gdbarch_return_value (gdbarch, v850_return_value);
   set_gdbarch_push_dummy_call (gdbarch, v850_push_dummy_call);
   set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]