From: Markus Metzger Date: Wed, 22 Jul 2026 07:39:24 +0000 (+0000) Subject: gdb: fix maint info btrace X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;ds=sidebyside;p=thirdparty%2Fbinutils-gdb.git gdb: fix maint info btrace 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. Reviewed-by: Tom Tromey --- 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; + + 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) */