This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [test] Use raise(SIGSTOP) instead of trap in fork tests
ClosedPublic

Authored by mgorny on Jun 28 2022, 10:24 PM.

Details

Summary

Replace the use of "trap" with a new "stop" command in fork tests,
that maps to raise(SIGSTOP). Since traps do not increment PC on some
architectures (notably ARM), using traps would require special logic
to increment it while testing. Using SIGSTOP avoids the problem
and is probably more logical, given that the purpose of the "trap"s
was to simply stop the inferior at a synchronization point. This fixes
tests on AArch64 (and possibly ARM, I'll update XFAILs when it is
confirmed by the buildbot).

Sponsored by: The FreeBSD Foundation

Diff Detail

Event Timeline

mgorny created this revision.Jun 28 2022, 10:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2022, 10:24 PM
mgorny requested review of this revision.Jun 28 2022, 10:24 PM
labath accepted this revision.Jun 29 2022, 1:46 AM
labath added inline comments.
lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
157

SIGSTOP is 17 (0x11) on macos. Maybe you could check for "reason:signal" instead?

This revision is now accepted and ready to land.Jun 29 2022, 1:46 AM
mgorny marked an inline comment as done.Jun 29 2022, 5:52 AM
mgorny added inline comments.
lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
157

I don't think macos is really relevant but you're right. I've forgotten that we haven't changed lldb-server to use normalized signos. I'll fix all the tests not to rely on specific signos.

mgorny marked an inline comment as done.Jun 29 2022, 6:37 AM
mgorny added inline comments.
lldb/test/API/tools/lldb-server/main.cpp
357

Changing this to arg == "stop", as right now it unintentionally matches stuff like "stop-me-now" that other tests use as output.

Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 6:38 AM