Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Mike Frysinger <vapier@gentoo.org>,	gdb-patches@sourceware.org
Subject: Re: [PATCH] h8300 target breakpoint doesn't work on Simulator
Date: Wed, 16 Mar 2011 14:15:00 -0000	[thread overview]
Message-ID: <87oc5bxj3k.wl%ysato@users.sourceforge.jp> (raw)
In-Reply-To: <20110311063904.GZ30306@adacore.com>

At Fri, 11 Mar 2011 10:39:04 +0400,
Joel Brobecker wrote:
> 
> > +2011-03-11  Yoshinori Sato <ysato@users.sourceforge.jp>
> > +
> > +	* h8300-tdep.c (h8300_breakpoint_from_pc): Update to breakpoint
> > +	instruction
> > +
> 
> A few minor comments:

Thanks.
 
> > -  /*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 */
> 
> Can you remove a few spaces before the "/* bpt */" comment? It seems
> to me that the spaces are not really necessary, and removing them
> would make it a little closer to our soft-limit (70 characters).
> 
> > -  *lenptr = sizeof (breakpoint);
> > -  return breakpoint;
> > +  if (strcmp(target_shortname, "sim") == 0) {
> > +    *lenptr = sizeof (sim_breakpoint);
> > +    return sim_breakpoint;
> > +  } else {
> > +    *lenptr = sizeof (breakpoint);
> > +    return breakpoint;
> > +  }
> >  }
> 
> The proper style for braces in GDB is to put the curly brace on
> the next line. Also, we require a space before opening parens
> in function calls. Thus
> 
>   if (strcmp (target_shortname, "sim") == 0)
>     {
>       *lenptr = sizeof (sim_breakpoint);
>       return sim_breakpoint;
>     }
>   else
>     {
>       *lenptr = sizeof (breakpoint);
>       return breakpoint;
>     }

Sorry. I mistake editor setting.
Cleanup.

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.12820
diff -u -r1.12820 ChangeLog
--- ChangeLog	16 Mar 2011 09:49:41 -0000	1.12820
+++ ChangeLog	16 Mar 2011 13:47:25 -0000
@@ -1,3 +1,8 @@
+2011-03-16  Yoshinori Sato <ysato@users.sourceforge.jp>
+
+	* h8300-tdep.c (h8300_breakpoint_from_pc): Update to breakpoint
+	instruction
+
 2011-03-16  Phil Muldoon  <pmuldoon@redhat.com>
 
 	* NEWS: Add Parameter sub-classing description.
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	16 Mar 2011 13:47:25 -0000
@@ -1197,11 +1197,19 @@
 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

> I wonder if there isn't a better way to detect the sim, other
> than checking the target name. I don't know of any, but perhaps
> other maintainers might...

Hmm...
I think so.
However, I think it is rare case. I do not think that there is so an 
enhanced necessity.  

> -- 
> Joel

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

===File ~/h8300-tdep.diff===================================
============================================================


  reply	other threads:[~2011-03-16 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 16:38 Yoshinori Sato
2011-03-04 21:11 ` Mike Frysinger
2011-03-05  3:27   ` Joel Brobecker
2011-03-11  6:28   ` Yoshinori Sato
2011-03-11  6:58     ` Joel Brobecker
2011-03-16 14:15       ` Yoshinori Sato [this message]
2011-03-23 23:38         ` Joel Brobecker

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=87oc5bxj3k.wl%ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.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