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 30 matching lines...) Expand all Loading... |
41 bool ProcessSnapshotWin::Initialize(HANDLE process, | 41 bool ProcessSnapshotWin::Initialize(HANDLE process, |
42 ProcessSuspensionState suspension_state) { | 42 ProcessSuspensionState suspension_state) { |
43 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); | 43 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); |
44 | 44 |
45 GetTimeOfDay(&snapshot_time_); | 45 GetTimeOfDay(&snapshot_time_); |
46 | 46 |
47 if (!process_reader_.Initialize(process, suspension_state)) | 47 if (!process_reader_.Initialize(process, suspension_state)) |
48 return false; | 48 return false; |
49 | 49 |
50 system_.Initialize(&process_reader_); | 50 system_.Initialize(&process_reader_); |
| 51 WinVMAddress peb_address; |
| 52 WinVMSize peb_size; |
| 53 process_reader_.GetProcessInfo().Peb(&peb_address, &peb_size); |
| 54 peb_.Initialize(&process_reader_, peb_address, peb_size); |
51 | 55 |
52 InitializeThreads(); | 56 InitializeThreads(); |
53 InitializeModules(); | 57 InitializeModules(); |
54 | 58 |
55 INITIALIZATION_STATE_SET_VALID(initialized_); | 59 INITIALIZATION_STATE_SET_VALID(initialized_); |
56 return true; | 60 return true; |
57 } | 61 } |
58 | 62 |
59 bool ProcessSnapshotWin::InitializeException( | 63 bool ProcessSnapshotWin::InitializeException( |
60 WinVMAddress exception_information_address) { | 64 WinVMAddress exception_information_address) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 local_options.system_crash_reporter_forwarding != TriState::kUnset) { | 109 local_options.system_crash_reporter_forwarding != TriState::kUnset) { |
106 break; | 110 break; |
107 } | 111 } |
108 } | 112 } |
109 | 113 |
110 *options = local_options; | 114 *options = local_options; |
111 } | 115 } |
112 | 116 |
113 pid_t ProcessSnapshotWin::ProcessID() const { | 117 pid_t ProcessSnapshotWin::ProcessID() const { |
114 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 118 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
115 return process_reader_.ProcessID(); | 119 return process_reader_.GetProcessInfo().ProcessID(); |
116 } | 120 } |
117 | 121 |
118 pid_t ProcessSnapshotWin::ParentProcessID() const { | 122 pid_t ProcessSnapshotWin::ParentProcessID() const { |
119 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 123 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
120 return process_reader_.ParentProcessID(); | 124 return process_reader_.GetProcessInfo().ParentProcessID(); |
121 } | 125 } |
122 | 126 |
123 void ProcessSnapshotWin::SnapshotTime(timeval* snapshot_time) const { | 127 void ProcessSnapshotWin::SnapshotTime(timeval* snapshot_time) const { |
124 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 128 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
125 *snapshot_time = snapshot_time_; | 129 *snapshot_time = snapshot_time_; |
126 } | 130 } |
127 | 131 |
128 void ProcessSnapshotWin::ProcessStartTime(timeval* start_time) const { | 132 void ProcessSnapshotWin::ProcessStartTime(timeval* start_time) const { |
129 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 133 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
130 process_reader_.StartTime(start_time); | 134 process_reader_.StartTime(start_time); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 for (internal::ModuleSnapshotWin* module : modules_) { | 176 for (internal::ModuleSnapshotWin* module : modules_) { |
173 modules.push_back(module); | 177 modules.push_back(module); |
174 } | 178 } |
175 return modules; | 179 return modules; |
176 } | 180 } |
177 | 181 |
178 const ExceptionSnapshot* ProcessSnapshotWin::Exception() const { | 182 const ExceptionSnapshot* ProcessSnapshotWin::Exception() const { |
179 return exception_.get(); | 183 return exception_.get(); |
180 } | 184 } |
181 | 185 |
| 186 std::vector<const MemorySnapshot*> ProcessSnapshotWin::ExtraMemory() const { |
| 187 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 188 std::vector<const MemorySnapshot*> extra_memory; |
| 189 extra_memory.push_back(&peb_); |
| 190 return extra_memory; |
| 191 } |
| 192 |
182 void ProcessSnapshotWin::InitializeThreads() { | 193 void ProcessSnapshotWin::InitializeThreads() { |
183 const std::vector<ProcessReaderWin::Thread>& process_reader_threads = | 194 const std::vector<ProcessReaderWin::Thread>& process_reader_threads = |
184 process_reader_.Threads(); | 195 process_reader_.Threads(); |
185 for (const ProcessReaderWin::Thread& process_reader_thread : | 196 for (const ProcessReaderWin::Thread& process_reader_thread : |
186 process_reader_threads) { | 197 process_reader_threads) { |
187 auto thread = make_scoped_ptr(new internal::ThreadSnapshotWin()); | 198 auto thread = make_scoped_ptr(new internal::ThreadSnapshotWin()); |
188 if (thread->Initialize(&process_reader_, process_reader_thread)) { | 199 if (thread->Initialize(&process_reader_, process_reader_thread)) { |
189 threads_.push_back(thread.release()); | 200 threads_.push_back(thread.release()); |
190 } | 201 } |
191 } | 202 } |
192 } | 203 } |
193 | 204 |
194 void ProcessSnapshotWin::InitializeModules() { | 205 void ProcessSnapshotWin::InitializeModules() { |
195 const std::vector<ProcessInfo::Module>& process_reader_modules = | 206 const std::vector<ProcessInfo::Module>& process_reader_modules = |
196 process_reader_.Modules(); | 207 process_reader_.Modules(); |
197 for (const ProcessInfo::Module& process_reader_module : | 208 for (const ProcessInfo::Module& process_reader_module : |
198 process_reader_modules) { | 209 process_reader_modules) { |
199 auto module = make_scoped_ptr(new internal::ModuleSnapshotWin()); | 210 auto module = make_scoped_ptr(new internal::ModuleSnapshotWin()); |
200 if (module->Initialize(&process_reader_, process_reader_module)) { | 211 if (module->Initialize(&process_reader_, process_reader_module)) { |
201 modules_.push_back(module.release()); | 212 modules_.push_back(module.release()); |
202 } | 213 } |
203 } | 214 } |
204 } | 215 } |
205 | 216 |
206 } // namespace crashpad | 217 } // namespace crashpad |
OLD | NEW |