record_btrace_call_history_range (self, begin, end, flags);
}
+/* The to_record_method method of target record-btrace. */
+
+static enum record_method
+record_btrace_record_method (struct target_ops *self, ptid_t ptid)
+{
+ const struct btrace_config *config;
+ struct thread_info * const tp = find_thread_ptid (ptid);
+
+ if (tp == NULL)
+ error (_("No thread."));
+
+ if (tp->btrace.target == NULL)
+ return RECORD_METHOD_NONE;
+
+ return RECORD_METHOD_BTRACE;
+}
+
/* The to_record_is_replaying method of target record-btrace. */
static int
ops->to_call_history = record_btrace_call_history;
ops->to_call_history_from = record_btrace_call_history_from;
ops->to_call_history_range = record_btrace_call_history_range;
+ ops->to_record_method = record_btrace_record_method;
ops->to_record_is_replaying = record_btrace_is_replaying;
ops->to_record_will_replay = record_btrace_will_replay;
ops->to_record_stop_replaying = record_btrace_stop_replaying_all;
return record_full_execution_dir;
}
+/* The to_record_method method of target record-full. */
+
+enum record_method
+record_full_record_method (struct target_ops *self, ptid_t ptid)
+{
+ return RECORD_METHOD_FULL;
+}
+
static void
record_full_info (struct target_ops *self)
{
record_full_ops.to_get_bookmark = record_full_get_bookmark;
record_full_ops.to_goto_bookmark = record_full_goto_bookmark;
record_full_ops.to_execution_direction = record_full_execution_direction;
+ record_full_ops.to_record_method = record_full_record_method;
record_full_ops.to_info_record = record_full_info;
record_full_ops.to_save_record = record_full_save;
record_full_ops.to_delete_record = record_full_delete;
record_full_core_ops.to_goto_bookmark = record_full_goto_bookmark;
record_full_core_ops.to_execution_direction
= record_full_execution_direction;
+ record_full_core_ops.to_record_method = record_full_record_method;
record_full_core_ops.to_info_record = record_full_info;
record_full_core_ops.to_delete_record = record_full_delete;
record_full_core_ops.to_record_is_replaying = record_full_is_replaying;
extern const struct frame_unwind record_btrace_frame_unwind;
extern const struct frame_unwind record_btrace_tailcall_frame_unwind;
+/* A list of different recording methods. */
+enum record_method
+{
+ /* No or unknown record method. */
+ RECORD_METHOD_NONE,
+
+ /* Record method "full". */
+ RECORD_METHOD_FULL,
+
+ /* Record method "btrace". */
+ RECORD_METHOD_BTRACE
+};
+
/* A list of flags specifying what record target methods should print. */
enum record_print_flag
{
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_enum_btrace_format(X) \
target_debug_do_print (plongest (X))
+#define target_debug_print_enum_record_method(X) \
+ target_debug_do_print (plongest (X))
#define target_debug_print_const_struct_btrace_config_p(X) \
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_const_struct_btrace_target_info_p(X) \
return result;
}
+static enum record_method
+delegate_record_method (struct target_ops *self, ptid_t arg1)
+{
+ self = self->beneath;
+ return self->to_record_method (self, arg1);
+}
+
+static enum record_method
+tdefault_record_method (struct target_ops *self, ptid_t arg1)
+{
+ return RECORD_METHOD_NONE;
+}
+
+static enum record_method
+debug_record_method (struct target_ops *self, ptid_t arg1)
+{
+ enum record_method result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->to_record_method (...)\n", debug_target.to_shortname);
+ result = debug_target.to_record_method (&debug_target, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->to_record_method (", debug_target.to_shortname);
+ target_debug_print_struct_target_ops_p (&debug_target);
+ fputs_unfiltered (", ", gdb_stdlog);
+ target_debug_print_ptid_t (arg1);
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_enum_record_method (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
static void
delegate_stop_recording (struct target_ops *self)
{
ops->to_read_btrace = delegate_read_btrace;
if (ops->to_btrace_conf == NULL)
ops->to_btrace_conf = delegate_btrace_conf;
+ if (ops->to_record_method == NULL)
+ ops->to_record_method = delegate_record_method;
if (ops->to_stop_recording == NULL)
ops->to_stop_recording = delegate_stop_recording;
if (ops->to_info_record == NULL)
ops->to_teardown_btrace = tdefault_teardown_btrace;
ops->to_read_btrace = tdefault_read_btrace;
ops->to_btrace_conf = tdefault_btrace_conf;
+ ops->to_record_method = tdefault_record_method;
ops->to_stop_recording = tdefault_stop_recording;
ops->to_info_record = tdefault_info_record;
ops->to_save_record = tdefault_save_record;
ops->to_teardown_btrace = debug_teardown_btrace;
ops->to_read_btrace = debug_read_btrace;
ops->to_btrace_conf = debug_btrace_conf;
+ ops->to_record_method = debug_record_method;
ops->to_stop_recording = debug_stop_recording;
ops->to_info_record = debug_info_record;
ops->to_save_record = debug_save_record;
/* See target.h. */
+enum record_method
+target_record_method (ptid_t ptid)
+{
+ return current_target.to_record_method (¤t_target, ptid);
+}
+
+/* See target.h. */
+
int
target_record_is_replaying (ptid_t ptid)
{
#include "vec.h"
#include "gdb_signals.h"
#include "btrace.h"
+#include "record.h"
#include "command.h"
#include "break-common.h" /* For enum target_hw_bp_type. */
const struct btrace_target_info *)
TARGET_DEFAULT_RETURN (NULL);
+ /* Current recording method. */
+ enum record_method (*to_record_method) (struct target_ops *, ptid_t ptid)
+ TARGET_DEFAULT_RETURN (RECORD_METHOD_NONE);
+
/* Stop trace recording. */
void (*to_stop_recording) (struct target_ops *)
TARGET_DEFAULT_IGNORE ();
/* See to_delete_record in struct target_ops. */
extern void target_delete_record (void);
+/* See to_record_method. */
+extern enum record_method target_record_method (ptid_t ptid);
+
/* See to_record_is_replaying in struct target_ops. */
extern int target_record_is_replaying (ptid_t ptid);