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 HEAD~1...HEAD lldb/test/API/commands/target/stop-hooks/on-core-load/TestStopHookOnCoreLoad.py lldb/test/API/commands/target/stop-hooks/on-core-load/stop_hook.py lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py lldb/test/API/commands/target/stop-hooks/TestStopHooks.py lldb/test/API/python_api/event/TestEvents.py `````````` </details> <details> <summary> View the diff from darker here. </summary> ``````````diff --- commands/target/stop-hooks/TestStopHooks.py 2025-04-25 22:36:26.000000 +0000 +++ commands/target/stop-hooks/TestStopHooks.py 2025-04-25 22:49:40.254071 +0000 @@ -107,6 +107,5 @@ interp.HandleCommand("target stop-hook add -o 'thread backtrace'", result) self.assertTrue(result.Succeeded(), "Set the target stop hook") self.expect( "target stop-hook list", substrs=["expr g_var++", "thread backtrace"] ) - --- commands/target/stop-hooks/on-core-load/TestStopHookOnCoreLoad.py 2025-04-25 22:36:26.000000 +0000 +++ commands/target/stop-hooks/on-core-load/TestStopHookOnCoreLoad.py 2025-04-25 22:49:40.272662 +0000 @@ -20,19 +20,18 @@ def test_hook_runs_no_threads(self): # Create core form YAML. core_path = self.getBuildArtifact("test.core") self.yaml2obj("test.core.yaml", core_path) - # Since mach core files don't have stop reasons, we should choose - # the first thread: + # Since mach core files don't have stop reasons, we should choose + # the first thread: self.do_test(core_path, 1) def test_hook_one_thread(self): core_path = os.path.join(self.getSourceDir(), "linux-x86_64.core") self.do_test(core_path, 3) - def do_test(self, core_path, stop_thread): # Set debugger into synchronous mode self.dbg.SetAsync(False) # Create a target by the debugger. @@ -40,16 +39,17 @@ # load the stop hook module and add the stop hook: stop_hook_path = os.path.join(self.getSourceDir(), "stop_hook.py") self.runCmd(f"command script import {stop_hook_path}") self.runCmd("target stop-hook add -P stop_hook.stop_handler") - + # Load core. process = target.LoadCore(core_path) self.assertTrue(process, PROCESS_IS_VALID) - # Now run our report command and make sure we get the right answer. - + # Now run our report command and make sure we get the right answer. + result = lldb.SBCommandReturnObject() self.dbg.GetCommandInterpreter().HandleCommand("report_command", result) print(f"Command Output: '{result.GetOutput}'") - self.assertIn(f"Stop Threads: {stop_thread}", result.GetOutput(), "Ran the stop hook") - + self.assertIn( + f"Stop Threads: {stop_thread}", result.GetOutput(), "Ran the stop hook" + ) --- commands/target/stop-hooks/on-core-load/stop_hook.py 2025-04-25 22:36:26.000000 +0000 +++ commands/target/stop-hooks/on-core-load/stop_hook.py 2025-04-25 22:49:40.284187 +0000 @@ -1,15 +1,17 @@ import lldb + def report_command(debugger, command, exe_ctx, result, internal_dict): global stop_thread print(f"About to report out stop_thread: {stop_thread}") mssg = f"Stop Threads: {stop_thread}" result.AppendMessage(mssg) result.SetStatus(lldb.eReturnStatusSuccessFinishResult) - + + class stop_handler: def __init__(self, target, extra_args, dict): global stop_thread stop_thead = 0 self.target = target @@ -17,12 +19,12 @@ def handle_stop(self, exe_ctx, stream): global stop_thread thread = exe_ctx.thread stop_thread = thread.idx + def __lldb_init_module(debugger, internal_dict): global stop_thread stop_thread = 0 debugger.HandleCommand( - f"command script add -o -f '{__name__}.report_command' report_command" -) - + f"command script add -o -f '{__name__}.report_command' report_command" + ) `````````` </details> https://github.com/llvm/llvm-project/pull/137410 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits