[Lldb-commits] [lldb] Private process events were being delivered to the secondary listener (PR #98571)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 11 18:01:14 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 7b604cdf75fd1c741a15138684ea0e98dca5e46f...fb563e516f3a73d508ea7b3a61df4f1bab2f33a6 lldb/test/API/python_api/event/TestEvents.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestEvents.py 2024-07-12 00:50:08.000000 +0000
+++ TestEvents.py 2024-07-12 01:00:49.476504 +0000
@@ -343,14 +343,13 @@
if not restart:
self.stop_counter += 1
self.assertEqual(
stop_hook.StopHook.counter[self.instance],
self.stop_counter,
- "matching stop hook"
+ "matching stop hook",
)
-
-
+
if expected_state is not None:
self.assertEqual(
state, expected_state, "Primary thread got the correct event"
)
@@ -358,18 +357,14 @@
# listener:
success = self.shadow_listener.WaitForEvent(5, event)
self.assertTrue(success, "Shadow listener got event too")
shadow_event_type = event.GetType()
self.assertEqual(
- primary_event_type,
- shadow_event_type,
- "It was the same event type"
- )
- self.assertEqual(
- state,
- lldb.SBProcess.GetStateFromEvent(event),
- "It was the same state"
+ primary_event_type, shadow_event_type, "It was the same event type"
+ )
+ self.assertEqual(
+ state, lldb.SBProcess.GetStateFromEvent(event), "It was the same state"
)
self.assertEqual(
restart,
lldb.SBProcess.GetRestartedFromEvent(event),
"It was the same restarted",
@@ -413,29 +408,32 @@
# this instance of the stop hook:
self.instance = f"Key{random.randint(0,10000)}"
stop_hook_path = os.path.join(self.getSourceDir(), "stop_hook.py")
self.runCmd(f"command script import {stop_hook_path}")
import stop_hook
- self.runCmd(f"target stop-hook add -P stop_hook.StopHook -k instance -v {self.instance}")
+
+ self.runCmd(
+ f"target stop-hook add -P stop_hook.StopHook -k instance -v {self.instance}"
+ )
self.stop_counter = 0
-
+
self.process = target.Launch(launch_info, error)
self.assertSuccess(error, "Process launched successfully")
# Keep fetching events from the primary to trigger the do on removal and
# then from the shadow listener, and make sure they match:
# Events in the launch sequence might be platform dependent, so don't
# expect any particular event till we get the stopped:
state = lldb.eStateInvalid
-
+
while state != lldb.eStateStopped:
state, restart = self.wait_for_next_event(None, False)
-
+
# Okay, we're now at a good stop, so try a next:
self.cur_thread = self.process.threads[0]
-
+
# Make sure we're at our expected breakpoint:
self.assertTrue(self.cur_thread.IsValid(), "Got a zeroth thread")
self.assertEqual(self.cur_thread.stop_reason, lldb.eStopReasonBreakpoint)
self.assertEqual(
self.cur_thread.GetStopReasonDataCount(), 2, "Only one breakpoint/loc here"
``````````
</details>
https://github.com/llvm/llvm-project/pull/98571
More information about the lldb-commits
mailing list