* monitor.c (monitor_make_srec): Fix thinkos in computation
authorJeff Law <law@redhat.com>
Wed, 13 Sep 1995 01:41:30 +0000 (01:41 +0000)
committerJeff Law <law@redhat.com>
Wed, 13 Sep 1995 01:41:30 +0000 (01:41 +0000)
of addr_size.
Critical patch from Stu.

gdb/ChangeLog
gdb/monitor.c

index 92d14a918f7408f386ccb1245f0f3cd6dc192a9c..5ddea8175f29a875c254fbb5d8311393a1700709 100644 (file)
@@ -1,3 +1,8 @@
+Tue Sep 12 19:37:24 1995  Jeff Law  (law@snake.cs.utah.edu)
+
+       * monitor.c (monitor_make_srec): Fix thinkos in computation
+       of addr_size.
+
 Tue Sep 12 15:46:18 1995  Kung Hsu  <kung@mexican.cygnus.com>
 
        * stabsread.c (read_one_struct_field): Add a patch to handle cfront
index e76421d177a0ca74ef40d3a8d5816f2e43def8d9..782f8bc9a50313e4b5213440ebdcb89c130b494b 100644 (file)
@@ -16,7 +16,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This file was derived from various remote-* modules. It is a collection
    of generic support functions so GDB can talk directly to a ROM based
@@ -709,44 +709,39 @@ monitor_fetch_register (regno)
       return;
     }
 
- /* send the register examine command */
 /* send the register examine command */
 
   monitor_printf (current_monitor->getreg.cmd, name);
 
-/* If RESP_DELIM is specified, we search for that as a leading delimiter for
-   the register value.  Otherwise, we just start searching from the start of
-   the buf.  */
+  /* If RESP_DELIM is specified, we search for that as a leading delimiter for
+     the register value.  Otherwise, we just start searching from the start of
+     the buf.  */
 
   if (current_monitor->getreg.resp_delim)
     monitor_expect (current_monitor->getreg.resp_delim, NULL, 0);
 
-/* Now, read the appropriate number of hex digits for this register, skipping
-   spaces.  */
+  /* Read upto the maximum number of hex digits for this register, skipping
+     spaces, but stop reading if something else is seen.  Some monitors
+     like to drop leading zeros.  */
 
   for (i = 0; i < REGISTER_RAW_SIZE (regno) * 2; i++)
     {
       int c;
+      c = readchar (timeout);
+      while (c == ' ')
+       c = readchar (timeout);
 
-      while (1)
-       {
-         c = readchar (timeout);
-         if (isxdigit (c))
-           break;
-         if (c == ' ')
-           continue;
-
-         error ("monitor_fetch_register (%d):  bad response from monitor: %.*s%c.",
-        regno, i, regbuf, c);
-       }
+      if (!isxdigit (c))
+       break;
 
       regbuf[i] = c;
     }
 
   regbuf[i] = '\000';          /* terminate the number */
 
-/* If TERM is present, we wait for that to show up.  Also, (if TERM is
-   present), we will send TERM_CMD if that is present.  In any case, we collect
-   all of the output into buf, and then wait for the normal prompt.  */
+  /* If TERM is present, we wait for that to show up.  Also, (if TERM is
+     present), we will send TERM_CMD if that is present.  In any case, we collect
+     all of the output into buf, and then wait for the normal prompt.  */
 
   if (current_monitor->getreg.term)
     {
@@ -1436,9 +1431,9 @@ monitor_make_srec (buffer, type, memaddr, myaddr, len)
   checksum = 0;
   
   addr_size = 2;
-  if (memaddr >= 0xffffff)
+  if (memaddr > 0xffffff)
     addr_size = 4;
-  else if (memaddr >= 0xffffff)
+  else if (memaddr > 0xffff)
     addr_size = 3;
   else
     addr_size = 2;
This page took 0.030096 seconds and 4 git commands to generate.