mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-14 09:17:57 +08:00
non-win: Add Multiprocess::SetExpectedChildTerminationBuiltinTrap()
Bug: crashpad:30 Change-Id: Ide7ad3d0f8b9938f57d183ff3fc73868ce28c02c Reviewed-on: https://chromium-review.googlesource.com/932363 Commit-Queue: Joshua Peraza <jperaza@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
61f1013ee4
commit
c69ba3d527
@ -92,6 +92,12 @@ class Multiprocess {
|
||||
//! expected to kill the child.
|
||||
void SetExpectedChildTermination(TerminationReason reason, int code);
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
//! \brief Sets termination reason and code appropriately for a child that
|
||||
//! terminates via `__builtin_trap()`.
|
||||
void SetExpectedChildTerminationBuiltinTrap();
|
||||
#endif // !OS_WIN
|
||||
|
||||
protected:
|
||||
~Multiprocess();
|
||||
|
||||
|
@ -86,6 +86,10 @@ void Multiprocess::SetExpectedChildTermination(TerminationReason reason,
|
||||
code_ = code;
|
||||
}
|
||||
|
||||
void Multiprocess::SetExpectedChildTerminationBuiltinTrap() {
|
||||
SetExpectedChildTermination(kTerminationNormal, -1);
|
||||
}
|
||||
|
||||
Multiprocess::~Multiprocess() {
|
||||
delete info_;
|
||||
}
|
||||
|
@ -98,6 +98,35 @@ TEST(MultiprocessExec, MultiprocessExecSimpleChildReturnsNonZero) {
|
||||
exec.Run();
|
||||
};
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
|
||||
CRASHPAD_CHILD_TEST_MAIN(BuiltinTrapChild) {
|
||||
__builtin_trap();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
class TestBuiltinTrapTermination final : public MultiprocessExec {
|
||||
public:
|
||||
TestBuiltinTrapTermination() {
|
||||
SetChildTestMainFunction("BuiltinTrapChild");
|
||||
SetExpectedChildTerminationBuiltinTrap();
|
||||
}
|
||||
|
||||
~TestBuiltinTrapTermination() = default;
|
||||
|
||||
private:
|
||||
void MultiprocessParent() override {}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TestBuiltinTrapTermination);
|
||||
};
|
||||
|
||||
TEST(MultiprocessExec, BuiltinTrapTermination) {
|
||||
TestBuiltinTrapTermination test;
|
||||
test.Run();
|
||||
}
|
||||
|
||||
#endif // !OS_WIN
|
||||
|
||||
} // namespace
|
||||
} // namespace test
|
||||
} // namespace crashpad
|
||||
|
@ -157,6 +157,14 @@ void Multiprocess::SetExpectedChildTermination(TerminationReason reason,
|
||||
code_ = code;
|
||||
}
|
||||
|
||||
void Multiprocess::SetExpectedChildTerminationBuiltinTrap() {
|
||||
#if defined(ARCH_CPU_ARM64)
|
||||
SetExpectedChildTermination(kTerminationSignal, SIGTRAP);
|
||||
#else
|
||||
SetExpectedChildTermination(kTerminationSignal, SIGILL);
|
||||
#endif
|
||||
}
|
||||
|
||||
Multiprocess::~Multiprocess() {
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user