Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] Move the traceframe_available_memory code from memory_xfer_partial_1 down to the targets
Date: Fri, 21 Mar 2014 11:56:00 -0000	[thread overview]
Message-ID: <532C28F1.5040705@redhat.com> (raw)
In-Reply-To: <1394541731-27486-1-git-send-email-yao@codesourcery.com>

On 03/11/2014 12:42 PM, Yao Qi wrote:

> 	(remote_read_bytes): Moved from memory_xfer_partial_1.

Say:

 	(remote_read_bytes): New, factored out from memory_xfer_partial_1.

> @@ -6847,6 +6928,63 @@ remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len,
>    if (len == 0)
>      return 0;
>  
> +  if (get_traceframe_number () != -1)
> +    {
> +      VEC(mem_range_s) *available;
> +
> +      /* If we fail to get the set of available memory, then the
> +	 target does not support querying traceframe info, and so we
> +	 attempt reading from the traceframe anyway (assuming the
> +	 target implements the old QTro packet then).  */
> +      if (traceframe_available_memory (&available, memaddr, len))
> +	{
> +	  struct cleanup *old_chain;
> +
> +	  old_chain = make_cleanup (VEC_cleanup(mem_range_s), &available);
> +
> +	  if (VEC_empty (mem_range_s, available)
> +	      || VEC_index (mem_range_s, available, 0)->start != memaddr)
> +	    {
> +	      enum target_xfer_status res;
> +
> +	      /* Don't read into the traceframe's available
> +		 memory.  */
> +	      if (!VEC_empty (mem_range_s, available))
> +		{
> +		  LONGEST oldlen = len;
> +
> +		  len = VEC_index (mem_range_s, available, 0)->start - memaddr;
> +		  gdb_assert (len <= oldlen);
> +		}
> +
> +	      do_cleanups (old_chain);
> +
> +	      /* This goes through the topmost target again.  */
> +	      res = memory_xfer_live_readonly_partial (&remote_ops,

This "&remote_ops" here will be wrong in case we're connected
with extended-remote.  Looks like remote_read_bytes needs to be
gain an ops parameter.

Otherwise looks good.

Thanks,
-- 
Pedro Alves


  parent reply	other threads:[~2014-03-21 11:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 12:44 Yao Qi
2014-03-11 12:45 ` [PATCH 3/3] Remove target_read_live_memory Yao Qi
2014-03-21 12:01   ` Pedro Alves
2014-03-22 11:23     ` Yao Qi
2014-03-11 12:45 ` [PATCH 2/3] Factor remote_read_bytes Yao Qi
2014-03-21 11:57   ` Pedro Alves
2014-03-21  9:41 ` [PATCH 1/3] Move the traceframe_available_memory code from memory_xfer_partial_1 down to the targets Yao Qi
2014-03-21 11:56 ` Pedro Alves [this message]
2014-03-22 11:20   ` Yao Qi

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=532C28F1.5040705@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.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