Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jeff Holcomb <jeffh@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] monitor.c fix for rom68k target boards
Date: Mon, 02 Apr 2001 17:13:00 -0000	[thread overview]
Message-ID: <Pine.SOL.3.91.1010402165500.747F-100000@cse.cygnus.com> (raw)
In-Reply-To: <3AC4F369.39725D8D@cygnus.com>

On Fri, 30 Mar 2001, Andrew Cagney wrote:

> So the old code would just return with ``p'' pointing to one char beyond
> the hex digit?

Yes, though p is a local variable in monitor_supply_register.  After the 
strtoul call p points to the location following the last valid digit.  The 
old code looked like this:

  val = strtoul (valstr, &p, 16);
  RDEBUG (("Supplying Register %d %s\n", regno, valstr));
 
  if (val == 0 && valstr == p)
    error ("monitor_supply_register (%d):  bad value from monitor: %s.",
           regno, valstr);

This seems like it was a valid check.  If the strtoul totally fails (no 
value was found and p hasn't changed), then it reports the error.

The new code looks like this:

  p = valstr;
  while (p && *p != '\0')
    {
      if (*p == '\r' || *p == '\n')
        {
          while (*p != '\0') 
              p++;
          break;
        }
      if (isspace (*p))
        {
          p++;
          continue;
        }
      if (!isxdigit (*p) && *p != 'x')
        {
          break;
        }
 
      val <<= 4;
      val += fromhex (*p++);
    }
  monitor_debug ("Supplying Register %d %s\n", regno, valstr);
 
  if (*p != '\0')
    error ("monitor_supply_register (%d):  bad value from monitor: %s.",
           regno, valstr);

This is testing something totally different.  If the next character is 
not the end of the string, then it reports the error.  The rom68k 
monitor outputs a text representation of the status register flags after 
the value.

A possibility would be to change the test back to the original version 
rather than removing the test, like:

  if (val == 0 && valstr == p)
     error ("monitor_supply_register (%d):  bad value from monitor: %s.",
           regno, valstr);

I'm willing to go either way, I just don't know what the intent was in 
changing the if test.

--
Jeff Holcomb
jeffh@redhat.com
GDB Engineering
Red Hat, Inc.


  reply	other threads:[~2001-04-02 17:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-29 22:00 Jeff Holcomb
2001-03-30 12:58 ` Andrew Cagney
2001-04-02 17:13   ` Jeff Holcomb [this message]
2001-04-04 13:54     ` Andrew Cagney
2001-04-05 10:44       ` [patch] " Jeff Holcomb

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=Pine.SOL.3.91.1010402165500.747F-100000@cse.cygnus.com \
    --to=jeffh@redhat.com \
    --cc=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    /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