Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <lgustavo@codesourcery.com>
To: Simon Marchi <simon.marchi@ericsson.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/2] arm-tdep.c: Refactor displaced stepping relocation functions
Date: Fri, 26 Feb 2016 16:11:00 -0000	[thread overview]
Message-ID: <56D07946.2060104@codesourcery.com> (raw)
In-Reply-To: <1456415245-24005-3-git-send-email-simon.marchi@ericsson.com>

On 02/25/2016 12:47 PM, Simon Marchi wrote:
> A small refactor so that arm_process_displaced_insn is the only function
> specific to GDB.  All functions called from this one will eventually be
> moved to common/, so they need to be free of anything GDB-specific.  I
> also renamed those functions from "process_displaced" to "relocate",
> since they won't be used exclusively for displaced stepping anymore.
>
> The call tree ends up like this:
>
>    - arm_process_displaced_insn
>      - arm_relocate_insn_arm
>        ...
>      - arm_relocate_insn_thumb_32bit
>        ...
>      - arm_relocate_insn_thumb_16bit
>        ...
>
> gdb/ChangeLog:
>
> 	* arm-tdep.c (thumb_process_displaced_16bit_insn): Rename to...
> 	(arm_relocate_insn_thumb_16bit): ... this, and add return error
> 	code.
> 	(thumb_process_displaced_32bit_insn): Rename to...
> 	(arm_relocate_insn_thumb_32bit): ... this, and add return error
> 	code.
> 	(thumb_process_displaced_insn): Remove.
> 	(arm_relocate_insn_arm): New function, extracted mostly from...
> 	(arm_process_displaced_insn): ... this.  Refactor to adapt to
> 	other functions changes.
> ---
>   gdb/arm-tdep.c | 122 ++++++++++++++++++++++++++++++---------------------------
>   1 file changed, 64 insertions(+), 58 deletions(-)
>
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index 43b61c2..ef48a90 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -7111,9 +7111,8 @@ thumb_copy_pop_pc_16bit (uint16_t insn1, struct arm_insn_reloc_data *data)
>     return 0;
>   }
>
> -static void
> -thumb_process_displaced_16bit_insn (uint16_t insn1,
> -				    struct arm_insn_reloc_data *data)
> +static int
> +arm_relocate_insn_thumb_16bit (uint16_t insn1, struct arm_insn_reloc_data *data)
>   {
>     unsigned short op_bit_12_15 = bits (insn1, 12, 15);
>     unsigned short op_bit_10_11 = bits (insn1, 10, 11);
> @@ -7202,9 +7201,7 @@ thumb_process_displaced_16bit_insn (uint16_t insn1,
>         err = 1;
>       }
>
> -  if (err)
> -    internal_error (__FILE__, __LINE__,
> -		    _("thumb_process_displaced_16bit_insn: Instruction decode error"));
> +  return err;

Should we keep this internal error message under a different context 
instead of exporting just an error code? Maybe the error code should 
trigger this internal error for GDB?

>   }
>
>   static int
> @@ -7279,9 +7276,9 @@ decode_thumb_32bit_ld_mem_hints (uint16_t insn1, uint16_t insn2,
>     return 0;
>   }
>
> -static void
> -thumb_process_displaced_32bit_insn (uint16_t insn1, uint16_t insn2,
> -				    struct arm_insn_reloc_data *data)
> +static int
> +arm_relocate_insn_thumb_32bit (uint16_t insn1, uint16_t insn2,
> +			       struct arm_insn_reloc_data *data)
>   {
>     int err = 0;
>     unsigned short op = bit (insn2, 15);
> @@ -7393,34 +7390,41 @@ thumb_process_displaced_32bit_insn (uint16_t insn1, uint16_t insn2,
>         err = 1;
>       }
>
> -  if (err)
> -    internal_error (__FILE__, __LINE__,
> -		    _("thumb_process_displaced_32bit_insn: Instruction decode error"));
> +  return err;
>

The above one too?

Otherwise it looks mostly ok to me, though the patch is a little 
convoluted due to code movement.


  reply	other threads:[~2016-02-26 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 15:47 [PATCH 0/2] Decouple ARM instruction decoding/relocating from GDB Simon Marchi
2016-02-25 15:47 ` [PATCH 1/2] arm-tdep.c: Replace arguments to relocation functions by a structure Simon Marchi
2016-02-26 16:12   ` Luis Machado
2016-02-26 16:25     ` Simon Marchi
2016-02-26 16:26       ` Simon Marchi
2016-02-25 15:47 ` [PATCH 2/2] arm-tdep.c: Refactor displaced stepping relocation functions Simon Marchi
2016-02-26 16:11   ` Luis Machado [this message]
2016-02-26 16:23     ` Simon Marchi
2016-02-26 16:50       ` Luis Machado
2016-03-04 12:03 ` [PATCH 0/2] Decouple ARM instruction decoding/relocating from GDB Yao Qi
2016-03-04 18:42   ` Simon Marchi

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=56D07946.2060104@codesourcery.com \
    --to=lgustavo@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.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