{
struct btrace_function *bfun;
- bfun = xzalloc (sizeof (*bfun));
+ bfun = XCNEW (struct btrace_function);
bfun->msym = mfun;
bfun->sym = fun;
insn.pc = pc;
insn.size = size;
insn.iclass = ftrace_classify_insn (gdbarch, pc);
+ insn.flags = 0;
ftrace_update_insns (end, &insn);
}
}
+/* 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
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);
}
const struct gdb_xml_element *element,
void *user_data, VEC (gdb_xml_value_s) *attributes)
{
- const char *version = xml_find_attribute (attributes, "version")->value;
+ const char *version
+ = (const char *) xml_find_attribute (attributes, "version")->value;
if (strcmp (version, "1.0") != 0)
gdb_xml_error (parser, _("Unsupported btrace version: \"%s\""), version);
struct btrace_block *block;
ULONGEST *begin, *end;
- btrace = user_data;
+ btrace = (struct btrace_data *) user_data;
switch (btrace->format)
{
gdb_xml_error (parser, _("Btrace format error."));
}
- begin = xml_find_attribute (attributes, "begin")->value;
- end = xml_find_attribute (attributes, "end")->value;
+ begin = (ULONGEST *) xml_find_attribute (attributes, "begin")->value;
+ end = (ULONGEST *) xml_find_attribute (attributes, "end")->value;
block = VEC_safe_push (btrace_block_s, btrace->variant.bts.blocks, NULL);
block->begin = *begin;
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."));
- bin = data = xmalloc (size);
+ size = len / 2;
+
+ bin = data = (gdb_byte *) xmalloc (size);
cleanup = make_cleanup (xfree, data);
/* We use hex encoding - see common/rsp-low.h. */
const char *vendor;
ULONGEST *family, *model, *stepping;
- vendor = xml_find_attribute (attributes, "vendor")->value;
- family = xml_find_attribute (attributes, "family")->value;
- model = xml_find_attribute (attributes, "model")->value;
- stepping = xml_find_attribute (attributes, "stepping")->value;
+ vendor = (const char *) xml_find_attribute (attributes, "vendor")->value;
+ family = (ULONGEST *) xml_find_attribute (attributes, "family")->value;
+ model = (ULONGEST *) xml_find_attribute (attributes, "model")->value;
+ stepping = (ULONGEST *) xml_find_attribute (attributes, "stepping")->value;
- btrace = user_data;
+ btrace = (struct btrace_data *) user_data;
if (strcmp (vendor, "GenuineIntel") == 0)
btrace->variant.pt.config.cpu.vendor = CV_INTEL;
{
struct btrace_data *btrace;
- btrace = user_data;
+ btrace = (struct btrace_data *) user_data;
parse_xml_raw (parser, body_text, &btrace->variant.pt.data,
&btrace->variant.pt.size);
}
{
struct btrace_data *btrace;
- btrace = user_data;
+ btrace = (struct btrace_data *) user_data;
btrace->format = BTRACE_FORMAT_PT;
btrace->variant.pt.config.cpu.vendor = CV_UNKNOWN;
btrace->variant.pt.data = NULL;
struct btrace_config *conf;
struct gdb_xml_value *size;
- conf = user_data;
+ conf = (struct btrace_config *) user_data;
conf->format = BTRACE_FORMAT_BTS;
conf->bts.size = 0;
struct btrace_config *conf;
struct gdb_xml_value *size;
- conf = user_data;
+ conf = (struct btrace_config *) user_data;
conf->format = BTRACE_FORMAT_PT;
conf->pt.size = 0;
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;
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;
static void
do_btrace_data_cleanup (void *arg)
{
- btrace_data_fini (arg);
+ btrace_data_fini ((struct btrace_data *) arg);
}
/* See btrace.h. */