Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: [commit] Allow cached cooked reads
Date: Tue, 24 Jun 2003 23:02:00 -0000	[thread overview]
Message-ID: <1030624220608.ZM22089@localhost.localdomain> (raw)
In-Reply-To: Andrew Cagney <ac131313@redhat.com> "[commit] Allow cached cooked reads" (Jun 16,  9:22am)

On Jun 16,  9:22am, Andrew Cagney wrote:

> Just stumbled across this.  When trying to save cooked registers the 
> regcache was triggering an assertion failure instead of ignoring a bogus 
> request.
> 
> 2003-06-16  Andrew Cagney  <cagney@redhat.com>
> 
> 	* regcache.c (do_cooked_read): Do not use register_valid_p.
> 
> Index: regcache.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/regcache.c,v
> retrieving revision 1.87
> diff -u -r1.87 regcache.c
> --- regcache.c	9 Jun 2003 01:02:06 -0000	1.87
> +++ regcache.c	16 Jun 2003 13:18:46 -0000
> @@ -423,8 +423,7 @@
>  do_cooked_read (void *src, int regnum, void *buf)
>  {
>    struct regcache *regcache = src;
> -  if (!regcache_valid_p (regcache, regnum)
> -      && regcache->readonly_p)
> +  if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
>      /* Don't even think about fetching a register from a read-only
>         cache when the register isn't yet valid.  There isn't a target
>         from which the register value can be fetched.  */

Which assertion was failing?  The check for regcache != NULL or the
bounds check?

I'm wondering if the new code above should include some bounds checks. 
Alternately, go back to using regcache_valid_p() and weaken the
assertions in regcache_valid_p() somewhat.  E.g, perhaps rewrite
regcache_valid_p() from:

int
regcache_valid_p (struct regcache *regcache, int regnum)
{
  gdb_assert (regcache != NULL);
  gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
  return regcache->register_valid_p[regnum];
}

to:

int
regcache_valid_p (struct regcache *regcache, int regnum)
{
  gdb_assert (regcache != NULL);
  gdb_assert (regnum >= 0);
  return regnum < regcache->descr->nr_raw_registers)
         && regcache->register_valid_p[regnum];
}

Kevin


  reply	other threads:[~2003-06-24 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-16 13:22 Andrew Cagney
2003-06-24 23:02 ` Kevin Buettner [this message]
2003-06-25 21:46   ` Andrew Cagney

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=1030624220608.ZM22089@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=ac131313@redhat.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