Discussion:
[PATCH][Binutils][Arm] Fix disassembler crashing on -b binary when thumb file and thumb not forced.
Tamar Christina
2018-10-17 16:18:12 UTC
Permalink
Hi All,

The disassembler for Arm has some aborts in it in places it assumes can never
be reached. Under normal circumstances they indeed cannot be reached because
the right options are selected from the ARM attributes in the ELF file.

However when disassembling with -b binary then if you do not get the options
right the disassembler just aborts. This changes it so it just prints how it
was trying to interpret the instruction and prints UNKNOWN instructions next to it.

This way the user has an idea of what's going.

build on native hardware and regtested on
arm-none-eabi, arm-none-eabi (64 bit host),
arm-none-linux-gnueabihf, arm-none-linux-gnueabihf (64 bit host)

Cross-compiled and regtested on
arm-none-eabi, armeb-none-eabi

and no issues.

Ok for master? and for backport to binutils-2.31?

Thanks,
Tamar

gas/ChangeLog:
2018-10-17 Tamar Christina <***@arm.com>

* testsuite/gas/arm/undefined-insn-arm.d: New test.
* testsuite/gas/arm/undefined-insn-thumb.d: New test.
* testsuite/gas/arm/undefined-insn.s: New test.

opcodes/ChangeLog:
2018-10-17 Tamar Christina <***@arm.com>

* arm-dis.c (UNKNOWN_INSTRUCTION_32BIT): Format specifier for arm mode.
(UNKNOWN_INSTRUCTION_16BIT): Format specifier for thumb mode.
(print_insn_arm, print_insn_thumb16, print_insn_thumb32): Use them.

--
Nick Clifton
2018-10-18 16:18:03 UTC
Permalink
Hi Tamar,
Post by Tamar Christina
* testsuite/gas/arm/undefined-insn-arm.d: New test.
* testsuite/gas/arm/undefined-insn-thumb.d: New test.
* testsuite/gas/arm/undefined-insn.s: New test.
* arm-dis.c (UNKNOWN_INSTRUCTION_32BIT): Format specifier for arm mode.
(UNKNOWN_INSTRUCTION_16BIT): Format specifier for thumb mode.
(print_insn_arm, print_insn_thumb16, print_insn_thumb32): Use them.
Approved - please apply.

Cheers
Nick


PS. Thank you for getting rid of some aborts. Personally, I think that
they are a bad thing to have in a library...
Christophe Lyon
2018-10-19 12:44:36 UTC
Permalink
Hi Tamar,
Post by Nick Clifton
Hi Tamar,
Post by Tamar Christina
* testsuite/gas/arm/undefined-insn-arm.d: New test.
* testsuite/gas/arm/undefined-insn-thumb.d: New test.
* testsuite/gas/arm/undefined-insn.s: New test.
* arm-dis.c (UNKNOWN_INSTRUCTION_32BIT): Format specifier for arm mode.
(UNKNOWN_INSTRUCTION_16BIT): Format specifier for thumb mode.
(print_insn_arm, print_insn_thumb16, print_insn_thumb32): Use them.
Approved - please apply.
Cheers
Nick
PS. Thank you for getting rid of some aborts. Personally, I think that
they are a bad thing to have in a library...
I've noticed regressions after your patch on arm-wince-pe:
FAIL: gas:Undefined binary printing in arm mode
FAIL: gas:Undefined binary printing in thumb mode

Christophe
Tamar Christina
2018-10-19 13:15:51 UTC
Permalink
Hi Christoph,
Post by Christophe Lyon
FAIL: gas:Undefined binary printing in arm mode
FAIL: gas:Undefined binary printing in thumb mode
Christophe
Ah right, the test aren't valid for -pe, I'll widen the skips to exclude *-*-pe instead of
*-unknown-pe and commit it under the obvious rule.

Thanks,

Loading...