https://github.com/jeffreytan81 created https://github.com/llvm/llvm-project/pull/72902
https://github.com/llvm/llvm-project/pull/69238 caused breakage in VSCode debug console usage -- the user's input is always treated as commands instead of expressions (the same behavior as if empty command escape prefix is specified). The bug is in one overload of `GetString()` which did not respect the default value of "`". But more important, I am puzzled to find out why the regression is not caught by lldb test (testdap_evaluate). Turns out https://github.com/llvm/llvm-project/pull/69238 specifies commandEscapePrefix default value in test framework to be "`" while VSCode will default not specify any commandEscapePrefix at all. Changing it to None will fail `testdap_evaluate`. We should align the default behavior between DAP client and testcase. This patches fixes the bug in `GetString()` and changed the default value of commandEscapePrefix in testcases to be None (be consistent with IDE). >From 2838929d255642942dfe33d6584d0486d026f926 Mon Sep 17 00:00:00 2001 From: jeffreytan81 <jeffrey...@fb.com> Date: Mon, 20 Nov 2023 10:54:39 -0800 Subject: [PATCH] Fix command escape bug in lldb-dap --- .../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 2 +- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 4 ++-- lldb/tools/lldb-dap/JSONUtils.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 518e3b9cf5bab33..bb863bb87191763 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -731,7 +731,7 @@ def request_launch( postRunCommands=None, enableAutoVariableSummaries=False, enableSyntheticChildDebugging=False, - commandEscapePrefix="`", + commandEscapePrefix=None, customFrameFormat=None, customThreadFormat=None, ): diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 0cf9d4fde49488f..4ccd6014e54be6a 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -354,7 +354,7 @@ def launch( postRunCommands=None, enableAutoVariableSummaries=False, enableSyntheticChildDebugging=False, - commandEscapePrefix="`", + commandEscapePrefix=None, customFrameFormat=None, customThreadFormat=None, ): @@ -434,7 +434,7 @@ def build_and_launch( lldbDAPEnv=None, enableAutoVariableSummaries=False, enableSyntheticChildDebugging=False, - commandEscapePrefix="`", + commandEscapePrefix=None, customFrameFormat=None, customThreadFormat=None, ): diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 50ade02801529c3..03a43f9da87f241 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -57,7 +57,7 @@ llvm::StringRef GetString(const llvm::json::Object *obj, llvm::StringRef key, llvm::StringRef defaultValue) { if (obj == nullptr) return defaultValue; - return GetString(*obj, key); + return GetString(*obj, key, defaultValue); } // Gets an unsigned integer from a JSON object using the key, or returns the _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits