]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, btrace: support libipt v2.2 events
authorMarkus Metzger <markus.t.metzger@intel.com>
Thu, 20 Nov 2025 11:21:41 +0000 (11:21 +0000)
committerMarkus Metzger <markus.t.metzger@intel.com>
Wed, 10 Jun 2026 04:45:58 +0000 (04:45 +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>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
gdb/NEWS
gdb/btrace.c

index 7c8cf9af4c2d2e9e05b2dd2709d10ff4893b471a..d5214a98a5750642ccc0b214defaee581c97643c 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
 
 * 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
index 965e2654c7d8f469533fb524d6d8291d68395ccc..5349a89001a204185654795c7cdee3716e7efab3 100644 (file)
@@ -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)  */
     }
 }