Fix shifting of negative value
authorLuis Machado <luis.machado@linaro.org>
Wed, 2 Dec 2020 14:29:30 +0000 (11:29 -0300)
committerLuis Machado <luis.machado@linaro.org>
Fri, 4 Dec 2020 14:17:00 +0000 (11:17 -0300)
commit5382f97180f5be551868449e411a4daaebf232fb
tree8cc4c6f8a8d23877ce212441c8946122c829c630
parent67748e0f666f0645d7f182e1365f4d9859e55f1d
Fix shifting of negative value

When UBSan is enabled, I noticed runtime errors complaining of shifting
of negative numbers.

This patch fixes this by reusing existing macros from the ARM port.

It also removes unused macros from AArch64's port.

gdb/ChangeLog:

2020-12-04  Luis Machado  <luis.machado@linaro.org>

* aarch64-tdep.c (submask, bit, bits): Remove.
* arch/aarch64-insn.c (extract_signed_bitfield): Remove.
(aarch64_decode_adr, aarch64_decode_b aarch64_decode_bcond)
(aarch64_decode_cb, aarch64_decode_tb)
(aarch64_decode_ldr_literal): Use sbits to extract a signed
immediate.
* arch/aarch64-insn.h (submask, bits, bit, sbits): New macros.
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/arch/aarch64-insn.c
gdb/arch/aarch64-insn.h