summaryrefslogtreecommitdiff
path: root/gdb/btrace.h
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2014-02-03 14:35:28 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2015-07-02 12:56:29 +0200
commitb0627500e819fcaaa42538046b0bf069a7c2edc5 (patch)
tree81c3957314de7320ff4c9d332a1734702a10484b /gdb/btrace.h
parent9be54cae43929ab989fcd44dfcf8d3313a55f7a0 (diff)
downloadbinutils-gdb-b0627500e819fcaaa42538046b0bf069a7c2edc5.tar.gz
btrace: maintenance commands
Add maintenance commands that help debugging the btrace record target. The following new commands are added: maint info btrace Print information about branch tracing internals. maint btrace packet-history Print the raw branch tracing data. maint btrace clear-packet-history Discard the stored raw branch tracing data. maint btrace clear Discard all branch tracing data. It will be fetched and processed anew by the next "record" command. maint set|show btrace pt skip-pad Set and show whether PAD packets are skipped when computing the packet history. gdb/ * btrace.c: Include gdbcmd.h, cli/cli-utils.h, and ctype.h. (maint_btrace_cmdlist, maint_btrace_set_cmdlist) (maint_btrace_show_cmdlist, maint_btrace_pt_set_cmdlist) (maint_btrace_pt_show_cmdlist, maint_btrace_pt_skip_pad) (btrace_maint_clear): New. (btrace_fetch, btrace_clear): Call btrace_maint_clear. (pt_print_packet, btrace_maint_decode_pt) (btrace_maint_update_pt_packets, btrace_maint_update_packets) (btrace_maint_print_packets, get_uint, get_context_size, no_chunk) (maint_btrace_packet_history_cmd) (maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd) (maint_btrace_cmd, maint_btrace_set_cmd, maint_btrace_show_cmd) (maint_btrace_pt_set_cmd, maint_btrace_pt_show_cmd) (maint_info_btrace_cmd, _initialize_btrace): New. * btrace.h (btrace_pt_packet, btrace_pt_packet_s) (btrace_maint_packet_history, btrace_maint_info): New. (btrace_thread_info) <maint>: New. * NEWS: Announce it. doc/ * gdb.texinfo (Maintenance Commands): Document "maint btrace" commands.
Diffstat (limited to 'gdb/btrace.h')
-rw-r--r--gdb/btrace.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/gdb/btrace.h b/gdb/btrace.h
index 0845b78d0c4..93c84ffa0fb 100644
--- a/gdb/btrace.h
+++ b/gdb/btrace.h
@@ -233,6 +233,66 @@ enum btrace_thread_flag
BTHR_MOVE = (BTHR_STEP | BTHR_RSTEP | BTHR_CONT | BTHR_RCONT)
};
+#if defined (HAVE_LIBIPT)
+/* A packet. */
+struct btrace_pt_packet
+{
+ /* The offset in the trace stream. */
+ uint64_t offset;
+
+ /* The decode error code. */
+ enum pt_error_code errcode;
+
+ /* The decoded packet. Only valid if ERRCODE == pte_ok. */
+ struct pt_packet packet;
+};
+
+/* Define functions operating on a vector of packets. */
+typedef struct btrace_pt_packet btrace_pt_packet_s;
+DEF_VEC_O (btrace_pt_packet_s);
+#endif /* defined (HAVE_LIBIPT) */
+
+/* Branch trace iteration state for "maintenance btrace packet-history". */
+struct btrace_maint_packet_history
+{
+ /* The branch trace packet range from BEGIN (inclusive) to
+ END (exclusive) that has been covered last time. */
+ unsigned int begin;
+ unsigned int end;
+};
+
+/* Branch trace maintenance information per thread.
+
+ This information is used by "maintenance btrace" commands. */
+struct btrace_maint_info
+{
+ /* Most information is format-specific.
+ The format can be found in the BTRACE.DATA.FORMAT field of each thread. */
+ union
+ {
+ /* BTRACE.DATA.FORMAT == BTRACE_FORMAT_BTS */
+ struct
+ {
+ /* The packet history iterator.
+ We are iterating over BTRACE.DATA.FORMAT.VARIANT.BTS.BLOCKS. */
+ struct btrace_maint_packet_history packet_history;
+ } bts;
+
+#if defined (HAVE_LIBIPT)
+ /* BTRACE.DATA.FORMAT == BTRACE_FORMAT_PT */
+ struct
+ {
+ /* A vector of decoded packets. */
+ VEC (btrace_pt_packet_s) *packets;
+
+ /* The packet history iterator.
+ We are iterating over the above PACKETS vector. */
+ struct btrace_maint_packet_history packet_history;
+ } pt;
+#endif /* defined (HAVE_LIBIPT) */
+ } variant;
+};
+
/* Branch trace information per thread.
This represents the branch trace configuration as well as the entry point
@@ -284,6 +344,9 @@ struct btrace_thread_info
/* Why the thread stopped, if we need to track it. */
enum target_stop_reason stop_reason;
+
+ /* Maintenance information. */
+ struct btrace_maint_info maint;
};
/* Enable branch tracing for a thread. */