39#include "gdbsupport/event-loop.h"
46#include <forward_list>
50 N_(
"Branch tracing target"),
51 N_(
"Collect control-flow trace and provide the execution history.")
64 void close ()
override;
65 void async (
bool)
override;
85 gdb_disassembly_flags
flags)
override;
87 gdb_disassembly_flags
flags)
override;
101 const gdb_byte *writebuf,
102 ULONGEST offset, ULONGEST len,
103 ULONGEST *xfered_len)
override;
119 void resume (ptid_t,
int,
enum gdb_signal)
override;
122 void stop (ptid_t)
override;
210#define DEBUG(msg, args...) \
213 if (record_debug != 0) \
214 gdb_printf (gdb_stdlog, \
215 "[record-btrace] " msg "\n", ##args); \
222const struct btrace_cpu *
237 error (_(
"Internal error: bad record btrace cpu state."));
252 error (_(
"No thread."));
261 error (_(
"No trace."));
296 catch (
const gdb_exception_error &error)
298 warning (
"%s", error.what ());
307 DEBUG (
"attach thread observer");
319 DEBUG (
"detach thread observer");
345 NULL,
"record-btrace");
394 error (_(
"The program is not being run."));
414 DEBUG (
"stop recording");
419 if (tp->btrace.target != NULL)
478 if ((sz & ((1u << 30) - 1)) == 0)
483 else if ((sz & ((1u << 20) - 1)) == 0)
488 else if ((sz & ((1u << 10) - 1)) == 0)
535 btrace_format_string (conf->format));
537 switch (conf->format)
539 case BTRACE_FORMAT_NONE:
542 case BTRACE_FORMAT_BTS:
546 case BTRACE_FORMAT_PT:
551 internal_error (_(
"Unknown branch trace format."));
560 const struct btrace_config *conf;
562 unsigned int insns, calls, gaps;
567 error (_(
"No thread."));
602 gaps = btinfo->
ngaps;
605 gdb_printf (_(
"Recorded %u instructions in %u functions (%u gaps) "
606 "for thread %s (%s).\n"), insns, calls, gaps,
611 gdb_printf (_(
"Replay in progress. At instruction %u.\n"),
619 enum btrace_format format)
623 uiout->
text (_(
"["));
625 if (!(format == BTRACE_FORMAT_PT && errcode > 0))
627 uiout->
text (_(
"decode error ("));
629 uiout->
text (_(
"): "));
631 uiout->
text (errstr);
632 uiout->
text (_(
"]\n"));
672 range.end = line + 1;
674 else if (line <
range.begin)
676 else if (
range.end < line)
721 lines = ltable->
item;
726 for (i = 0; i < nlines - 1; i++)
736 if ((lines[i].pc == pc) && (lines[i].line != 0)
737 && (lines[i].is_stmt == 1))
755 gdb::optional<ui_out_emit_tuple> *src_and_asm_tuple,
756 gdb::optional<ui_out_emit_list> *asm_list,
757 gdb_disassembly_flags
flags)
759 print_source_lines_flags psl_flags;
764 for (
int line = lines.
begin; line < lines.
end; ++line)
768 src_and_asm_tuple->emplace (uiout,
"src_and_asm_line");
772 asm_list->emplace (uiout,
"line_asm_insn");
783 gdb_disassembly_flags
flags)
785 DEBUG (
"itrace (0x%x): [%u; %u)", (
unsigned)
flags,
795 gdb::optional<ui_out_emit_tuple> src_and_asm_tuple;
796 gdb::optional<ui_out_emit_list> asm_list;
810 const struct btrace_config *conf;
815 gdb_assert (conf != NULL);
840 else if (!src_and_asm_tuple.has_value ())
842 gdb_assert (!asm_list.has_value ());
844 src_and_asm_tuple.emplace (uiout,
"src_and_asm_line");
847 asm_list.emplace (uiout,
"line_asm_insn");
850 gdb_assert (src_and_asm_tuple.has_value ());
851 gdb_assert (asm_list.has_value ());
854 memset (&dinsn, 0,
sizeof (dinsn));
875 unsigned int context, covered;
879 context = abs (
size);
881 error (_(
"Bad record instruction-history-size."));
918 begin = history->
begin;
921 DEBUG (
"insn-history (0x%x): %d, prev: [%u; %u)", (
unsigned)
flags,
size,
941 gdb_printf (_(
"At the start of the branch trace record.\n"));
943 gdb_printf (_(
"At the end of the branch trace record.\n"));
953 gdb_disassembly_flags
flags)
958 unsigned int low, high;
966 DEBUG (
"insn-history (0x%x): [%u; %u)", (
unsigned)
flags, low, high);
969 if (low != from || high != to)
970 error (_(
"Bad range."));
973 error (_(
"Bad range."));
979 error (_(
"Range out of bounds."));
1001 gdb_disassembly_flags
flags)
1003 ULONGEST begin, end, context;
1005 context = abs (
size);
1007 error (_(
"Bad record instruction-history-size."));
1016 begin = from - context + 1;
1021 end = from + context - 1;
1040 gdb_assert (
size > 0);
1057 int *pbegin,
int *pend)
1080 begin = std::min (begin, sal.
line);
1136 else if (msym != NULL)
1174 const struct btrace_config *conf;
1179 gdb_assert (conf != NULL);
1190 for (i = 0; i < level; ++i)
1197 else if (msym != NULL)
1206 uiout->
text (_(
"\tinst "));
1212 uiout->
text (_(
"\tat "));
1229 unsigned int context, covered;
1233 context = abs (
size);
1235 error (_(
"Bad record function-call-history-size."));
1239 if (history == NULL)
1275 begin = history->
begin;
1278 DEBUG (
"call-history (0x%x): %d, prev: [%u; %u)", (
int)
flags,
size,
1298 gdb_printf (_(
"At the start of the branch trace record.\n"));
1300 gdb_printf (_(
"At the end of the branch trace record.\n"));
1310 record_print_flags
flags)
1315 unsigned int low, high;
1323 DEBUG (
"call-history (0x%x): [%u; %u)", (
int)
flags, low, high);
1326 if (low != from || high != to)
1327 error (_(
"Bad range."));
1330 error (_(
"Bad range."));
1336 error (_(
"Range out of bounds."));
1358 record_print_flags
flags)
1360 ULONGEST begin, end, context;
1362 context = abs (
size);
1364 error (_(
"Bad record function-call-history-size."));
1373 begin = from - context + 1;
1378 end = from + context - 1;
1397 error (_(
"No thread."));
1399 if (tp->
btrace.target == NULL)
1430 const char *annex, gdb_byte *readbuf,
1431 const gdb_byte *writebuf, ULONGEST offset,
1432 ULONGEST len, ULONGEST *xfered_len)
1446 if (writebuf != NULL)
1454 if (section != NULL)
1458 & SEC_READONLY) != 0)
1461 len = std::min (len, section->
endaddr - offset);
1474 offset, len, xfered_len);
1496 catch (
const gdb_exception &except)
1526 catch (
const gdb_exception &except)
1548 replay = tp->
btrace.replay;
1562 if (regno >= 0 && regno != pcreg)
1566 gdb_assert (insn != NULL);
1581 error (_(
"Cannot write registers while replaying."));
1626 return htab_hash_pointer (cache->
frame);
1653 slot = htab_find_slot (
bfcache, cache, INSERT);
1654 gdb_assert (*slot == NULL);
1671 slot = htab_find_slot (
bfcache, &pattern, NO_INSERT);
1690 gdb_assert (
bfun != NULL);
1693 return UNWIND_UNAVAILABLE;
1695 return UNWIND_NO_REASON;
1707 CORE_ADDR
code, special;
1712 gdb_assert (
bfun != NULL);
1722 DEBUG (
"[frame] %s id: (!stack, pc=%s, special=%s)",
1724 core_addr_to_string_nz (this_id->
code_addr),
1730static struct value *
1744 if (pcreg < 0 ||
regnum != pcreg)
1745 throw_error (NOT_AVAILABLE_ERROR,
1746 _(
"Registers are not available in btrace record history"));
1750 gdb_assert (
bfun != NULL);
1753 throw_error (NOT_AVAILABLE_ERROR,
1754 _(
"No caller in btrace record history"));
1759 pc = caller->
insn.front ().pc;
1762 pc = caller->
insn.back ().pc;
1766 DEBUG (
"[frame] unwound PC in %s on level %d: %s",
1768 core_addr_to_string_nz (pc));
1794 replay = tp->
btrace.replay;
1816 DEBUG (
"[frame] sniffed frame for %s on level %d",
1824 *this_cache = cache;
1858 DEBUG (
"[frame] sniffed tailcall frame for %s on level %d",
1866 *this_cache = cache;
1878 slot = htab_find_slot (
bfcache, cache, NO_INSERT);
1879 gdb_assert (slot != NULL);
1881 htab_remove_elt (
bfcache, cache);
1904 "record-btrace tailcall",
1941 return "reverse-step";
1947 return "reverse-cont";
1965 tp->
ptid.to_string ().c_str (), flag,
1975 btinfo->
flags |= flag;
1998 bool executing = tp->executing ();
2020 error (_(
"No trace."));
2030 int upd_step_frame_id, upd_step_stack_frame_id;
2051 error (_(
"No trace."));
2055 gdb_assert (btinfo->
replay == NULL);
2065 if (upd_step_frame_id)
2067 if (upd_step_stack_frame_id)
2070 catch (
const gdb_exception &except)
2126 DEBUG (
"resume %s: %s%s", ptid.to_string ().c_str (),
2128 step ?
"step" :
"cont");
2198 btrace_thread_flags
flags;
2204 DEBUG (
"cancel resume thread %s (%s): %x (%s)",
2206 tp->
ptid.to_string ().c_str (),
flags.raw (),
2220 status.set_no_history ();
2232 status.set_stopped (GDB_SIGNAL_TRAP);
2245 status.set_stopped (GDB_SIGNAL_0);
2269 status.set_no_resumed ();
2329 btinfo = &tp->btrace;
2378 btinfo = &tp->btrace;
2424 btrace_thread_flags
flags;
2426 btinfo = &tp->btrace;
2432 tp->ptid.to_string ().c_str (),
flags.raw (),
2442 internal_error (_(
"invalid stepping type."));
2490 (
const std::vector<thread_info *> &moving,
2491 const std::vector<thread_info *> &no_history)
2493 bool more_moving = !moving.empty ();
2494 bool more_no_history = !no_history.empty ();;
2496 if (!more_moving && !more_no_history)
2500 DEBUG (
"movers pending");
2502 if (more_no_history)
2503 DEBUG (
"no-history pending");
2512 target_wait_flags options)
2514 std::vector<thread_info *> moving;
2515 std::vector<thread_info *> no_history;
2520 DEBUG (
"wait %s (0x%x)", ptid.to_string ().c_str (),
2521 (
unsigned) options);
2534 moving.push_back (tp);
2536 if (moving.empty ())
2540 DEBUG (
"wait ended by %s: %s", null_ptid.to_string ().c_str (),
2541 status->to_string ().c_str ());
2564 while ((eventing == NULL) && !moving.empty ())
2566 for (
unsigned int ix = 0; eventing == NULL && ix < moving.size ();)
2579 no_history.push_back (ordered_remove (moving, ix));
2583 eventing = unordered_remove (moving, ix);
2589 if (eventing == NULL)
2596 gdb_assert (!no_history.empty ());
2600 eventing = unordered_remove (no_history, 0);
2601 eventing->
btrace.flags &= ~BTHR_MOVE;
2606 gdb_assert (eventing != NULL);
2629 DEBUG (
"wait ended by thread %s (%s): %s",
2631 eventing->
ptid.to_string ().c_str (),
2632 status->to_string ().c_str ());
2634 return eventing->
ptid;
2642 DEBUG (
"stop %s", ptid.to_string ().c_str ());
2657 tp->btrace.flags &= ~BTHR_MOVE;
2766 if (btinfo->
replay == NULL)
2801 error (_(
"No trace."));
2826 unsigned int number;
2833 error (_(
"Instruction number out of range."));
2841 error (_(
"No such instruction."));
2884 if (args != NULL && *args != 0)
2885 error (_(
"Invalid argument."));
2893 catch (
const gdb_exception &exception)
2905 if (args != NULL && *args != 0)
2906 error (_(
"Invalid argument."));
2914 catch (
const gdb_exception &exception)
2926 if (args != NULL && *args != 0)
2927 error (_(
"Invalid argument."));
2935 catch (
const gdb_exception &exception)
2943 catch (
const gdb_exception &ex)
2957 gdb_printf (file, _(
"Replay memory access is %s.\n"),
2966 if (args !=
nullptr && *args != 0)
2967 error (_(
"Trailing junk: '%s'."), args);
2977 if (args !=
nullptr && *args != 0)
2978 error (_(
"Trailing junk: '%s'."), args);
2988 if (args ==
nullptr)
2992 unsigned int family, model, stepping;
2993 int l1, l2, matches = sscanf (args,
"intel: %u/%u%n/%u%n", &family,
2994 &model, &l1, &stepping, &l2);
2997 if (strlen (args) != l2)
2998 error (_(
"Trailing junk: '%s'."), args + l2);
3000 else if (matches == 2)
3002 if (strlen (args) != l1)
3003 error (_(
"Trailing junk: '%s'."), args + l1);
3008 error (_(
"Bad format. See \"help set record btrace cpu\"."));
3010 if (USHRT_MAX < family)
3011 error (_(
"Cpu family too big."));
3013 if (UCHAR_MAX < model)
3014 error (_(
"Cpu model too big."));
3016 if (UCHAR_MAX < stepping)
3017 error (_(
"Cpu stepping too big."));
3032 if (args !=
nullptr && *args != 0)
3033 error (_(
"Trailing junk: '%s'."), args);
3050 gdb_printf (_(
"btrace cpu is 'intel: %u/%u'.\n"),
3054 gdb_printf (_(
"btrace cpu is 'intel: %u/%u/%u'.\n"),
3062 error (_(
"Internal error: bad cpu state."));
3072 gdb_printf (file, _(
"The record/replay bts buffer size is %s.\n"),
3083 gdb_printf (file, _(
"The record/replay pt buffer size is %s.\n"),
3095 _(
"Start branch trace recording."),
3102Start branch trace recording in Branch Trace Store (BTS) format.\n\n\
3103The processor stores a from/to record for each branch into a cyclic buffer.\n\
3104This format may not be available on all processors."),
3112Start branch trace recording in Intel Processor Trace format.\n\n\
3113This format may not be available on all processors."),
3118 _(
"Set record options."),
3119 _(
"Show record options."),
3126Set what memory accesses are allowed during replay."), _(
"\
3127Show what memory accesses are allowed during replay."),
3128 _(
"Default is READ-ONLY.\n\n\
3129The btrace record target does not trace data.\n\
3130The memory therefore corresponds to the live target and not \
3131to the current replay position.\n\n\
3132When READ-ONLY, allow accesses to read-only memory during replay.\n\
3133When READ-WRITE, allow accesses to read-only and read-write memory during \
3141Set the cpu to be used for trace decode.\n\n\
3142The format is \"VENDOR:IDENTIFIER\" or \"none\" or \"auto\" (default).\n\
3143For vendor \"intel\" the format is \"FAMILY/MODEL[/STEPPING]\".\n\n\
3144When decoding branch trace, enable errata workarounds for the specified cpu.\n\
3145The default is \"auto\", which uses the cpu on which the trace was recorded.\n\
3146When GDB does not support that cpu, this option can be used to enable\n\
3147workarounds for a similar cpu that GDB supports.\n\n\
3148When set to \"none\", errata workarounds are disabled."),
3154Automatically determine the cpu to be used for trace decode."),
3158Do not enable errata workarounds for trace decode."),
3162Show the cpu to be used for trace decode."),
3166 _(
"Set record btrace bts options."),
3167 _(
"Show record btrace bts options."),
3175 _(
"Set the record/replay bts buffer size."),
3176 _(
"Show the record/replay bts buffer size."), _(
"\
3177When starting recording request a trace buffer of this size. \
3178The actual buffer size may differ from the requested size. \
3179Use \"info record\" to see the actual buffer size.\n\n\
3180Bigger buffers allow longer recording but also take more time to process \
3181the recorded execution trace.\n\n\
3182The trace buffer size may not be changed while recording."), NULL,
3188 _(
"Set record btrace pt options."),
3189 _(
"Show record btrace pt options."),
3197 _(
"Set the record/replay pt buffer size."),
3198 _(
"Show the record/replay pt buffer size."), _(
"\
3199Bigger buffers allow longer recording but also take more time to process \
3200the recorded execution.\n\
3201The actual buffer size may differ from the requested size. Use \"info record\" \
void * xcalloc(size_t number, size_t size)
struct gdbarch * target_gdbarch(void)
void mark_async_event_handler(async_event_handler *async_handler_ptr)
async_event_handler * create_async_event_handler(async_event_handler_func *proc, gdb_client_data client_data, const char *name)
void clear_async_event_handler(async_event_handler *async_handler_ptr)
void delete_async_event_handler(async_event_handler **async_handler_ptr)
void btrace_enable(struct thread_info *tp, const struct btrace_config *conf)
const struct btrace_function * btrace_call_get(const struct btrace_call_iterator *it)
unsigned int btrace_call_prev(struct btrace_call_iterator *it, unsigned int stride)
unsigned int btrace_call_next(struct btrace_call_iterator *it, unsigned int stride)
unsigned int btrace_call_number(const struct btrace_call_iterator *it)
void btrace_insn_end(struct btrace_insn_iterator *it, const struct btrace_thread_info *btinfo)
int btrace_insn_cmp(const struct btrace_insn_iterator *lhs, const struct btrace_insn_iterator *rhs)
int btrace_find_insn_by_number(struct btrace_insn_iterator *it, const struct btrace_thread_info *btinfo, unsigned int number)
unsigned int btrace_insn_prev(struct btrace_insn_iterator *it, unsigned int stride)
const char * btrace_decode_error(enum btrace_format format, int errcode)
int btrace_find_call_by_number(struct btrace_call_iterator *it, const struct btrace_thread_info *btinfo, unsigned int number)
void btrace_set_insn_history(struct btrace_thread_info *btinfo, const struct btrace_insn_iterator *begin, const struct btrace_insn_iterator *end)
void btrace_disable(struct thread_info *tp)
void btrace_fetch(struct thread_info *tp, const struct btrace_cpu *cpu)
void btrace_set_call_history(struct btrace_thread_info *btinfo, const struct btrace_call_iterator *begin, const struct btrace_call_iterator *end)
const struct btrace_config * btrace_conf(const struct btrace_thread_info *btinfo)
unsigned int btrace_insn_next(struct btrace_insn_iterator *it, unsigned int stride)
const struct btrace_insn * btrace_insn_get(const struct btrace_insn_iterator *it)
void btrace_teardown(struct thread_info *tp)
unsigned int btrace_insn_number(const struct btrace_insn_iterator *it)
int btrace_insn_get_error(const struct btrace_insn_iterator *it)
int btrace_is_empty(struct thread_info *tp)
void btrace_insn_begin(struct btrace_insn_iterator *it, const struct btrace_thread_info *btinfo)
void btrace_call_end(struct btrace_call_iterator *it, const struct btrace_thread_info *btinfo)
int btrace_is_replaying(struct thread_info *tp)
int btrace_call_cmp(const struct btrace_call_iterator *lhs, const struct btrace_call_iterator *rhs)
@ BFUN_UP_LINKS_TO_TAILCALL
@ BTRACE_INSN_FLAG_SPECULATIVE
ui_file_style style() const
int pretty_print_insn(const struct disasm_insn *insn, gdb_disassembly_flags flags)
int unpush_target(struct target_ops *t)
void push_target(struct target_ops *t)
struct process_stratum_target * process_target()
struct address_space * aspace
target_ops * target_at(enum strata stratum)
void stop_recording() override
void call_history_range(ULONGEST begin, ULONGEST end, record_print_flags flags) override
void async(bool) override
void fetch_registers(struct regcache *, int) override
enum record_method record_method(ptid_t ptid) override
void record_stop_replaying() override
void info_record() override
ptid_t wait(ptid_t, struct target_waitstatus *, target_wait_flags) override
enum exec_direction_kind execution_direction() override
bool stopped_by_hw_breakpoint() override
void insn_history(int size, gdb_disassembly_flags flags) override
bool stopped_by_sw_breakpoint() override
void goto_record_end() override
void prepare_to_store(struct regcache *) override
void mourn_inferior() override
void call_history_from(ULONGEST begin, int size, record_print_flags flags) override
void detach(inferior *inf, int from_tty) override
void update_thread_list() override
bool supports_stopped_by_hw_breakpoint() override
void goto_record_begin() override
void store_registers(struct regcache *, int) override
bool supports_stopped_by_sw_breakpoint() override
void insn_history_from(ULONGEST from, int size, gdb_disassembly_flags flags) override
bool can_execute_reverse() override
int insert_breakpoint(struct gdbarch *, struct bp_target_info *) override
bool record_is_replaying(ptid_t ptid) override
const struct frame_unwind * get_tailcall_unwinder() override
enum target_xfer_status xfer_partial(enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) override
bool record_will_replay(ptid_t ptid, int dir) override
strata stratum() const override
const struct frame_unwind * get_unwinder() override
bool thread_alive(ptid_t ptid) override
int remove_breakpoint(struct gdbarch *, struct bp_target_info *, enum remove_bp_reason) override
void prepare_to_generate_core() override
void goto_record(ULONGEST insn) override
void call_history(int size, record_print_flags flags) override
void resume(ptid_t, int, enum gdb_signal) override
void insn_history_range(ULONGEST begin, ULONGEST end, gdb_disassembly_flags flags) override
void done_generating_core() override
const target_info & info() const override
void disconnect(const char *, int) override
void raw_supply(int regnum, const void *buf) override
process_stratum_target * target() const
void set_stop_pc(CORE_ADDR stop_pc)
thread_control_state control
void begin(ui_out_type type, const char *id)
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
void field_fmt(const char *fldname, const char *format,...) ATTRIBUTE_PRINTF(3
void field_signed(const char *fldname, LONGEST value)
void text(const char *string)
bool is_mi_like_p() const
void field_unsigned(const char *fldname, ULONGEST value)
void end(ui_out_type type)
set_show_commands add_setshow_uinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *target, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
set_show_commands add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
set_show_commands add_setshow_prefix_cmd(const char *name, command_class theclass, const char *set_doc, const char *show_doc, cmd_list_element **set_subcommands_list, cmd_list_element **show_subcommands_list, cmd_list_element **set_list, cmd_list_element **show_list)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
cli_style_option function_name_style
cli_style_option file_name_style
int number_is_in_list(const char *list, int number)
@ DISASSEMBLY_SPECULATIVE
int gdb_insn_length(struct gdbarch *gdbarch, CORE_ADDR addr)
struct value * frame_unwind_got_address(frame_info_ptr frame, int regnum, CORE_ADDR addr)
frame_info_ptr get_next_frame(frame_info_ptr this_frame)
struct frame_id frame_id_build_unavailable_stack_special(CORE_ADDR code_addr, CORE_ADDR special_addr)
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
CORE_ADDR get_frame_func(frame_info_ptr this_frame)
frame_info_ptr get_selected_frame(const char *message)
frame_info_ptr get_current_frame(void)
struct frame_id get_frame_id(frame_info_ptr fi)
void print_stack_frame(frame_info_ptr, int print_level, enum print_what print_what, int set_current_sal)
#define FRAME_OBSTACK_ZALLOC(TYPE)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
void execute_command(const char *, int)
thread_info * find_thread_ptid(inferior *inf, ptid_t ptid)
all_non_exited_threads_range all_non_exited_threads(process_stratum_target *proc_target=nullptr, ptid_t filter_ptid=minus_one_ptid)
void validate_registers_access(void)
void set_executing(process_stratum_target *targ, ptid_t ptid, bool executing)
struct thread_info * inferior_thread(void)
void switch_to_thread(struct thread_info *thr)
const char * print_thread_id(struct thread_info *thr)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly 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
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
void inferior_event_handler(enum inferior_event_type event_type)
struct inferior * current_inferior(void)
observable< struct thread_info * > new_thread
observable< struct inferior *, int, const char *, const char * > record_changed
void _initialize_record_btrace()
static void record_btrace_print_conf(const struct btrace_config *conf)
static struct btrace_line_range btrace_line_range_add(struct btrace_line_range range, int line)
static struct cmd_list_element * set_record_btrace_pt_cmdlist
static struct cmd_list_element * show_record_btrace_pt_cmdlist
static struct btrace_line_range btrace_find_line_range(CORE_ADDR pc)
static const char replay_memory_access_read_only[]
static const char * btrace_thread_flag_to_str(btrace_thread_flags flag)
static struct target_waitstatus btrace_step_again(void)
static void btrace_compute_src_line_range(const struct btrace_function *bfun, int *pbegin, int *pend)
static int bfcache_eq(const void *arg1, const void *arg2)
static void record_btrace_maybe_mark_async_event(const std::vector< thread_info * > &moving, const std::vector< thread_info * > &no_history)
static void record_btrace_stop_replaying_at_end(struct thread_info *tp)
static void record_btrace_set_replay(struct thread_info *tp, const struct btrace_insn_iterator *it)
static struct thread_info * require_btrace_thread(void)
static void cmd_record_btrace_pt_start(const char *args, int from_tty)
static void cmd_show_record_btrace_cpu(const char *args, int from_tty)
static struct async_event_handler * record_btrace_async_inferior_event_handler
static void cmd_set_record_btrace_cpu_auto(const char *args, int from_tty)
static void record_btrace_cancel_resume(struct thread_info *tp)
static void record_btrace_auto_disable(void)
static void record_btrace_stop_replaying(struct thread_info *tp)
static const gdb::observers::token record_btrace_thread_observer_token
static void btrace_print_lines(struct btrace_line_range lines, struct ui_out *uiout, gdb::optional< ui_out_emit_tuple > *src_and_asm_tuple, gdb::optional< ui_out_emit_list > *asm_list, gdb_disassembly_flags flags)
static hashval_t bfcache_hash(const void *arg)
static record_btrace_target record_btrace_ops
static struct btrace_cpu record_btrace_cpu
static enum record_btrace_cpu_state_kind record_btrace_cpu_state
record_btrace_cpu_state_kind
const struct frame_unwind record_btrace_frame_unwind
static void cmd_show_replay_memory_access(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void record_btrace_clear_histories(struct btrace_thread_info *btinfo)
static struct cmd_list_element * show_record_btrace_cmdlist
static void cmd_set_record_btrace_cpu(const char *args, int from_tty)
static struct btrace_insn_iterator * record_btrace_start_replaying(struct thread_info *tp)
static const char * replay_memory_access
static struct btrace_line_range btrace_mk_line_range(struct symtab *symtab, int begin, int end)
#define DEBUG(msg, args...)
static void btrace_call_history_insn_range(struct ui_out *uiout, const struct btrace_function *bfun)
static void record_btrace_print_bts_conf(const struct btrace_config_bts *conf)
static struct target_waitstatus btrace_step_spurious(void)
static struct value * record_btrace_frame_prev_register(frame_info_ptr this_frame, void **this_cache, int regnum)
static void cmd_set_record_btrace_cpu_none(const char *args, int from_tty)
static const char replay_memory_access_read_write[]
static void cmd_record_btrace_bts_start(const char *args, int from_tty)
static struct target_waitstatus btrace_step_stopped(void)
static struct target_waitstatus record_btrace_single_step_backward(struct thread_info *tp)
const struct btrace_cpu * record_btrace_get_cpu(void)
static void cmd_record_btrace_start(const char *args, int from_tty)
static struct target_waitstatus record_btrace_single_step_forward(struct thread_info *tp)
static struct target_waitstatus btrace_step_stopped_on_request(void)
static void record_btrace_print_pt_conf(const struct btrace_config_pt *conf)
static void btrace_call_history_src_line(struct ui_out *uiout, const struct btrace_function *bfun)
static void btrace_ui_out_decode_error(struct ui_out *uiout, int errcode, enum btrace_format format)
static enum exec_direction_kind record_btrace_resume_exec_dir
static struct cmd_list_element * show_record_btrace_bts_cmdlist
static struct frame_id get_thread_current_frame_id(struct thread_info *tp)
static int record_btrace_generating_corefile
static void record_btrace_handle_async_inferior_event(gdb_client_data data)
const struct frame_unwind record_btrace_tailcall_frame_unwind
void record_btrace_push_target(void)
static struct target_waitstatus record_btrace_step_thread(struct thread_info *tp)
static int record_btrace_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_cache)
static struct cmd_list_element * set_record_btrace_cmdlist
static void record_btrace_resume_thread(struct thread_info *tp, enum btrace_thread_flag flag)
static void record_btrace_target_open(const char *args, int from_tty)
static int btrace_line_range_contains_range(struct btrace_line_range lhs, struct btrace_line_range rhs)
static int record_btrace_tailcall_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_cache)
static struct btrace_thread_info * require_btrace(void)
static struct btrace_config record_btrace_conf
static void record_btrace_frame_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
static struct target_waitstatus btrace_step_no_resumed(void)
static int btrace_line_range_is_empty(struct btrace_line_range range)
static void record_btrace_on_new_thread(struct thread_info *tp)
static void show_record_pt_buffer_size_value(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static const char * btrace_get_bfun_name(const struct btrace_function *bfun)
static struct target_waitstatus btrace_step_no_history(void)
static void record_btrace_frame_dealloc_cache(frame_info *self, void *this_cache)
static void show_record_bts_buffer_size_value(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static const char *const replay_memory_access_types[]
static struct cmd_list_element * record_btrace_cmdlist
static const char * record_btrace_adjust_size(unsigned int *size)
static struct cmd_list_element * set_record_btrace_cpu_cmdlist
static void record_btrace_auto_enable(void)
static enum unwind_stop_reason record_btrace_frame_unwind_stop_reason(frame_info_ptr this_frame, void **this_cache)
static const target_info record_btrace_target_info
static struct btrace_frame_cache * bfcache_new(frame_info_ptr frame)
static const struct btrace_function * btrace_get_frame_function(frame_info_ptr frame)
static struct cmd_list_element * set_record_btrace_bts_cmdlist
static int record_btrace_replay_at_breakpoint(struct thread_info *tp)
void record_detach(struct target_ops *t, inferior *inf, int from_tty)
struct cmd_list_element * set_record_cmdlist
struct cmd_list_element * show_record_cmdlist
struct cmd_list_element * record_cmdlist
void record_preopen(void)
void record_mourn_inferior(struct target_ops *t)
void record_kill(struct target_ops *t)
int record_check_stopped_by_breakpoint(const address_space *aspace, CORE_ADDR pc, enum target_stop_reason *reason)
@ RECORD_PRINT_INSN_RANGE
@ RECORD_PRINT_INDENT_CALLS
CORE_ADDR regcache_read_pc(struct regcache *regcache)
void registers_changed_thread(thread_info *thread)
struct regcache * get_current_regcache(void)
const char * symtab_to_filename_for_display(struct symtab *symtab)
void print_source_lines(struct symtab *s, int line, int stopline, print_source_lines_flags flags)
@ PRINT_SOURCE_LINES_FILENAME
struct btrace_call_iterator begin
struct btrace_call_iterator end
const struct btrace_thread_info * btinfo
const struct btrace_function * bfun
btrace_function_flags flags
struct minimal_symbol * msym
std::vector< btrace_insn > insn
struct btrace_insn_iterator begin
struct btrace_insn_iterator end
const struct btrace_thread_info * btinfo
std::vector< btrace_function > functions
btrace_thread_flags flags
struct btrace_insn_iterator * replay
struct btrace_call_history * call_history
enum target_stop_reason stop_reason
struct btrace_insn_history * insn_history
unsigned int is_speculative
const char * print_name() const
struct linetable_entry item[1]
void add_thread(thread_info *thread)
DISABLE_COPY_AND_ASSIGN(scoped_btrace_disable)
scoped_btrace_disable()=default
std::forward_list< thread_info * > m_threads
struct linetable * linetable() const
virtual ptid_t wait(ptid_t, struct target_waitstatus *, target_wait_flags options) TARGET_DEFAULT_FUNC(default_target_wait)
virtual int remove_breakpoint(struct gdbarch *, struct bp_target_info *, enum remove_bp_reason) TARGET_DEFAULT_NORETURN(noprocess())
virtual void fetch_registers(struct regcache *, int) TARGET_DEFAULT_IGNORE()
virtual bool stopped_by_sw_breakpoint() TARGET_DEFAULT_RETURN(false)
target_ops * beneath() const
virtual void store_registers(struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
virtual enum target_xfer_status xfer_partial(enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) TARGET_DEFAULT_RETURN(TARGET_XFER_E_IO)
virtual gdb::byte_vector virtual thread_info_to_thread_handle(struct thread_info *) TARGET_DEFAULT_RETURN(gdb voi stop)(ptid_t) TARGET_DEFAULT_IGNORE()
virtual bool supports_stopped_by_sw_breakpoint() TARGET_DEFAULT_RETURN(false)
virtual bool stopped_by_hw_breakpoint() TARGET_DEFAULT_RETURN(false)
virtual void async(bool) TARGET_DEFAULT_NORETURN(tcomplain())
virtual bool supports_stopped_by_hw_breakpoint() TARGET_DEFAULT_RETURN(false)
virtual void resume(ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
virtual void update_thread_list() TARGET_DEFAULT_IGNORE()
virtual void prepare_to_store(struct regcache *) TARGET_DEFAULT_NORETURN(noprocess())
virtual bool thread_alive(ptid_t ptid) TARGET_DEFAULT_RETURN(false)
virtual void disconnect(const char *, int) TARGET_DEFAULT_NORETURN(tcomplain())
virtual int insert_breakpoint(struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_NORETURN(noprocess())
virtual const struct btrace_config * btrace_conf(const struct btrace_target_info *) TARGET_DEFAULT_RETURN(NULL)
struct bfd_section * the_bfd_section
struct symtab * find_pc_line_symtab(CORE_ADDR pc)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
void target_async(bool enable)
const struct target_section * target_section_by_addr(struct target_ops *target, CORE_ADDR addr)
bool target_can_async_p()
bool target_has_execution(inferior *inf)
void add_target(const target_info &t, target_open_ftype *func, completer_ftype *completer)
bool target_is_non_stop_p()
std::string target_pid_to_str(ptid_t ptid)
@ TARGET_XFER_UNAVAILABLE
void gdb_printf(struct ui_file *stream, const char *format,...)
@ TARGET_WAITKIND_SPURIOUS
@ TARGET_WAITKIND_NO_HISTORY
@ TARGET_STOPPED_BY_SW_BREAKPOINT
@ TARGET_STOPPED_BY_HW_BREAKPOINT