This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/6] Tweak in memory_error
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 06 Feb 2014 12:41:49 +0000
- Subject: Re: [PATCH 1/6] Tweak in memory_error
- Authentication-results: sourceware.org; auth=none
- References: <1391139325-2758-1-git-send-email-yao at codesourcery dot com> <1391139325-2758-2-git-send-email-yao at codesourcery dot com>
On 01/31/2014 03:35 AM, Yao Qi wrote:
> This patch adds a local variable exception of type 'enum errors' and
> pass it to throw_error.
Ah, took me a second to realize _why_. OK, but could you
add this to the commit log please ? :
'err' is of type 'enum target_xfer_error', and we're abusing it
to store an 'enum errors'.
Thanks!
--
Pedro Alves
>
> gdb:
>
> 2014-01-30 Yao Qi <yao@codesourcery.com>
>
> * corefile.c (memory_error): Get 'exception' from ERR and pass
> 'exception' to throw_error.
> ---
> gdb/corefile.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/corefile.c b/gdb/corefile.c
> index 1ed8395..93f5e04 100644
> --- a/gdb/corefile.c
> +++ b/gdb/corefile.c
> @@ -221,6 +221,7 @@ void
> memory_error (enum target_xfer_error err, CORE_ADDR memaddr)
> {
> char *str;
> + enum errors exception = GDB_NO_ERROR;
>
> /* Build error string. */
> str = memory_error_message (err, target_gdbarch (), memaddr);
> @@ -230,15 +231,15 @@ memory_error (enum target_xfer_error err, CORE_ADDR memaddr)
> switch (err)
> {
> case TARGET_XFER_E_IO:
> - err = MEMORY_ERROR;
> + exception = MEMORY_ERROR;
> break;
> case TARGET_XFER_E_UNAVAILABLE:
> - err = NOT_AVAILABLE_ERROR;
> + exception = NOT_AVAILABLE_ERROR;
> break;
> }
>
> /* Throw it. */
> - throw_error (err, ("%s"), str);
> + throw_error (exception, ("%s"), str);
> }
>
> /* Same as target_read_memory, but report an error if can't read. */
>