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, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 timestamp_ = process_reader_module.timestamp; | 48 timestamp_ = process_reader_module.timestamp; |
49 mach_o_image_reader_ = process_reader_module.reader; | 49 mach_o_image_reader_ = process_reader_module.reader; |
50 if (!mach_o_image_reader_) { | 50 if (!mach_o_image_reader_) { |
51 return false; | 51 return false; |
52 } | 52 } |
53 | 53 |
54 INITIALIZATION_STATE_SET_VALID(initialized_); | 54 INITIALIZATION_STATE_SET_VALID(initialized_); |
55 return true; | 55 return true; |
56 } | 56 } |
57 | 57 |
58 void ModuleSnapshotMac::GetCrashpadOptions( | |
59 CrashpadInfo::TriState* enable_crashpad_handler, | |
60 CrashpadInfo::TriState* enable_native_crash_reporter_forwarding) { | |
61 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | |
62 MachOImageAnnotationsReader annotations_reader( | |
63 process_reader_, mach_o_image_reader_, name_); | |
64 | |
65 process_types::CrashpadInfo crashpad_info; | |
66 if (!annotations_reader.GetCrashpadInfo(&crashpad_info)) { | |
67 *enable_crashpad_handler = CrashpadInfo::kDefault; | |
68 *enable_native_crash_reporter_forwarding = CrashpadInfo::kDefault; | |
69 return; | |
70 } | |
71 | |
72 int value = crashpad_info.options & 0x3; | |
Robert Sesek
2015/03/10 23:03:04
Yeah, this should be an enum with constants.
| |
73 if (value == 3) { | |
74 LOG(WARNING) << "unknown value 3 for enable_crashpad_handler"; | |
75 value = CrashpadInfo::kDefault; | |
76 } | |
77 *enable_crashpad_handler = static_cast<CrashpadInfo::TriState>(value); | |
78 | |
79 value = (crashpad_info.options >> 2) & 0x3; | |
80 if (value == 3) { | |
81 LOG(WARNING) | |
82 << "unknown value 3 for enable_native_crash_reporter_forwarding"; | |
83 value = CrashpadInfo::kDefault; | |
84 } | |
85 *enable_native_crash_reporter_forwarding = | |
86 static_cast<CrashpadInfo::TriState>(value); | |
87 } | |
88 | |
58 std::string ModuleSnapshotMac::Name() const { | 89 std::string ModuleSnapshotMac::Name() const { |
59 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 90 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
60 return name_; | 91 return name_; |
61 } | 92 } |
62 | 93 |
63 uint64_t ModuleSnapshotMac::Address() const { | 94 uint64_t ModuleSnapshotMac::Address() const { |
64 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 95 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
65 return mach_o_image_reader_->Address(); | 96 return mach_o_image_reader_->Address(); |
66 } | 97 } |
67 | 98 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 std::map<std::string, std::string> ModuleSnapshotMac::AnnotationsSimpleMap() | 176 std::map<std::string, std::string> ModuleSnapshotMac::AnnotationsSimpleMap() |
146 const { | 177 const { |
147 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 178 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
148 MachOImageAnnotationsReader annotations_reader( | 179 MachOImageAnnotationsReader annotations_reader( |
149 process_reader_, mach_o_image_reader_, name_); | 180 process_reader_, mach_o_image_reader_, name_); |
150 return annotations_reader.SimpleMap(); | 181 return annotations_reader.SimpleMap(); |
151 } | 182 } |
152 | 183 |
153 } // namespace internal | 184 } // namespace internal |
154 } // namespace crashpad | 185 } // namespace crashpad |
OLD | NEW |