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
Subject: [PATCH] gdb: fix maint info btrace
Date: Wed, 22 Jul 2026 11:05:45 +0000	[thread overview]
Message-ID: <20260722110545.1480862-1-markus.t.metzger@intel.com> (raw)

The 'maint info btrace' command forgets to check whether the trace has
already been decoded and keeps appending the same trace to the packet
history at every command.  Fix that.
---
 gdb/btrace.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/btrace.c b/gdb/btrace.c
index 5349a89001a..f5f2d6da972 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3546,10 +3546,14 @@ maint_info_btrace_cmd (const char *args, int from_tty)
 		    version.minor, version.build,
 		    version.ext != NULL ? version.ext : "");
 
-	btrace_maint_update_pt_packets (btinfo);
+	if (btinfo->maint.variant.pt.packets == nullptr)
+	  btinfo->maint.variant.pt.packets = new std::vector<btrace_pt_packet>;
+
+	if (btinfo->maint.variant.pt.packets->empty ())
+	  btrace_maint_update_pt_packets (btinfo);
+
 	gdb_printf (_("Number of packets: %zu.\n"),
-		    ((btinfo->maint.variant.pt.packets == nullptr)
-		     ? 0 : btinfo->maint.variant.pt.packets->size ()));
+		    btinfo->maint.variant.pt.packets->size ());
       }
       break;
 #endif /* defined (HAVE_LIBIPT)  */
-- 
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-07-22 11:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 11:05 Markus Metzger [this message]
2026-07-22 15:16 ` Tom Tromey

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=20260722110545.1480862-1-markus.t.metzger@intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    /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