This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] arm-tdep.c: Refactor displaced stepping relocation functions
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>, <gdb-patches at sourceware dot org>
- Date: Fri, 26 Feb 2016 11:23:32 -0500
- Subject: Re: [PATCH 2/2] arm-tdep.c: Refactor displaced stepping relocation functions
- Authentication-results: sourceware.org; auth=none
- References: <1456415245-24005-1-git-send-email-simon dot marchi at ericsson dot com> <1456415245-24005-3-git-send-email-simon dot marchi at ericsson dot com> <56D07946 dot 2060104 at codesourcery dot com>
>> 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?
I am not sure I understand your comment. Given this call tree:
- arm_process_displaced_insn
- arm_relocate_insn_arm
...
- arm_relocate_insn_thumb_32bit
...
- arm_relocate_insn_thumb_16bit
...
my patch makes it so that the arm_relocate_insn* functions return an error code, and
arm_process_displaced_insn calls internal_error if an error is returned. Do you suggest
putting the internal_error calls in the arm_relocate_insn_* functions directly?