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

Side by Side Diff: minidump/minidump_memory_writer.h

Issue 641603006: Add MinidumpMemoryListWriter::AddFromSnapshot(), everything downstream and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Correctly look for the last memory range at EOF 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 unified diff | Download patch
« no previous file with comments | « no previous file | minidump/minidump_memory_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 11 matching lines...) Expand all
22 #include <vector> 22 #include <vector>
23 23
24 #include "base/basictypes.h" 24 #include "base/basictypes.h"
25 #include "base/memory/scoped_ptr.h" 25 #include "base/memory/scoped_ptr.h"
26 #include "minidump/minidump_stream_writer.h" 26 #include "minidump/minidump_stream_writer.h"
27 #include "minidump/minidump_writable.h" 27 #include "minidump/minidump_writable.h"
28 #include "util/stdlib/pointer_container.h" 28 #include "util/stdlib/pointer_container.h"
29 29
30 namespace crashpad { 30 namespace crashpad {
31 31
32 class MemorySnapshot;
33
32 //! \brief The base class for writers of memory ranges pointed to by 34 //! \brief The base class for writers of memory ranges pointed to by
33 //! MINIDUMP_MEMORY_DESCRIPTOR objects in a minidump file. 35 //! MINIDUMP_MEMORY_DESCRIPTOR objects in a minidump file.
34 //! 36 //!
35 //! This is an abstract base class because users are expected to provide their 37 //! This is an abstract base class because users are expected to provide their
36 //! own implementations that, when possible, obtain the memory contents 38 //! own implementations that, when possible, obtain the memory contents
37 //! on-demand in their WriteObject() methods. Memory ranges may be large, and 39 //! on-demand in their WriteObject() methods. Memory ranges may be large, and
38 //! the alternative construction would require the contents of multiple ranges 40 //! the alternative construction would require the contents of multiple ranges
39 //! to be held in memory simultaneously while a minidump file is being written. 41 //! to be held in memory simultaneously while a minidump file is being written.
40 class MinidumpMemoryWriter : public internal::MinidumpWritable { 42 class MinidumpMemoryWriter : public internal::MinidumpWritable {
41 public: 43 public:
42 ~MinidumpMemoryWriter() override; 44 ~MinidumpMemoryWriter() override;
43 45
46 //! \brief Creates a concrete initialized MinidumpMemoryWriter based on \a
47 //! memory_snapshot.
48 //!
49 //! \param[in] memory_snapshot The memory snapshot to use as source data.
50 //!
51 //! \return An object of a MinidumpMemoryWriter subclass initialized using the
52 //! source data in \a memory_snapshot.
53 static scoped_ptr<MinidumpMemoryWriter> CreateFromSnapshot(
54 const MemorySnapshot* memory_snapshot);
55
44 //! \brief Returns a MINIDUMP_MEMORY_DESCRIPTOR referencing the data that this 56 //! \brief Returns a MINIDUMP_MEMORY_DESCRIPTOR referencing the data that this
45 //! object writes. 57 //! object writes.
46 //! 58 //!
47 //! This method is expected to be called by a MinidumpMemoryListWriter in 59 //! This method is expected to be called by a MinidumpMemoryListWriter in
48 //! order to obtain a MINIDUMP_MEMORY_DESCRIPTOR to include in its list. 60 //! order to obtain a MINIDUMP_MEMORY_DESCRIPTOR to include in its list.
49 //! 61 //!
50 //! \note Valid in #kStateWritable. 62 //! \note Valid in #kStateWritable.
51 const MINIDUMP_MEMORY_DESCRIPTOR* MinidumpMemoryDescriptor() const; 63 const MINIDUMP_MEMORY_DESCRIPTOR* MinidumpMemoryDescriptor() const;
52 64
53 //! \brief Registers a memory descriptor as one that should point to the 65 //! \brief Registers a memory descriptor as one that should point to the
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryWriter); 126 DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryWriter);
115 }; 127 };
116 128
117 //! \brief The writer for a MINIDUMP_MEMORY_LIST stream in a minidump file, 129 //! \brief The writer for a MINIDUMP_MEMORY_LIST stream in a minidump file,
118 //! containing a list of MINIDUMP_MEMORY_DESCRIPTOR objects. 130 //! containing a list of MINIDUMP_MEMORY_DESCRIPTOR objects.
119 class MinidumpMemoryListWriter final : public internal::MinidumpStreamWriter { 131 class MinidumpMemoryListWriter final : public internal::MinidumpStreamWriter {
120 public: 132 public:
121 MinidumpMemoryListWriter(); 133 MinidumpMemoryListWriter();
122 ~MinidumpMemoryListWriter() override; 134 ~MinidumpMemoryListWriter() override;
123 135
136 //! \brief Adds a concrete initialized MinidumpMemoryWriter for each memory
137 //! snapshot in \a memory_snapshots to the MINIDUMP_MEMORY_LIST.
138 //!
139 //! Memory snapshots are added in the fashion of AddMemory().
140 //!
141 //! \param[in] memory_snapshots The memory snapshots to use as source data.
142 //!
143 //! \note Valid in #kStateMutable.
144 void AddFromSnapshot(
145 const std::vector<const MemorySnapshot*>& memory_snapshots);
146
124 //! \brief Adds a MinidumpMemoryWriter to the MINIDUMP_MEMORY_LIST. 147 //! \brief Adds a MinidumpMemoryWriter to the MINIDUMP_MEMORY_LIST.
125 //! 148 //!
126 //! This object takes ownership of \a memory_writer and becomes its parent in 149 //! This object takes ownership of \a memory_writer and becomes its parent in
127 //! the overall tree of internal::MinidumpWritable objects. 150 //! the overall tree of internal::MinidumpWritable objects.
128 //! 151 //!
129 //! \note Valid in #kStateMutable. 152 //! \note Valid in #kStateMutable.
130 void AddMemory(scoped_ptr<MinidumpMemoryWriter> memory_writer); 153 void AddMemory(scoped_ptr<MinidumpMemoryWriter> memory_writer);
131 154
132 //! \brief Adds a MinidumpMemoryWriter that’s a child of another 155 //! \brief Adds a MinidumpMemoryWriter that’s a child of another
133 //! internal::MinidumpWritable object to the MINIDUMP_MEMORY_LIST. 156 //! internal::MinidumpWritable object to the MINIDUMP_MEMORY_LIST.
(...skipping 25 matching lines...) Expand all
159 MINIDUMP_MEMORY_LIST memory_list_base_; 182 MINIDUMP_MEMORY_LIST memory_list_base_;
160 std::vector<MinidumpMemoryWriter*> memory_writers_; // weak 183 std::vector<MinidumpMemoryWriter*> memory_writers_; // weak
161 PointerVector<MinidumpMemoryWriter> children_; 184 PointerVector<MinidumpMemoryWriter> children_;
162 185
163 DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryListWriter); 186 DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryListWriter);
164 }; 187 };
165 188
166 } // namespace crashpad 189 } // namespace crashpad
167 190
168 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MEMORY_WRITER_H_ 191 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MEMORY_WRITER_H_
OLDNEW
« no previous file with comments | « no previous file | minidump/minidump_memory_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698