Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Metzger <markus.t.metzger@intel.com>
To: gdb-patches@sourceware.org
Cc: Keith Seitz <keiths@redhat.com>, Eli Zaretskii <eliz@gnu.org>
Subject: [PATCH v4] gdb, btrace: support libipt v2.2 events
Date: Tue,  5 May 2026 04:32:34 +0000	[thread overview]
Message-ID: <20260505043234.1355988-1-markus.t.metzger@intel.com> (raw)

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     |  4 ++++
 gdb/btrace.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/gdb/NEWS b/gdb/NEWS
index e233906153a..d82b81d7dd6 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -75,6 +75,10 @@
 * 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 (set
+  record btrace pt event-tracing on) on a FRED-enabled system and from
+  Trigger Tracing.
+
 * New targets
 
 GNU/Linux/MicroBlaze (gdbserver) microblazeel-*linux*
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 965e2654c7d..73b7fc313b7 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1597,6 +1597,59 @@ 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 +3078,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 ? " ip" : "",
+		    packet->payload.trig.mult ? " mult" : "");
+      else
+	gdb_printf ("trig 0x%x%s%s icnt: %u", packet->payload.trig.trbv,
+		    packet->payload.trig.ip ? " ip" : "",
+		    packet->payload.trig.mult ? " mult" : "",
+		    packet->payload.trig.icnt);
+      break;
+#endif /* (LIBIPT_VERSION >= 0x202)  */
     }
 }
 
-- 
2.34.1

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


                 reply	other threads:[~2026-05-05  4:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260505043234.1355988-1-markus.t.metzger@intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox