Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | |
|
Robert Sesek
2015/03/04 01:52:25
2015
| |
| 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 #include "snapshot/minidump/module_snapshot_minidump.h" | |
| 16 | |
| 17 #include "minidump/minidump_extensions.h" | |
| 18 #include "snapshot/minidump/minidump_simple_string_dictionary_reader.h" | |
| 19 #include "snapshot/minidump/minidump_string_list_reader.h" | |
| 20 | |
| 21 namespace crashpad { | |
| 22 namespace internal { | |
| 23 | |
| 24 ModuleSnapshotMinidump::ModuleSnapshotMinidump() | |
| 25 : ModuleSnapshot(), | |
| 26 minidump_module_(), | |
| 27 annotations_vector_(), | |
| 28 annotations_simple_map_(), | |
| 29 initialized_() { | |
| 30 } | |
| 31 | |
| 32 ModuleSnapshotMinidump::~ModuleSnapshotMinidump() { | |
| 33 } | |
| 34 | |
| 35 bool ModuleSnapshotMinidump::Initialize( | |
| 36 FileReaderInterface* file_reader, | |
| 37 RVA minidump_module_rva, | |
| 38 const MINIDUMP_LOCATION_DESCRIPTOR* | |
| 39 minidump_module_crashpad_info_location) { | |
| 40 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); | |
| 41 | |
| 42 if (!file_reader->SeekSet(minidump_module_rva)) { | |
| 43 return false; | |
| 44 } | |
| 45 | |
| 46 if (!file_reader->ReadExactly(&minidump_module_, sizeof(minidump_module_))) { | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 InitializeModuleCrashpadInfo(file_reader, | |
| 51 minidump_module_crashpad_info_location); | |
| 52 | |
| 53 INITIALIZATION_STATE_SET_VALID(initialized_); | |
| 54 return true; | |
| 55 } | |
| 56 | |
| 57 std::string ModuleSnapshotMinidump::Name() const { | |
| 58 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 59 NOTREACHED(); | |
|
Robert Sesek
2015/03/04 01:52:25
Are these going to be implemented eventually? If s
Mark Mentovai
2015/03/04 16:24:24
Robert Sesek wrote:
Robert Sesek
2015/03/04 17:06:25
OK. Are these methods going to be implemented at s
Mark Mentovai
2015/03/04 17:10:21
Robert Sesek wrote:
Robert Sesek
2015/03/04 17:14:00
Yeah TODO would probably be good (w/ associated bu
| |
| 60 return std::string(); | |
| 61 } | |
| 62 | |
| 63 uint64_t ModuleSnapshotMinidump::Address() const { | |
| 64 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 65 NOTREACHED(); | |
| 66 return 0; | |
| 67 } | |
| 68 | |
| 69 uint64_t ModuleSnapshotMinidump::Size() const { | |
| 70 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 71 NOTREACHED(); | |
| 72 return 0; | |
| 73 } | |
| 74 | |
| 75 time_t ModuleSnapshotMinidump::Timestamp() const { | |
| 76 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 77 NOTREACHED(); | |
| 78 return 0; | |
| 79 } | |
| 80 | |
| 81 void ModuleSnapshotMinidump::FileVersion(uint16_t* version_0, | |
| 82 uint16_t* version_1, | |
| 83 uint16_t* version_2, | |
| 84 uint16_t* version_3) const { | |
| 85 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 86 NOTREACHED(); | |
| 87 *version_0 = 0; | |
| 88 *version_1 = 0; | |
| 89 *version_2 = 0; | |
| 90 *version_3 = 0; | |
| 91 } | |
| 92 | |
| 93 void ModuleSnapshotMinidump::SourceVersion(uint16_t* version_0, | |
| 94 uint16_t* version_1, | |
| 95 uint16_t* version_2, | |
| 96 uint16_t* version_3) const { | |
| 97 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 98 NOTREACHED(); | |
| 99 *version_0 = 0; | |
| 100 *version_1 = 0; | |
| 101 *version_2 = 0; | |
| 102 *version_3 = 0; | |
| 103 } | |
| 104 | |
| 105 ModuleSnapshot::ModuleType ModuleSnapshotMinidump::GetModuleType() const { | |
| 106 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 107 NOTREACHED(); | |
| 108 return kModuleTypeUnknown; | |
| 109 } | |
| 110 | |
| 111 void ModuleSnapshotMinidump::UUID(crashpad::UUID* uuid) const { | |
| 112 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 113 NOTREACHED(); | |
| 114 *uuid = crashpad::UUID(); | |
| 115 } | |
| 116 | |
| 117 std::vector<std::string> ModuleSnapshotMinidump::AnnotationsVector() const { | |
| 118 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 119 return annotations_vector_; | |
| 120 } | |
| 121 | |
| 122 std::map<std::string, std::string> | |
| 123 ModuleSnapshotMinidump::AnnotationsSimpleMap() const { | |
| 124 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
| 125 return annotations_simple_map_; | |
| 126 } | |
| 127 | |
| 128 void ModuleSnapshotMinidump::InitializeModuleCrashpadInfo( | |
| 129 FileReaderInterface* file_reader, | |
| 130 const MINIDUMP_LOCATION_DESCRIPTOR* | |
| 131 minidump_module_crashpad_info_location) { | |
| 132 if (!minidump_module_crashpad_info_location || | |
| 133 minidump_module_crashpad_info_location->Rva == 0) { | |
| 134 return; | |
| 135 } | |
| 136 | |
| 137 MinidumpModuleCrashpadInfo minidump_module_crashpad_info; | |
| 138 if (minidump_module_crashpad_info_location->DataSize < | |
| 139 sizeof(minidump_module_crashpad_info)) { | |
|
Robert Sesek
2015/03/04 01:52:25
nit: indent +4
| |
| 140 LOG(ERROR) << "minidump_module_crashpad_info size mismatch"; | |
| 141 return; | |
| 142 } | |
| 143 | |
| 144 if (!file_reader->SeekSet(minidump_module_crashpad_info_location->Rva)) { | |
| 145 return; | |
| 146 } | |
| 147 | |
| 148 if (!file_reader->ReadExactly(&minidump_module_crashpad_info, | |
| 149 sizeof(minidump_module_crashpad_info))) { | |
| 150 return; | |
| 151 } | |
| 152 | |
| 153 if (minidump_module_crashpad_info.version != | |
| 154 MinidumpModuleCrashpadInfo::kVersion) { | |
| 155 LOG(ERROR) << "minidump_module_crashpad_info version mismatch"; | |
| 156 return; | |
| 157 } | |
| 158 | |
| 159 ReadMinidumpStringList(file_reader, | |
|
Robert Sesek
2015/03/04 01:52:25
What if these functions return false? There's no w
Mark Mentovai
2015/03/04 16:24:24
Robert Sesek wrote:
| |
| 160 minidump_module_crashpad_info.list_annotations, | |
| 161 &annotations_vector_); | |
| 162 | |
| 163 ReadMinidumpSimpleStringDictionary( | |
| 164 file_reader, | |
| 165 minidump_module_crashpad_info.simple_annotations, | |
| 166 &annotations_simple_map_); | |
| 167 } | |
| 168 | |
| 169 } // namespace internal | |
| 170 } // namespace crashpad | |
| OLD | NEW |