| OLD | NEW |
| 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 #include "snapshot/mac/module_snapshot_mac.h" | 15 #include "snapshot/mac/module_snapshot_mac.h" |
| 16 | 16 |
| 17 #include <mach/mach.h> | 17 #include <mach/mach.h> |
| 18 #include <mach-o/loader.h> | 18 #include <mach-o/loader.h> |
| 19 | 19 |
| 20 #include "base/files/file_path.h" |
| 20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 21 #include "snapshot/mac/mach_o_image_annotations_reader.h" | 22 #include "snapshot/mac/mach_o_image_annotations_reader.h" |
| 22 #include "snapshot/mac/mach_o_image_reader.h" | 23 #include "snapshot/mac/mach_o_image_reader.h" |
| 23 #include "util/misc/tri_state.h" | 24 #include "util/misc/tri_state.h" |
| 24 #include "util/misc/uuid.h" | 25 #include "util/misc/uuid.h" |
| 25 #include "util/stdlib/strnlen.h" | 26 #include "util/stdlib/strnlen.h" |
| 26 | 27 |
| 27 namespace crashpad { | 28 namespace crashpad { |
| 28 namespace internal { | 29 namespace internal { |
| 29 | 30 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return kModuleTypeUnknown; | 150 return kModuleTypeUnknown; |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 | 153 |
| 153 void ModuleSnapshotMac::UUIDAndAge(crashpad::UUID* uuid, uint32_t* age) const { | 154 void ModuleSnapshotMac::UUIDAndAge(crashpad::UUID* uuid, uint32_t* age) const { |
| 154 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 155 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 155 mach_o_image_reader_->UUID(uuid); | 156 mach_o_image_reader_->UUID(uuid); |
| 156 *age = 0; | 157 *age = 0; |
| 157 } | 158 } |
| 158 | 159 |
| 160 std::string ModuleSnapshotMac::DebugFileName() const { |
| 161 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 162 return base::FilePath(Name()).BaseName().value(); |
| 163 } |
| 164 |
| 159 std::vector<std::string> ModuleSnapshotMac::AnnotationsVector() const { | 165 std::vector<std::string> ModuleSnapshotMac::AnnotationsVector() const { |
| 160 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 166 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 161 MachOImageAnnotationsReader annotations_reader( | 167 MachOImageAnnotationsReader annotations_reader( |
| 162 process_reader_, mach_o_image_reader_, name_); | 168 process_reader_, mach_o_image_reader_, name_); |
| 163 return annotations_reader.Vector(); | 169 return annotations_reader.Vector(); |
| 164 } | 170 } |
| 165 | 171 |
| 166 std::map<std::string, std::string> ModuleSnapshotMac::AnnotationsSimpleMap() | 172 std::map<std::string, std::string> ModuleSnapshotMac::AnnotationsSimpleMap() |
| 167 const { | 173 const { |
| 168 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 174 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 169 MachOImageAnnotationsReader annotations_reader( | 175 MachOImageAnnotationsReader annotations_reader( |
| 170 process_reader_, mach_o_image_reader_, name_); | 176 process_reader_, mach_o_image_reader_, name_); |
| 171 return annotations_reader.SimpleMap(); | 177 return annotations_reader.SimpleMap(); |
| 172 } | 178 } |
| 173 | 179 |
| 174 } // namespace internal | 180 } // namespace internal |
| 175 } // namespace crashpad | 181 } // namespace crashpad |
| OLD | NEW |