[Lldb-commits] [lldb] Send an explicit interrupt to cancel an attach waitfor. (PR #72565)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 29 17:29:00 PST 2023
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 a322d50804c5248f9e2981f3733bcb598fa13d51..f6be566cda37974027d2fb591465f385965bd7d1 lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestCancelAttach.py 2023-11-30 01:25:00.000000 +0000
+++ TestCancelAttach.py 2023-11-30 01:28:51.443331 +0000
@@ -26,14 +26,16 @@
# Make this a daemon thread so if we don't manage to interrupt,
# Python will keep this thread from hanging the test.
threading.Thread.__init__(self, daemon=True)
self.target = target
self.error = error
-
+
def run(self):
- self.target.AttachToProcessWithName(lldb.SBListener(), "LLDB-No-Such-Process", True, self.error)
-
+ self.target.AttachToProcessWithName(
+ lldb.SBListener(), "LLDB-No-Such-Process", True, self.error
+ )
+
error = lldb.SBError()
thread = AttachThread(target, error)
thread.start()
# Now wait till the attach on the child thread has made a process
@@ -48,10 +50,9 @@
# Now send the attach interrupt:
target.process.SendAsyncInterrupt()
# We don't want to stall if we can't interrupt, so join with a timeout:
thread.join(60)
if thread.is_alive():
- self.fail("The attach thread is alive after timeout interval")
+ self.fail("The attach thread is alive after timeout interval")
# Now check the error, should say the attach was interrupted:
self.assertTrue(error.Fail(), "We succeeded in not attaching")
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/72565
More information about the lldb-commits
mailing list