commit:     9f95083619891f1740aa1759a2021ccf42e547bb
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Thu Jun 27 20:17:49 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 30 02:14:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f950836

dev-debug/gdb: support for AMD GPU debugging via USE=rocm

This adds ability to debug AMD GPU code with recently added 
`dev-libs/rocdbgapi` library.
This feature was introduced in GDB 13 and documented at:
* https://sourceware.org/gdb/current/onlinedocs/gdb.html/AMD-GPU.html
* 
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=18b4d0736bc570c6d2e3e5f6ebc2ad4617d93847

As described in binutils-gdb commit message, this feature requires 
`--enable-targets=all`,
and if no `--with-amd-dbgapi=yes/no` specified, it tries to probe for library
and enable if found (which is undesirable for Gentoo), therefore it is better 
to set this flag explicitly.

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37324
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-debug/gdb/{gdb-9999.ebuild => gdb-15.2-r101.ebuild} | 5 ++++-
 dev-debug/gdb/gdb-9999.ebuild                           | 5 ++++-
 dev-debug/gdb/metadata.xml                              | 1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dev-debug/gdb/gdb-9999.ebuild b/dev-debug/gdb/gdb-15.2-r101.ebuild
similarity index 97%
copy from dev-debug/gdb/gdb-9999.ebuild
copy to dev-debug/gdb/gdb-15.2-r101.ebuild
index 7c3816fa9eb2..811789dab6d8 100644
--- a/dev-debug/gdb/gdb-9999.ebuild
+++ b/dev-debug/gdb/gdb-15.2-r101.ebuild
@@ -73,13 +73,14 @@ SRC_URI="
 
 LICENSE="GPL-3+ LGPL-2.1+"
 SLOT="0"
-IUSE="cet debuginfod guile lzma multitarget nls +python +server sim 
source-highlight test vanilla xml xxhash zstd"
+IUSE="cet debuginfod guile lzma multitarget nls +python rocm +server sim 
source-highlight test vanilla xml xxhash zstd"
 if [[ -n ${REGULAR_RELEASE} ]] ; then
        KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
 fi
 REQUIRED_USE="
        guile? ( ${GUILE_REQUIRED_USE} )
        python? ( ${PYTHON_REQUIRED_USE} )
+       rocm? ( multitarget )
 "
 RESTRICT="!test? ( test )"
 
@@ -97,6 +98,7 @@ RDEPEND="
        python? ( ${PYTHON_DEPS} )
        guile? ( ${GUILE_DEPS} )
        xml? ( dev-libs/expat )
+       rocm? ( dev-libs/rocdbgapi )
        source-highlight? (
                dev-util/source-highlight
        )
@@ -239,6 +241,7 @@ src_configure() {
                --without-zlib
                --with-system-zlib
                --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+               --with-amd-dbgapi=$(usex rocm)
                $(use_with xml expat)
                $(use_with lzma)
                $(use_enable nls)

diff --git a/dev-debug/gdb/gdb-9999.ebuild b/dev-debug/gdb/gdb-9999.ebuild
index 7c3816fa9eb2..811789dab6d8 100644
--- a/dev-debug/gdb/gdb-9999.ebuild
+++ b/dev-debug/gdb/gdb-9999.ebuild
@@ -73,13 +73,14 @@ SRC_URI="
 
 LICENSE="GPL-3+ LGPL-2.1+"
 SLOT="0"
-IUSE="cet debuginfod guile lzma multitarget nls +python +server sim 
source-highlight test vanilla xml xxhash zstd"
+IUSE="cet debuginfod guile lzma multitarget nls +python rocm +server sim 
source-highlight test vanilla xml xxhash zstd"
 if [[ -n ${REGULAR_RELEASE} ]] ; then
        KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
 fi
 REQUIRED_USE="
        guile? ( ${GUILE_REQUIRED_USE} )
        python? ( ${PYTHON_REQUIRED_USE} )
+       rocm? ( multitarget )
 "
 RESTRICT="!test? ( test )"
 
@@ -97,6 +98,7 @@ RDEPEND="
        python? ( ${PYTHON_DEPS} )
        guile? ( ${GUILE_DEPS} )
        xml? ( dev-libs/expat )
+       rocm? ( dev-libs/rocdbgapi )
        source-highlight? (
                dev-util/source-highlight
        )
@@ -239,6 +241,7 @@ src_configure() {
                --without-zlib
                --with-system-zlib
                --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+               --with-amd-dbgapi=$(usex rocm)
                $(use_with xml expat)
                $(use_with lzma)
                $(use_enable nls)

diff --git a/dev-debug/gdb/metadata.xml b/dev-debug/gdb/metadata.xml
index 2e08f18a3470..a9c1d3521c85 100644
--- a/dev-debug/gdb/metadata.xml
+++ b/dev-debug/gdb/metadata.xml
@@ -10,6 +10,7 @@
                <flag name="lzma">Support lzma compression in ELF debug 
info</flag>
                <flag name="multitarget">Support all known targets in one gdb 
binary</flag>
                <flag name="python">Enable support for the new internal 
scripting language, as well as extended pretty printers</flag>
+               <flag name="rocm">Enable support for AMD GPU debugging via 
<pkg>dev-libs/rocdbgapi</pkg></flag>
                <flag name="server">Install the "gdbserver" program (useful for 
embedded/remote targets)</flag>
                <flag name="sim">Build gdb's simulators for various hardware 
platforms. See https://sourceware.org/gdb/wiki/Sim.</flag>
                <flag name="source-highlight">Enable listing highlighting via 
<pkg>dev-util/source-highlight</pkg></flag>

Reply via email to