This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA/m32r] Fix breakpoint bug of m32rsdi protocol; remote-m32r-sdi.cre-indented.


Kei,

It looks like some re-indentation got mixed in with the change proper vis:

-  if (!sdi_desc)
+  if (!sdi_desc)

-  if (c != '+')                /* error */
+  if (c != '+')                        /* error */

...

I've committed the attached which re-indents remote-m32r-sdi.c using
gdb/gdb_indent.sh.  You'll want to merge in that change and strip out
any other stray mods.

Looking at the change proper, given the many occurances of sequences
like this:

+      buf[0] = SDI_WRITE_MEMORY;
+      store_long_parameter (buf + 1, 0xffff8080 + 4 * i);
+      store_long_parameter (buf + 5, 4);
+      store_unsigned_integer (buf + 9, 4, bp_addr);
+      send_data (buf, 13);

+      buf[0] = SDI_WRITE_MEMORY;
+      store_long_parameter (buf + 1, 0xffff8200 + 4 * i);
+      store_long_parameter (buf + 5, 4);
+      store_long_parameter (buf + 9, 0xffffffff);
+      send_data (buf, 13);

+      buf[0] = SDI_WRITE_MEMORY;
+      store_long_parameter (buf + 1, bp_addr);
+      store_long_parameter (buf + 5, 4);
+         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+           {
+             buf[9] = dbt_bp_entry[0];
+             buf[10] = dbt_bp_entry[1];
+             buf[11] = dbt_bp_entry[2];
+             buf[12] = dbt_bp_entry[3];
+           }
+         else
+           {
+             buf[9] = dbt_bp_entry[3];
+             buf[10] = dbt_bp_entry[2];
+             buf[11] = dbt_bp_entry[1];
+             buf[12] = dbt_bp_entry[0];

can you add helper functions like:
  send_l4_data (SDI_WRITE_MEMORY, 0xffff8200 + 4 * i, 4, 0xffffffff);
for each of these cases (and any others you feel useful).

Andrew
2004-07-16  Andrew Cagney  <cagney@gnu.org>

	* remote-m32r-sdi.c: Re-indent.

Index: remote-m32r-sdi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-m32r-sdi.c,v
retrieving revision 1.4
diff -p -u -r1.4 remote-m32r-sdi.c
--- remote-m32r-sdi.c	15 Jun 2004 01:04:19 -0000	1.4
+++ remote-m32r-sdi.c	16 Jul 2004 21:15:51 -0000
@@ -161,7 +161,7 @@ get_ack (void)
 {
   int c;
 
-  if (!sdi_desc) 
+  if (!sdi_desc)
     return -1;
 
   c = serial_readchar (sdi_desc, SDI_TIMEOUT);
@@ -169,7 +169,7 @@ get_ack (void)
   if (c < 0)
     return -1;
 
-  if (c != '+')		/* error */
+  if (c != '+')			/* error */
     return -1;
 
   return 0;
@@ -181,7 +181,7 @@ send_data (void *buf, int len)
 {
   int ret;
 
-  if (!sdi_desc) 
+  if (!sdi_desc)
     return -1;
 
   if (serial_write (sdi_desc, buf, len) != 0)
@@ -200,7 +200,7 @@ recv_data (void *buf, int len)
   int total = 0;
   int c;
 
-  if (!sdi_desc) 
+  if (!sdi_desc)
     return -1;
 
   while (total < len)
@@ -264,8 +264,7 @@ check_mmu_status (void)
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-m32r_create_inferior (char *execfile, char *args, char **env,
-		      int from_tty)
+m32r_create_inferior (char *execfile, char *args, char **env, int from_tty)
 {
   CORE_ADDR entry_pt;
 
@@ -326,7 +325,7 @@ m32r_open (char *args, int from_tty)
     {
       port_str = strchr (args, ':');
       if (port_str == NULL)
-        sprintf (hostname, "%s:%d", args, SDIPORT);
+	sprintf (hostname, "%s:%d", args, SDIPORT);
       else
 	strcpy (hostname, args);
     }
@@ -705,7 +704,7 @@ m32r_wait (ptid_t ptid, struct target_wa
       if (c < 0)
 	error ("Remote connection closed");
 
-      if (c == '-')	/* error */
+      if (c == '-')		/* error */
 	{
 	  status->kind = TARGET_WAITKIND_STOPPED;
 	  status->value.sig = TARGET_SIGNAL_HUP;
@@ -1540,11 +1539,11 @@ sdistatus_command (char *args, int from_
     {
       c = serial_readchar (sdi_desc, SDI_TIMEOUT);
       if (c < 0)
-        return;
+	return;
       buf[i] = c;
       if (c == 0)
-        break;
-    }    
+	break;
+    }
 
   printf_filtered ("%s", buf);
 }

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