[v2] gdb, btrace: support libipt v2.2 events
Commit Message
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 <keiths@redhat.com>
---
gdb/NEWS | 3 +++
gdb/btrace.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
Comments
> From: Markus Metzger <markus.t.metzger@intel.com>
> Cc: Keith Seitz <keiths@redhat.com>
> Date: Mon, 4 May 2026 07:16:36 +0000
>
> 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 <keiths@redhat.com>
> ---
> gdb/NEWS | 3 +++
> gdb/btrace.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index e233906153a..4464135ef71 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -75,6 +75,9 @@
> * The Windows native target now supports scheduler-locking. E.g.,
> "set scheduler-locking on" now works. Previously it gave an error.
>
> +* GDB now supports libipt v2.2 events originating from Event Tracing on a
> + FRED-enabled system and from Trigger Tracing.
I think it would be good to mention the "maint btrace" command here,
since AFAIU that's where these events will appear. Perhaps also
update the manual with what these events will look like in btrace?
Thanks
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
>> +* GDB now supports libipt v2.2 events originating from Event Tracing on a
>> + FRED-enabled system and from Trigger Tracing.
>
>I think it would be good to mention the "maint btrace" command here,
>since AFAIU that's where these events will appear. Perhaps also
>update the manual with what these events will look like in btrace?
They are part of event tracing, which is enabled via
set record btrace pt event-tracing on
The manual currently does not contain example output. It describes how
to enable event tracing and what it does, but it does not give an example.
This reminds me that support for dumping the new TRIG packet is missing.
The other events are just new variants of existing packets that are already
covered.
>
>Thanks
>
>Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Thanks for your review,
Markus.
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
> From: "Metzger, Markus T" <markus.t.metzger@intel.com>
> CC: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
> "keiths@redhat.com" <keiths@redhat.com>
> Date: Mon, 4 May 2026 14:00:06 +0000
>
> >> +* GDB now supports libipt v2.2 events originating from Event Tracing on a
> >> + FRED-enabled system and from Trigger Tracing.
> >
> >I think it would be good to mention the "maint btrace" command here,
> >since AFAIU that's where these events will appear. Perhaps also
> >update the manual with what these events will look like in btrace?
>
> They are part of event tracing, which is enabled via
>
> set record btrace pt event-tracing on
OK, then how about saying just that in NEWS?
Hello Eli,
>> From: "Metzger, Markus T" <markus.t.metzger@intel.com>
>> CC: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
>> "keiths@redhat.com" <keiths@redhat.com>
>> Date: Mon, 4 May 2026 14:00:06 +0000
>>
>> >> +* GDB now supports libipt v2.2 events originating from Event Tracing on
>a
>> >> + FRED-enabled system and from Trigger Tracing.
>> >
>> >I think it would be good to mention the "maint btrace" command here,
>> >since AFAIU that's where these events will appear. Perhaps also
>> >update the manual with what these events will look like in btrace?
>>
>> They are part of event tracing, which is enabled via
>>
>> set record btrace pt event-tracing on
>
>OK, then how about saying just that in NEWS?
I added "( set record btrace pt event-tracing on)" after "Event Tracing" in v4.
Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
> From: "Metzger, Markus T" <markus.t.metzger@intel.com>
> CC: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
> "keiths@redhat.com" <keiths@redhat.com>
> Date: Tue, 5 May 2026 04:32:27 +0000
>
> Hello Eli,
>
> >> From: "Metzger, Markus T" <markus.t.metzger@intel.com>
> >> CC: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
> >> "keiths@redhat.com" <keiths@redhat.com>
> >> Date: Mon, 4 May 2026 14:00:06 +0000
> >>
> >> >> +* GDB now supports libipt v2.2 events originating from Event Tracing on
> >a
> >> >> + FRED-enabled system and from Trigger Tracing.
> >> >
> >> >I think it would be good to mention the "maint btrace" command here,
> >> >since AFAIU that's where these events will appear. Perhaps also
> >> >update the manual with what these events will look like in btrace?
> >>
> >> They are part of event tracing, which is enabled via
> >>
> >> set record btrace pt event-tracing on
> >
> >OK, then how about saying just that in NEWS?
>
> I added "( set record btrace pt event-tracing on)" after "Event Tracing" in v4.
Thanks, that's fine.
@@ -75,6 +75,9 @@
* The Windows native target now supports scheduler-locking. E.g.,
"set scheduler-locking on" now works. Previously it gave an error.
+* GDB now supports libipt v2.2 events originating from Event Tracing on a
+ FRED-enabled system and from Trigger Tracing.
+
* New targets
GNU/Linux/MicroBlaze (gdbserver) microblazeel-*linux*
@@ -1597,6 +1597,59 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo,
break;
}
#endif /* defined (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) */