aboutsummaryrefslogtreecommitdiff
path: root/gdb/btrace.c
diff options
context:
space:
mode:
authorFelix Willgerodt <felix.willgerodt@intel.com>2023-06-27 11:20:55 +0200
committerFelix Willgerodt <felix.willgerodt@intel.com>2024-09-24 14:22:29 +0200
commit63b87d7c85ac25fffa3c8a590a55aa5ccd42b5fc (patch)
tree76bfea2ae49026bc8ac93914d22c747872fe32ec /gdb/btrace.c
parentdc08e970bb59880a0a2d712e13cb57344af82635 (diff)
downloadgdb-63b87d7c85ac25fffa3c8a590a55aa5ccd42b5fc.zip
gdb-63b87d7c85ac25fffa3c8a590a55aa5ccd42b5fc.tar.gz
gdb-63b87d7c85ac25fffa3c8a590a55aa5ccd42b5fc.tar.bz2
btrace: Add support for further events.
This is similar to the previous events that we added, and adds support for SMI, RSM, SIPI, INIT, VMENTRY, VMEXIT, SHUTDOWN, UINTR and UIRET. Though since these are mainly mechanical and not really possible to test, they are bundled in one commit. Approved-By: Markus Metzger <markus.t.metzger@intel.com>
Diffstat (limited to 'gdb/btrace.c')
-rw-r--r--gdb/btrace.c155
1 files changed, 155 insertions, 0 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 317516c..152f6f2 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1442,6 +1442,161 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo,
handle_pt_aux_insn (btinfo, aux_string, pc);
break;
}
+
+ case ptev_smi:
+ {
+ std::string aux_string = std::string (_("smi"));
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.smi.ip;
+ aux_string += std::string (": ip = ") + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_rsm:
+ {
+ std::string aux_string = std::string (_("rsm"));
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.rsm.ip;
+ aux_string += std::string (": ip = ") + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_sipi:
+ {
+ std::string aux_string = std::string (_("sipi: vector = "))
+ + hex_string (event.variant.sipi.vector);
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_init:
+ {
+ std::string aux_string = std::string (_("init"));
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.init.ip;
+ aux_string += std::string (": ip = ") + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_vmentry:
+ {
+ std::string aux_string = std::string (_("vmentry"));
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.vmentry.ip;
+ aux_string += std::string (": ip = ") + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_vmexit:
+ {
+ std::string aux_string = std::string (_("vmexit"));
+
+ if (event.variant.vmexit.has_vector != 0
+ || event.variant.vmexit.has_vmxr != 0
+ || event.variant.vmexit.has_vmxq != 0
+ || event.ip_suppressed != 0)
+ aux_string += std::string (":");
+
+ if (event.variant.vmexit.has_vector != 0)
+ {
+ aux_string += std::string (_(" vector = "))
+ + hex_string (event.variant.vmexit.vector);
+
+ const char* decoded = decode_interrupt_vector
+ (event.variant.vmexit.vector);
+ if (decoded != nullptr)
+ aux_string += std::string (" (") + decoded + ")";
+ }
+
+ if (event.variant.vmexit.has_vmxr != 0)
+ {
+ std::string seperator = aux_string.back () == ':' ? "" : ",";
+ aux_string += seperator + std::string (" vmxr = ")
+ + hex_string (event.variant.vmexit.vmxr);
+ }
+
+ if (event.variant.vmexit.has_vmxq != 0)
+ {
+ std::string seperator = aux_string.back () == ':' ? "" : ",";
+ aux_string += seperator + std::string (" vmxq = ")
+ + hex_string (event.variant.vmexit.vmxq);
+ }
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.vmexit.ip;
+ std::string seperator = aux_string.back () == ':' ? "" : ",";
+ aux_string += seperator + std::string (" ip = ")
+ + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_shutdown:
+ {
+ std::string aux_string = std::string (_("shutdown"));
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.shutdown.ip;
+ aux_string += std::string (": ip = ") + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_uintr:
+ {
+ std::string aux_string = std::string (_("uintr: vector = "))
+ + hex_string (event.variant.uintr.vector);
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.uintr.ip;
+ aux_string += std::string (", ip = ") + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
+
+ case ptev_uiret:
+ {
+ std::string aux_string = std::string (_("uiret"));
+
+ if (event.ip_suppressed == 0)
+ {
+ pc = event.variant.uiret.ip;
+ aux_string += std::string (": ip = ") + hex_string (*pc);
+ }
+
+ handle_pt_aux_insn (btinfo, aux_string, pc);
+ break;
+ }
#endif /* defined (LIBIPT_VERSION >= 0x201) */
}
}