Add a test for debugserver handling threads suspended from within a program.
authorJim Ingham <jingham@apple.com>
Thu, 13 Feb 2020 23:48:38 +0000 (15:48 -0800)
committerJim Ingham <jingham@apple.com>
Thu, 13 Feb 2020 23:48:38 +0000 (15:48 -0800)
commit4570f2c7cf35388d8b3ab9cc5cdcad4971e31cf2
tree00e9d99cca1c0f096eae4e60b1e42c3711d6bab3
parentb21c7999520a83aedcffb7e3f9399bb3603cfcca
Add a test for debugserver handling threads suspended from within a program.

Mach allows you to suspend and resume other threads within a program, so
debugserver has to be careful not to interfere with this when it goes to supend and
resume threads while stepping over breakpoints and calling functions.  Even
trickier, if you call a function on a suspended thread, it has to resume the
thread to get the expression to run, and then suspend it properly when done.

This all works already, but there wasn't a test for it.  Adding that here.

This same test could be written for a unix that supports pthread_{suspend,resume}_np, but
macOS doesn't support these calls, only the mach version.  It doesn't look like
a lot of Linux'es support this (AIX does apparently...)  And IIUC Windows allows
you to suspend and resume other threads, but the code for that would look pretty
different than this main.c.  So for simplicity's sake I wrote this test for Darwin-only.
lldb/test/API/macosx/thread_suspend/Makefile [new file with mode: 0644]
lldb/test/API/macosx/thread_suspend/TestInternalThreadSuspension.py [new file with mode: 0644]
lldb/test/API/macosx/thread_suspend/main.c [new file with mode: 0644]