Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: simon.marchi@polymtl.ca
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>, Lancelot SIX <Lancelot.Six@amd.com>,
	Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH v3 00/10] Multiple solib_ops in a program_space
Date: Wed,  8 Jul 2026 17:51:32 -0400	[thread overview]
Message-ID: <20260708215145.93134-1-simon.marchi@polymtl.ca> (raw)

From: Simon Marchi <simon.marchi@polymtl.ca>

This is v3 of:

  https://inbox.sourceware.org/gdb-patches/20260608200100.666134-7-simon.marchi@efficios.com/T/#m41d7f6aa673b981591cbc1bca6833c7c6a8dc3e3

This version fixes a transient use-after-free bug (introduced by one
patch, fixed later in the series) identified by Lancelot.  To fix it
with minimal disruption, I moved the "gdb/solib: add remove_solib
function" patch earlier, and then made patch "gdb/solib-rocm: move
per-inferior data to rocm_solib_ops" remove ROCm solibs when removing
the rocm_solib_ops instance for the pspace.  This code disappears with
the last patch, which introduces the same behavior but in a more general
way: when removing an solib_ops, GDB now automatically removes all the
solibs from that solib_ops.

The patches without explicit approvals are:

 - gdb/solib-rocm: move per-inferior data to rocm_solib_ops
 - gdb: add objfile -> solib backlink

Below is the original cover letter, which still applies.

This series adds support for having multiple solib_ops instances
providing solibs for a given program_space.  The main use case to
justify this change is to make rocm_solib_ops less clunky.

When debugging ROCm programs, we need to have an instance of
svr4_solib_ops providing solibs for host shared libraries, and
an instance of rocm_solib_ops providing solibs for device code objects.
Since there can only be one solib_ops in a program, rocm_solib_ops has
to wrap and replce the svr4_solib_ops instance previously installed.

By allowing multiple solib_ops in the same program_space, the two
solib_ops instances can co-exist without knowing each other.

The main change is contained in the last patch.  The patches before that
are cleanup or preparatory patches.

Simon Marchi (10):
  gdb/solib-rocm: assert that host ops isn't rocm_solib_ops
  gdb/solib-rocm: pass reference to cache to
    rocm_code_object_stream_file
  gdb/solib-rocm: add cached_target_fd to manage cached fd lifetime
  gdb: de-constify some methods of solib_ops
  gdb/solib: add remove_solib function
  gdb/solib-rocm: move per-inferior data to rocm_solib_ops
  gdb/solib-rocm: save inferior in rocm_solib_ops
  gdb: add objfile -> solib backlink
  gdb: change default objfile iteration order to start with current
    objfile
  gdb: multiple solib_ops per program space

 gdb/amd-dbgapi-target.c                  |   3 +-
 gdb/infcmd.c                             |  16 +-
 gdb/inferior.h                           |   6 +-
 gdb/infrun.c                             |   7 +-
 gdb/objfiles.h                           |  23 ++
 gdb/observable.h                         |   8 +-
 gdb/progspace.c                          |  91 +++++-
 gdb/progspace.h                          |  57 ++--
 gdb/solib-aix.c                          |  14 +-
 gdb/solib-darwin.c                       |  14 +-
 gdb/solib-dsbt.c                         |  10 +-
 gdb/solib-frv.c                          |  10 +-
 gdb/solib-rocm.c                         | 340 ++++++++++-------------
 gdb/solib-svr4.c                         |  60 ++--
 gdb/solib-svr4.h                         |  20 +-
 gdb/solib-target.c                       |   4 +-
 gdb/solib-target.h                       |   2 +-
 gdb/solib.c                              | 314 ++++++++++++---------
 gdb/solib.h                              |  44 ++-
 gdb/target.c                             |   2 +-
 gdb/testsuite/gdb.rocm/symbol-lookup.cpp | 320 +++++++++++++++++++++
 gdb/testsuite/gdb.rocm/symbol-lookup.exp | 243 ++++++++++++++++
 gdb/windows-tdep.c                       |  46 +--
 23 files changed, 1178 insertions(+), 476 deletions(-)
 create mode 100644 gdb/testsuite/gdb.rocm/symbol-lookup.cpp
 create mode 100644 gdb/testsuite/gdb.rocm/symbol-lookup.exp


base-commit: 46709f190eb7ddf3888226feec6c1e13984cfcc9
-- 
2.55.0


             reply	other threads:[~2026-07-08 21:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 21:51 simon.marchi [this message]
2026-07-08 21:51 ` [PATCH v3 01/10] gdb/solib-rocm: assert that host ops isn't rocm_solib_ops simon.marchi
2026-07-08 21:51 ` [PATCH v3 02/10] gdb/solib-rocm: pass reference to cache to rocm_code_object_stream_file simon.marchi
2026-07-08 21:51 ` [PATCH v3 03/10] gdb/solib-rocm: add cached_target_fd to manage cached fd lifetime simon.marchi
2026-07-08 21:51 ` [PATCH v3 04/10] gdb: de-constify some methods of solib_ops simon.marchi
2026-07-08 21:51 ` [PATCH v3 05/10] gdb/solib: add remove_solib function simon.marchi
2026-07-08 21:51 ` [PATCH v3 06/10] gdb/solib-rocm: move per-inferior data to rocm_solib_ops simon.marchi
2026-07-08 21:51 ` [PATCH v3 07/10] gdb/solib-rocm: save inferior in rocm_solib_ops simon.marchi
2026-07-08 21:51 ` [PATCH v3 08/10] gdb: add objfile -> solib backlink simon.marchi
2026-07-21 17:31   ` Tom Tromey
2026-07-08 21:51 ` [PATCH v3 09/10] gdb: change default objfile iteration order to start with current objfile simon.marchi
2026-07-08 21:51 ` [PATCH v3 10/10] gdb: multiple solib_ops per program space simon.marchi

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=20260708215145.93134-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=Lancelot.Six@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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