* [PATCH v2] gdb, amdgpu: add config guards for AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE
@ 2026-10-15 18:15 Tankut Baris Aktemur
2026-10-15 19:03 ` Simon Marchi
0 siblings, 1 reply; 4+ messages in thread
From: Tankut Baris Aktemur @ 2026-10-15 18:15 UTC (permalink / raw)
To: gdb-patches, lancelot.six
Commit e52a8aca2baf6481c4e8fea45530283759096be5 "gdb, amdgpu: handle
UNAVAILABLE error when accessing memory" used an enum value from
amd-dbgapi named AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE that may
not be available in all installed packages. This causes a build
failure as reported by Tom Tromey at
https://sourceware.org/pipermail/gdb-patches/2026-October/231115.html
Detect at configuration time if the enum value exists and guard the
newly added code accordingly.
---
gdb/amd-dbgapi-target.c | 4 ++++
gdb/config.in | 3 +++
gdb/configure | 36 ++++++++++++++++++++++++++++++++++++
gdb/configure.ac | 21 +++++++++++++++++++++
4 files changed, 64 insertions(+)
diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
index 2fd175de6f7..1446187c75f 100644
--- a/gdb/amd-dbgapi-target.c
+++ b/gdb/amd-dbgapi-target.c
@@ -786,11 +786,13 @@ amd_dbgapi_target::xfer_partial (enum target_object object, const char *annex,
AMD_DBGAPI_ADDRESS_SPACE_GLOBAL,
offset, &len, writebuf);
+#if AMD_DBGAPI_HAS_STATUS_ERROR_MEMORY_UNAVAILABLE
if (status == AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE)
{
*xfered_len = requested_len;
return TARGET_XFER_UNAVAILABLE;
}
+#endif
if (status != AMD_DBGAPI_STATUS_SUCCESS)
return TARGET_XFER_E_IO;
@@ -2576,8 +2578,10 @@ amd_dbgapi_xfer_global_memory_callback
if (status == TARGET_XFER_EOF)
return AMD_DBGAPI_STATUS_ERROR_PROCESS_EXITED;
+#if AMD_DBGAPI_HAS_STATUS_ERROR_MEMORY_UNAVAILABLE
else if (status == TARGET_XFER_UNAVAILABLE)
return AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE;
+#endif
else if (status != TARGET_XFER_OK)
return AMD_DBGAPI_STATUS_ERROR_MEMORY_ACCESS;
diff --git a/gdb/config.in b/gdb/config.in
index 7ea0e9cfce8..93060f573c5 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -6,6 +6,9 @@
/* Additional directories to look for separate debug info. */
#undef ADDITIONAL_DEBUG_DIRS
+/* Define if AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE is available. */
+#undef AMD_DBGAPI_HAS_STATUS_ERROR_MEMORY_UNAVAILABLE
+
/* Directories from which to load auto-loaded scripts. */
#undef AUTO_LOAD_DIR
diff --git a/gdb/configure b/gdb/configure
index 0ed49887480..5f1c2a22422 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -25105,6 +25105,42 @@ $as_echo "#define HAVE_AMD_DBGAPI 1" >>confdefs.h
as_fn_error $? "amd-dbgapi not supported for host ${gdb_host}" "$LINENO" 5
;;
esac
+
+ # Detect if AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE can be used.
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $AMD_DBGAPI_CFLAGS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE is available" >&5
+$as_echo_n "checking whether AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE is available... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <amd-dbgapi/amd-dbgapi.h>
+int
+main ()
+{
+(void) AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ amd_dbgapi_has_status_error_memory_unavailable=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ amd_dbgapi_has_status_error_memory_unavailable=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="$save_CPPFLAGS"
+
+ if test "x${amd_dbgapi_has_status_error_memory_unavailable}" = "xyes"; then
+
+$as_echo "#define AMD_DBGAPI_HAS_STATUS_ERROR_MEMORY_UNAVAILABLE 1" >>confdefs.h
+
+ fi
+
elif test "$gdb_require_amd_dbgapi" = true -o "$with_amd_dbgapi" = yes; then
# amd-dbgapi was not found and...
#
diff --git a/gdb/configure.ac b/gdb/configure.ac
index e0117ede292..7a437747e35 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -368,6 +368,27 @@ if test "$gdb_require_amd_dbgapi" = true \
AC_MSG_ERROR([amd-dbgapi not supported for host ${gdb_host}])
;;
esac
+
+ # Detect if AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE can be used.
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $AMD_DBGAPI_CFLAGS"
+ AC_MSG_CHECKING([whether AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE is available])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <amd-dbgapi/amd-dbgapi.h>]],
+ [[(void) AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE;]]
+ )],
+ [amd_dbgapi_has_status_error_memory_unavailable=yes
+ AC_MSG_RESULT([yes])],
+ [amd_dbgapi_has_status_error_memory_unavailable=no
+ AC_MSG_RESULT([no])])
+ CPPFLAGS="$save_CPPFLAGS"
+
+ if test "x${amd_dbgapi_has_status_error_memory_unavailable}" = "xyes"; then
+ AC_DEFINE(AMD_DBGAPI_HAS_STATUS_ERROR_MEMORY_UNAVAILABLE, 1,
+ [Define if AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE is available.])
+ fi
+
elif test "$gdb_require_amd_dbgapi" = true -o "$with_amd_dbgapi" = yes; then
# amd-dbgapi was not found and...
#
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] gdb, amdgpu: add config guards for AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE
2026-10-15 18:15 [PATCH v2] gdb, amdgpu: add config guards for AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE Tankut Baris Aktemur
@ 2026-10-15 19:03 ` Simon Marchi
2026-10-16 6:52 ` Aktemur, Baris
0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2026-10-15 19:03 UTC (permalink / raw)
To: Tankut Baris Aktemur, gdb-patches, lancelot.six
On 10/15/26 2:15 PM, Tankut Baris Aktemur wrote:
> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index e0117ede292..7a437747e35 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -368,6 +368,27 @@ if test "$gdb_require_amd_dbgapi" = true \
> AC_MSG_ERROR([amd-dbgapi not supported for host ${gdb_host}])
> ;;
> esac
> +
> + # Detect if AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE can be used.
As a person who likes to clean up obsolete code, may I ask you to
mention which dbgapi version introduced
AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE? This way it will become easier
to spot when this configure check is no longer necessary.
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [PATCH v2] gdb, amdgpu: add config guards for AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE
2026-10-15 19:03 ` Simon Marchi
@ 2026-10-16 6:52 ` Aktemur, Baris
2026-10-19 15:00 ` Six, Lancelot
0 siblings, 1 reply; 4+ messages in thread
From: Aktemur, Baris @ 2026-10-16 6:52 UTC (permalink / raw)
To: Simon Marchi, gdb-patches, Six, Lancelot
AMD General
On Thursday, October 15, 2026 9:04 PM, Simon Marchi wrote:
> On 10/15/26 2:15 PM, Tankut Baris Aktemur wrote:
> > diff --git a/gdb/configure.ac b/gdb/configure.ac
> > index e0117ede292..7a437747e35 100644
> > --- a/gdb/configure.ac
> > +++ b/gdb/configure.ac
> > @@ -368,6 +368,27 @@ if test "$gdb_require_amd_dbgapi" = true \
> > AC_MSG_ERROR([amd-dbgapi not supported for host ${gdb_host}])
> > ;;
> > esac
> > +
> > + # Detect if AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE can be used.
>
> As a person who likes to clean up obsolete code, may I ask you to
> mention which dbgapi version introduced
> AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE? This way it will become easier
> to spot when this configure check is no longer necessary.
It became available with rocm-dbgapi-0.78. I'll add this to the comment above.
-Baris
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [PATCH v2] gdb, amdgpu: add config guards for AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE
2026-10-16 6:52 ` Aktemur, Baris
@ 2026-10-19 15:00 ` Six, Lancelot
0 siblings, 0 replies; 4+ messages in thread
From: Six, Lancelot @ 2026-10-19 15:00 UTC (permalink / raw)
To: Aktemur, Baris, Simon Marchi, gdb-patches
AMD General
> -----Original Message-----
> From: Aktemur, Baris <TankutBaris.Aktemur@amd.com>
> Sent: 16 October 2026 07:53
> To: Simon Marchi <simark@simark.ca>; gdb-patches@sourceware.org; Six,
> Lancelot <Lancelot.Six@amd.com>
> Subject: RE: [PATCH v2] gdb, amdgpu: add config guards for
> AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE
>
> AMD General
>
> On Thursday, October 15, 2026 9:04 PM, Simon Marchi wrote:
> > On 10/15/26 2:15 PM, Tankut Baris Aktemur wrote:
> > > diff --git a/gdb/configure.ac b/gdb/configure.ac
> > > index e0117ede292..7a437747e35 100644
> > > --- a/gdb/configure.ac
> > > +++ b/gdb/configure.ac
> > > @@ -368,6 +368,27 @@ if test "$gdb_require_amd_dbgapi" = true \
> > > AC_MSG_ERROR([amd-dbgapi not supported for host ${gdb_host}])
> > > ;;
> > > esac
> > > +
> > > + # Detect if AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE can
> be used.
> >
> > As a person who likes to clean up obsolete code, may I ask you to
> > mention which dbgapi version introduced
> > AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE? This way it will
> become easier
> > to spot when this configure check is no longer necessary.
>
> It became available with rocm-dbgapi-0.78. I'll add this to the comment
> above.
>
> -Baris
>
Hi,
I was wondering if AC_CHECK_DECLS wouldn't be a better fit than AC_COMPILE_IFELSE. Would probably simplify things a bit.
WDYT?
Best,
Lanceloet.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-19 15:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15 18:15 [PATCH v2] gdb, amdgpu: add config guards for AMD_DBGAPI_STATUS_ERROR_MEMORY_UNAVAILABLE Tankut Baris Aktemur
2026-10-15 19:03 ` Simon Marchi
2026-10-16 6:52 ` Aktemur, Baris
2026-10-19 15:00 ` Six, Lancelot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox