OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_HANDLE_WRITER_H_ |
| 16 #define CRASHPAD_MINIDUMP_MINIDUMP_HANDLE_WRITER_H_ |
| 17 |
| 18 #include <windows.h> |
| 19 #include <dbghelp.h> |
| 20 |
| 21 #include <vector> |
| 22 |
| 23 #include "minidump/minidump_stream_writer.h" |
| 24 #include "minidump/minidump_string_writer.h" |
| 25 #include "minidump/minidump_writable.h" |
| 26 #include "snapshot/handle_snapshot.h" |
| 27 #include "util/stdlib/pointer_container.h" |
| 28 |
| 29 namespace crashpad { |
| 30 |
| 31 //! \brief The writer for a MINIDUMP_HANDLE_DATA_STREAM stream in a minidump |
| 32 //! and its contained MINIDUMP_HANDLE_DESCRIPTOR s. |
| 33 //! |
| 34 //! As we currently do not track any data beyond what MINIDUMP_HANDLE_DESCRIPTOR |
| 35 //! supports, we only write that type of record rather than the newer |
| 36 //! MINIDUMP_HANDLE_DESCRIPTOR_2. |
| 37 //! |
| 38 //! Note that this writer writes both the header (MINIDUMP_HANDLE_DATA_STREAM) |
| 39 //! and the list of objects (MINIDUMP_HANDLE_DESCRIPTOR), which is different |
| 40 //! from some of the other list writers. |
| 41 class MinidumpHandleDataWriter final : public internal::MinidumpStreamWriter { |
| 42 public: |
| 43 MinidumpHandleDataWriter(); |
| 44 ~MinidumpHandleDataWriter() override; |
| 45 |
| 46 //! \brief Adds a MINIDUMP_HANDLE_DESCRIPTOR for each handle in \a |
| 47 //! handle_snapshot to the MINIDUMP_HANDLE_DATA_STREAM. |
| 48 //! |
| 49 //! \param[in] handle_snapshots The handle snapshots to use as source data. |
| 50 //! |
| 51 //! \note Valid in #kStateMutable. |
| 52 void InitializeFromSnapshot( |
| 53 const std::vector<HandleSnapshot>& handle_snapshots); |
| 54 |
| 55 protected: |
| 56 // MinidumpWritable: |
| 57 bool Freeze() override; |
| 58 size_t SizeOfObject() override; |
| 59 std::vector<MinidumpWritable*> Children() override; |
| 60 bool WriteObject(FileWriterInterface* file_writer) override; |
| 61 |
| 62 // MinidumpStreamWriter: |
| 63 MinidumpStreamType StreamType() const override; |
| 64 |
| 65 private: |
| 66 MINIDUMP_HANDLE_DATA_STREAM handle_data_stream_base_; |
| 67 std::vector<MINIDUMP_HANDLE_DESCRIPTOR> handle_descriptors_; |
| 68 PointerVector<internal::MinidumpUTF16StringWriter> strings_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(MinidumpHandleDataWriter); |
| 71 }; |
| 72 |
| 73 } // namespace crashpad |
| 74 |
| 75 #endif // CRASHPAD_MINIDUMP_MINIDUMP_HANDLE_WRITER_H_ |
OLD | NEW |