Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lancelot SIX <Lancelot.Six@amd.com>
To: Tankut Baris Aktemur <tankutbaris.aktemur@amd.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb, amdgpu: handle UNAVAILABLE error when accessing memory
Date: Wed, 14 Oct 2026 11:42:08 +0100	[thread overview]
Message-ID: <e54ca61d-8144-4314-b18f-f75680e12fab@amd.com> (raw)
In-Reply-To: <20261014090838.1211026-1-tankutbaris.aktemur@amd.com>



On 14/10/2026 10:08, Tankut Baris Aktemur wrote:
> In amd_dbgapi_target, accessing memory through dbgapi may fail with
> AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE.  Convert this error to
> GDB's TARGET_XFER_UNAVAILABLE.  Similarly, in the global memory access
> callback function, if the access result is TARGET_XFER_UNAVAILABLE, pass
> the result back to dbgapi as AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE.
> 
> These conversions in both ways are useful to display to the user an
> "<unavailable>" result instead of "Cannot access memory...".  This may
> happen in lightweight corefiles, where some chunk of memory may not
> have been captured.
> 
> Note that if xfer_partial target op replies with TARGET_XFER_UNAVAILABLE,
> GDB expects xfered_len to be greater than zero.
> 
> Regression-tested in gfx1201.

Hi,

This looks good to me, thanks.

Approved-by: Lancelot Six <lancelot.six@amd.com> (amdgpu)

Best,
Lancelot.

> ---
>   gdb/amd-dbgapi-target.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
> index 93207a8fdd2..2fd175de6f7 100644
> --- a/gdb/amd-dbgapi-target.c
> +++ b/gdb/amd-dbgapi-target.c
> @@ -786,6 +786,12 @@ amd_dbgapi_target::xfer_partial (enum target_object object, const char *annex,
>   				      AMD_DBGAPI_ADDRESS_SPACE_GLOBAL,
>   				      offset, &len, writebuf);
>   
> +  if (status == AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE)
> +    {
> +      *xfered_len = requested_len;
> +      return TARGET_XFER_UNAVAILABLE;
> +    }
> +
>     if (status != AMD_DBGAPI_STATUS_SUCCESS)
>       return TARGET_XFER_E_IO;
>   
> @@ -2570,6 +2576,8 @@ amd_dbgapi_xfer_global_memory_callback
>   
>     if (status == TARGET_XFER_EOF)
>       return AMD_DBGAPI_STATUS_ERROR_PROCESS_EXITED;
> +  else if (status == TARGET_XFER_UNAVAILABLE)
> +    return AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE;
>     else if (status != TARGET_XFER_OK)
>       return AMD_DBGAPI_STATUS_ERROR_MEMORY_ACCESS;
>   


  reply	other threads:[~2026-10-14 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  9:08 Tankut Baris Aktemur
2026-10-14 10:42 ` Lancelot SIX [this message]
2026-10-15 15:40 ` Tom Tromey
2026-10-15 16:06   ` Six, Lancelot

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=e54ca61d-8144-4314-b18f-f75680e12fab@amd.com \
    --to=lancelot.six@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tankutbaris.aktemur@amd.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