Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Unified Diff: util/mach/exc_server_variants.h

Issue 1049023003: Add ExcServerCopyState() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/mac/catch_exception_tool.cc ('k') | util/mach/exc_server_variants.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/exc_server_variants.h
diff --git a/util/mach/exc_server_variants.h b/util/mach/exc_server_variants.h
index d5d5cc54a09bcf6c9e1c41ea593a0702ff2305d5..3109ca0d2280e520e037329397c6160f52f89640 100644
--- a/util/mach/exc_server_variants.h
+++ b/util/mach/exc_server_variants.h
@@ -199,6 +199,43 @@ exception_type_t ExcCrashRecoverOriginalException(
kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior,
bool set_thread_state);
+//! \brief Copies the old state to the new state for state-carrying exceptions.
+//!
+//! When the kernel sends a state-carrying exception request and the response is
+//! successful (`MACH_MSG_SUCCESS`, a synonym for `KERN_SUCCESS`), it will set
+//! a new thread state based on \a new_state and \a new_state_count. To ease
+//! initialization of the new state, this function copies \a old_state and
+//! \a old_state_count. This is only done if \a behavior indicates a
+//! state-carrying exception.
+//!
+//! \param[in] behavior The behavior of the exception handler as invoked. This
+//! may be taken directly from the \a behavior parameter of
+//! internal::SimplifiedExcServer::Interface::CatchException(), for example.
+//! \param[in] old_state The original state value. This may be taken directly
+//! from the \a old_state parameter of
+//! internal::SimplifiedExcServer::Interface::CatchException(), for example.
+//! \param[in] old_state_count The number of significant `natural_t` words in \a
+//! old_state. This may be taken directly from the \a old_state_count
+//! parameter of internal::SimplifiedExcServer::Interface::CatchException(),
+//! for example.
+//! \param[out] new_state The state value to be set. This may be taken directly
+//! from the \a new_state parameter of
+//! internal::SimplifiedExcServer::Interface::CatchException(), for example.
+//! This parameter is untouched if \a behavior is not state-carrying.
+//! \param[inout] new_state_count On entry, the number of `natural_t` words
+//! available to be written to in \a new_state. On return, the number of
+//! significant `natural_t` words in \a new_state. This may be taken
+//! directly from the \a new_state_count parameter of
+//! internal::SimplifiedExcServer::Interface::CatchException(), for example.
+//! This parameter is untouched if \a behavior is not state-carrying. If \a
+//! \a behavior is state-carrying, this parameter should be at least as
+//! large as \a old_state_count.
+void ExcServerCopyState(exception_behavior_t behavior,
+ const natural_t* old_state,
+ mach_msg_type_number_t old_state_count,
+ thread_state_t new_state,
+ mach_msg_type_number_t* new_state_count);
+
} // namespace crashpad
#endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_
« no previous file with comments | « tools/mac/catch_exception_tool.cc ('k') | util/mach/exc_server_variants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698