summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.btrace
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2014-03-19 13:49:58 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2015-08-07 10:22:39 +0200
commitda8c46d2967b6325dcd2cc72eca26d807964c93c (patch)
treecb49a304435ae9f3ce94f7214b3c8aa2e95ee38d /gdb/testsuite/gdb.btrace
parent5599c404621b2d8ac021c1427aee6e8974572042 (diff)
btrace: indicate speculative execution
Indicate speculatively executed instructions with a leading '?'. We use the space that is normally used for the PC prefix. In the case where the instruction at the current PC had been executed speculatively before, the PC prefix will be partially overwritten resulting in "?> ". As a side-effect, the /p modifier to omit the PC prefix in the "record instruction-history" command now uses a 3-space PC prefix " " in order to have enough space for the speculative execution indication. gdb/ * btrace.c (btrace_compute_ftrace_bts): Clear insn flags. (pt_btrace_insn_flags): New. (ftrace_add_pt): Call pt_btrace_insn_flags. * btrace.h (btrace_insn_flag): New. (btrace_insn) <flags>: New. * record-btrace.c (btrace_insn_history): Print insn prefix. * NEWS: Announce it. doc/ * gdb.texinfo (Process Record and Replay): Document prefixing of speculatively executed instructions in the "record instruction-history" command. testsuite/ * gdb.btrace/instruction_history.exp: Update. * gdb.btrace/tsx.exp: New. * gdb.btrace/tsx.c: New. * lib/gdb.exp (skip_tsx_tests, skip_btrace_pt_tests): New.
Diffstat (limited to 'gdb/testsuite/gdb.btrace')
-rw-r--r--gdb/testsuite/gdb.btrace/instruction_history.exp20
-rw-r--r--gdb/testsuite/gdb.btrace/tsx.c26
-rw-r--r--gdb/testsuite/gdb.btrace/tsx.exp41
-rw-r--r--gdb/testsuite/gdb.btrace/x86-tsx.S29
4 files changed, 106 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.btrace/instruction_history.exp b/gdb/testsuite/gdb.btrace/instruction_history.exp
index ba06647f9a..0348f70412 100644
--- a/gdb/testsuite/gdb.btrace/instruction_history.exp
+++ b/gdb/testsuite/gdb.btrace/instruction_history.exp
@@ -82,19 +82,19 @@ gdb_test "record instruction-history /f 3,+5" [multi_line \
]
gdb_test "record instruction-history /p 7,-5" [multi_line \
- "3\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
- "4\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \
- "5\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
- "6\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \
- "7\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
+ "3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
+ "4\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \
+ "5\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
+ "6\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \
+ "7\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
]
gdb_test "record instruction-history /pf 3,7" [multi_line \
- "3\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
- "4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \
- "5\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
- "6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \
- "7\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
+ "3\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
+ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \
+ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
+ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \
+ "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
]
gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
diff --git a/gdb/testsuite/gdb.btrace/tsx.c b/gdb/testsuite/gdb.btrace/tsx.c
new file mode 100644
index 0000000000..f06046d20d
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/tsx.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2015 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/>. */
+
+
+extern void test (void);
+
+int
+main (void)
+{
+ test ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.btrace/tsx.exp b/gdb/testsuite/gdb.btrace/tsx.exp
new file mode 100644
index 0000000000..525d4d22d0
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/tsx.exp
@@ -0,0 +1,41 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2015 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/>.
+
+if { [skip_btrace_pt_tests] } { return -1 }
+if { [skip_tsx_tests] } { return -1 }
+
+# compile and run to main
+standard_testfile .c x86-tsx.S
+if [prepare_for_testing tsx.exp $testfile "$srcfile $srcfile2" {debug}] {
+ return -1
+}
+if ![runto_main] {
+ return -1
+}
+
+# record the test
+gdb_test_no_output "record btrace pt"
+gdb_test "next"
+
+# look at the instruction trace
+gdb_test "record instruction-history" [multi_line \
+ ".*" \
+ "\[0-9\]*\t\\? 0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txbegin\[^\\\r\\\n\]*" \
+ "\[0-9\]*\t\\? 0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tmov\[^\\\r\\\n\]*" \
+ "\[0-9\]*\t 0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txend\[^\\\r\\\n\]*" \
+ ".*" \
+ ]
diff --git a/gdb/testsuite/gdb.btrace/x86-tsx.S b/gdb/testsuite/gdb.btrace/x86-tsx.S
new file mode 100644
index 0000000000..640d969c94
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/x86-tsx.S
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2015 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/>. */
+
+ .text
+ .globl test
+ .type test, @function
+
+test:
+ xbegin .Lhandler
+ mov $0, %eax
+ xend
+ ret
+.Lhandler:
+ mov $1, %eax
+ ret