aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c
diff options
context:
space:
mode:
authorKyle McMartin <kmcmarti@redhat.com>2014-04-30 12:04:50 -0400
committerJoel Brobecker <brobecker@adacore.com>2014-05-07 09:41:50 -0700
commit9404b58f46328b3b171b0d5eeb0691bd685bc4f5 (patch)
tree58af2628b8997b03e420677d7793c1892372e248 /gdb/testsuite/gdb.arch/aarch64-atomic-inst.c
parentae52f4830604b4b82bcbe6ad52208d5efcea2f82 (diff)
downloadbinutils-9404b58f46328b3b171b0d5eeb0691bd685bc4f5.zip
binutils-9404b58f46328b3b171b0d5eeb0691bd685bc4f5.tar.gz
binutils-9404b58f46328b3b171b0d5eeb0691bd685bc4f5.tar.bz2
aarch64: detect atomic sequences like other ll/sc architectures
gdb/Changelog: * aarch64-tdep.c (aarch64_software_single_step): New function. (aarch64_gdbarch_init): Handle single stepping of atomic sequences with aarch64_software_single_step. gdb/testsuite/ChangeLog: * gdb.arch/aarch64-atomic-inst.c: New file. * gdb.arch/aarch64-atomic-inst.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.arch/aarch64-atomic-inst.c')
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-atomic-inst.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c
new file mode 100644
index 0000000..9a73c7a
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c
@@ -0,0 +1,48 @@
+/* This file is part of GDB, the GNU debugger.
+
+ Copyright 2008-2014 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int main(void)
+{
+ unsigned long tmp, cond;
+ unsigned long dword = 0;
+
+ /* Test that we can step over ldxr/stxr. This sequence should step from
+ ldxr to the following __asm __volatile. */
+ __asm __volatile ("1: ldxr %0,%2\n" \
+ " cmp %0,#1\n" \
+ " b.eq out\n" \
+ " add %0,%0,1\n" \
+ " stxr %w1,%0,%2\n" \
+ " cbnz %w1,1b" \
+ : "=&r" (tmp), "=&r" (cond), "+Q" (dword) \
+ : : "memory");
+
+ /* This sequence should take the conditional branch and step from ldxr
+ to the return dword line. */
+ __asm __volatile ("1: ldxr %0,%2\n" \
+ " cmp %0,#1\n" \
+ " b.eq out\n" \
+ " add %0,%0,1\n" \
+ " stxr %w1,%0,%2\n" \
+ " cbnz %w1,1b\n" \
+ : "=&r" (tmp), "=&r" (cond), "+Q" (dword) \
+ : : "memory");
+
+ dword = -1;
+__asm __volatile ("out:\n");
+ return dword;
+}