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

Side by Side Diff: minidump/minidump_thread_writer.h

Issue 693933002: Add MinidumpThreadListWriter::InitializeFromSnapshot() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@minidump_init_from_snapshot_context_new
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 unified diff | Download patch
« no previous file with comments | « minidump/minidump_thread_id_map_test.cc ('k') | minidump/minidump_thread_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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_ 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_
16 #define CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_ 16 #define CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_
17 17
18 #include <dbghelp.h> 18 #include <dbghelp.h>
19 #include <stdint.h> 19 #include <stdint.h>
20 20
21 #include <vector> 21 #include <vector>
22 22
23 #include "base/basictypes.h" 23 #include "base/basictypes.h"
24 #include "base/memory/scoped_ptr.h" 24 #include "base/memory/scoped_ptr.h"
25 #include "minidump/minidump_stream_writer.h" 25 #include "minidump/minidump_stream_writer.h"
26 #include "minidump/minidump_thread_id_map.h"
26 #include "minidump/minidump_writable.h" 27 #include "minidump/minidump_writable.h"
27 #include "util/stdlib/pointer_container.h" 28 #include "util/stdlib/pointer_container.h"
28 29
29 namespace crashpad { 30 namespace crashpad {
30 31
31 class MinidumpContextWriter; 32 class MinidumpContextWriter;
32 class MinidumpMemoryListWriter; 33 class MinidumpMemoryListWriter;
33 class MinidumpMemoryWriter; 34 class MinidumpMemoryWriter;
35 class ThreadSnapshot;
34 36
35 //! \brief The writer for a MINIDUMP_THREAD object in a minidump file. 37 //! \brief The writer for a MINIDUMP_THREAD object in a minidump file.
36 //! 38 //!
37 //! Because MINIDUMP_THREAD objects only appear as elements of 39 //! Because MINIDUMP_THREAD objects only appear as elements of
38 //! MINIDUMP_THREAD_LIST objects, this class does not write any data on its own. 40 //! MINIDUMP_THREAD_LIST objects, this class does not write any data on its own.
39 //! It makes its MINIDUMP_THREAD data available to its MinidumpThreadListWriter 41 //! It makes its MINIDUMP_THREAD data available to its MinidumpThreadListWriter
40 //! parent, which writes it as part of a MINIDUMP_THREAD_LIST. 42 //! parent, which writes it as part of a MINIDUMP_THREAD_LIST.
41 class MinidumpThreadWriter final : public internal::MinidumpWritable { 43 class MinidumpThreadWriter final : public internal::MinidumpWritable {
42 public: 44 public:
43 MinidumpThreadWriter(); 45 MinidumpThreadWriter();
44 ~MinidumpThreadWriter() override; 46 ~MinidumpThreadWriter() override;
45 47
48 //! \brief Initializes the MINIDUMP_THREAD based on \a thread_snapshot.
49 //!
50 //! \param[in] thread_snapshot The thread snapshot to use as source data.
51 //! \param[in] thread_id_map A MinidumpThreadIDMap to be consulted to
52 //! determine the 32-bit minidump thread ID to use for \a thread_snapshot.
53 //!
54 //! \note Valid in #kStateMutable. No mutator methods may be called before
55 //! this method, and it is not normally necessary to call any mutator
56 //! methods after this method.
57 void InitializeFromSnapshot(const ThreadSnapshot* thread_snapshot,
58 const MinidumpThreadIDMap* thread_id_map);
59
46 //! \brief Returns a MINIDUMP_THREAD referencing this object’s data. 60 //! \brief Returns a MINIDUMP_THREAD referencing this object’s data.
47 //! 61 //!
48 //! This method is expected to be called by a MinidumpThreadListWriter in 62 //! This method is expected to be called by a MinidumpThreadListWriter in
49 //! order to obtain a MINIDUMP_THREAD to include in its list. 63 //! order to obtain a MINIDUMP_THREAD to include in its list.
50 //! 64 //!
51 //! \note Valid in #kStateWritable. 65 //! \note Valid in #kStateWritable.
52 const MINIDUMP_THREAD* MinidumpThread() const; 66 const MINIDUMP_THREAD* MinidumpThread() const;
53 67
54 //! \brief Returns a MinidumpMemoryWriter that will write the memory region 68 //! \brief Returns a MinidumpMemoryWriter that will write the memory region
55 //! corresponding to this object’s stack. 69 //! corresponding to this object’s stack.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadWriter); 134 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadWriter);
121 }; 135 };
122 136
123 //! \brief The writer for a MINIDUMP_THREAD_LIST stream in a minidump file, 137 //! \brief The writer for a MINIDUMP_THREAD_LIST stream in a minidump file,
124 //! containing a list of MINIDUMP_THREAD objects. 138 //! containing a list of MINIDUMP_THREAD objects.
125 class MinidumpThreadListWriter final : public internal::MinidumpStreamWriter { 139 class MinidumpThreadListWriter final : public internal::MinidumpStreamWriter {
126 public: 140 public:
127 MinidumpThreadListWriter(); 141 MinidumpThreadListWriter();
128 ~MinidumpThreadListWriter() override; 142 ~MinidumpThreadListWriter() override;
129 143
144 //! \brief Adds an initialized MINIDUMP_THREAD for each thread in \a
145 //! thread_snapshots to the MINIDUMP_THREAD_LIST.
146 //!
147 //! \param[in] thread_snapshots The thread snapshots to use as source data.
148 //! \param[out] thread_id_map A MinidumpThreadIDMap to be built by this
149 //! method. This map must be empty when this method is called.
150 //!
151 //! \note Valid in #kStateMutable. AddThread() may not be called before this
152 //! method, and it is not normally necessary to call AddThread() after
153 //! this method.
154 void InitializeFromSnapshot(
155 const std::vector<const ThreadSnapshot*>& thread_snapshots,
156 MinidumpThreadIDMap* thread_id_map);
157
130 //! \brief Sets the MinidumpMemoryListWriter that each thread’s stack memory 158 //! \brief Sets the MinidumpMemoryListWriter that each thread’s stack memory
131 //! region should be added to as extra memory. 159 //! region should be added to as extra memory.
132 //! 160 //!
133 //! Each MINIDUMP_THREAD object can contain a reference to a 161 //! Each MINIDUMP_THREAD object can contain a reference to a
134 //! MinidumpMemoryWriter object that contains a snapshot of its stack memory. 162 //! MinidumpMemoryWriter object that contains a snapshot of its stack memory.
135 //! In the overall tree of internal::MinidumpWritable objects, these 163 //! In the overall tree of internal::MinidumpWritable objects, these
136 //! MinidumpMemoryWriter objects are considered children of their 164 //! MinidumpMemoryWriter objects are considered children of their
137 //! MINIDUMP_THREAD, and are referenced by a MINIDUMP_MEMORY_DESCRIPTOR 165 //! MINIDUMP_THREAD, and are referenced by a MINIDUMP_MEMORY_DESCRIPTOR
138 //! contained in the MINIDUMP_THREAD. It is also possible for the same memory 166 //! contained in the MINIDUMP_THREAD. It is also possible for the same memory
139 //! regions to have MINIDUMP_MEMORY_DESCRIPTOR objects present in a 167 //! regions to have MINIDUMP_MEMORY_DESCRIPTOR objects present in a
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 MINIDUMP_THREAD_LIST thread_list_base_; 204 MINIDUMP_THREAD_LIST thread_list_base_;
177 PointerVector<MinidumpThreadWriter> threads_; 205 PointerVector<MinidumpThreadWriter> threads_;
178 MinidumpMemoryListWriter* memory_list_writer_; // weak 206 MinidumpMemoryListWriter* memory_list_writer_; // weak
179 207
180 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadListWriter); 208 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadListWriter);
181 }; 209 };
182 210
183 } // namespace crashpad 211 } // namespace crashpad
184 212
185 #endif // CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_ 213 #endif // CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_
OLDNEW
« no previous file with comments | « minidump/minidump_thread_id_map_test.cc ('k') | minidump/minidump_thread_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698