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_SNAPSHOT_MINIDUMP_PROCESS_SNAPSHOT_MINIDUMP_H_ |
| 16 #define CRASHPAD_SNAPSHOT_MINIDUMP_PROCESS_SNAPSHOT_MINIDUMP_H_ |
| 17 |
| 18 #include <sys/time.h> |
| 19 #include <windows.h> |
| 20 #include <dbghelp.h> |
| 21 |
| 22 #include <map> |
| 23 #include <string> |
| 24 #include <vector> |
| 25 |
| 26 #include "base/basictypes.h" |
| 27 #include "minidump/minidump_extensions.h" |
| 28 #include "snapshot/exception_snapshot.h" |
| 29 #include "snapshot/module_snapshot.h" |
| 30 #include "snapshot/process_snapshot.h" |
| 31 #include "snapshot/system_snapshot.h" |
| 32 #include "snapshot/thread_snapshot.h" |
| 33 #include "util/file/file_reader.h" |
| 34 #include "util/misc/initialization_state_dcheck.h" |
| 35 |
| 36 namespace crashpad { |
| 37 |
| 38 //! \brief A ProcessSnapshot based on a minidump file. |
| 39 class ProcessSnapshotMinidump final : public ProcessSnapshot { |
| 40 public: |
| 41 ProcessSnapshotMinidump(); |
| 42 ~ProcessSnapshotMinidump() override; |
| 43 |
| 44 //! \brief Initializes the object. |
| 45 //! |
| 46 //! \param[in] file_reader A file reader corresponding to a minidump file. |
| 47 //! The file reader must support seeking. |
| 48 //! |
| 49 //! \return `true` if the snapshot could be created, `false` otherwise with |
| 50 //! an appropriate message logged. |
| 51 bool Initialize(FileReaderInterface* file_reader); |
| 52 |
| 53 // ProcessSnapshot: |
| 54 |
| 55 pid_t ProcessID() const override; |
| 56 pid_t ParentProcessID() const override; |
| 57 void SnapshotTime(timeval* snapshot_time) const override; |
| 58 void ProcessStartTime(timeval* start_time) const override; |
| 59 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; |
| 60 const std::map<std::string, std::string>& AnnotationsSimpleMap() |
| 61 const override; |
| 62 const SystemSnapshot* System() const override; |
| 63 std::vector<const ThreadSnapshot*> Threads() const override; |
| 64 std::vector<const ModuleSnapshot*> Modules() const override; |
| 65 const ExceptionSnapshot* Exception() const override; |
| 66 |
| 67 private: |
| 68 // Initializes data carried in a MinidumpCrashpadInfo stream on behalf of |
| 69 // Initialize(). |
| 70 void InitializeCrashpadInfo(); |
| 71 |
| 72 MINIDUMP_HEADER header_; |
| 73 std::vector<MINIDUMP_DIRECTORY> stream_directory_; |
| 74 std::map<MinidumpStreamType, const MINIDUMP_LOCATION_DESCRIPTOR*> stream_map_; |
| 75 MinidumpCrashpadInfo crashpad_info_; |
| 76 std::map<std::string, std::string> annotations_simple_map_; |
| 77 FileReaderInterface* file_reader_; // weak |
| 78 InitializationStateDcheck initialized_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(ProcessSnapshotMinidump); |
| 81 }; |
| 82 |
| 83 } // namespace crashpad |
| 84 |
| 85 #endif // CRASHPAD_SNAPSHOT_MINIDUMP_PROCESS_SNAPSHOT_MINIDUMP_H_ |
OLD | NEW |