diff options
| author | Jim Ingham <jingham@apple.com> | 2024-07-15 16:00:58 -0700 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2024-07-15 16:02:10 -0700 |
| commit | a7816c8e0086c1ae9b8ea15a6c252ca97f0405d1 (patch) | |
| tree | e8b94eedec88da0a31538e28058567b665f7acfc /lldb/test/API/python_api | |
| parent | bc1c84aee5b33c30e7bfe1e4a65a64650ec357db (diff) | |
| download | llvm-a7816c8e0086c1ae9b8ea15a6c252ca97f0405d1.zip llvm-a7816c8e0086c1ae9b8ea15a6c252ca97f0405d1.tar.gz llvm-a7816c8e0086c1ae9b8ea15a6c252ca97f0405d1.tar.bz2 | |
git add a test file from a previous commit.
A new file was added to the python_api/events test, but I forgot to
git add it before making the PR. The commit was:
44d9692e6a657ec46e98e4912ac56417da67cfee
Diffstat (limited to 'lldb/test/API/python_api')
| -rw-r--r-- | lldb/test/API/python_api/event/stop_hook.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/event/stop_hook.py b/lldb/test/API/python_api/event/stop_hook.py new file mode 100644 index 0000000..932fa91 --- /dev/null +++ b/lldb/test/API/python_api/event/stop_hook.py @@ -0,0 +1,35 @@ +import lldb +import time + +class StopHook: + # These dictionaries are used to pass data back to the test case. + # Since these are global, we need to know which test run is which. + # The test passes a key in the extra_args, we use that as the key + # for these dictionaries, and then the test can fetch out the right + # one. + counter = {} + non_stops = {} + def __init__(self, target, extra_args, dict): + self.target = target + self.regs = {} + self.instance = extra_args.GetValueForKey("instance").GetStringValue(100) + StopHook.counter[self.instance] = 0 + StopHook.non_stops[self.instance] = 0 + + def handle_stop(self, exe_ctx, stream): + import time + # All this stop hook does is sleep a bit and count. There was a bug + # where we were sending the secondary listener events when the + # private state thread's DoOnRemoval completed, rather than when + # the primary public process Listener consumes the event. That + # became really clear when a stop hook artificially delayed the + # delivery of the primary listener's event - since IT had to come + # after the stop hook ran. + time.sleep(0.5) + StopHook.counter[self.instance] += 1 + # When we were sending events too early, one symptom was the stop + # event would get triggered before the state had been changed. + # Watch for that here. + if exe_ctx.process.GetState() != lldb.eStateStopped: + StopHook.non_stops[self.instance] += 1 + |
