From: Eli Zaretskii <eliz@gnu.org>
To: Bratislav Filipovic <bfilipov@amd.com>
Cc: gdb-patches@sourceware.org, simark@simark.ca,
Lancelot.Six@amd.com, TankutBaris.Aktemur@amd.com,
luis.machado.foss@gmail.com, pedro@palves.net
Subject: Re: [PATCH] gdb: Implement stop-on-solib-events for GPU code objects
Date: Thu, 01 Oct 2026 13:54:32 +0300 [thread overview]
Message-ID: <867bk1wv13.fsf@gnu.org> (raw)
In-Reply-To: <20261001104000.7968-1-bfilipov@amd.com> (message from Bratislav Filipovic on Thu, 1 Oct 2026 12:35:05 +0200)
> From: Bratislav Filipovic <bfilipov@amd.com>
> CC: <simark@simark.ca>, <Lancelot.Six@amd.com>, <TankutBaris.Aktemur@amd.com>,
> <luis.machado.foss@gmail.com>, <pedro@palves.net>, Bratislav Filipovic
> <bfilipov@amd.com>
> Date: Thu, 1 Oct 2026 12:35:05 +0200
>
> GDB's "set stop-on-solib-events 1" setting allows users to stop execution
> when shared libraries are loaded or unloaded, enabling inspection and
> breakpoint placement before library code executes. This feature works for
> CPU shared libraries but is not working for GPU code objects loaded by the
> AMD ROCm runtime.
>
> This commit implements stop-on-solib-events support for GPU code objects,
> making GPU code object load/unload events behave consistently with CPU
> shared library events.
>
> The root cause is in amd_dbgapi_target_breakpoint::check_status(), which
> unconditionally sets bs->stop = 0 and bs->print_it = print_it_noop,
> regardless of the stop_on_solib_events setting. This is in contrast to
> internal_breakpoint::check_status() for CPU shared libraries, which
> respects the setting.
>
> The fix includes:
>
> 1. Generalize print_solib_event() function to eliminate code duplication
> between CPU and GPU event printing. The function now accepts parameters
> for event description, field names, and plural forms. This reduces
> ~50 lines of duplicated code.
>
> 2. Add code_object_list_updated flag to amd_dbgapi_inferior_info to track
> when AMD_DBGAPI_EVENT_KIND_CODE_OBJECT_LIST_UPDATED events occur during
> process_event_queue().
>
> 3. Modify check_status() to check this flag after processing events and
> update bs->stop, bs->print, and bs->print_it based on stop_on_solib_events.
>
> 4. Implement print_it() override to display "Stopped due to GPU code object
> event" to distinguish GPU events from CPU shared library events.
>
> This makes GPU code object load events behave consistently with CPU shared
> library events. A test is included in gdb.rocm/solib-event.exp.
>
> Thanks for the review Simon. Addressed your comments, here's the v2.
>
> Regards Bratislav
> ---
> gdb/NEWS | 6 +
> gdb/amd-dbgapi-target.c | 56 ++++++++-
> gdb/breakpoint.c | 31 +++--
> gdb/breakpoint.h | 6 +-
> gdb/doc/gdb.texinfo | 13 +-
> gdb/infrun.c | 5 +-
> gdb/testsuite/gdb.rocm/solib-event-kernel.cpp | 27 +++++
> gdb/testsuite/gdb.rocm/solib-event.cpp | 105 ++++++++++++++++
> gdb/testsuite/gdb.rocm/solib-event.exp | 112 ++++++++++++++++++
> 9 files changed, 340 insertions(+), 21 deletions(-)
> create mode 100644 gdb/testsuite/gdb.rocm/solib-event-kernel.cpp
> create mode 100644 gdb/testsuite/gdb.rocm/solib-event.cpp
> create mode 100644 gdb/testsuite/gdb.rocm/solib-event.exp
Thanks, the documentation parts of this patch are okay.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
next prev parent reply other threads:[~2026-10-01 10:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 13:04 Bratislav Filipovic
2026-09-28 20:03 ` Simon Marchi
2026-09-28 20:33 ` Simon Marchi
2026-10-01 10:35 ` Bratislav Filipovic
2026-10-01 10:54 ` Eli Zaretskii [this message]
2026-10-01 19:26 ` Simon Marchi
2026-10-08 13:09 ` [PATCH v3] " Bratislav Filipovic
2026-10-12 14:32 ` Lancelot SIX
2026-10-28 17:17 ` [PATCH v4] " Bratislav Filipovic
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=867bk1wv13.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=Lancelot.Six@amd.com \
--cc=TankutBaris.Aktemur@amd.com \
--cc=bfilipov@amd.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado.foss@gmail.com \
--cc=pedro@palves.net \
--cc=simark@simark.ca \
/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