Index: snapshot/mac/module_snapshot_mac.cc |
diff --git a/snapshot/mac/module_snapshot_mac.cc b/snapshot/mac/module_snapshot_mac.cc |
index ddbb6a00b9cb88fca15f6048b88f0b03d5317d43..da4ad34afdf03c99fb2a3805e281e23233178002 100644 |
--- a/snapshot/mac/module_snapshot_mac.cc |
+++ b/snapshot/mac/module_snapshot_mac.cc |
@@ -55,6 +55,37 @@ bool ModuleSnapshotMac::Initialize( |
return true; |
} |
+void ModuleSnapshotMac::GetCrashpadOptions( |
+ CrashpadInfo::TriState* enable_crashpad_handler, |
+ CrashpadInfo::TriState* enable_native_crash_reporter_forwarding) { |
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
+ MachOImageAnnotationsReader annotations_reader( |
+ process_reader_, mach_o_image_reader_, name_); |
+ |
+ process_types::CrashpadInfo crashpad_info; |
+ if (!annotations_reader.GetCrashpadInfo(&crashpad_info)) { |
+ *enable_crashpad_handler = CrashpadInfo::kDefault; |
+ *enable_native_crash_reporter_forwarding = CrashpadInfo::kDefault; |
+ return; |
+ } |
+ |
+ int value = crashpad_info.options & 0x3; |
Robert Sesek
2015/03/10 23:03:04
Yeah, this should be an enum with constants.
|
+ if (value == 3) { |
+ LOG(WARNING) << "unknown value 3 for enable_crashpad_handler"; |
+ value = CrashpadInfo::kDefault; |
+ } |
+ *enable_crashpad_handler = static_cast<CrashpadInfo::TriState>(value); |
+ |
+ value = (crashpad_info.options >> 2) & 0x3; |
+ if (value == 3) { |
+ LOG(WARNING) |
+ << "unknown value 3 for enable_native_crash_reporter_forwarding"; |
+ value = CrashpadInfo::kDefault; |
+ } |
+ *enable_native_crash_reporter_forwarding = |
+ static_cast<CrashpadInfo::TriState>(value); |
+} |
+ |
std::string ModuleSnapshotMac::Name() const { |
INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
return name_; |