This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] arm-tdep.c: Refactor arm_process_displaced_insn
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Thu, 11 Feb 2016 11:21:56 +0000
- Subject: Re: [PATCH 1/3] arm-tdep.c: Refactor arm_process_displaced_insn
- Authentication-results: sourceware.org; auth=none
- References: <1455121027-27061-1-git-send-email-simon dot marchi at ericsson dot com> <1455121027-27061-2-git-send-email-simon dot marchi at ericsson dot com>
Simon Marchi <simon.marchi@ericsson.com> writes:
> - if ((insn & 0xf0000000) == 0xf0000000)
> - err = arm_decode_unconditional (gdbarch, insn, regs, dsc);
> - else switch (((insn & 0x10) >> 4) | ((insn & 0xe000000) >> 24))
> + cond = bits (insn, 28, 31);
Variable 'cond' is only used once, so don't need to define it. This is
my personal flavour.
> + op1 = bits (insn, 25, 27);
> + op = bit (insn, 4);
> +
> + if (cond != 0xf)
if (bits (insn, 28, 31) != INST_NV)
this is consistent with other places in arm-tdep.c
> {
> - case 0x0: case 0x1: case 0x2: case 0x3:
> - err = arm_decode_dp_misc (gdbarch, insn, regs, dsc);
> - break;
> + switch (op1)
> + {
> + case 0x0:
> + case 0x1:
> + /* Data-processing and miscellaneous instructions */
> + err = arm_decode_dp_misc (gdbarch, insn, regs, dsc);
> + break;
>
> - case 0x4: case 0x5: case 0x6:
> - err = arm_decode_ld_st_word_ubyte (gdbarch, insn, regs, dsc);
> - break;
> + case 0x2:
> + /* Load/store word and unsigned byte */
> + err = arm_decode_ld_st_word_ubyte (gdbarch, insn, regs, dsc);
> + break;
>
> - case 0x7:
> - err = arm_decode_media (gdbarch, insn, dsc);
> - break;
> + case 0x3:
> + if (op == 0)
'op' is only used here, let us define it in this block, or use
'bit (insn, 4)' instead.
--
Yao (éå)