* [PATCH] gdb: fix maint info btrace
@ 2026-07-22 11:05 Markus Metzger
2026-07-22 15:16 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Markus Metzger @ 2026-07-22 11:05 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] gdb: fix maint info btrace
2026-07-22 11:05 [PATCH] gdb: fix maint info btrace Markus Metzger
@ 2026-07-22 15:16 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2026-07-22 15:16 UTC (permalink / raw)
To: Markus Metzger; +Cc: gdb-patches
>>>>> "Markus" == Markus Metzger <markus.t.metzger@intel.com> writes:
Markus> The 'maint info btrace' command forgets to check whether the trace has
Markus> already been decoded and keeps appending the same trace to the packet
Markus> history at every command. Fix that.
I don't know this code, and you're listed as the maintainer of it; but
FWIW the patch looks reasonable to me.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-22 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-22 11:05 [PATCH] gdb: fix maint info btrace Markus Metzger
2026-07-22 15:16 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox