aboutsummaryrefslogtreecommitdiff
path: root/gdb/btrace.c
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/btrace.c
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/btrace.c')
-rw-r--r--gdb/btrace.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 94942f4a49..abdf639f23 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -660,6 +660,7 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
insn.pc = pc;
insn.size = size;
insn.iclass = ftrace_classify_insn (gdbarch, pc);
+ insn.flags = 0;
ftrace_update_insns (end, &insn);
@@ -725,6 +726,19 @@ pt_reclassify_insn (enum pt_insn_class iclass)
}
}
+/* Return the btrace instruction flags for INSN. */
+
+static enum btrace_insn_flag
+pt_btrace_insn_flags (const struct pt_insn *insn)
+{
+ enum btrace_insn_flag flags = 0;
+
+ if (insn->speculative)
+ flags |= BTRACE_INSN_FLAG_SPECULATIVE;
+
+ return flags;
+}
+
/* Add function branch trace using DECODER. */
static void
@@ -792,6 +806,7 @@ ftrace_add_pt (struct pt_insn_decoder *decoder,
btinsn.pc = (CORE_ADDR) insn.ip;
btinsn.size = (gdb_byte) insn.size;
btinsn.iclass = pt_reclassify_insn (insn.iclass);
+ btinsn.flags = pt_btrace_insn_flags (&insn);
ftrace_update_insns (end, &btinsn);
}