This is the mail archive of the gdb-patches@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]

Re: [PATCH] h8300 target breakpoint doesn't work on Simulator


At Fri, 4 Mar 2011 16:10:11 -0500,
Mike Frysinger wrote:
> 
> On Friday, March 04, 2011 11:38:42 Yoshinori Sato wrote:
> > h8300-elf simulator handling O_BPT instruction of breakpoint.
> > But gdb write to O_SLEEP instruction of breakpoint.
> > 
> > So breakpoint command doesn't work on h8300 simulator.
> > 
> > --- h8300-tdep.c	25 Jan 2011 12:13:20 -0000	1.128
> > +++ h8300-tdep.c	4 Mar 2011 16:31:41 -0000
> > @@ -1197,8 +1197,7 @@
> >  h8300_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
> >  			  int *lenptr)
> >  {
> > -  /*static unsigned char breakpoint[] = { 0x7A, 0xFF }; *//* ??? */
> > -  static unsigned char breakpoint[] = { 0x01, 0x80 };	/* Sleep */
> > +  static unsigned char breakpoint[] = { 0x7A, 0xFF };	/* bpt (only
> > simulator) */
> 
> this sounds like you're fixing one system (sim) at the cost of breaking others 
> (everyone else).  this func is used by all h8300 targets ... not just sim.  so 
> are you sure this is what you want ?
> 
> try looking at the Blackfin tdep to see how we handle sim-specific bp's.
> -mike

Thanks comment.
I rewrite fix.

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.12792
diff -u -r1.12792 ChangeLog
--- ChangeLog	11 Mar 2011 02:33:27 -0000	1.12792
+++ ChangeLog	11 Mar 2011 04:19:13 -0000
@@ -1,3 +1,8 @@
+2011-03-11  Yoshinori Sato <ysato@users.sourceforge.jp>
+
+	* h8300-tdep.c (h8300_breakpoint_from_pc): Update to breakpoint
+	instruction
+
 2011-03-10  Maxim Grigoriev  <maxim2405@gmail.com>
 
 	* xtensa-tdep.c (windowing_enabled): Remove inline attribute.
Index: h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.128
diff -u -r1.128 h8300-tdep.c
--- h8300-tdep.c	25 Jan 2011 12:13:20 -0000	1.128
+++ h8300-tdep.c	11 Mar 2011 04:19:13 -0000
@@ -1197,11 +1197,16 @@
 h8300_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
 			  int *lenptr)
 {
-  /*static unsigned char breakpoint[] = { 0x7A, 0xFF }; *//* ??? */
-  static unsigned char breakpoint[] = { 0x01, 0x80 };	/* Sleep */
+  static const unsigned char sim_breakpoint[] = { 0x7A, 0xFF };	/* bpt */
+  static const unsigned char breakpoint[] = { 0x57, 0x30 };	/* trap #3 */
 
-  *lenptr = sizeof (breakpoint);
-  return breakpoint;
+  if (strcmp(target_shortname, "sim") == 0) {
+    *lenptr = sizeof (sim_breakpoint);
+    return sim_breakpoint;
+  } else {
+    *lenptr = sizeof (breakpoint);
+    return breakpoint;
+  }
 }
 
 static void

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>


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