target, record: add PTID argument to to_record_is_replaying
[deliverable/binutils-gdb.git] / gdb / btrace.c
index 731d2377fadc8d332ce211ee34ee4cb459c656eb..e205ea867c4e318009f0a36a0b197452e32c90dc 100644 (file)
@@ -193,7 +193,7 @@ ftrace_new_function (struct btrace_function *prev,
 {
   struct btrace_function *bfun;
 
-  bfun = xzalloc (sizeof (*bfun));
+  bfun = XCNEW (struct btrace_function);
 
   bfun->msym = mfun;
   bfun->sym = fun;
@@ -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);
        }
@@ -1414,19 +1429,18 @@ parse_xml_btrace_block (struct gdb_xml_parser *parser,
 
 static void
 parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text,
-              gdb_byte **pdata, unsigned long *psize)
+              gdb_byte **pdata, size_t *psize)
 {
   struct cleanup *cleanup;
   gdb_byte *data, *bin;
-  unsigned long size;
-  size_t len;
+  size_t len, size;
 
   len = strlen (body_text);
-  size = len / 2;
-
-  if ((size_t) size * 2 != len)
+  if (len % 2 != 0)
     gdb_xml_error (parser, _("Bad raw data size."));
 
+  size = len / 2;
+
   bin = data = xmalloc (size);
   cleanup = make_cleanup (xfree, data);
 
@@ -2182,7 +2196,7 @@ btrace_set_insn_history (struct btrace_thread_info *btinfo,
                         const struct btrace_insn_iterator *end)
 {
   if (btinfo->insn_history == NULL)
-    btinfo->insn_history = xzalloc (sizeof (*btinfo->insn_history));
+    btinfo->insn_history = XCNEW (struct btrace_insn_history);
 
   btinfo->insn_history->begin = *begin;
   btinfo->insn_history->end = *end;
@@ -2198,7 +2212,7 @@ btrace_set_call_history (struct btrace_thread_info *btinfo,
   gdb_assert (begin->btinfo == end->btinfo);
 
   if (btinfo->call_history == NULL)
-    btinfo->call_history = xzalloc (sizeof (*btinfo->call_history));
+    btinfo->call_history = XCNEW (struct btrace_call_history);
 
   btinfo->call_history->begin = *begin;
   btinfo->call_history->end = *end;
This page took 0.025 seconds and 4 git commands to generate.