+/* Parse a branch trace xml document XML into DATA. */
+extern void parse_xml_btrace (struct btrace_data *data, const char *xml);
+
+/* Parse a branch trace configuration xml document XML into CONF. */
+extern void parse_xml_btrace_conf (struct btrace_config *conf, const char *xml);
+
+/* Dereference a branch trace instruction iterator. Return a pointer to the
+ instruction the iterator points to.
+ May return NULL if the iterator points to a gap in the trace. */
+extern const struct btrace_insn *
+ btrace_insn_get (const struct btrace_insn_iterator *);
+
+/* Return the error code for a branch trace instruction iterator. Returns zero
+ if there is no error, i.e. the instruction is valid. */
+extern int btrace_insn_get_error (const struct btrace_insn_iterator *);
+
+/* Return the instruction number for a branch trace iterator.
+ Returns one past the maximum instruction number for the end iterator. */
+extern unsigned int btrace_insn_number (const struct btrace_insn_iterator *);
+
+/* Initialize a branch trace instruction iterator to point to the begin/end of
+ the branch trace. Throws an error if there is no branch trace. */
+extern void btrace_insn_begin (struct btrace_insn_iterator *,
+ const struct btrace_thread_info *);
+extern void btrace_insn_end (struct btrace_insn_iterator *,
+ const struct btrace_thread_info *);
+
+/* Increment/decrement a branch trace instruction iterator by at most STRIDE
+ instructions. Return the number of instructions by which the instruction
+ iterator has been advanced.
+ Returns zero, if the operation failed or STRIDE had been zero. */
+extern unsigned int btrace_insn_next (struct btrace_insn_iterator *,
+ unsigned int stride);
+extern unsigned int btrace_insn_prev (struct btrace_insn_iterator *,
+ unsigned int stride);
+
+/* Compare two branch trace instruction iterators.
+ Return a negative number if LHS < RHS.
+ Return zero if LHS == RHS.
+ Return a positive number if LHS > RHS. */
+extern int btrace_insn_cmp (const struct btrace_insn_iterator *lhs,
+ const struct btrace_insn_iterator *rhs);
+
+/* Find an instruction or gap in the function branch trace by its number.
+ If the instruction is found, initialize the branch trace instruction
+ iterator to point to this instruction and return non-zero.
+ Return zero otherwise. */
+extern int btrace_find_insn_by_number (struct btrace_insn_iterator *,
+ const struct btrace_thread_info *,
+ unsigned int number);
+
+/* Dereference a branch trace call iterator. Return a pointer to the
+ function the iterator points to or NULL if the interator points past
+ the end of the branch trace. */
+extern const struct btrace_function *
+ btrace_call_get (const struct btrace_call_iterator *);
+
+/* Return the function number for a branch trace call iterator.
+ Returns one past the maximum function number for the end iterator.
+ Returns zero if the iterator does not point to a valid function. */
+extern unsigned int btrace_call_number (const struct btrace_call_iterator *);
+
+/* Initialize a branch trace call iterator to point to the begin/end of
+ the branch trace. Throws an error if there is no branch trace. */
+extern void btrace_call_begin (struct btrace_call_iterator *,
+ const struct btrace_thread_info *);
+extern void btrace_call_end (struct btrace_call_iterator *,
+ const struct btrace_thread_info *);
+
+/* Increment/decrement a branch trace call iterator by at most STRIDE function
+ segments. Return the number of function segments by which the call
+ iterator has been advanced.
+ Returns zero, if the operation failed or STRIDE had been zero. */
+extern unsigned int btrace_call_next (struct btrace_call_iterator *,
+ unsigned int stride);
+extern unsigned int btrace_call_prev (struct btrace_call_iterator *,
+ unsigned int stride);
+
+/* Compare two branch trace call iterators.
+ Return a negative number if LHS < RHS.
+ Return zero if LHS == RHS.
+ Return a positive number if LHS > RHS. */
+extern int btrace_call_cmp (const struct btrace_call_iterator *lhs,
+ const struct btrace_call_iterator *rhs);
+
+/* Find a function in the function branch trace by its NUMBER.
+ If the function is found, initialize the branch trace call
+ iterator to point to this function and return non-zero.
+ Return zero otherwise. */
+extern int btrace_find_call_by_number (struct btrace_call_iterator *,
+ const struct btrace_thread_info *,
+ unsigned int number);
+
+/* Set the branch trace instruction history from BEGIN (inclusive) to
+ END (exclusive). */
+extern void btrace_set_insn_history (struct btrace_thread_info *,
+ const struct btrace_insn_iterator *begin,
+ const struct btrace_insn_iterator *end);
+
+/* Set the branch trace function call history from BEGIN (inclusive) to
+ END (exclusive). */
+extern void btrace_set_call_history (struct btrace_thread_info *,
+ const struct btrace_call_iterator *begin,
+ const struct btrace_call_iterator *end);
+
+/* Determine if branch tracing is currently replaying TP. */
+extern int btrace_is_replaying (struct thread_info *tp);
+
+/* Return non-zero if the branch trace for TP is empty; zero otherwise. */
+extern int btrace_is_empty (struct thread_info *tp);