[Lldb-commits] [lldb] Fix saving minidump from lldb-dap (PR #89113)

via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 17 11:14:27 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 93f9fb2c825dba48db64d5f726b54bcbd4766009...4453a9cb876fe4ed3c5a3ea57a03a428c5d847fc lldb/test/API/tools/lldb-dap/save-core/TestDAP_save_core.py
``````````

</details>

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

``````````diff
--- TestDAP_save_core.py	2024-04-17 17:59:51.000000 +0000
+++ TestDAP_save_core.py	2024-04-17 18:13:59.115018 +0000
@@ -27,55 +27,54 @@
         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)
-        
+
         # Getting dap stack trace may trigger __lldb_caller_function JIT module to be created.
         self.get_stackFrames(startFrame=0)
-        
+
         # Evaluating an expression that cause "_$__lldb_valid_pointer_check" JIT module to be created.
         expression = 'printf("this is a test")'
         self.dap_server.request_evaluate(expression, context="watch")
-        
+
         # Verify "_$__lldb_valid_pointer_check" JIT module is created.
         modules = self.dap_server.get_modules()
         self.assertTrue(modules["_$__lldb_valid_pointer_check"])
         thread_count = len(self.dap_server.get_threads())
-        
+
         core_stack = self.getBuildArtifact("core.stack.dmp")
         core_dirty = self.getBuildArtifact("core.dirty.dmp")
         core_full = self.getBuildArtifact("core.full.dmp")
-        
+
         base_command = "`process save-core --plugin-name=minidump "
-        self.dap_server.request_evaluate(base_command + " --style=stack '%s'" % (core_stack), context="repl")
-        
-        self.assertTrue(os.path.isfile(core_stack))
-        self.verify_core_file(
-            core_stack, len(modules), thread_count
+        self.dap_server.request_evaluate(
+            base_command + " --style=stack '%s'" % (core_stack), context="repl"
         )
 
-        self.dap_server.request_evaluate(base_command + " --style=modified-memory '%s'" % (core_dirty), context="repl")
+        self.assertTrue(os.path.isfile(core_stack))
+        self.verify_core_file(core_stack, len(modules), thread_count)
+
+        self.dap_server.request_evaluate(
+            base_command + " --style=modified-memory '%s'" % (core_dirty),
+            context="repl",
+        )
         self.assertTrue(os.path.isfile(core_dirty))
-        self.verify_core_file(
-            core_dirty, len(modules), thread_count
+        self.verify_core_file(core_dirty, len(modules), thread_count)
+
+        self.dap_server.request_evaluate(
+            base_command + " --style=full '%s'" % (core_full), context="repl"
         )
+        self.assertTrue(os.path.isfile(core_full))
+        self.verify_core_file(core_full, len(modules), thread_count)
 
-        self.dap_server.request_evaluate(base_command + " --style=full '%s'" % (core_full), context="repl")
-        self.assertTrue(os.path.isfile(core_full))
-        self.verify_core_file(
-            core_full, len(modules), thread_count
-        )
+    def verify_core_file(self, core_path, expected_module_count, expected_thread_count):
+        # To verify, we'll launch with the mini dump
+        target = self.dbg.CreateTarget(None)
+        process = target.LoadCore(core_path)
 
-    def verify_core_file(
-          self, core_path, expected_module_count, expected_thread_count
-      ):
-          # To verify, we'll launch with the mini dump
-          target = self.dbg.CreateTarget(None)
-          process = target.LoadCore(core_path)
-
-          # check if the core is in desired state
-          self.assertTrue(process, PROCESS_IS_VALID)
-          self.assertTrue(process.GetProcessInfo().IsValid())
-          self.assertNotEqual(target.GetTriple().find("linux"), -1)
-          self.assertTrue(target.GetNumModules(), expected_module_count)
-          self.assertEqual(process.GetNumThreads(), expected_thread_count)
+        # check if the core is in desired state
+        self.assertTrue(process, PROCESS_IS_VALID)
+        self.assertTrue(process.GetProcessInfo().IsValid())
+        self.assertNotEqual(target.GetTriple().find("linux"), -1)
+        self.assertTrue(target.GetNumModules(), expected_module_count)
+        self.assertEqual(process.GetNumThreads(), expected_thread_count)

``````````

</details>


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


More information about the lldb-commits mailing list