[binutils-gdb] gdb: fix maint info btrace
Markus Metzger via Gdb-cvs <[email protected]> Thu, 23 Jul 2026 05:07:12 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2d3ff0f750c1= 2b0ca2f9e572d3a22e63200ba913 commit 2d3ff0f750c12b0ca2f9e572d3a22e63200ba913 Author: Markus Metzger <[email protected]> Date: Wed Jul 22 07:39:24 2026 +0000 gdb: fix maint info btrace =20 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. =20 Reviewed-by: Tom Tromey <[email protected]> Diff: --- 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_t= ty) version.minor, version.build, version.ext !=3D NULL ? version.ext : ""); =20 - btrace_maint_update_pt_packets (btinfo); + if (btinfo->maint.variant.pt.packets =3D=3D nullptr) + btinfo->maint.variant.pt.packets =3D 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 =3D=3D nullptr) - ? 0 : btinfo->maint.variant.pt.packets->size ())); + btinfo->maint.variant.pt.packets->size ()); } break; #endif /* defined (HAVE_LIBIPT) */