X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fpython%2Flib%2Fgdb%2Fdap%2Fvarref.py;h=0e0d92a883205b1686c16ef548eb43131f5115aa;hb=2128d888b888b04edb4553a5359e6e259c792606;hp=213151fd3d34164b574379b8ce819248b86b9edb;hpb=af93035b2755fef31c67016f68ab9fcdc2074c42;p=binutils-gdb.git diff --git a/gdb/python/lib/gdb/dap/varref.py b/gdb/python/lib/gdb/dap/varref.py index 213151fd3d3..0e0d92a8832 100644 --- a/gdb/python/lib/gdb/dap/varref.py +++ b/gdb/python/lib/gdb/dap/varref.py @@ -162,10 +162,13 @@ class VariableReference(BaseReference): result["indexedVariables"] = num_children else: result["namedVariables"] = num_children - if self.value.type.code == gdb.TYPE_CODE_PTR: - result["memoryReference"] = hex(int(self.value)) - elif self.value.address is not None: - result["memoryReference"] = hex(int(self.value.address)) + if client_bool_capability("supportsMemoryReferences"): + # https://github.com/microsoft/debug-adapter-protocol/issues/414 + # 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: + result["memoryReference"] = hex(int(self.value)) if client_bool_capability("supportsVariableType"): result["type"] = str(self.value.type) return result