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

Side by Side Diff: snapshot/minidump/module_snapshot_minidump.h

Issue 972383002: snapshot: Add a minimal ModuleSnapshotMinidump and accessor from ProcessSnapshotMinidump (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Add NOTREACHED() comments Created 5 years, 9 months 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
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 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_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ 15 #ifndef CRASHPAD_SNAPSHOT_MINIDUMP_MODULE_SNAPSHOT_MINIDUMP_H_
16 #define CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ 16 #define CRASHPAD_SNAPSHOT_MINIDUMP_MODULE_SNAPSHOT_MINIDUMP_H_
17 17
18 #include <windows.h>
19 #include <dbghelp.h>
18 #include <stdint.h> 20 #include <stdint.h>
19 #include <sys/types.h> 21 #include <sys/types.h>
20 22
21 #include <map> 23 #include <map>
22 #include <string> 24 #include <string>
23 #include <vector> 25 #include <vector>
24 26
25 #include "base/basictypes.h" 27 #include "base/basictypes.h"
26 #include "snapshot/mac/process_reader.h"
27 #include "snapshot/module_snapshot.h" 28 #include "snapshot/module_snapshot.h"
29 #include "util/file/file_reader.h"
28 #include "util/misc/initialization_state_dcheck.h" 30 #include "util/misc/initialization_state_dcheck.h"
29 31
30 namespace crashpad { 32 namespace crashpad {
31
32 class MachOImageReader;
33 struct UUID;
34
35 namespace internal { 33 namespace internal {
36 34
37 //! \brief A ModuleSnapshot of a code module (binary image) loaded into a 35 //! \brief A ModuleSnapshot based on a module in a minidump file.
38 //! running (or crashed) process on a Mac OS X system. 36 class ModuleSnapshotMinidump final : public ModuleSnapshot {
39 class ModuleSnapshotMac final : public ModuleSnapshot {
40 public: 37 public:
41 ModuleSnapshotMac(); 38 ModuleSnapshotMinidump();
42 ~ModuleSnapshotMac() override; 39 ~ModuleSnapshotMinidump() override;
43 40
44 //! \brief Initializes the object. 41 //! \brief Initializes the object.
45 //! 42 //!
46 //! \param[in] process_reader A ProcessReader for the task containing the 43 //! \param[in] file_reader A file reader corresponding to a minidump file.
47 //! module. 44 //! The file reader must support seeking.
48 //! \param[in] process_reader_module The module within the ProcessReader for 45 //! \param[in] minidump_module_rva The file offset in \a file_reader at which
49 //! which the snapshot should be created. 46 //! the module’s MINIDUMP_MODULE structure is located.
47 //! \param[in] minidump_crashpad_module_info_location The location in \a
48 //! file_reader at which the module’s corresponding
49 //! MinidumpModuleCrashpadInfo structure is located. If no such
50 //! corresponding structure is available for a module, this may be
51 //! `nullptr`.
50 //! 52 //!
51 //! \return `true` if the snapshot could be created, `false` otherwise with 53 //! \return `true` if the snapshot could be created, `false` otherwise with
52 //! an appropriate message logged. 54 //! an appropriate message logged.
53 bool Initialize(ProcessReader* process_reader, 55 bool Initialize(FileReaderInterface* file_reader,
54 const ProcessReader::Module& process_reader_module); 56 RVA minidump_module_rva,
57 const MINIDUMP_LOCATION_DESCRIPTOR*
58 minidump_crashpad_module_info_location);
55 59
56 // ModuleSnapshot: 60 // ModuleSnapshot:
57 61
58 std::string Name() const override; 62 std::string Name() const override;
59 uint64_t Address() const override; 63 uint64_t Address() const override;
60 uint64_t Size() const override; 64 uint64_t Size() const override;
61 time_t Timestamp() const override; 65 time_t Timestamp() const override;
62 void FileVersion(uint16_t* version_0, 66 void FileVersion(uint16_t* version_0,
63 uint16_t* version_1, 67 uint16_t* version_1,
64 uint16_t* version_2, 68 uint16_t* version_2,
65 uint16_t* version_3) const override; 69 uint16_t* version_3) const override;
66 void SourceVersion(uint16_t* version_0, 70 void SourceVersion(uint16_t* version_0,
67 uint16_t* version_1, 71 uint16_t* version_1,
68 uint16_t* version_2, 72 uint16_t* version_2,
69 uint16_t* version_3) const override; 73 uint16_t* version_3) const override;
70 ModuleType GetModuleType() const override; 74 ModuleType GetModuleType() const override;
71 void UUID(crashpad::UUID* uuid) const override; 75 void UUID(crashpad::UUID* uuid) const override;
72 std::vector<std::string> AnnotationsVector() const override; 76 std::vector<std::string> AnnotationsVector() const override;
73 std::map<std::string, std::string> AnnotationsSimpleMap() const override; 77 std::map<std::string, std::string> AnnotationsSimpleMap() const override;
74 78
75 private: 79 private:
76 std::string name_; 80 // Initializes data carried in a MinidumpModuleCrashpadInfo structure on
77 time_t timestamp_; 81 // behalf of Initialize().
78 const MachOImageReader* mach_o_image_reader_; // weak 82 bool InitializeModuleCrashpadInfo(FileReaderInterface* file_reader,
79 ProcessReader* process_reader_; // weak 83 const MINIDUMP_LOCATION_DESCRIPTOR*
84 minidump_module_crashpad_info_location);
85
86 MINIDUMP_MODULE minidump_module_;
87 std::vector<std::string> annotations_vector_;
88 std::map<std::string, std::string> annotations_simple_map_;
80 InitializationStateDcheck initialized_; 89 InitializationStateDcheck initialized_;
81 90
82 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotMac); 91 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotMinidump);
83 }; 92 };
84 93
85 } // namespace internal 94 } // namespace internal
86 } // namespace crashpad 95 } // namespace crashpad
87 96
88 #endif // CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ 97 #endif // CRASHPAD_SNAPSHOT_MINIDUMP_MODULE_SNAPSHOT_MINIDUMP_H_
OLDNEW
« no previous file with comments | « snapshot/minidump/minidump_string_list_reader.cc ('k') | snapshot/minidump/module_snapshot_minidump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698