Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v1 0/7] gdb, btrace: fix unexpected core file
@ 2026-11-10  6:43 Markus Metzger
  2026-11-10  6:43 ` [PATCH v1 1/7] gdb, btrace: add clear_btrace_resources() Markus Metzger
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Markus Metzger @ 2026-11-10  6:43 UTC (permalink / raw)
  To: gdb-patches

When running gdb.btrace/multi-inferior.exp with extended-remote target, an
unexpected core file appears in gdb.sum but not in gdb.log, due to an
uncaught exception thrown by the dummy target when the remote connection
is closed.

The remote target iterates over all inferiors, unpushes all targets at or
above the process stratum, then exits the inferior and all threads within
it.  This flow calls the teardown_btrace() target method, which ends up in
the dummy target because the record-btrace target was unpushed.

Unpushing the record-btrace target calls its close() target method when
the last reference to the target is dropped.  This flow also calls the
teardown_btrace() target method for all non-exited threads in the current
inferior.  This time, however, we end up in the correct method because the
record-btrace target has not been unpushed, yet.

So, if there is only a single inferior, the close() target method handles
the cleanup.  But if there are more inferiors, it doesn't.

This patch series changes the cleanup flow, thereby also simplifying it.

Markus Metzger (7):
  gdb, btrace: add clear_btrace_resources()
  gdb, btrace: disable tracing in linux_btrace_target_info dtor
  gdb, btrace: do not use btrace_teardown() for an exited thread
  gdb, btrace: do not stop recording on close
  gdb, btrace: remove btrace_teardown()
  gdb, btrace: remove the teardown_btrace() target method
  gdb, btrace: remove the disconnect() record-btrace target method

 gdb/btrace.c               | 13 ++++++-------
 gdb/btrace.h               |  6 ++----
 gdb/nat/linux-btrace.c     | 33 ++++++++++++++-------------------
 gdb/nat/linux-btrace.h     |  2 ++
 gdb/record-btrace.c        | 22 ----------------------
 gdb/remote.c               | 11 -----------
 gdb/target-delegates-gen.c | 24 ------------------------
 gdb/target.c               |  8 --------
 gdb/target.h               | 10 ----------
 gdb/thread.c               |  2 +-
 gdb/x86-linux-nat.c        |  9 ---------
 gdb/x86-linux-nat.h        |  1 -
 12 files changed, 25 insertions(+), 116 deletions(-)


base-commit: 892d98146139de38662c1f5b7d48fc3a606ec3f6
-- 
2.53.0

________________________________________
Intel Deutschland GmbH 

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany 

Tel: +49 (89) 99143-0 

www.intel.de 

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-10  6:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10  6:43 [PATCH v1 0/7] gdb, btrace: fix unexpected core file Markus Metzger
2026-11-10  6:43 ` [PATCH v1 1/7] gdb, btrace: add clear_btrace_resources() Markus Metzger
2026-11-10  6:43 ` [PATCH v1 2/7] gdb, btrace: disable tracing in linux_btrace_target_info dtor Markus Metzger
2026-11-10  6:43 ` [PATCH v1 3/7] gdb, btrace: do not use btrace_teardown() for an exited thread Markus Metzger
2026-11-10  6:43 ` [PATCH v1 4/7] gdb, btrace: do not stop recording on close Markus Metzger
2026-11-10  6:43 ` [PATCH v1 5/7] gdb, btrace: remove btrace_teardown() Markus Metzger
2026-11-10  6:43 ` [PATCH v1 6/7] gdb, btrace: remove the teardown_btrace() target method Markus Metzger
2026-11-10  6:43 ` [PATCH v1 7/7] gdb, btrace: remove the disconnect() record-btrace " Markus Metzger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox