Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, <tromey@redhat.com>,
	<gdb-patches@sourceware.org>
Subject: Re: [COMMIT] Re: [PATCH] PR gdb/15871: Unavailable entry value is not shown correctly
Date: Fri, 23 Aug 2013 01:08:00 -0000	[thread overview]
Message-ID: <5216B5C9.3010402@codesourcery.com> (raw)
In-Reply-To: <5215E241.6010008@redhat.com>

On 08/22/2013 06:04 PM, Pedro Alves wrote:
> I meant deprecated_xfer_memory, which does:
>
>         0 means that we can't handle this.  If errno has been set, it is the
>         error which prevented us from doing it (FIXME: What about bfd_error?).
>
> and using errno values as error indication in target.h methods.  E.g.,
> target_read_memory:
>
> /* Read LEN bytes of target memory at address MEMADDR, placing the results in
>     GDB's memory at MYADDR.  Returns either 0 for success or an errno value
>     if any error occurs.
>
> using errno values limits what we can return here.  There's no
> errno for <unavailable>, for example.  So, it'd be better if
> we returned target_xfer_error instead.  If we needed to indicate
> an errno or a bfd error in addition, new TARGET_XFER_E_ERRNO or
> TARGET_XFER_E_BFD values could be added to target_xfer_error
> (and the caller would then have to consult errno or bfd_error
> in addition then).
>

OK, it is clear to me.

I'd like to write this down in section "Internals" in 
http://sourceware.org/gdb/wiki/ProjectIdeas , let me know what do you think.

Use target_xfer_error instead of errno.  Some xfer_memory functions 
(such as target_read_memory and deprecated_xfer_memory) are
using errno to indicate any error occurs.  This limites what we can 
return here, because we can't return some GDB-specific errors, such as 
<unavailable>.  If we need to indicate an errno, bfd error for example, 
a new TARGET_XFER_E_BFD can be added to target_xfer_error.  See
http://sourceware.org/ml/gdb-patches/2013-08/msg00589.html for more info.

>> >
>>> >>+/* Report a target xfer memory error by throwing a suitable
>>> >>+   exception.  */
>>> >>+
>>> >>+static void
>>> >>+target_xfer_memory_error (enum target_xfer_error err, CORE_ADDR memaddr)
>>> >>+{
>>> >>+  switch (err)
>>> >>+    {
>>> >>+    case TARGET_XFER_E_IO:
>>> >>+      /* Actually, address between memaddr and memaddr + len was out of
>>> >>+	 bounds.  */
>> >
>> >This line of comment doesn't make much sense in the context of this
>> >function.
> I think it makes some sense if you consider the context that the caller
> always has a length handy.  But yeah.  This is a preexisting issue
> though (see memory_error, this new function can be looked at as
> a refactor).  Maybe what we should do is actually pass in the
> length, and show the range to the user instead of just the first
> address.  Sometimes that info is useful, as it may not be the first
> address in the requested range that actually is inaccessible.
>

Yeah, printing the range is useful some times.

-- 
Yao (齐尧)


  reply	other threads:[~2013-08-23  1:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13  7:41 [PATCH 0/2] Test case on entry values Yao Qi
2013-08-13  7:41 ` [RFC 2/2] Test entry values in trace frame Yao Qi
2013-08-20 17:48   ` Tom Tromey
2013-08-21  6:06     ` Yao Qi
2013-08-21 14:35       ` [PATCH] PR gdb/15871: Unavailable entry value is not shown correctly Pedro Alves
2013-08-21 14:47         ` Mark Kettenis
2013-08-21 15:32           ` Pedro Alves
2013-08-21 15:43             ` Mark Kettenis
2013-08-22  1:25             ` Yao Qi
2013-08-22 10:04               ` [COMMIT] " Pedro Alves
2013-08-23  1:08                 ` Yao Qi [this message]
2013-08-23 16:50                   ` Pedro Alves
2013-08-23  0:32       ` [RFC 2/2] Test entry values in trace frame Yao Qi
2013-08-23 17:04         ` Pedro Alves
2013-08-23 19:16           ` Tom Tromey
2013-08-24  1:56             ` Yao Qi
2013-08-13  7:41 ` [PATCH 1/2] Test case for entry values Yao Qi
2013-08-20 17:39   ` Tom Tromey
2013-08-21  5:55     ` Yao Qi
2013-08-21 15:02       ` Tom Tromey
2013-08-22  0:12         ` Yao Qi
2013-08-22 14:05           ` Tom Tromey
2013-08-23  0:27             ` Yao Qi
2013-08-23 19:23               ` Tom Tromey
2013-08-24  1:56                 ` Yao Qi
2013-08-30 14:52   ` Vidya Praveen
2013-08-30 15:29     ` Vidya Praveen
2013-08-31  0:22       ` Yao Qi
2013-09-10 15:30         ` Vidya Praveen
2013-09-10 23:44           ` Yao Qi
2013-09-11 13:27             ` Vidya Praveen

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=5216B5C9.3010402@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=palves@redhat.com \
    --cc=tromey@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