[Lldb-commits] [lldb] WIP: Stop using replicated variable ids (PR #124232)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 27 21:46:24 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 2025-08-28 04:25:00.000000 +0000
+++ packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 2025-08-28 04:45:58.003701 +0000
@@ -367,13 +367,14 @@
scopes_response = self.dap_server.request_scopes(frameId)
frame_scopes = scopes_response["body"]["scopes"]
for scope in frame_scopes:
if scope["name"] == "Globals":
varRef = scope["variablesReference"]
- return self.dap_server.request_setVariable(varRef, name, str(value), id=id)
+ return self.dap_server.request_setVariable(
+ varRef, name, str(value), id=id
+ )
return None
-
def get_locals_scope_reference(self):
"""Get the variablesReference for the locals scope."""
stackFrame = self.dap_server.get_stackFrame()
if stackFrame is None:
--- test/API/tools/lldb-dap/variables/TestDAP_variables.py 2025-08-28 04:25:00.000000 +0000
+++ test/API/tools/lldb-dap/variables/TestDAP_variables.py 2025-08-28 04:45:58.319114 +0000
@@ -340,40 +340,52 @@
self.verify_variables(verify_locals, self.dap_server.get_local_variables())
# Now we verify that we correctly change the name of a variable with and without differentiator suffix
local_scope_ref = self.get_locals_scope_reference()
- self.assertFalse(self.dap_server.request_setVariable(local_scope_ref, "x2", 9)["success"])
self.assertFalse(
- self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:0", 9)["success"]
+ self.dap_server.request_setVariable(local_scope_ref, "x2", 9)["success"]
+ )
+ self.assertFalse(
+ self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:0", 9)[
+ "success"
+ ]
)
self.assertTrue(
- self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:19", 19)["success"]
+ self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:19", 19)[
+ "success"
+ ]
)
self.assertTrue(
- self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:21", 21)["success"]
+ self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:21", 21)[
+ "success"
+ ]
)
self.assertTrue(
- self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:23", 23)["success"]
+ self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:23", 23)[
+ "success"
+ ]
)
# The following should have no effect
self.assertFalse(
- self.dap_server.request_setVariable(local_scope_ref, "x @ main.cpp:23", "invalid")[
- "success"
- ]
+ self.dap_server.request_setVariable(
+ local_scope_ref, "x @ main.cpp:23", "invalid"
+ )["success"]
)
verify_locals["x @ main.cpp:19"]["equals"]["value"] = "19"
verify_locals["x @ main.cpp:21"]["equals"]["value"] = "21"
verify_locals["x @ main.cpp:23"]["equals"]["value"] = "23"
self.verify_variables(verify_locals, self.dap_server.get_local_variables())
# The plain x variable shold refer to the innermost x
- self.assertTrue(self.dap_server.request_setVariable(local_scope_ref, "x", 22)["success"])
+ self.assertTrue(
+ self.dap_server.request_setVariable(local_scope_ref, "x", 22)["success"]
+ )
verify_locals["x @ main.cpp:23"]["equals"]["value"] = "22"
self.verify_variables(verify_locals, self.dap_server.get_local_variables())
# In breakpoint 3, there should be no shadowed variables
@@ -708,11 +720,13 @@
self.verify_variables(verify_locals, local_variables, varref_dict)
break
self.assertFalse(
- self.dap_server.request_setVariable(self.get_locals_scope_reference(), "(Return Value)", 20)["success"]
+ self.dap_server.request_setVariable(
+ self.get_locals_scope_reference(), "(Return Value)", 20
+ )["success"]
)
@skipIfWindows
def test_indexedVariables(self):
self.do_test_indexedVariables(enableSyntheticChildDebugging=False)
``````````
</details>
https://github.com/llvm/llvm-project/pull/124232
More information about the lldb-commits
mailing list