diff options
| author | Jim Ingham <jingham@apple.com> | 2019-02-23 00:13:25 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2019-02-23 00:13:25 +0000 |
| commit | ff8c7a0947663ce7515f0b8ee52b9d0fe8883bc3 (patch) | |
| tree | aa2c285e2f294cc7b0620c84c9f4f726677c8a21 /lldb/lit/ExecControl/StopHook/Inputs | |
| parent | 275d15ecf3476b7f884174e1c85f4894fb815bf1 (diff) | |
| download | bcm5719-llvm-ff8c7a0947663ce7515f0b8ee52b9d0fe8883bc3.tar.gz bcm5719-llvm-ff8c7a0947663ce7515f0b8ee52b9d0fe8883bc3.zip | |
Make sure that stop-hooks run asynchronously.
They aren't designed to nest recursively, so this will prevent that.
Also add a --auto-continue flag, putting "continue" in the stop hook makes
the stop hooks fight one another in multi-threaded programs.
Also allow more than one -o options so you can make more complex stop hooks w/o
having to go into the editor.
<rdar://problem/48115661>
Differential Revision: https://reviews.llvm.org/D58394
llvm-svn: 354706
Diffstat (limited to 'lldb/lit/ExecControl/StopHook/Inputs')
5 files changed, 13 insertions, 8 deletions
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit index 13de5fb60bc..31817bdaaa5 100644 --- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit +++ b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit @@ -1 +1 @@ -target stop-hook add -f stop-hook.c -l 29 -e 34 -o "expr ptr"
\ No newline at end of file +target stop-hook add -f stop-hook.c -l 29 -e 34 -o "expr ptr" diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit index b4dcda2f88f..36e144deecc 100644 --- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit +++ b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit @@ -1,3 +1,3 @@ target stop-hook add -f stop-hook.c -l 29 -e 34 expr ptr -DONE
\ No newline at end of file +DONE diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit index f192d9952e9..004bd34abfb 100644 --- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit +++ b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit @@ -1,7 +1,7 @@ +break set -f stop-hook-threads.cpp -p "Break here to set up the stop hook" break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook" run -target stop-hook add -frame variable --show-globals g_val +target stop-hook add -G true +expr lldb_val += 1 thread list -continue DONE diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit index 467f60b1e1e..3b7d23953c3 100644 --- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit +++ b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit @@ -1,4 +1,5 @@ +break set -f stop-hook-threads.cpp -p "Break here to set up the stop hook" break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook" run -target stop-hook add -x 2 -o "frame variable thread_index" -target stop-hook add -o continue +target stop-hook add -x 2 -o "expr lldb_val += 1" -o "thread list" +target stop-hook add -G true -o "script print('Hit stop hook') diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp index 5b6f31edd1b..e653f5ff518 100644 --- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp +++ b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp @@ -16,6 +16,7 @@ std::default_random_engine g_random_engine{std::random_device{}()}; std::uniform_int_distribution<> g_distribution{0, 3000}; uint32_t g_val = 0; +uint32_t lldb_val = 0; uint32_t access_pool (bool flag = false) @@ -62,7 +63,8 @@ thread_func (uint32_t thread_index) int main (int argc, char const *argv[]) { std::thread threads[3]; - + // Break here to set up the stop hook + printf("Stop hooks engaged.\n"); // Create 3 threads for (auto &thread : threads) thread = std::thread{thread_func, std::distance(threads, &thread)}; @@ -71,5 +73,7 @@ int main (int argc, char const *argv[]) for (auto &thread : threads) thread.join(); + // print lldb_val so we can check it here. + printf ("lldb_val was set to: %d.\n", lldb_val); return 0; } |

