Skip to content

Commit 85ee3fc

Browse files
jeffreytan81jeffreytan81
andauthored
Fix command escape bug in lldb-dap (#72902)
#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 #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). Co-authored-by: jeffreytan81 <[email protected]>
1 parent dfcf9fe commit 85ee3fc

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ def request_launch(
731731
postRunCommands=None,
732732
enableAutoVariableSummaries=False,
733733
enableSyntheticChildDebugging=False,
734-
commandEscapePrefix="`",
734+
commandEscapePrefix=None,
735735
customFrameFormat=None,
736736
customThreadFormat=None,
737737
):

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def launch(
354354
postRunCommands=None,
355355
enableAutoVariableSummaries=False,
356356
enableSyntheticChildDebugging=False,
357-
commandEscapePrefix="`",
357+
commandEscapePrefix=None,
358358
customFrameFormat=None,
359359
customThreadFormat=None,
360360
):
@@ -434,7 +434,7 @@ def build_and_launch(
434434
lldbDAPEnv=None,
435435
enableAutoVariableSummaries=False,
436436
enableSyntheticChildDebugging=False,
437-
commandEscapePrefix="`",
437+
commandEscapePrefix=None,
438438
customFrameFormat=None,
439439
customThreadFormat=None,
440440
):

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ llvm::StringRef GetString(const llvm::json::Object *obj, llvm::StringRef key,
5757
llvm::StringRef defaultValue) {
5858
if (obj == nullptr)
5959
return defaultValue;
60-
return GetString(*obj, key);
60+
return GetString(*obj, key, defaultValue);
6161
}
6262

6363
// Gets an unsigned integer from a JSON object using the key, or returns the

0 commit comments

Comments
 (0)