[binutils-gdb] gdb, btrace: support libipt v2.2 events
Markus Metzger via Gdb-cvs <[email protected]> Wed, 10 Jun 2026 04:57:02 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=06dc564fcc4a2cdb40d6572c8ba36cbb12904e26 commit 06dc564fcc4a2cdb40d6572c8ba36cbb12904e26 Author: Markus Metzger <[email protected]> Date: Thu Nov 20 11:21:41 2025 +0000 gdb, btrace: support libipt v2.2 events Add support for printing new events added in libipt v2.2 originating from Event Tracing in combination with Flexible Return and Event Delivery (FRED) and from Trigger Tracing. Reviewed-By: Keith Seitz <[email protected]> Reviewed-By: Eli Zaretskii <[email protected]> Diff: --- gdb/NEWS | 4 ++++ gdb/btrace.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index 7c8cf9af4c2..d5214a98a57 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -83,6 +83,10 @@ * Support for native Thread Local Storage (TLS) variables on Windows. +* GDB now supports libipt v2.2 events originating from Event Tracing (set + record btrace pt event-tracing on) on a FRED-enabled system and from + Trigger Tracing. + * Configure changes ** --with-babeltrace has been removed. The babeltrace library was diff --git a/gdb/btrace.c b/gdb/btrace.c index 965e2654c7d..5349a89001a 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -1597,6 +1597,61 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo, break; } #endif /* (LIBIPT_VERSION >= 0x201) */ + +#if (LIBIPT_VERSION >= 0x202) + case ptev_trig: + { + std::string aux_string + = (std::string (_("trig: trbv = ")) + + hex_string (event.variant.trig.trbv)); + + if (event.variant.trig.mult != 0) + aux_string += std::string (", mult"); + + if (event.ip_suppressed == 0) + { + pc = event.variant.trig.ip; + aux_string += (std::string (", ip = ") + hex_string (*pc)); + } + + if (event.variant.trig.icnt != 0) + aux_string += (std::string (", icnt = ") + + hex_string (event.variant.trig.icnt)); + + handle_pt_aux_insn (btinfo, aux_string, pc); + break; + } + + case ptev_swintr: + { + std::string aux_string + = (std::string (_("swintr: vector = ")) + + hex_string (event.variant.swintr.vector)); + + if (event.ip_suppressed == 0) + { + pc = event.variant.swintr.ip; + aux_string += (std::string (", ip = ") + hex_string (*pc)); + } + + handle_pt_aux_insn (btinfo, aux_string, pc); + break; + } + + case ptev_syscall: + { + std::string aux_string = std::string (_("syscall")); + + if (event.ip_suppressed == 0) + { + pc = event.variant.syscall.ip; + aux_string += (std::string (": ip = ") + hex_string (*pc)); + } + + handle_pt_aux_insn (btinfo, aux_string, pc); + break; + } +#endif /* (LIBIPT_VERSION >= 0x202) */ } } #endif /* defined (HAVE_PT_INSN_EVENT) */ @@ -3025,6 +3080,20 @@ pt_print_packet (const struct pt_packet *packet) packet->payload.evd.payload); break; #endif /* (LIBIPT_VERSION >= 0x201) */ + +#if (LIBIPT_VERSION >= 0x202) + case ppt_trig: + if (packet->payload.trig.icntv == 0) + gdb_printf ("trig 0x%x%s%s", packet->payload.trig.trbv, + (packet->payload.trig.ip != 0) ? " ip" : "", + (packet->payload.trig.mult != 0) ? " mult" : ""); + else + gdb_printf ("trig 0x%x%s%s icnt: %u", packet->payload.trig.trbv, + (packet->payload.trig.ip != 0) ? " ip" : "", + (packet->payload.trig.mult != 0) ? " mult" : "", + packet->payload.trig.icnt); + break; +#endif /* (LIBIPT_VERSION >= 0x202) */ } }