• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

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

修訂9e45a8561d934bc1ae07ff4356312afb69e0bd00 (tree)
時間2020-06-16 21:58:32
作者Luis Machado <luis.machado@lina...>
CommiterLuis Machado

Log Message

Add unit testing for logical tag set/get

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.

Change Summary

差異

--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -52,6 +52,8 @@
5252
5353 #include "arch/aarch64-linux.h"
5454
55+#include "gdbsupport/selftest.h"
56+
5557 /* Signal frame handling.
5658
5759 +------------+ ^
@@ -1956,10 +1958,39 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
19561958 set_gdbarch_gcc_target_options (gdbarch, aarch64_linux_gcc_target_options);
19571959 }
19581960
1961+#if GDB_SELF_TEST
1962+
1963+namespace selftests {
1964+
1965+/* Verify functions to read and write logical tags. */
1966+
1967+static void
1968+aarch64_linux_ltag_tests (void)
1969+{
1970+ /* We have 4 bits of tags, but we test writing all the bits of the top
1971+ byte of address. */
1972+ for (int i = 0; i < 1 << 8; i++)
1973+ {
1974+ CORE_ADDR addr = ((CORE_ADDR) i << 56) | 0xdeadbeef;
1975+ SELF_CHECK (aarch64_linux_get_ltag (addr) == (i & 0xf));
1976+
1977+ addr = aarch64_linux_set_ltag (0xdeadbeef, i);
1978+ SELF_CHECK (addr = ((CORE_ADDR) (i & 0xf) << 56) | 0xdeadbeef);
1979+ }
1980+}
1981+
1982+} // namespace selftests
1983+#endif /* GDB_SELF_TEST */
1984+
19591985 void _initialize_aarch64_linux_tdep ();
19601986 void
19611987 _initialize_aarch64_linux_tdep ()
19621988 {
19631989 gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_LINUX,
19641990 aarch64_linux_init_abi);
1991+
1992+#if GDB_SELF_TEST
1993+ selftests::register_test ("aarch64-linux-tagged-address",
1994+ selftests::aarch64_linux_ltag_tests);
1995+#endif
19651996 }