From 8a7650b0135fbc46c98f215ca676d13d79da966d Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Mon, 14 Jul 2025 18:12:48 +0200 Subject: [PATCH] service/dap: do not try to access value of unreadable string variables (#4055) Fixes #4053 --- service/dap/server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/service/dap/server.go b/service/dap/server.go index c3f4d58f..42b95e36 100644 --- a/service/dap/server.go +++ b/service/dap/server.go @@ -2437,8 +2437,10 @@ func (s *Session) childrenToDAPVariables(v *fullyQualifiedVariable) []dap.Variab reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: valexpr = fmt.Sprintf("%s[%s]", v.fullyQualifiedNameOrExpr, api.VariableValueAsString(keyv)) case reflect.String: - if key := constant.StringVal(keyv.Value); keyv.Len == int64(len(key)) { // fully loaded - valexpr = fmt.Sprintf("%s[%q]", v.fullyQualifiedNameOrExpr, key) + if keyv.Unreadable == nil { + if key := constant.StringVal(keyv.Value); keyv.Len == int64(len(key)) { // fully loaded + valexpr = fmt.Sprintf("%s[%q]", v.fullyQualifiedNameOrExpr, key) + } } } key, keyref := s.convertVariable(keyv, keyexpr)