Blame SOURCES/gdb-rhbz1480496-power-atomic-step-1of5.patch

8f6b9e
commit 62f7182c14492421b8d59ba5c6640d6c27ad6ea2
8f6b9e
Author: Anton Blanchard <anton@samba.org>
8f6b9e
Date:   Fri Mar 28 12:37:37 2014 +1100
8f6b9e
8f6b9e
    Fix ppc64 single step over atomic sequence testcase.
8f6b9e
    
8f6b9e
    The current ppc64 single step over atomic sequence testcase is written
8f6b9e
    in C and breaks with some versions of gcc. Convert the test to
8f6b9e
    assembly and use stepi to step through it.
8f6b9e
    
8f6b9e
    gdb/testsuite/
8f6b9e
    2014-04-01  Anton Blanchard  <anton@samba.org>
8f6b9e
    
8f6b9e
            * gdb.arch/ppc64-atomic-inst.c: Remove.
8f6b9e
            * gdb.arch/ppc64-atomic-inst.S: New file.
8f6b9e
            * gdb.arch/ppc64-atomic-inst.exp: Adapt for asm based testcase.
8f6b9e
8f6b9e
### a/gdb/testsuite/ChangeLog
8f6b9e
### b/gdb/testsuite/ChangeLog
8f6b9e
## -1,3 +1,9 @@
8f6b9e
+2014-04-01  Anton Blanchard  <anton@samba.org>
8f6b9e
+
8f6b9e
+	* gdb.arch/ppc64-atomic-inst.c: Remove.
8f6b9e
+	* gdb.arch/ppc64-atomic-inst.S: New file.
8f6b9e
+	* gdb.arch/ppc64-atomic-inst.exp: Adapt for asm based testcase.
8f6b9e
+
8f6b9e
 2014-03-31  Doug Evans  <dje@google.com>
8f6b9e
 
8f6b9e
 	* gdb.base/print-symbol-loading-lib.c: New file.
