31 #include "filenames.h" 57 #define DEBUG(msg, args...) \ 60 if (record_debug != 0) \ 61 fprintf_unfiltered (gdb_stdlog, \ 62 "[btrace] " msg "\n", ##args); \ 66 #define DEBUG_FTRACE(msg, args...) DEBUG ("[ftrace] " msg, ##args) 103 filename =
"<unknown>";
125 const char *fun, *file;
126 unsigned int ibegin, iend;
134 iend = ibegin + bfun->
insn.size ();
136 DEBUG_FTRACE (
"%s: fun = %s, file = %s, level = %d, insn = [%u; %u)",
137 prefix, fun, file, level, ibegin, iend);
152 return bfun->
insn.size ();
195 if (mfun != NULL && msym != NULL
200 if (fun != NULL && sym != NULL)
202 const char *bfname, *fname;
211 if (filename_cmp (fname, bfname) != 0)
216 if (!(msym == NULL && sym == NULL) && mfun == NULL && fun == NULL)
220 if (msym == NULL && sym == NULL && !(mfun == NULL && fun == NULL))
313 const unsigned int length = btinfo->
functions.size ();
333 const unsigned int length = btinfo->
functions.size ();
438 bfun->
up = caller->
up;
458 while (
prev->up != 0)
519 std::vector<unsigned int> &gaps)
534 gaps.push_back (bfun->
number);
560 if (fun == NULL && mfun == NULL)
576 if (!bfun->
insn.empty ())
577 last = &bfun->
insn.back ();
597 if (strcmp (fname,
"_dl_runtime_resolve") == 0)
605 if (last->
pc + last->
size == pc)
692 for (matches = 0; lhs != NULL && rhs != NULL; ++matches)
719 bfun->
level += adjustment;
738 unsigned int length = btinfo->
functions.size() - 1;
739 for (
unsigned int i = 0; i < length; ++i)
746 if (last->
insn.size () != 1)
779 const btrace_function_flags
flags =
next->flags;
788 else if (
next->up == 0)
790 const btrace_function_flags
flags =
prev->flags;
814 btrace_function_flags next_flags, prev_flags;
818 next_flags =
next->flags;
819 prev_flags =
prev->flags;
873 while (lhs != NULL && rhs != NULL)
904 DEBUG_FTRACE (
"checking gap at insn %u (req matches: %d)",
914 for (cand_l = lhs; cand_l != NULL;
916 for (cand_r = rhs; cand_r != NULL;
922 if (best_matches < matches)
924 best_matches = matches;
932 if (best_matches < min_matches)
960 std::vector<unsigned int> remaining;
963 DEBUG (
"bridge gaps");
971 for (min_matches = 5; min_matches > 0; --min_matches)
975 while (!gaps.empty ())
977 for (
const unsigned int number : gaps)
990 if (lhs == NULL || lhs->
errcode != 0)
995 while (rhs != NULL && rhs->
errcode != 0)
1008 remaining.push_back (
number);
1012 if (remaining.size () == gaps.size ())
1016 gaps.swap (remaining);
1036 std::vector<unsigned int> &gaps)
1050 level = -btinfo->
level;
1074 warning (
_(
"Recorded trace may be corrupted at instruction " 1086 level = std::min (level, bfun->
level);
1116 warning (
_(
"Recorded trace may be incomplete at instruction %u " 1132 level = std::min (level, bfun->
level);
1139 btinfo->
level = -level;
1142 #if defined (HAVE_LIBIPT) 1145 pt_reclassify_insn (
enum pt_insn_class
iclass)
1165 static btrace_insn_flags
1166 pt_btrace_insn_flags (
const struct pt_insn &insn)
1168 btrace_insn_flags
flags = 0;
1170 if (insn.speculative)
1179 pt_btrace_insn (
const struct pt_insn &insn)
1182 pt_reclassify_insn (insn.iclass),
1183 pt_btrace_insn_flags (insn)};
1190 struct pt_insn_decoder *decoder,
1191 std::vector<unsigned int> &gaps,
int status)
1193 #if defined (HAVE_PT_INSN_EVENT) 1194 while (
status & pts_event_pending)
1197 struct pt_event event;
1200 status = pt_insn_event (decoder, &event,
sizeof (event));
1210 if (event.variant.enabled.resumed == 0 && !btinfo->
functions.empty ())
1214 pt_insn_get_offset (decoder, &
offset);
1216 warning (
_(
"Non-contiguous trace at instruction %u (offset = 0x%" 1225 pt_insn_get_offset (decoder, &
offset);
1227 warning (
_(
"Overflow at instruction %u (offset = 0x%" PRIx64
")."),
1242 struct pt_insn_decoder *decoder,
1243 const struct pt_insn &insn,
1244 std::vector<unsigned int> &gaps)
1246 #if defined (HAVE_STRUCT_PT_INSN_ENABLED) 1252 if (insn.enabled && !btinfo->
functions.empty ())
1259 pt_insn_get_offset (decoder, &
offset);
1261 warning (
_(
"Non-contiguous trace at instruction %u (offset = 0x%" PRIx64
1267 #if defined (HAVE_STRUCT_PT_INSN_RESYNCED) 1276 pt_insn_get_offset (decoder, &
offset);
1278 warning (
_(
"Overflow at instruction %u (offset = 0x%" PRIx64
", pc = 0x%" 1288 struct pt_insn_decoder *decoder,
1290 std::vector<unsigned int> &gaps)
1298 struct pt_insn insn;
1300 status = pt_insn_sync_forward (decoder);
1304 warning (
_(
"Failed to synchronize onto the Intel Processor " 1305 "Trace stream: %s."), pt_errstr (pt_errcode (
status)));
1312 status = handle_pt_insn_events (btinfo, decoder, gaps,
status);
1316 status = pt_insn_next (decoder, &insn,
sizeof(insn));
1321 handle_pt_insn_event_flags (btinfo, decoder, insn, gaps);
1326 *plevel = std::min (*plevel, bfun->
level);
1337 pt_insn_get_offset (decoder, &
offset);
1339 warning (
_(
"Decode error (%d) at instruction %u (offset = 0x%" PRIx64
1350 const struct pt_asid *asid, uint64_t pc,
1353 int result, errcode;
1355 result = (int)
size;
1360 result = -pte_nomap;
1364 result = -pte_nomap;
1373 static enum pt_cpu_vendor
1388 static void btrace_finalize_ftrace_pt (
struct pt_insn_decoder *decoder,
1391 pt_insn_free_decoder (decoder);
1396 tp->
btrace.level = -level;
1411 std::vector<unsigned int> &gaps)
1414 struct pt_insn_decoder *decoder;
1415 struct pt_config config;
1418 if (btrace->
size == 0)
1425 level = -btinfo->
level;
1427 pt_config_init(&config);
1428 config.begin = btrace->
data;
1429 config.end = btrace->
data + btrace->
size;
1431 config.cpu.vendor = pt_translate_cpu_vendor (btrace->
config.
cpu.
vendor);
1436 errcode = pt_cpu_errata (&config.errata, &config.cpu);
1438 error (
_(
"Failed to configure the Intel Processor Trace decoder: %s."),
1439 pt_errstr (pt_errcode (errcode)));
1441 decoder = pt_insn_alloc_decoder (&config);
1442 if (decoder == NULL)
1443 error (
_(
"Failed to allocate the Intel Processor Trace decoder."));
1447 struct pt_image *image;
1449 image = pt_insn_get_image(decoder);
1451 error (
_(
"Failed to configure the Intel Processor Trace decoder."));
1453 errcode = pt_image_set_callback(image, btrace_pt_readmem_callback, NULL);
1455 error (
_(
"Failed to configure the Intel Processor Trace decoder: " 1456 "%s."), pt_errstr (pt_errcode (errcode)));
1458 ftrace_add_pt (btinfo, decoder, &level, gaps);
1466 btrace_finalize_ftrace_pt (decoder, tp, level);
1472 btrace_finalize_ftrace_pt (decoder, tp, level);
1480 std::vector<unsigned int> &gaps)
1482 internal_error (__FILE__, __LINE__,
_(
"Unexpected branch trace format."));
1492 std::vector<unsigned int> &gaps)
1494 DEBUG (
"compute ftrace");
1510 internal_error (__FILE__, __LINE__,
_(
"Unkown branch trace format."));
1518 tp->
btrace.ngaps += gaps.size ();
1526 std::vector<unsigned int> gaps;
1577 if (tp->
btrace.target != NULL)
1580 #if !defined (HAVE_LIBIPT) 1582 error (
_(
"GDB does not support Intel Processor Trace."));
1586 error (
_(
"Target does not support branch tracing."));
1594 if (tp->
btrace.target == NULL)
1627 if (btinfo->
target == NULL)
1689 if (last_bfun->
insn.empty ())
1709 if (first_new_block->
end == last_insn.
pc 1721 if (first_new_block->
end < last_insn.
pc)
1723 warning (
_(
"Error while trying to read delta trace. Falling back to " 1730 first_new_block->
begin = last_insn.
pc;
1736 DEBUG (
"pruning insn at %s for stitching",
1739 last_bfun->
insn.pop_back ();
1750 if (last_bfun->
number == 1 && last_bfun->
insn.empty ())
1782 internal_error (__FILE__, __LINE__,
_(
"Unkown branch trace format."));
1814 #if defined (HAVE_LIBIPT) 1837 return _(
"instruction overflow");
1840 return _(
"unknown instruction");
1847 #if defined (HAVE_LIBIPT) 1852 return _(
"trace decode cancelled");
1855 return _(
"disabled");
1858 return _(
"overflow");
1862 return pt_errstr (pt_errcode (
errcode));
1872 return _(
"unknown");
1897 if (btinfo->
replay != NULL)
1943 error (
_(
"Failed to read branch trace."));
1992 DEBUG (
"free objfile");
1998 #if defined (HAVE_LIBEXPAT) 2010 if (strcmp (
version,
"1.0") != 0)
2045 block->begin = *begin;
2059 len = strlen (body_text);
2076 if (hi == 0 || lo == 0)
2099 ULONGEST *family, *model, *stepping;
2108 if (strcmp (vendor,
"GenuineIntel") == 0)
2121 void *user_data,
const char *body_text)
2202 #if defined (HAVE_LIBEXPAT) 2210 error (
_(
"Error parsing branch trace."));
2217 error (
_(
"Cannot process branch trace. XML parsing is not supported."));
2222 #if defined (HAVE_LIBEXPAT) 2300 #if defined (HAVE_LIBEXPAT) 2305 error (
_(
"Error parsing branch trace configuration."));
2309 error (
_(
"XML parsing is not supported."));
2320 unsigned int index, end;
2330 end = bfun->
insn.size ();
2334 return &bfun->
insn[index];
2374 unsigned int length;
2380 length = bfun->
insn.size ();
2399 unsigned int index, steps;
2407 unsigned int end, space, adv;
2409 end = bfun->
insn.size ();
2434 space = end - index;
2437 adv = std::min (space, stride);
2481 unsigned int index, steps;
2502 index = bfun->
insn.size ();
2516 adv = std::min (index, stride);
2555 unsigned int upper, lower;
2573 const unsigned int average = lower + (upper - lower) / 2;
2579 upper = average - 1;
2585 lower = average + 1;
2639 return it->
index + 1;
2675 if (it->
index + stride < length - 1)
2677 it->
index += stride;
2678 else if (it->
index + stride == length - 1)
2686 it->
index = length - 1;
2694 stride = length - it->
index - 1;
2696 stride = length - it->
index;
2714 if (stride == 0 || it->
index == 0)
2721 if ((it->
index == length) && (length > 1))
2724 it->
index = length - 2;
2726 it->
index = length - 1;
2732 stride = std::min (stride, it->
index);
2734 it->
index -= stride;
2735 return steps + stride;
2755 const unsigned int length = btinfo->
functions.size ();
2800 return tp->
btrace.replay != NULL;
2838 #if defined (HAVE_LIBIPT) 2843 pt_print_packet (
const struct pt_packet *packet)
2845 switch (packet->type)
2865 packet->payload.ip.ipc,
2866 packet->payload.ip.ip);
2871 packet->payload.ip.ipc,
2872 packet->payload.ip.ip);
2877 packet->payload.ip.ipc,
2878 packet->payload.ip.ip);
2883 packet->payload.ip.ipc,
2884 packet->payload.ip.ip);
2889 packet->payload.tnt.bit_size,
2890 packet->payload.tnt.payload);
2895 packet->payload.tnt.bit_size,
2896 packet->payload.tnt.payload);
2901 packet->payload.pip.nr ? (
" nr") : (
""));
2913 switch (packet->payload.mode.leaf)
2921 packet->payload.mode.bits.exec.csl
2923 packet->payload.mode.bits.exec.csd
2924 ? (
" cs.d") : (
""));
2929 packet->payload.mode.bits.tsx.intx
2931 packet->payload.mode.bits.tsx.abrt
2932 ? (
" abrt") : (
""));
2951 packet->payload.tma.fc);
2972 struct pt_packet_decoder *decoder)
2978 struct btrace_pt_packet packet;
2980 errcode = pt_pkt_sync_forward (decoder);
2986 pt_pkt_get_offset (decoder, &packet.offset);
2988 errcode = pt_pkt_next (decoder, &packet.packet,
2989 sizeof(packet.packet));
2995 packet.errcode = pt_errcode (errcode);
3001 if (errcode == -pte_eos)
3004 packet.errcode = pt_errcode (errcode);
3008 warning (
_(
"Error at trace offset 0x%" PRIx64
": %s."),
3009 packet.offset, pt_errstr (packet.errcode));
3012 if (errcode != -pte_eos)
3013 warning (
_(
"Failed to synchronize onto the Intel Processor Trace " 3014 "stream: %s."), pt_errstr (pt_errcode (errcode)));
3022 struct pt_packet_decoder *decoder;
3024 struct pt_config config;
3033 memset (&config, 0,
sizeof(config));
3035 config.size =
sizeof (config);
3036 config.begin = pt->
data;
3044 errcode = pt_cpu_errata (&config.errata, &config.cpu);
3046 error (
_(
"Failed to configure the Intel Processor Trace decoder: %s."),
3047 pt_errstr (pt_errcode (errcode)));
3049 decoder = pt_pkt_alloc_decoder (&config);
3050 if (decoder == NULL)
3051 error (
_(
"Failed to allocate the Intel Processor Trace decoder."));
3055 btrace_maint_decode_pt (&btinfo->
maint, decoder);
3059 pt_pkt_free_decoder (decoder);
3061 if (except.reason < 0)
3066 pt_pkt_free_decoder (decoder);
3077 unsigned int *begin,
unsigned int *end,
3078 unsigned int *from,
unsigned int *to)
3097 #if defined (HAVE_LIBIPT) 3100 btrace_maint_update_pt_packets (btinfo);
3116 unsigned int begin,
unsigned int end)
3129 for (blk = begin; blk < end; ++blk)
3145 #if defined (HAVE_LIBIPT) 3148 VEC (btrace_pt_packet_s) *packets;
3152 for (pkt = begin; pkt < end; ++pkt)
3154 const struct btrace_pt_packet *packet;
3156 packet =
VEC_index (btrace_pt_packet_s, packets, pkt);
3161 if (packet->errcode == pte_ok)
3162 pt_print_packet (&packet->packet);
3182 const char *begin, *pos;
3184 unsigned long number;
3189 if (!isdigit (*pos))
3190 error (
_(
"Expected positive number, got: %s."), pos);
3192 number = strtoul (pos, &end, 10);
3194 error (
_(
"Number too big."));
3196 *arg += (end - begin);
3198 return (
unsigned int) number;
3208 if (!isdigit (*pos))
3209 error (
_(
"Expected positive number, got: %s."), pos);
3212 long result = strtol (pos, &end, 10);
3223 error (
_(
"Junk after argument: %s."), arg);
3233 unsigned int size, begin, end, from, to;
3249 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
3253 if (end - from <
size)
3257 else if (strcmp (arg,
"-") == 0)
3261 if (to - begin <
size)
3269 error (
_(
"'%u' is out of range."), from);
3283 if (end - from <
size)
3287 else if (*arg ==
'-')
3298 if (to - begin <
size)
3320 if (end - from <
size)
3339 if (args != NULL && *args != 0)
3340 error (
_(
"Invalid argument."));
3360 if (args != NULL && *args != 0)
3361 error (
_(
"Invalid argument."));
3424 if (args != NULL && *args != 0)
3425 error (
_(
"Invalid argument."));
3435 error (
_(
"No btrace configuration."));
3451 #if defined (HAVE_LIBIPT) 3456 version = pt_library_version ();
3461 btrace_maint_update_pt_packets (btinfo);
3491 _(
"Branch tracing maintenance commands."),
3496 Set branch tracing specific variables."),
3501 Set Intel Processor Trace specific variables."),
3506 Show branch tracing specific variables."),
3511 Show Intel Processor Trace specific variables."),
3517 Set whether PAD packets should be skipped in the btrace packet history."),
_(
"\ 3518 Show whether PAD packets should be skipped in the btrace packet history."),
_(
"\ 3519 When enabled, PAD packets are ignored in the btrace packet history."),
3525 _(
"Print the raw branch tracing data.\n\ 3526 With no argument, print ten more packets after the previous ten-line print.\n\ 3527 With '-' as argument print ten packets before a previous ten-line print.\n\ 3528 One argument specifies the starting packet of a ten-line print.\n\ 3529 Two arguments with comma between specify starting and ending packets to \ 3531 Preceded with '+'/'-' the second argument specifies the distance from the \ 3537 _(
"Clears the branch tracing packet history.\n\ 3538 Discards the raw branch tracing data but not the execution history data.\n\ 3543 _(
"Clears the branch tracing data.\n\ 3544 Discards the raw branch tracing data and the execution history data.\n\ 3545 The next 'record' command will fetch the branch tracing data anew.\n\ static const char * ftrace_print_function_name(const struct btrace_function *bfun)
struct gdbarch * target_gdbarch(void)
static struct cmd_list_element * maint_btrace_cmdlist
static const char * ftrace_print_insn_addr(const struct btrace_insn *insn)
union btrace_data::@24 variant
static void no_chunk(const char *arg)
struct btrace_config_bts bts
static void ftrace_compute_global_level_offset(struct btrace_thread_info *btinfo)
unsigned int btrace_insn_prev(struct btrace_insn_iterator *it, unsigned int stride)
const char * symtab_to_filename_for_display(struct symtab *symtab)
void target_disable_btrace(struct btrace_target_info *btinfo)
static const struct gdb_xml_attribute btrace_conf_bts_attributes[]
static const struct gdb_xml_attribute btrace_pt_config_cpu_attributes[]
struct thread_info * find_thread_ptid(ptid_t ptid)
static struct cmd_list_element * maint_btrace_set_cmdlist
static void maint_btrace_cmd(const char *args, int from_tty)
static struct cmd_list_element * maint_btrace_show_cmdlist
static void parse_xml_raw(struct gdb_xml_parser *parser, const char *body_text, gdb_byte **pdata, size_t *psize)
void target_teardown_btrace(struct btrace_target_info *btinfo)
#define SYMBOL_PRINT_NAME(symbol)
void parse_xml_btrace(struct btrace_data *btrace, const char *buffer)
#define MSYMBOL_LINKAGE_NAME(symbol)
bool can_access_registers_ptid(ptid_t ptid)
static struct btrace_function * ftrace_new_gap(struct btrace_thread_info *btinfo, int errcode, std::vector< unsigned int > &gaps)
static int get_context_size(const char **arg)
struct regcache * get_thread_regcache(ptid_t ptid)
static void ftrace_connect_backtrace(struct btrace_thread_info *btinfo, struct btrace_function *lhs, struct btrace_function *rhs)
struct btrace_target_info * target_enable_btrace(ptid_t ptid, const struct btrace_config *conf)
static void maint_info_btrace_cmd(const char *args, int from_tty)
void warning(const char *fmt,...)
static int btrace_stitch_bts(struct btrace_data_bts *btrace, struct thread_info *tp)
regcache(gdbarch *gdbarch)
int target_supports_btrace(enum btrace_format format)
static void btrace_clear_history(struct btrace_thread_info *btinfo)
void btrace_data_fini(struct btrace_data *data)
static const struct gdb_xml_attribute block_attributes[]
struct btrace_insn_iterator * replay
struct cmd_list_element * maintenanceinfolist
struct btrace_call_history * call_history
static int ftrace_function_switched(const struct btrace_function *bfun, const struct minimal_symbol *mfun, const struct symbol *fun)
int gdb_insn_length(struct gdbarch *gdbarch, CORE_ADDR addr)
static int btrace_stitch_trace(struct btrace_data *btrace, struct thread_info *tp)
static void parse_xml_btrace_block(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
struct btrace_data_bts bts
void btrace_clear(struct thread_info *tp)
void * memset(T *s, int c, size_t n)=delete
void internal_error(const char *file, int line, const char *fmt,...)
unsigned int record_debug
static struct cmd_list_element * maint_btrace_pt_set_cmdlist
unsigned int btrace_call_number(const struct btrace_call_iterator *it)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
const struct btrace_thread_info * btinfo
int btrace_insn_get_error(const struct btrace_insn_iterator *it)
static const struct gdb_xml_element btrace_elements[]
#define VEC_safe_push(T, V, O)
static void btrace_maint_print_packets(struct btrace_thread_info *btinfo, unsigned int begin, unsigned int end)
char * skip_spaces(char *chp)
struct btrace_call_iterator begin
#define DEBUG_FTRACE(msg, args...)
static void ftrace_fixup_level(struct btrace_thread_info *btinfo, struct btrace_function *bfun, int adjustment)
struct btrace_insn_history * insn_history
int btrace_call_cmp(const struct btrace_call_iterator *lhs, const struct btrace_call_iterator *rhs)
static void parse_xml_btrace_conf_bts(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
int gdbarch_insn_is_jump(struct gdbarch *gdbarch, CORE_ADDR addr)
static void maint_btrace_packet_history_cmd(const char *arg, int from_tty)
void btrace_insn_begin(struct btrace_insn_iterator *it, const struct btrace_thread_info *btinfo)
void btrace_set_call_history(struct btrace_thread_info *btinfo, const struct btrace_call_iterator *begin, const struct btrace_call_iterator *end)
void btrace_disable(struct thread_info *tp)
struct cmd_list_element * maintenance_set_cmdlist
static struct btrace_function * ftrace_find_caller(struct btrace_thread_info *btinfo, struct btrace_function *bfun, struct minimal_symbol *mfun, struct symbol *fun)
static void maint_btrace_pt_show_cmd(const char *args, int from_tty)
static void ftrace_connect_bfun(struct btrace_thread_info *btinfo, struct btrace_function *prev, struct btrace_function *next)
struct btrace_insn_iterator end
const char * symtab_to_fullname(struct symtab *s)
static unsigned int get_uint(const char **arg)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
int target_read_code(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
scoped_restore_tmpl< T > make_scoped_restore(T *var)
const struct btrace_thread_info * btinfo
unsigned int btrace_insn_number(const struct btrace_insn_iterator *it)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
enum btrace_cpu_vendor vendor
static enum btrace_insn_class ftrace_classify_insn(struct gdbarch *gdbarch, CORE_ADDR pc)
#define MSYMBOL_PRINT_NAME(symbol)
static const char * ftrace_print_filename(const struct btrace_function *bfun)
static struct btrace_function * ftrace_find_call_by_number(struct btrace_thread_info *btinfo, unsigned int number)
static struct btrace_function * ftrace_update_function(struct btrace_thread_info *btinfo, CORE_ADDR pc)
static void btrace_compute_ftrace(struct thread_info *tp, struct btrace_data *btrace)
static unsigned int ftrace_call_num_insn(const struct btrace_function *bfun)
#define CATCH(EXCEPTION, MASK)
static struct btrace_function * ftrace_new_tailcall(struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, struct symbol *fun)
void btrace_teardown(struct thread_info *tp)
btrace_function_flags flags
std::vector< btrace_insn > insn
int gdb_xml_parse_quick(const char *name, const char *dtd_name, const struct gdb_xml_element *elements, const char *document, void *user_data)
struct gdb_xml_value * xml_find_attribute(VEC(gdb_xml_value_s) *attributes, const char *name)
struct cleanup * make_cleanup_btrace_data(struct btrace_data *data)
void btrace_data_clear(struct btrace_data *data)
const char * btrace_format_string(enum btrace_format format)
static bool btrace_ends_with_single_insn(const struct btrace_thread_info *btinfo)
void btrace_insn_end(struct btrace_insn_iterator *it, const struct btrace_thread_info *btinfo)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
struct symbol * find_pc_function(CORE_ADDR pc)
enum btrace_format format
unsigned int btrace_call_prev(struct btrace_call_iterator *it, unsigned int stride)
struct btrace_maint_packet_history packet_history
struct btrace_maint_info maint
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
static void btrace_maint_clear(struct btrace_thread_info *btinfo)
static void do_btrace_data_cleanup(void *arg)
static void ftrace_update_caller(struct btrace_function *bfun, struct btrace_function *caller, enum btrace_function_flag flags)
static const struct gdb_xml_element btrace_children[]
struct btrace_target_info * target
static void parse_xml_btrace_pt(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
static struct btrace_function * ftrace_get_caller(struct btrace_thread_info *btinfo, struct btrace_function *bfun)
void btrace_call_end(struct btrace_call_iterator *it, const struct btrace_thread_info *btinfo)
#define VEC_index(T, V, I)
static struct cmd_list_element * maint_btrace_pt_show_cmdlist
const char * btrace_decode_error(enum btrace_format format, int errcode)
static void maint_btrace_set_cmd(const char *args, int from_tty)
#define SYMBOL_LINKAGE_NAME(symbol)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
const char * print_thread_id(struct thread_info *thr)
static void btrace_add_pc(struct thread_info *tp)
const struct btrace_config * btrace_conf(const struct btrace_thread_info *btinfo)
const struct btrace_insn * btrace_insn_get(const struct btrace_insn_iterator *it)
static const struct gdb_xml_element btrace_pt_config_children[]
static const struct gdb_xml_element btrace_conf_elements[]
struct minimal_symbol * msym
static void parse_xml_btrace_conf_pt(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
void printf_unfiltered(const char *format,...)
static void btrace_finalize_ftrace(struct thread_info *tp, std::vector< unsigned int > &gaps)
static struct btrace_function * ftrace_new_function(struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, struct symbol *fun)
static void show_maint_btrace_pt_skip_pad(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
enum btrace_error target_read_btrace(struct btrace_data *btrace, struct btrace_target_info *btinfo, enum btrace_read_type type)
int btrace_data_empty(struct btrace_data *data)
void gdb_xml_error(struct gdb_xml_parser *parser, const char *format,...)
static int maint_btrace_pt_skip_pad
union btrace_maint_info::@16 variant
int btrace_is_empty(struct thread_info *tp)
unsigned int btrace_insn_next(struct btrace_insn_iterator *it, unsigned int stride)
enum btrace_insn_class iclass
struct btrace_insn_iterator begin
static const struct gdb_xml_attribute btrace_attributes[]
struct btrace_config_pt pt
static struct btrace_function * ftrace_new_call(struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, struct symbol *fun)
void throw_exception(struct gdb_exception exception)
void _initialize_btrace(void)
void btrace_fetch(struct thread_info *tp)
unsigned int btrace_call_next(struct btrace_call_iterator *it, unsigned int stride)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
void discard_cleanups(struct cleanup *old_chain)
void btrace_enable(struct thread_info *tp, const struct btrace_config *conf)
struct btrace_maint_info::@16::@17 bts
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
#define ALL_NON_EXITED_THREADS(T)
static void maint_btrace_clear_packet_history_cmd(const char *args, int from_tty)
int btrace_insn_cmp(const struct btrace_insn_iterator *lhs, const struct btrace_insn_iterator *rhs)
void btrace_call_begin(struct btrace_call_iterator *it, const struct btrace_thread_info *btinfo)
static void btrace_compute_ftrace_pt(struct thread_info *tp, const struct btrace_data_pt *btrace, std::vector< unsigned int > &gaps)
int gdbarch_insn_is_call(struct gdbarch *gdbarch, CORE_ADDR addr)
static const struct gdb_xml_element btrace_pt_children[]
static void btrace_compute_ftrace_bts(struct thread_info *tp, const struct btrace_data_bts *btrace, std::vector< unsigned int > &gaps)
static const struct gdb_xml_attribute btrace_conf_attributes[]
void btrace_free_objfile(struct objfile *objfile)
static void check_xml_btrace_version(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
CORE_ADDR regcache_read_pc(struct regcache *regcache)
struct btrace_data_pt_config config
struct minimal_symbol * minsym
static void btrace_bridge_gaps(struct thread_info *tp, std::vector< unsigned int > &gaps)
static void parse_xml_btrace_pt_config_cpu(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
const char * target_pid_to_str(ptid_t ptid)
static int ftrace_match_backtrace(struct btrace_thread_info *btinfo, struct btrace_function *lhs, struct btrace_function *rhs)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static void maint_btrace_clear_cmd(const char *args, int from_tty)
const struct btrace_function * btrace_call_get(const struct btrace_call_iterator *it)
static void ftrace_update_insns(struct btrace_function *bfun, const btrace_insn &insn)
static struct btrace_function * ftrace_new_return(struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, struct symbol *fun)
void parse_xml_btrace_conf(struct btrace_config *conf, const char *xml)
static void maint_btrace_show_cmd(const char *args, int from_tty)
int btrace_is_replaying(struct thread_info *tp)
gdb_xml_attribute_handler gdb_xml_parse_attr_ulongest
std::vector< btrace_function > functions
unsigned long long ULONGEST
static struct btrace_function * ftrace_find_call(struct btrace_thread_info *btinfo, struct btrace_function *bfun)
struct cmd_list_element * maintenancelist
void btrace_set_insn_history(struct btrace_thread_info *btinfo, const struct btrace_insn_iterator *begin, const struct btrace_insn_iterator *end)
int btrace_find_insn_by_number(struct btrace_insn_iterator *it, const struct btrace_thread_info *btinfo, unsigned int number)
enum btrace_format format
void reinit_frame_cache(void)
CORE_ADDR get_pc_function_start(CORE_ADDR pc)
static void ftrace_fixup_caller(struct btrace_thread_info *btinfo, struct btrace_function *bfun, struct btrace_function *caller, enum btrace_function_flag flags)
void btrace_data_init(struct btrace_data *data)
static void ftrace_debug(const struct btrace_function *bfun, const char *prefix)
static void btrace_maint_update_packets(struct btrace_thread_info *btinfo, unsigned int *begin, unsigned int *end, unsigned int *from, unsigned int *to)
struct btrace_call_iterator end
struct symtab * symbol_symtab(const struct symbol *symbol)
static void btrace_compute_ftrace_1(struct thread_info *tp, struct btrace_data *btrace, std::vector< unsigned int > &gaps)
int btrace_find_call_by_number(struct btrace_call_iterator *it, const struct btrace_thread_info *btinfo, unsigned int number)
const char * core_addr_to_string_nz(const CORE_ADDR addr)
struct cmd_list_element * maintenance_show_cmdlist
static const struct gdb_xml_element btrace_conf_children[]
const struct btrace_config * target_btrace_conf(const struct btrace_target_info *btinfo)
#define DEBUG(msg, args...)
void error(const char *fmt,...)
static struct btrace_function * ftrace_new_switch(struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, struct symbol *fun)
static void maint_btrace_pt_set_cmd(const char *args, int from_tty)
void do_cleanups(struct cleanup *old_chain)
static void parse_xml_btrace_pt_raw(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, const char *body_text)
int gdbarch_insn_is_ret(struct gdbarch *gdbarch, CORE_ADDR addr)
int btrace_data_append(struct btrace_data *dst, const struct btrace_data *src)
static const struct gdb_xml_attribute btrace_conf_pt_attributes[]
static int ftrace_bridge_gap(struct btrace_thread_info *btinfo, struct btrace_function *lhs, struct btrace_function *rhs, int min_matches)