|
|
dc7ef9 |
commit 2039d74e780db6659c87cd3c426d526615cfe703
|
|
|
dc7ef9 |
Author: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
|
|
|
dc7ef9 |
Date: Tue Feb 21 11:14:56 2017 -0300
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
[ppc64] Add POWER8/ISA 2.07 atomic sequences single-stepping support
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
gdb/
|
|
|
dc7ef9 |
2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
* rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK.
|
|
|
dc7ef9 |
(STORE_CONDITIONAL_MASK): Rename from STWCX_MASK.
|
|
|
dc7ef9 |
(LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION,
|
|
|
dc7ef9 |
STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines.
|
|
|
dc7ef9 |
(IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros.
|
|
|
dc7ef9 |
(ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN.
|
|
|
dc7ef9 |
(ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and
|
|
|
dc7ef9 |
IS_STORE_CONDITIONAL_INSN.
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
gdb/testsuite/
|
|
|
dc7ef9 |
2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
* gdb.arch/ppc64-isa207-atomic-inst.exp: New testcase based on
|
|
|
dc7ef9 |
gdb.arch/ppc64-atomic-inst.exp. Add tests for lbarx/stbcx, lharx/sthcx
|
|
|
dc7ef9 |
and lqarx/stqcx.
|
|
|
dc7ef9 |
* gdb.arch/ppc64-isa207-atomic-inst.S: New file.
|
|
|
dc7ef9 |
* gdb.arch/ppc64-isa207-atomic-inst.c: Likewise.
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
### a/gdb/ChangeLog
|
|
|
dc7ef9 |
### b/gdb/ChangeLog
|
|
|
dc7ef9 |
## -1,3 +1,14 @@
|
|
|
dc7ef9 |
+2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ * rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK.
|
|
|
dc7ef9 |
+ (STORE_CONDITIONAL_MASK): Rename from STWCX_MASK.
|
|
|
dc7ef9 |
+ (LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION,
|
|
|
dc7ef9 |
+ STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines.
|
|
|
dc7ef9 |
+ (IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros.
|
|
|
dc7ef9 |
+ (ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN.
|
|
|
dc7ef9 |
+ (ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and
|
|
|
dc7ef9 |
+ IS_STORE_CONDITIONAL_INSN.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
2017-02-21 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
* dwarf2_rnglists_process: Initialize range_beginning and range_end.
|
|
|
dc7ef9 |
Index: gdb-7.6.1/gdb/rs6000-tdep.c
|
|
|
dc7ef9 |
===================================================================
|
|
|
dc7ef9 |
--- gdb-7.6.1.orig/gdb/rs6000-tdep.c 2017-08-29 21:41:48.797481976 +0200
|
|
|
dc7ef9 |
+++ gdb-7.6.1/gdb/rs6000-tdep.c 2017-08-29 21:44:12.643863483 +0200
|
|
|
dc7ef9 |
@@ -977,12 +977,33 @@
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
/* Instruction masks used during single-stepping of atomic
|
|
|
dc7ef9 |
sequences. */
|
|
|
dc7ef9 |
-#define LWARX_MASK 0xfc0007fe
|
|
|
dc7ef9 |
+#define LOAD_AND_RESERVE_MASK 0xfc0007fe
|
|
|
dc7ef9 |
#define LWARX_INSTRUCTION 0x7c000028
|
|
|
dc7ef9 |
#define LDARX_INSTRUCTION 0x7c0000A8
|
|
|
dc7ef9 |
-#define STWCX_MASK 0xfc0007ff
|
|
|
dc7ef9 |
+#define LBARX_INSTRUCTION 0x7c000068
|
|
|
dc7ef9 |
+#define LHARX_INSTRUCTION 0x7c0000e8
|
|
|
dc7ef9 |
+#define LQARX_INSTRUCTION 0x7c000228
|
|
|
dc7ef9 |
+#define STORE_CONDITIONAL_MASK 0xfc0007ff
|
|
|
dc7ef9 |
#define STWCX_INSTRUCTION 0x7c00012d
|
|
|
dc7ef9 |
#define STDCX_INSTRUCTION 0x7c0001ad
|
|
|
dc7ef9 |
+#define STBCX_INSTRUCTION 0x7c00056d
|
|
|
dc7ef9 |
+#define STHCX_INSTRUCTION 0x7c0005ad
|
|
|
dc7ef9 |
+#define STQCX_INSTRUCTION 0x7c00016d
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+/* Check if insn is one of the Load And Reserve instructions used for atomic
|
|
|
dc7ef9 |
+ sequences. */
|
|
|
dc7ef9 |
+#define IS_LOAD_AND_RESERVE_INSN(insn) ((insn & LOAD_AND_RESERVE_MASK) == LWARX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & LOAD_AND_RESERVE_MASK) == LDARX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & LOAD_AND_RESERVE_MASK) == LBARX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & LOAD_AND_RESERVE_MASK) == LHARX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & LOAD_AND_RESERVE_MASK) == LQARX_INSTRUCTION)
|
|
|
dc7ef9 |
+/* Check if insn is one of the Store Conditional instructions used for atomic
|
|
|
dc7ef9 |
+ sequences. */
|
|
|
dc7ef9 |
+#define IS_STORE_CONDITIONAL_INSN(insn) ((insn & STORE_CONDITIONAL_MASK) == STWCX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & STORE_CONDITIONAL_MASK) == STDCX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & STORE_CONDITIONAL_MASK) == STBCX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & STORE_CONDITIONAL_MASK) == STHCX_INSTRUCTION \
|
|
|
dc7ef9 |
+ || (insn & STORE_CONDITIONAL_MASK) == STQCX_INSTRUCTION)
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
/* We can't displaced step atomic sequences. Otherwise this is just
|
|
|
dc7ef9 |
like simple_displaced_step_copy_insn. */
|
|
|
dc7ef9 |
@@ -1002,9 +1023,8 @@
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
insn = extract_signed_integer (buf, PPC_INSN_SIZE, byte_order);
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
- /* Assume all atomic sequences start with a lwarx/ldarx instruction. */
|
|
|
dc7ef9 |
- if ((insn & LWARX_MASK) == LWARX_INSTRUCTION
|
|
|
dc7ef9 |
- || (insn & LWARX_MASK) == LDARX_INSTRUCTION)
|
|
|
dc7ef9 |
+ /* Assume all atomic sequences start with a Load and Reserve instruction. */
|
|
|
dc7ef9 |
+ if (IS_LOAD_AND_RESERVE_INSN (insn))
|
|
|
dc7ef9 |
{
|
|
|
dc7ef9 |
if (debug_displaced)
|
|
|
dc7ef9 |
{
|
|
|
dc7ef9 |
@@ -1132,11 +1152,10 @@
|
|
|
dc7ef9 |
return 1;
|
|
|
dc7ef9 |
}
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
-/* Checks for an atomic sequence of instructions beginning with a LWARX/LDARX
|
|
|
dc7ef9 |
- instruction and ending with a STWCX/STDCX instruction. If such a sequence
|
|
|
dc7ef9 |
- is found, attempt to step through it. A breakpoint is placed at the end of
|
|
|
dc7ef9 |
- the sequence. */
|
|
|
dc7ef9 |
-
|
|
|
dc7ef9 |
+/* Checks for an atomic sequence of instructions beginning with a
|
|
|
dc7ef9 |
+ Load And Reserve instruction and ending with a Store Conditional
|
|
|
dc7ef9 |
+ instruction. If such a sequence is found, attempt to step through it.
|
|
|
dc7ef9 |
+ A breakpoint is placed at the end of the sequence. */
|
|
|
dc7ef9 |
int
|
|
|
dc7ef9 |
ppc_deal_with_atomic_sequence (struct frame_info *frame)
|
|
|
dc7ef9 |
{
|
|
|
dc7ef9 |
@@ -1155,9 +1174,8 @@
|
|
|
dc7ef9 |
int opcode; /* Branch instruction's OPcode. */
|
|
|
dc7ef9 |
int bc_insn_count = 0; /* Conditional branch instruction count. */
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
- /* Assume all atomic sequences start with a lwarx/ldarx instruction. */
|
|
|
dc7ef9 |
- if ((insn & LWARX_MASK) != LWARX_INSTRUCTION
|
|
|
dc7ef9 |
- && (insn & LWARX_MASK) != LDARX_INSTRUCTION)
|
|
|
dc7ef9 |
+ /* Assume all atomic sequences start with a Load And Reserve instruction. */
|
|
|
dc7ef9 |
+ if (!IS_LOAD_AND_RESERVE_INSN (insn))
|
|
|
dc7ef9 |
return 0;
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
/* Assume that no atomic sequence is longer than "atomic_sequence_length"
|
|
|
dc7ef9 |
@@ -1188,14 +1206,13 @@
|
|
|
dc7ef9 |
last_breakpoint++;
|
|
|
dc7ef9 |
}
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
- if ((insn & STWCX_MASK) == STWCX_INSTRUCTION
|
|
|
dc7ef9 |
- || (insn & STWCX_MASK) == STDCX_INSTRUCTION)
|
|
|
dc7ef9 |
+ if (IS_STORE_CONDITIONAL_INSN (insn))
|
|
|
dc7ef9 |
break;
|
|
|
dc7ef9 |
}
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
- /* Assume that the atomic sequence ends with a stwcx/stdcx instruction. */
|
|
|
dc7ef9 |
- if ((insn & STWCX_MASK) != STWCX_INSTRUCTION
|
|
|
dc7ef9 |
- && (insn & STWCX_MASK) != STDCX_INSTRUCTION)
|
|
|
dc7ef9 |
+ /* Assume that the atomic sequence ends with a Store Conditional
|
|
|
dc7ef9 |
+ instruction. */
|
|
|
dc7ef9 |
+ if (!IS_STORE_CONDITIONAL_INSN (insn))
|
|
|
dc7ef9 |
return 0;
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
closing_insn = loc;
|
|
|
dc7ef9 |
Index: gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S
|
|
|
dc7ef9 |
===================================================================
|
|
|
dc7ef9 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
dc7ef9 |
+++ gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S 2017-08-29 21:41:50.528498600 +0200
|
|
|
dc7ef9 |
@@ -0,0 +1,100 @@
|
|
|
dc7ef9 |
+/* This file is part of GDB, the GNU debugger.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ Copyright 2017 Free Software Foundation, Inc.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
dc7ef9 |
+ it under the terms of the GNU General Public License as published by
|
|
|
dc7ef9 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
dc7ef9 |
+ (at your option) any later version.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ This program is distributed in the hope that it will be useful,
|
|
|
dc7ef9 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
dc7ef9 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
dc7ef9 |
+ GNU General Public License for more details.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ You should have received a copy of the GNU General Public License
|
|
|
dc7ef9 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ .align 2
|
|
|
dc7ef9 |
+ .globl test_atomic_sequences
|
|
|
dc7ef9 |
+#if _CALL_ELF == 2
|
|
|
dc7ef9 |
+ .type test_atomic_sequences,@function
|
|
|
dc7ef9 |
+test_atomic_sequences:
|
|
|
dc7ef9 |
+#else
|
|
|
dc7ef9 |
+ .section ".opd","aw"
|
|
|
dc7ef9 |
+ .align 3
|
|
|
dc7ef9 |
+test_atomic_sequences:
|
|
|
dc7ef9 |
+ .quad .test_atomic_sequences,.TOC.@tocbase,0
|
|
|
dc7ef9 |
+ .size test_atomic_sequences,.-test_atomic_sequences
|
|
|
dc7ef9 |
+ .previous
|
|
|
dc7ef9 |
+ .globl .test_atomic_sequences
|
|
|
dc7ef9 |
+ .type .test_atomic_sequences,@function
|
|
|
dc7ef9 |
+.test_atomic_sequences:
|
|
|
dc7ef9 |
+#endif
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ li 0,0
|
|
|
dc7ef9 |
+ addi 4,1,-8
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ stb 0,0(4)
|
|
|
dc7ef9 |
+1: lbarx 5,0,4
|
|
|
dc7ef9 |
+ cmpdi 5,0
|
|
|
dc7ef9 |
+ bne 2f
|
|
|
dc7ef9 |
+ addi 5,5,1
|
|
|
dc7ef9 |
+ stbcx. 5,0,4
|
|
|
dc7ef9 |
+ bne 1b
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ sth 0,0(4)
|
|
|
dc7ef9 |
+2: lharx 5,0,4
|
|
|
dc7ef9 |
+ cmpdi 5,0
|
|
|
dc7ef9 |
+ bne 3f
|
|
|
dc7ef9 |
+ addi 5,5,1
|
|
|
dc7ef9 |
+ sthcx. 5,0,4
|
|
|
dc7ef9 |
+ bne 2b
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+#ifdef __BIG_ENDIAN__
|
|
|
dc7ef9 |
+ li 10,0
|
|
|
dc7ef9 |
+ li 6,0
|
|
|
dc7ef9 |
+ li 7,1
|
|
|
dc7ef9 |
+ std 10,-16(1)
|
|
|
dc7ef9 |
+ li 10,1
|
|
|
dc7ef9 |
+ std 10,-8(1)
|
|
|
dc7ef9 |
+ addi 4,1,-16
|
|
|
dc7ef9 |
+#else
|
|
|
dc7ef9 |
+ std 9,40(1)
|
|
|
dc7ef9 |
+ li 9,1
|
|
|
dc7ef9 |
+ addi 4,1,32
|
|
|
dc7ef9 |
+ std 9,32(1)
|
|
|
dc7ef9 |
+ mr 8,9
|
|
|
dc7ef9 |
+ ld 3,8(4)
|
|
|
dc7ef9 |
+#endif
|
|
|
dc7ef9 |
+3: lqarx 10,0,4
|
|
|
dc7ef9 |
+#ifdef __BIG_ENDIAN__
|
|
|
dc7ef9 |
+ li 8,0
|
|
|
dc7ef9 |
+ li 9,2
|
|
|
dc7ef9 |
+ mr 5,10
|
|
|
dc7ef9 |
+ xor 10,11,7
|
|
|
dc7ef9 |
+ xor 5,5,6
|
|
|
dc7ef9 |
+ or. 4,5,10
|
|
|
dc7ef9 |
+ bne 4f
|
|
|
dc7ef9 |
+ addi 10,1,-16
|
|
|
dc7ef9 |
+ stqcx. 8,0,10
|
|
|
dc7ef9 |
+#else
|
|
|
dc7ef9 |
+ xor 9,11,8
|
|
|
dc7ef9 |
+ mr 6,11
|
|
|
dc7ef9 |
+ xor 11,10,3
|
|
|
dc7ef9 |
+ or. 0,9,11
|
|
|
dc7ef9 |
+ bne 4f
|
|
|
dc7ef9 |
+ li 14,0
|
|
|
dc7ef9 |
+ li 15,2
|
|
|
dc7ef9 |
+ stqcx. 14,0,4
|
|
|
dc7ef9 |
+#endif
|
|
|
dc7ef9 |
+ bne 3b
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+4: li 3,0
|
|
|
dc7ef9 |
+ blr
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+#if _CALL_ELF == 2
|
|
|
dc7ef9 |
+ .size test_atomic_sequences,.-test_atomic_sequences
|
|
|
dc7ef9 |
+#else
|
|
|
dc7ef9 |
+ .size .test_atomic_sequences,.-.test_atomic_sequences
|
|
|
dc7ef9 |
+#endif
|
|
|
dc7ef9 |
Index: gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c
|
|
|
dc7ef9 |
===================================================================
|
|
|
dc7ef9 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
dc7ef9 |
+++ gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c 2017-08-29 21:41:50.528498600 +0200
|
|
|
dc7ef9 |
@@ -0,0 +1,42 @@
|
|
|
dc7ef9 |
+/* Copyright 2017 Free Software Foundation, Inc.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ This file is part of GDB.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
dc7ef9 |
+ it under the terms of the GNU General Public License as published by
|
|
|
dc7ef9 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
dc7ef9 |
+ (at your option) any later version.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ This program is distributed in the hope that it will be useful,
|
|
|
dc7ef9 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
dc7ef9 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
dc7ef9 |
+ GNU General Public License for more details.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ You should have received a copy of the GNU General Public License
|
|
|
dc7ef9 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+#include <elf.h>
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+typedef Elf64_auxv_t auxv_t;
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+#ifndef PPC_FEATURE2_ARCH_2_07
|
|
|
dc7ef9 |
+#define PPC_FEATURE2_ARCH_2_07 0x80000000
|
|
|
dc7ef9 |
+#endif
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+extern void test_atomic_sequences (void);
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+int
|
|
|
dc7ef9 |
+main (int argc, char *argv[], char *envp[], auxv_t auxv[])
|
|
|
dc7ef9 |
+{
|
|
|
dc7ef9 |
+ int i;
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ for (i = 0; auxv[i].a_type != AT_NULL; i++)
|
|
|
dc7ef9 |
+ if (auxv[i].a_type == AT_HWCAP2) {
|
|
|
dc7ef9 |
+ if (!(auxv[i].a_un.a_val & PPC_FEATURE2_ARCH_2_07))
|
|
|
dc7ef9 |
+ return 1;
|
|
|
dc7ef9 |
+ break;
|
|
|
dc7ef9 |
+ }
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ test_atomic_sequences ();
|
|
|
dc7ef9 |
+ return 0;
|
|
|
dc7ef9 |
+}
|
|
|
dc7ef9 |
Index: gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
|
|
|
dc7ef9 |
===================================================================
|
|
|
dc7ef9 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
dc7ef9 |
+++ gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp 2017-08-29 21:41:50.528498600 +0200
|
|
|
dc7ef9 |
@@ -0,0 +1,99 @@
|
|
|
dc7ef9 |
+# Copyright 2017 Free Software Foundation, Inc.
|
|
|
dc7ef9 |
+#
|
|
|
dc7ef9 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
dc7ef9 |
+# it under the terms of the GNU General Public License as published by
|
|
|
dc7ef9 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
dc7ef9 |
+# (at your option) any later version.
|
|
|
dc7ef9 |
+#
|
|
|
dc7ef9 |
+# This program is distributed in the hope that it will be useful,
|
|
|
dc7ef9 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
dc7ef9 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
dc7ef9 |
+# GNU General Public License for more details.
|
|
|
dc7ef9 |
+#
|
|
|
dc7ef9 |
+# You should have received a copy of the GNU General Public License
|
|
|
dc7ef9 |
+# along with this program; if not, write to the Free Software
|
|
|
dc7ef9 |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
dc7ef9 |
+#
|
|
|
dc7ef9 |
+# This file is part of the gdb testsuite.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+# Test single stepping through POWER8/ISA 2.07 atomic sequences beginning with
|
|
|
dc7ef9 |
+# a lbarx/lharx/lqarx instruction and ending with a stbcx/sthcx/stqxc
|
|
|
dc7ef9 |
+# instruction. Note that although lbarx, lharx, stbcx and sthcx instructions
|
|
|
dc7ef9 |
+# were introduced in ISA 2.06, they were implemented only in POWER8 (ISA 2.07).
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+if {![istarget "powerpc*"] || ![is_lp64_target]} {
|
|
|
dc7ef9 |
+ untested "skipping powerpc isa 207 atomic sequences test"
|
|
|
dc7ef9 |
+ return
|
|
|
dc7ef9 |
+}
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+standard_testfile .c .S
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
|
|
|
dc7ef9 |
+ {debug quiet}] } {
|
|
|
dc7ef9 |
+ return -1
|
|
|
dc7ef9 |
+}
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+# The test proper. DISPLACED is true if we should try with displaced
|
|
|
dc7ef9 |
+# stepping.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+proc do_test { displaced } {
|
|
|
dc7ef9 |
+ global decimal hex
|
|
|
dc7ef9 |
+ global gdb_prompt inferior_exited_re srcfile srcfile2
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ if ![runto_main] then {
|
|
|
dc7ef9 |
+ untested "could not run to main"
|
|
|
dc7ef9 |
+ return -1
|
|
|
dc7ef9 |
+ }
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test_no_output "set displaced-stepping $displaced"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_breakpoint "test_atomic_sequences" "Breakpoint $decimal at $hex" \
|
|
|
dc7ef9 |
+ "set the breakpoint at the start of the test function"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test_multiple "continue" "Continue until lbarx/stbcx start breakpoint" {
|
|
|
dc7ef9 |
+ -re "$inferior_exited_re with code 01.\[\r\n\]+$gdb_prompt $" {
|
|
|
dc7ef9 |
+ unsupported "POWER8/ISA 2.07 atomic instructions not supported."
|
|
|
dc7ef9 |
+ return -1
|
|
|
dc7ef9 |
+ }
|
|
|
dc7ef9 |
+ -re "Continuing.*Breakpoint $decimal.*$gdb_prompt $" {
|
|
|
dc7ef9 |
+ pass "continue until test_atomic_sequences function"
|
|
|
dc7ef9 |
+ }
|
|
|
dc7ef9 |
+ }
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ set bp1 [gdb_get_line_number "lbarx" "$srcfile2"]
|
|
|
dc7ef9 |
+ gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \
|
|
|
dc7ef9 |
+ "set the breakpoint at the start of the lbarx/stbcx sequence"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ set bp2 [gdb_get_line_number "lharx" "$srcfile2"]
|
|
|
dc7ef9 |
+ gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \
|
|
|
dc7ef9 |
+ "set the breakpoint at the start of the lharx/sthcx sequence"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ set bp3 [gdb_get_line_number "lqarx" "$srcfile2"]
|
|
|
dc7ef9 |
+ gdb_breakpoint "$bp3" "Breakpoint $decimal at $hex" \
|
|
|
dc7ef9 |
+ "set the breakpoint at the start of the lqarx/stqcx sequence"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test continue "Continuing.*Breakpoint $decimal.*" \
|
|
|
dc7ef9 |
+ "continue until lbarx/stbcx start breakpoint"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test nexti "bne.*1b" \
|
|
|
dc7ef9 |
+ "step through the lbarx/stbcx sequence"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test continue "Continuing.*Breakpoint $decimal.*" \
|
|
|
dc7ef9 |
+ "continue until lharx/sthcx start breakpoint"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test nexti "bne.*2b" \
|
|
|
dc7ef9 |
+ "step through the lharx/sthcx sequence"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test continue "Continuing.*Breakpoint $decimal.*" \
|
|
|
dc7ef9 |
+ "continue until ldqrx/stqcx start breakpoint"
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+ gdb_test nexti "bne.*3b" \
|
|
|
dc7ef9 |
+ "step through the lqarx/stqcx sequence"
|
|
|
dc7ef9 |
+}
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+foreach displaced { "off" "on" } {
|
|
|
dc7ef9 |
+ with_test_prefix "displaced=$displaced" {
|
|
|
dc7ef9 |
+ do_test $displaced
|
|
|
dc7ef9 |
+ }
|
|
|
dc7ef9 |
+}
|