8f6b9e
--- /dev/null
8f6b9e
+++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S
8f6b9e
@@ -0,0 +1,61 @@
8f6b9e
+/* This file is part of GDB, the GNU debugger.
8f6b9e
+
8f6b9e
+   Copyright 2008-2014 Free Software Foundation, Inc.
8f6b9e
+
8f6b9e
+   This program is free software; you can redistribute it and/or modify
8f6b9e
+   it under the terms of the GNU General Public License as published by
8f6b9e
+   the Free Software Foundation; either version 3 of the License, or
8f6b9e
+   (at your option) any later version.
8f6b9e
+
8f6b9e
+   This program is distributed in the hope that it will be useful,
8f6b9e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
8f6b9e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8f6b9e
+   GNU General Public License for more details.
8f6b9e
+
8f6b9e
+   You should have received a copy of the GNU General Public License
8f6b9e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
8f6b9e
+
8f6b9e
+	.align 2
8f6b9e
+	.globl main
8f6b9e
+#if _CALL_ELF == 2
8f6b9e
+	.type main,@function
8f6b9e
+main:
8f6b9e
+#else
8f6b9e
+	.section ".opd","aw"
8f6b9e
+	.align 3
8f6b9e
+main:
8f6b9e
+	.quad .main,.TOC.@tocbase,0
8f6b9e
+	.size main,.-main
8f6b9e
+	.previous
8f6b9e
+	.globl .main
8f6b9e
+	.type .main,@function
8f6b9e
+.main:
8f6b9e
+#endif
8f6b9e
+
8f6b9e
+	li	0,0
8f6b9e
+	addi	4,1,-8
8f6b9e
+
8f6b9e
+	stw	0,0(4)
8f6b9e
+1:	lwarx	5,0,4
8f6b9e
+	cmpwi	5,0
8f6b9e
+	bne	2f
8f6b9e
+	addi	5,5,1
8f6b9e
+	stwcx.	5,0,4
8f6b9e
+	bne	1b
8f6b9e
+
8f6b9e
+	std	0,0(4)
8f6b9e
+2:	ldarx	5,0,4
8f6b9e
+	cmpdi	5,0
8f6b9e
+	bne	3f
8f6b9e
+	addi	5,5,1
8f6b9e
+	stdcx.	5,0,4
8f6b9e
+	bne	1b
8f6b9e
+
8f6b9e
+3:	li	3,0
8f6b9e
+	blr
8f6b9e
+
8f6b9e
+#if _CALL_ELF == 2
8f6b9e
+	.size main,.-main
8f6b9e
+#else
8f6b9e
+	.size .main,.-.main
8f6b9e
+#endif
8f6b9e
--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.c
8f6b9e
+++ /dev/null
8f6b9e
@@ -1,44 +0,0 @@
8f6b9e
-/* This file is part of GDB, the GNU debugger.
8f6b9e
-
8f6b9e
-   Copyright 2008-2013 Free Software Foundation, Inc.
8f6b9e
-
8f6b9e
-   This program is free software; you can redistribute it and/or modify
8f6b9e
-   it under the terms of the GNU General Public License as published by
8f6b9e
-   the Free Software Foundation; either version 3 of the License, or
8f6b9e
-   (at your option) any later version.
8f6b9e
-
8f6b9e
-   This program is distributed in the hope that it will be useful,
8f6b9e
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
8f6b9e
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8f6b9e
-   GNU General Public License for more details.
8f6b9e
-
8f6b9e
-   You should have received a copy of the GNU General Public License
8f6b9e
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
8f6b9e
-
8f6b9e
-#include <stdio.h>
8f6b9e
-
8f6b9e
-int main()
8f6b9e
-{
8f6b9e
-  unsigned int word = 0;
8f6b9e
-  unsigned int *word_addr = &wor;;
8f6b9e
-  unsigned long dword = 0;
8f6b9e
-  unsigned long *dword_addr = &dword;
8f6b9e
-
8f6b9e
-  __asm __volatile ("1:     lwarx   %0,0,%2\n"              \
8f6b9e
-                    "       addi    %0,%0,1\n"              \
8f6b9e
-                    "       stwcx.  %0,0,%2\n"              \
8f6b9e
-                    "       bne-    1b"			    \
8f6b9e
-                    : "=&b" (word), "=m" (*word_addr)       \
8f6b9e
-                    : "b" (word_addr), "m" (*word_addr)     \
8f6b9e
-                    : "cr0", "memory");			    \
8f6b9e
-
8f6b9e
-  __asm __volatile ("1:     ldarx   %0,0,%2\n"              \
8f6b9e
-                    "       addi    %0,%0,1\n"              \
8f6b9e
-                    "       stdcx.  %0,0,%2\n"              \
8f6b9e
-                    "       bne-    1b"                     \
8f6b9e
-                    : "=&b" (dword), "=m" (*dword_addr)     \
8f6b9e
-                    : "b" (dword_addr), "m" (*dword_addr)   \
8f6b9e
-                    : "cr0", "memory");                     \
8f6b9e
-
8f6b9e
-  return 0;
8f6b9e
-}
8f6b9e
--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
8f6b9e
+++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
8f6b9e
@@ -27,7 +27,7 @@ if {![istarget "powerpc*"] || ![is_lp64_target]} {
8f6b9e
 }
8f6b9e
 
8f6b9e
 set testfile "ppc64-atomic-inst"
8f6b9e
-set srcfile ${testfile}.c
8f6b9e
+set srcfile ${testfile}.S
8f6b9e
 set binfile ${objdir}/${subdir}/${testfile}
8f6b9e
 set compile_flags {debug quiet}
8f6b9e
 
8f6b9e
@@ -50,11 +50,18 @@ set bp1 [gdb_get_line_number "lwarx"]
8f6b9e
 gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \
8f6b9e
   "Set the breakpoint at the start of the sequence"
8f6b9e
 
8f6b9e
+set bp2 [gdb_get_line_number "ldarx"]
8f6b9e
+gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \
8f6b9e
+  "Set the breakpoint at the start of the sequence"
8f6b9e
+
8f6b9e
 gdb_test continue "Continuing.*Breakpoint $decimal.*" \
8f6b9e
   "Continue until breakpoint"
8f6b9e
 
8f6b9e
-gdb_test next ".*__asm __volatile.*" \
8f6b9e
+gdb_test nexti "bne.*1b" \
8f6b9e
   "Step through the lwarx/stwcx sequence"
8f6b9e
 
8f6b9e
-gdb_test next ".*return 0.*" \
8f6b9e
-  "Step through the ldarx/stdcx sequence"
8f6b9e
+gdb_test continue "Continuing.*Breakpoint $decimal.*" \
8f6b9e
+  "Continue until breakpoint"
8f6b9e
+
8f6b9e
+gdb_test nexti "bne.*1b" \
8f6b9e
+  "Step through the lwarx/stwcx sequence"