2017-04-25 Pedro Alves <palves@redhat.com>
+ * btrace.c (pt_btrace_insn_flags): Change parameter type to
+ reference.
+ (pt_btrace_insn): New function.
+ (ftrace_add_pt): Remove memset call and use pt_btrace_insn.
+
+2017-04-25 Pedro Alves <palves@redhat.com>
+
* ada-lang.c (ada_catchpoint_location): Now a "class". Remove
"base" field and inherit from "bp_location" instead. Add
non-default ctor.
/* Return the btrace instruction flags for INSN. */
static btrace_insn_flags
-pt_btrace_insn_flags (const struct pt_insn *insn)
+pt_btrace_insn_flags (const struct pt_insn &insn)
{
btrace_insn_flags flags = 0;
- if (insn->speculative)
+ if (insn.speculative)
flags |= BTRACE_INSN_FLAG_SPECULATIVE;
return flags;
}
+/* Return the btrace instruction for INSN. */
+
+static btrace_insn
+pt_btrace_insn (const struct pt_insn &insn)
+{
+ return {(CORE_ADDR) insn.ip, (gdb_byte) insn.size,
+ pt_reclassify_insn (insn.iclass),
+ pt_btrace_insn_flags (insn)};
+}
+
+
/* Add function branch trace using DECODER. */
static void
end = *pend;
for (;;)
{
- struct btrace_insn btinsn;
struct pt_insn insn;
errcode = pt_insn_sync_forward (decoder);
break;
}
- memset (&btinsn, 0, sizeof (btinsn));
for (;;)
{
errcode = pt_insn_next (decoder, &insn, sizeof(insn));
/* Maintain the function level offset. */
*plevel = std::min (*plevel, end->level);
- 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);
-
+ btrace_insn btinsn = pt_btrace_insn (insn);
ftrace_update_insns (end, &btinsn);
}