diff options
author | Kyle McMartin <kmcmarti@redhat.com> | 2014-04-30 12:04:50 -0400 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2014-05-07 09:41:50 -0700 |
commit | 9404b58f46328b3b171b0d5eeb0691bd685bc4f5 (patch) | |
tree | 58af2628b8997b03e420677d7793c1892372e248 /gdb/testsuite | |
parent | ae52f4830604b4b82bcbe6ad52208d5efcea2f82 (diff) | |
download | gdb-9404b58f46328b3b171b0d5eeb0691bd685bc4f5.zip gdb-9404b58f46328b3b171b0d5eeb0691bd685bc4f5.tar.gz gdb-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')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/aarch64-atomic-inst.c | 48 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp | 48 |
3 files changed, 102 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 106ba11..66d151b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-05-07 Kyle McMartin <kyle@redhat.com> + + Pushed by Joel Brobecker <brobecker@adacore.com>. + * gdb.arch/aarch64-atomic-inst.c: New file. + * gdb.arch/aarch64-atomic-inst.exp: New file. + 2014-05-07 Yao Qi <yao@codesourcery.com> * gdb.dwarf2/dwzbuildid.exp: Match output "No symbol "the_int" 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; +} diff --git a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp new file mode 100644 index 0000000..377aebc --- /dev/null +++ b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp @@ -0,0 +1,48 @@ +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# This file is part of the gdb testsuite. + +# Test single stepping through atomic sequences beginning with +# a ldxr instruction and ending with a stxr instruction. + +if {![istarget "aarch64*"]} { + verbose "Skipping ${gdb_test_file_name}." + return +} + +standard_testfile +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +if ![runto_main] { + untested "could not run to main" + return -1 +} + +gdb_breakpoint "[gdb_get_line_number "ldxr"]" \ + "Breakpoint $decimal at $hex" \ + "Set the breakpoint at the start of the sequence" + +gdb_test "continue" "Continuing.*Breakpoint $decimal.*" \ + "Continue until breakpoint" + +gdb_test "next" ".*__asm __volatile.*" \ + "Step through the ldxr/stxr sequence" + +gdb_test "next" ".*return dword.*" \ + "Stepped through sequence through conditional branch" |