Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Vladimir Prus <ghost@cs.msu.su>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Cleanup target memory reading
Date: Wed, 12 Jul 2006 19:22:00 -0000	[thread overview]
Message-ID: <20060712192158.GN24622@nevyn.them.org> (raw)
In-Reply-To: <200606281155.59166.ghost@cs.msu.su>

On Wed, Jun 28, 2006 at 11:55:57AM +0400, Vladimir Prus wrote:
> 
> Hi,
> at the moment, pretty much every read of target memory goes via 
> target_read_memory, and then via xfer_using_stratum.
> 
> The only exception is the get_target_memory_unsigned function, which calls 
> target_read function. It's the only use of 'target_read'.
> 
> The attached patch removes target_read, and makes get_target_memory_unsigned 
> use target_read_memory.
> 
> OK?

Since this was posted I added a use of target_read in the SPARC target
:-(  Let's leave it for now.

> 2006-06-28  Vladimir Prus  <vladimir@codesourcery.com>
> 
>             * target.h (target_read): Remove
>             (get_target_memory): Remove.
>             * target.c (target_read): Remove
>             (get_target_memory): Remove.
>             (get_target_memory_unsigned): Use target_read_memory.

But if you want to commit the other two parts of this patch, that's OK.
Except:

> @@ -1404,25 +1381,13 @@
>    return len;
>  }
>  
> -/* Memory transfer methods.  */
> -
> -void
> -get_target_memory (struct target_ops *ops, CORE_ADDR addr, gdb_byte *buf,
> -		   LONGEST len)
> -{
> -  if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len)
> -      != len)
> -    memory_error (EIO, addr);
> -}
> -
>  ULONGEST
> -get_target_memory_unsigned (struct target_ops *ops,
> -			    CORE_ADDR addr, int len)
> +get_target_memory_unsigned (CORE_ADDR addr, int len)
>  {
>    gdb_byte buf[sizeof (ULONGEST)];
>  
>    gdb_assert (len <= sizeof (buf));
> -  get_target_memory (ops, addr, buf, len);
> +  target_read_memory (addr, buf, len);
>    return extract_unsigned_integer (buf, len);
>  }
>  

get_target_memory used to call memory_error if there was a problem.
target_read_memory doesn't; it returns an error code.  So you need
to check it yourself.

-- 
Daniel Jacobowitz
CodeSourcery


      parent reply	other threads:[~2006-07-12 19:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-28  7:56 Vladimir Prus
2006-06-28 21:30 ` Mark Kettenis
2006-06-29  2:42   ` Daniel Jacobowitz
2006-06-29  9:34     ` Vladimir Prus
2006-07-12 19:22 ` Daniel Jacobowitz [this message]

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=20060712192158.GN24622@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=ghost@cs.msu.su \
    /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