[Lldb-commits] [lldb] Fix dap variable value format issue (PR #90799)

via lldb-commits lldb-commits at lists.llvm.org
Wed May 1 16:41:28 PDT 2024


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 cf3c714e4bd7b8a68793f2827080fe3388ae8bb1...2daf4aeaee1ce9062dfa964f3baeef0d7477479c lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py	2024-05-01 23:35:18.000000 +0000
+++ packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py	2024-05-01 23:41:05.012150 +0000
@@ -485,11 +485,13 @@
         return self.get_scope_variables(
             "Registers", frameIndex=frameIndex, threadId=threadId
         )
 
     def get_local_variable(self, name, frameIndex=0, threadId=None, is_hex=None):
-        locals = self.get_local_variables(frameIndex=frameIndex, threadId=threadId, is_hex=is_hex)
+        locals = self.get_local_variables(
+            frameIndex=frameIndex, threadId=threadId, is_hex=is_hex
+        )
         for local in locals:
             if "name" in local and local["name"] == name:
                 return local
         return None
 
@@ -499,17 +501,19 @@
         )
         if variable and "value" in variable:
             return variable["value"]
         return None
 
-    def get_local_variable_child(self, name, child_name, frameIndex=0, threadId=None, is_hex=None):
+    def get_local_variable_child(
+        self, name, child_name, frameIndex=0, threadId=None, is_hex=None
+    ):
         local = self.get_local_variable(name, frameIndex, threadId)
         if local["variablesReference"] == 0:
             return None
-        children = self.request_variables(local["variablesReference"], is_hex=is_hex)["body"][
-            "variables"
-        ]
+        children = self.request_variables(local["variablesReference"], is_hex=is_hex)[
+            "body"
+        ]["variables"]
         for child in children:
             if child["name"] == child_name:
                 return child
         return None
 
@@ -1033,11 +1037,13 @@
                             thread[key] = thread_stop_info[key]
         else:
             self.threads = None
         return response
 
-    def request_variables(self, variablesReference, start=None, count=None, is_hex=None):
+    def request_variables(
+        self, variablesReference, start=None, count=None, is_hex=None
+    ):
         args_dict = {"variablesReference": variablesReference}
         if start is not None:
             args_dict["start"] = start
         if count is not None:
             args_dict["count"] = count
--- test/API/tools/lldb-dap/variables/TestDAP_variables.py	2024-05-01 23:35:18.000000 +0000
+++ test/API/tools/lldb-dap/variables/TestDAP_variables.py	2024-05-01 23:41:05.291722 +0000
@@ -765,17 +765,17 @@
         program = self.getBuildArtifact("a.out")
         self.build_and_launch(program)
         source = "main.cpp"
         breakpoint1_line = line_number(source, "// breakpoint 1")
         lines = [breakpoint1_line]
-        
+
         breakpoint_ids = self.set_source_breakpoints(source, lines)
         self.assertEqual(
             len(breakpoint_ids), len(lines), "expect correct number of breakpoints"
         )
         self.continue_to_breakpoints(breakpoint_ids)
-        
+
         # Verify locals value format decimal
         is_hex = False
         var_pt_x = self.dap_server.get_local_variable_child("pt", "x", is_hex=is_hex)
         self.assertEquals(var_pt_x["value"], "11")
         var_pt_y = self.dap_server.get_local_variable_child("pt", "y", is_hex=is_hex)
@@ -785,11 +785,11 @@
         is_hex = True
         var_pt_x = self.dap_server.get_local_variable_child("pt", "x", is_hex=is_hex)
         self.assertEquals(var_pt_x["value"], "0x0000000b")
         var_pt_y = self.dap_server.get_local_variable_child("pt", "y", is_hex=is_hex)
         self.assertEquals(var_pt_y["value"], "0x00000016")
-        
+
         # Toggle and verify locals value format decimal again
         is_hex = False
         var_pt_x = self.dap_server.get_local_variable_child("pt", "x", is_hex=is_hex)
         self.assertEquals(var_pt_x["value"], "11")
         var_pt_y = self.dap_server.get_local_variable_child("pt", "y", is_hex=is_hex)

``````````

</details>


https://github.com/llvm/llvm-project/pull/90799


More information about the lldb-commits mailing list