Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: util/win/process_info.cc

Issue 1463633002: win: Avoid some more clang complaints (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@vm-counters-struct
Patch Set: {} Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/win/exception_handler_server.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 *peb_size = sizeof(process_types::PEB<process_types::internal::Traits32>); 215 *peb_size = sizeof(process_types::PEB<process_types::internal::Traits32>);
216 } 216 }
217 217
218 return true; 218 return true;
219 } 219 }
220 220
221 template <class Traits> 221 template <class Traits>
222 bool ReadProcessData(HANDLE process, 222 bool ReadProcessData(HANDLE process,
223 WinVMAddress peb_address_vmaddr, 223 WinVMAddress peb_address_vmaddr,
224 ProcessInfo* process_info) { 224 ProcessInfo* process_info) {
225 Traits::Pointer peb_address; 225 typename Traits::Pointer peb_address;
226 if (!AssignIfInRange(&peb_address, peb_address_vmaddr)) { 226 if (!AssignIfInRange(&peb_address, peb_address_vmaddr)) {
227 LOG(ERROR) << base::StringPrintf("peb address 0x%x out of range", 227 LOG(ERROR) << base::StringPrintf("peb address 0x%x out of range",
228 peb_address_vmaddr); 228 peb_address_vmaddr);
229 return false; 229 return false;
230 } 230 }
231 231
232 // Try to read the process environment block. 232 // Try to read the process environment block.
233 process_types::PEB<Traits> peb; 233 process_types::PEB<Traits> peb;
234 if (!ReadStruct(process, peb_address, &peb)) 234 if (!ReadStruct(process, peb_address, &peb))
235 return false; 235 return false;
(...skipping 30 matching lines...) Expand all
266 return false; 266 return false;
267 } 267 }
268 module.dll_base = ldr_data_table_entry.DllBase; 268 module.dll_base = ldr_data_table_entry.DllBase;
269 module.size = ldr_data_table_entry.SizeOfImage; 269 module.size = ldr_data_table_entry.SizeOfImage;
270 module.timestamp = ldr_data_table_entry.TimeDateStamp; 270 module.timestamp = ldr_data_table_entry.TimeDateStamp;
271 process_info->modules_.push_back(module); 271 process_info->modules_.push_back(module);
272 272
273 // Walk the PEB LDR structure (doubly-linked list) to get the list of loaded 273 // Walk the PEB LDR structure (doubly-linked list) to get the list of loaded
274 // modules. We use this method rather than EnumProcessModules to get the 274 // modules. We use this method rather than EnumProcessModules to get the
275 // modules in initialization order rather than memory order. 275 // modules in initialization order rather than memory order.
276 Traits::Pointer last = peb_ldr_data.InInitializationOrderModuleList.Blink; 276 typename Traits::Pointer last =
277 for (Traits::Pointer cur = peb_ldr_data.InInitializationOrderModuleList.Flink; 277 peb_ldr_data.InInitializationOrderModuleList.Blink;
278 for (typename Traits::Pointer cur =
279 peb_ldr_data.InInitializationOrderModuleList.Flink;
278 ; 280 ;
279 cur = ldr_data_table_entry.InInitializationOrderLinks.Flink) { 281 cur = ldr_data_table_entry.InInitializationOrderLinks.Flink) {
280 // |cur| is the pointer to the LIST_ENTRY embedded in the 282 // |cur| is the pointer to the LIST_ENTRY embedded in the
281 // LDR_DATA_TABLE_ENTRY, in the target process's address space. So we need 283 // LDR_DATA_TABLE_ENTRY, in the target process's address space. So we need
282 // to read from the target, and also offset back to the beginning of the 284 // to read from the target, and also offset back to the beginning of the
283 // structure. 285 // structure.
284 if (!ReadStruct(process, 286 if (!ReadStruct(process,
285 static_cast<WinVMAddress>(cur) - 287 static_cast<WinVMAddress>(cur) -
286 offsetof(process_types::LDR_DATA_TABLE_ENTRY<Traits>, 288 offsetof(process_types::LDR_DATA_TABLE_ENTRY<Traits>,
287 InInitializationOrderLinks), 289 InInitializationOrderLinks),
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 } else { 683 } else {
682 result.push_back(as_ranges[i]); 684 result.push_back(as_ranges[i]);
683 } 685 }
684 DCHECK(result.back().IsValid()); 686 DCHECK(result.back().IsValid());
685 } 687 }
686 688
687 return result; 689 return result;
688 } 690 }
689 691
690 } // namespace crashpad 692 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/win/exception_handler_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698