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 v1 0/7] gdb, btrace: fix unexpected core file
Date: Tue, 10 Nov 2026 07:43:09 +0100	[thread overview]
Message-ID: <20261110064317.405487-1-markus.t.metzger@intel.com> (raw)

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.


             reply	other threads:[~2026-11-10  6:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  6:43 Markus Metzger [this message]
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

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=20261110064317.405487-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