OLD | NEW |
1 // Copyright 2015 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, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 base::UTF16ToUTF8(name_))) { | 50 base::UTF16ToUTF8(name_))) { |
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 ModuleSnapshotWin::GetCrashpadOptions(CrashpadInfoClientOptions* options) { | 58 void ModuleSnapshotWin::GetCrashpadOptions(CrashpadInfoClientOptions* options) { |
59 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 59 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
60 | 60 if (process_reader_->Is64Bit()) |
61 process_types::CrashpadInfo crashpad_info; | 61 GetCrashpadOptionsInternal<process_types::internal::Traits64>(options); |
62 if (!pe_image_reader_->GetCrashpadInfo(&crashpad_info)) { | 62 else |
63 options->crashpad_handler_behavior = TriState::kUnset; | 63 GetCrashpadOptionsInternal<process_types::internal::Traits32>(options); |
64 options->system_crash_reporter_forwarding = TriState::kUnset; | |
65 return; | |
66 } | |
67 | |
68 options->crashpad_handler_behavior = | |
69 CrashpadInfoClientOptions::TriStateFromCrashpadInfo( | |
70 crashpad_info.crashpad_handler_behavior); | |
71 | |
72 options->system_crash_reporter_forwarding = | |
73 CrashpadInfoClientOptions::TriStateFromCrashpadInfo( | |
74 crashpad_info.system_crash_reporter_forwarding); | |
75 } | 64 } |
76 | 65 |
77 std::string ModuleSnapshotWin::Name() const { | 66 std::string ModuleSnapshotWin::Name() const { |
78 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 67 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
79 return base::UTF16ToUTF8(name_); | 68 return base::UTF16ToUTF8(name_); |
80 } | 69 } |
81 | 70 |
82 uint64_t ModuleSnapshotWin::Address() const { | 71 uint64_t ModuleSnapshotWin::Address() const { |
83 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 72 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
84 return pe_image_reader_->Address(); | 73 return pe_image_reader_->Address(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 153 } |
165 | 154 |
166 std::map<std::string, std::string> ModuleSnapshotWin::AnnotationsSimpleMap() | 155 std::map<std::string, std::string> ModuleSnapshotWin::AnnotationsSimpleMap() |
167 const { | 156 const { |
168 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 157 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
169 PEImageAnnotationsReader annotations_reader( | 158 PEImageAnnotationsReader annotations_reader( |
170 process_reader_, pe_image_reader_.get(), name_); | 159 process_reader_, pe_image_reader_.get(), name_); |
171 return annotations_reader.SimpleMap(); | 160 return annotations_reader.SimpleMap(); |
172 } | 161 } |
173 | 162 |
| 163 template <class Traits> |
| 164 void ModuleSnapshotWin::GetCrashpadOptionsInternal( |
| 165 CrashpadInfoClientOptions* options) { |
| 166 process_types::CrashpadInfo<Traits> crashpad_info; |
| 167 if (!pe_image_reader_->GetCrashpadInfo(&crashpad_info)) { |
| 168 options->crashpad_handler_behavior = TriState::kUnset; |
| 169 options->system_crash_reporter_forwarding = TriState::kUnset; |
| 170 return; |
| 171 } |
| 172 |
| 173 options->crashpad_handler_behavior = |
| 174 CrashpadInfoClientOptions::TriStateFromCrashpadInfo( |
| 175 crashpad_info.crashpad_handler_behavior); |
| 176 |
| 177 options->system_crash_reporter_forwarding = |
| 178 CrashpadInfoClientOptions::TriStateFromCrashpadInfo( |
| 179 crashpad_info.system_crash_reporter_forwarding); |
| 180 } |
| 181 |
174 } // namespace internal | 182 } // namespace internal |
175 } // namespace crashpad | 183 } // namespace crashpad |
OLD | NEW |