[Bug testsuite/33345] [gdb/testsuite] FAIL: gdb.dap/scopes.exp: fetch all registers success

aburgess at redhat dot com sourceware-bugzilla@sourceware.org
Mon Sep 1 15:42:19 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=33345

--- Comment #10 from Andrew Burgess <aburgess at redhat dot com> ---
Here's a super rough patch that fixes the issue:

diff --git i/gdb/python/lib/gdb/dap/varref.py
w/gdb/python/lib/gdb/dap/varref.py
index 1b54fe745fa..e5edbad46a6 100644
--- i/gdb/python/lib/gdb/dap/varref.py
+++ w/gdb/python/lib/gdb/dap/varref.py
@@ -246,7 +246,8 @@ class VariableReference(BaseReference):
             # changed DAP to allow memory references for any of the
             # variable response requests, and to lift the restriction
             # to pointer-to-function from Variable.
-            if self._value.type.strip_typedefs().code == gdb.TYPE_CODE_PTR:
+            if (self._value.type.strip_typedefs().code == gdb.TYPE_CODE_PTR
+                and str(self._value) != "<unavailable>"):
                 result["memoryReference"] = hex(int(self._value))
         if client_bool_capability("supportsVariableType"):
             result["type"] = str(self._value.type)


The problem is the 'int(self._value)' which throws an error if the value is
unavailable.

This really needs a new gdb.Value.is_unavailable attribute to go alongside the
existing Value.is_optimized_out, that would replace the use of the string
representation.

This would mean the reply lacks the 'memoryReference' DAP attribute, but that's
probably OK when the value is unavailable.  The 'value' attribute would still
be present, and this would contain the '<unavailable>' string.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list