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

Unified Diff: minidump/minidump_context_writer.h

Issue 686353004: Add MinidumpContextWriter::CreateFromSnapshot(), everything downstream, and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 1 month 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 | « minidump/minidump_context.h ('k') | minidump/minidump_context_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_context_writer.h
diff --git a/minidump/minidump_context_writer.h b/minidump/minidump_context_writer.h
index 070f3cff7d8ae19bd059cff2cde7938292b4b85e..e48650e32c8c2691a2f1bda25c4b3f0768ca9ab7 100644
--- a/minidump/minidump_context_writer.h
+++ b/minidump/minidump_context_writer.h
@@ -18,17 +18,34 @@
#include <sys/types.h>
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "minidump/minidump_context.h"
#include "minidump/minidump_writable.h"
namespace crashpad {
+struct CPUContext;
+struct CPUContextX86;
+struct CPUContextX86_64;
+
//! \brief The base class for writers of CPU context structures in minidump
//! files.
class MinidumpContextWriter : public internal::MinidumpWritable {
public:
~MinidumpContextWriter() override;
+ //! \brief Creates a MinidumpContextWriter based on \a context_snapshot.
+ //!
+ //! \param[in] context_snapshot The context snapshot to use as source data.
+ //!
+ //! \return A MinidumpContextWriter subclass, such as MinidumpContextWriterX86
+ //! or MinidumpContextWriterAMD64, appropriate to the CPU type of \a
+ //! context_snapshot. The returned object is initialized using the source
+ //! data in \a context_snapshot. If \a context_snapshot is an unknown CPU
+ //! type’s context, logs a message and returns `nullptr`.
+ static scoped_ptr<MinidumpContextWriter> CreateFromSnapshot(
+ const CPUContext* context_snapshot);
+
protected:
MinidumpContextWriter() : MinidumpWritable() {}
@@ -52,6 +69,15 @@ class MinidumpContextX86Writer final : public MinidumpContextWriter {
MinidumpContextX86Writer();
~MinidumpContextX86Writer() override;
+ //! \brief Initializes the MinidumpContextX86 based on \a context_snapshot.
+ //!
+ //! \param[in] context_snapshot The context snapshot to use as source data.
+ //!
+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
+ //! calling this method, and it is not normally necessary to alter
+ //! context() after calling this method.
+ void InitializeFromSnapshot(const CPUContextX86* context_snapshot);
+
//! \brief Returns a pointer to the context structure that this object will
//! write.
//!
@@ -83,6 +109,15 @@ class MinidumpContextAMD64Writer final : public MinidumpContextWriter {
MinidumpContextAMD64Writer();
~MinidumpContextAMD64Writer() override;
+ //! \brief Initializes the MinidumpContextAMD64 based on \a context_snapshot.
+ //!
+ //! \param[in] context_snapshot The context snapshot to use as source data.
+ //!
+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
+ //! calling this method, and it is not normally necessary to alter
+ //! context() after calling this method.
+ void InitializeFromSnapshot(const CPUContextX86_64* context_snapshot);
+
//! \brief Returns a pointer to the context structure that this object will
//! write.
//!
« no previous file with comments | « minidump/minidump_context.h ('k') | minidump/minidump_context_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698