[binutils-gdb] Windows/rocm-solib: Don't hardcode namespaces support

Pedro Alves via Gdb-cvs <[email protected]> Mon, 6 Jul 2026 22:38:42 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=694e0267385907eaa5620ae7fc65f5e2f265d9f0

commit 694e0267385907eaa5620ae7fc65f5e2f265d9f0
Author: Pedro Alves <[email protected]>
Date:   Wed Jun 24 14:45:56 2026 +0100

    Windows/rocm-solib: Don't hardcode namespaces support
    
    rocm_solib_ops currently unconditionally returns true to
    solib_ops::supports_namespaces.  That works OK on Linux where the
    underlying solib ops is svr4.  But on Windows, the underlying solib
    ops is solib-target, which does not support namespaces.  The result
    is:
    
     (gdb) info shared
     /home/pedro/rocm/gdb/build/gdb/solib.h:270: internal-error: num_active_namespaces: namespaces not supported
     A problem internal to GDB has been detected,
     further debugging may prove unreliable.
     ...
     Thread 1 hit Breakpoint 1, internal_verror (file=0x7ff71a27fc80 <SCRIPTING_SEARCH_FLAG+52> "/home/pedro/rocm/gdb/build/gdb/solib.h", line=270,
         fmt=0x7ff71a27fc5e <SCRIPTING_SEARCH_FLAG+18> "%s: namespaces not supported", ap=0xfff1a8 "\270\374'", <incomplete sequence \367\177>)
         at /home/pedro/rocm/gdb/build/gdb/utils.c:514
     514       internal_vproblem (&internal_error_problem, file, line, fmt, ap);
     (gdb) bt
     #0  internal_verror (file=0x7ff71a27fc80 <SCRIPTING_SEARCH_FLAG+52> "/home/pedro/rocm/gdb/build/gdb/solib.h", line=270,
         fmt=0x7ff71a27fc5e <SCRIPTING_SEARCH_FLAG+18> "%s: namespaces not supported", ap=0xfff1a8 "\270\374'", <incomplete sequence \367\177>)
         at /home/pedro/rocm/gdb/build/gdb/utils.c:514
     #1  0x00007ff719c75cf4 in internal_error_loc (file=0x7ff71a27fc80 <SCRIPTING_SEARCH_FLAG+52> "/home/pedro/rocm/gdb/build/gdb/solib.h", line=270,
         fmt=0x7ff71a27fc5e <SCRIPTING_SEARCH_FLAG+18> "%s: namespaces not supported") at /home/pedro/rocm/gdb/build/gdbsupport/errors.cc:57
     #2  0x00007ff719f0aafe in solib_ops::num_active_namespaces (this=0xbb3a0b0) at /home/pedro/rocm/gdb/build/gdb/solib.h:270
     #3  0x00007ff719eca99e in rocm_solib_ops::num_active_namespaces (this=0xc9388a0) at /home/pedro/rocm/gdb/build/gdb/solib-rocm.c:211
     #4  0x00007ff719a14d33 in print_solib_list_table (solib_list=..., print_namespace=true) at /home/pedro/rocm/gdb/build/gdb/solib.c:1011
     #5  0x00007ff719a15833 in info_sharedlibrary_command (pattern=0x0, from_tty=1) at /home/pedro/rocm/gdb/build/gdb/solib.c:1115
    
    rocm_solib_ops will stop sitting on top of another solib
    implementation once the multi solib provider work lands, but
    meanwhile, it'd be helpful to not crash.
    
    Fix this by making rocm_solib_ops::supports_namespaces() delegate to
    the underlying host solib ops like other methods do.
    
    Approved-by: Lancelot Six <[email protected]> (amdgpu)
    Change-Id: I1627c6e2f1b1c171c013c8457e9bfca92d5f4dc5

Diff:
---
 gdb/solib-rocm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index 3a58a46d886..73797801d6c 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -202,7 +202,7 @@ struct rocm_solib_ops : public solib_ops
   { return m_host_ops->find_solib_addr (so); }
 
   bool supports_namespaces () const override
-  { return true; }
+  { return m_host_ops->supports_namespaces (); }
 
   int find_solib_ns (const solib &so) const override
   { return m_host_ops->find_solib_ns (so); }