<trclass="memdesc:af7fdf8f0dca2bb2a34397d58283d3676"><tdclass="mdescLeft"> </td><tdclass="mdescRight">In a test child process, arranges to swallow <code>EXC_CRASH</code> and <code>EXC_CORPSE_NOTIFY</code> exceptions. <ahref="#af7fdf8f0dca2bb2a34397d58283d3676">More...</a><br/></td></tr>
<divclass="textblock"><p>Swallows <code>EXC_CRASH</code> and <code>EXC_CORPSE_NOTIFY</code> exceptions in test child processes. </p>
<p>This class is intended to be used by test code that crashes intentionally.</p>
<p>On macOS, the system’s crash reporter normally saves crash reports for all crashes in test code, by virtue of being set as the <code>EXC_CRASH</code> or <code>EXC_CORPSE_NOTIFY</code> handler. This litters the user’s <code>~/Library/Logs/DiagnosticReports</code> directory and can be time-consuming. Reports generated for code that crashes intentionally have no value, and many Crashpad tests do crash intentionally.</p>
<p>Instantiate an <aclass="el"href="classcrashpad_1_1test_1_1ExceptionSwallower.html"title="Swallows EXC_CRASH and EXC_CORPSE_NOTIFY exceptions in test child processes. ">ExceptionSwallower</a> object in a parent test process (a process where <code>TEST()</code>, <code>TEST_F()</code>, and <code>TEST_P()</code> execute) to create an exception swallower server running on a dedicated thread. A service mapping for this server will be published with the bootstrap server and made available in the <code>CRASHPAD_EXCEPTION_SWALLOWER_SERVICE</code> environment variable. In a child process, call <aclass="el"href="classcrashpad_1_1test_1_1ExceptionSwallower.html#af7fdf8f0dca2bb2a34397d58283d3676"title="In a test child process, arranges to swallow EXC_CRASH and EXC_CORPSE_NOTIFY exceptions. ">SwallowExceptions()</a> to look up this service and set it as the <code>EXC_CRASH</code> and <code>EXC_CORPSE_NOTIFY</code> handler. When these exceptions are raised in the child process, they’ll be handled by the exception swallower server, which performs no action but reports that exceptions were successfully handled so that the system’s crash reporter, ReportCrash, will not be invoked.</p>
<p>At most one <aclass="el"href="classcrashpad_1_1test_1_1ExceptionSwallower.html"title="Swallows EXC_CRASH and EXC_CORPSE_NOTIFY exceptions in test child processes. ">ExceptionSwallower</a> may be instantiated in a process at a time. If <code>CRASHPAD_EXCEPTION_SWALLOWER_SERVICE</code> is already set, <aclass="el"href="classcrashpad_1_1test_1_1ExceptionSwallower.html"title="Swallows EXC_CRASH and EXC_CORPSE_NOTIFY exceptions in test child processes. ">ExceptionSwallower</a> leaves it in place and takes no additional action.</p>
<p>Crashpad’s <aclass="el"href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e"title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a>, <aclass="el"href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f"title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a>, <aclass="el"href="gtest__death_8h.html#a11ab1a718cd7a7ed56b7e2fbd2c36f74"title="Wraps the ASSERT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">ASSERT_DEATH_CHECK()</a>, and <aclass="el"href="gtest__death_8h.html#aa4bd7e1dbfc8862448a4b0fb66790e50"title="Wraps the EXPECT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">EXPECT_DEATH_CHECK()</a> macros make use of this class on macOS, as does the <aclass="el"href="classcrashpad_1_1test_1_1Multiprocess.html"title="Manages a multiprocess test. ">Multiprocess</a> test interface. </p>
</div><h2class="groupheader">Member Function Documentation</h2>
<p>In a test child process, arranges to swallow <code>EXC_CRASH</code> and <code>EXC_CORPSE_NOTIFY</code> exceptions. </p>
<p>This must be called in a test child process. It must not be called from a parent test process directly. Parent test processes are those that execute <code>TEST()</code>, <code>TEST_F()</code>, and <code>TEST_P()</code>. Test child processes execute <aclass="el"href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e"title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a>, <aclass="el"href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f"title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a>, <aclass="el"href="gtest__death_8h.html#a11ab1a718cd7a7ed56b7e2fbd2c36f74"title="Wraps the ASSERT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">ASSERT_DEATH_CHECK()</a>, <aclass="el"href="gtest__death_8h.html#aa4bd7e1dbfc8862448a4b0fb66790e50"title="Wraps the EXPECT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">EXPECT_DEATH_CHECK()</a>, and Multiprocess::RunChild().</p>
<p>It is an error to call this in a test child process without having first instantiated an <aclass="el"href="classcrashpad_1_1test_1_1ExceptionSwallower.html"title="Swallows EXC_CRASH and EXC_CORPSE_NOTIFY exceptions in test child processes. ">ExceptionSwallower</a> object in a parent test project. It is also an error to call this in a parent test process. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>test/mac/exception_swallower.h</li>
<li>test/mac/exception_swallower.cc</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hrclass="footer"/><addressclass="footer"><small>
Generated by  <ahref="http://www.doxygen.org/index.html">