• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisióndddcc4b5eec8b9c89c54131ddcb6c73949de98ea (tree)
Tiempo2020-06-26 01:23:38
AutorLuis Machado <luis.machado@lina...>
CommiterLuis Machado

Log Message

AArch64: Add unit testing for logical tag set/get operations

Add some unit testing to exercise setting/getting logical tags in the
AArch64 implementation.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* aarch64-linux-tdep.c: Include gdbsupport/selftest.h.
(aarch64_linux_ltag_tests): New function.
(_initialize_aarch64_linux_tdep): Register aarch64_linux_ltag_tests.

Cambiar Resumen

Diferencia incremental

--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -50,6 +50,8 @@
5050 #include "arch-utils.h"
5151 #include "value.h"
5252
53+#include "gdbsupport/selftest.h"
54+
5355 /* Signal frame handling.
5456
5557 +------------+ ^
@@ -1900,10 +1902,39 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
19001902 set_gdbarch_gcc_target_options (gdbarch, aarch64_linux_gcc_target_options);
19011903 }
19021904
1905+#if GDB_SELF_TEST
1906+
1907+namespace selftests {
1908+
1909+/* Verify functions to read and write logical tags. */
1910+
1911+static void
1912+aarch64_linux_ltag_tests (void)
1913+{
1914+ /* We have 4 bits of tags, but we test writing all the bits of the top
1915+ byte of address. */
1916+ for (int i = 0; i < 1 << 8; i++)
1917+ {
1918+ CORE_ADDR addr = ((CORE_ADDR) i << 56) | 0xdeadbeef;
1919+ SELF_CHECK (aarch64_linux_get_ltag (addr) == (i & 0xf));
1920+
1921+ addr = aarch64_linux_set_ltag (0xdeadbeef, i);
1922+ SELF_CHECK (addr = ((CORE_ADDR) (i & 0xf) << 56) | 0xdeadbeef);
1923+ }
1924+}
1925+
1926+} // namespace selftests
1927+#endif /* GDB_SELF_TEST */
1928+
19031929 void _initialize_aarch64_linux_tdep ();
19041930 void
19051931 _initialize_aarch64_linux_tdep ()
19061932 {
19071933 gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_LINUX,
19081934 aarch64_linux_init_abi);
1935+
1936+#if GDB_SELF_TEST
1937+ selftests::register_test ("aarch64-linux-tagged-address",
1938+ selftests::aarch64_linux_ltag_tests);
1939+#endif
19091940 }