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

Side by Side Diff: tools/android/memdump/memdump.cc

Issue 825323002: replace COMPILE_ASSERT with static_assert in tools/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add fixups Created 5 years, 11 months 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 | « tools/android/forwarder2/common.h ('k') | tools/ipc_fuzzer/ipclist/ipclist.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <fcntl.h> 5 #include <fcntl.h>
6 #include <signal.h> 6 #include <signal.h>
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 const off64_t offset = memory_map.start_address / kPageSize; 211 const off64_t offset = memory_map.start_address / kPageSize;
212 if (lseek64(pagemap_fd, offset * sizeof(PageMapEntry), SEEK_SET) < 0) { 212 if (lseek64(pagemap_fd, offset * sizeof(PageMapEntry), SEEK_SET) < 0) {
213 PLOG(ERROR) << "lseek"; 213 PLOG(ERROR) << "lseek";
214 return false; 214 return false;
215 } 215 }
216 for (uint64 addr = memory_map.start_address, page_index = 0; 216 for (uint64 addr = memory_map.start_address, page_index = 0;
217 addr < memory_map.end_address; 217 addr < memory_map.end_address;
218 addr += kPageSize, ++page_index) { 218 addr += kPageSize, ++page_index) {
219 DCHECK_EQ(0, addr % kPageSize); 219 DCHECK_EQ(0, addr % kPageSize);
220 PageMapEntry page_map_entry = {}; 220 PageMapEntry page_map_entry = {};
221 COMPILE_ASSERT(sizeof(PageMapEntry) == sizeof(uint64), unexpected_size); 221 static_assert(sizeof(PageMapEntry) == sizeof(uint64), "unexpected size");
222 ssize_t bytes = read(pagemap_fd, &page_map_entry, sizeof(page_map_entry)); 222 ssize_t bytes = read(pagemap_fd, &page_map_entry, sizeof(page_map_entry));
223 if (bytes != sizeof(PageMapEntry) && bytes != 0) { 223 if (bytes != sizeof(PageMapEntry) && bytes != 0) {
224 PLOG(ERROR) << "read"; 224 PLOG(ERROR) << "read";
225 return false; 225 return false;
226 } 226 }
227 if (page_map_entry.present) { // Ignore non-committed pages. 227 if (page_map_entry.present) { // Ignore non-committed pages.
228 if (page_map_entry.page_frame_number == 0) 228 if (page_map_entry.page_frame_number == 0)
229 continue; 229 continue;
230 PageInfo page_info = {}; 230 PageInfo page_info = {};
231 page_info.page_frame_number = page_map_entry.page_frame_number; 231 page_info.page_frame_number = page_map_entry.page_frame_number;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 525 }
526 } 526 }
527 527
528 ClassifyPages(&processes_memory); 528 ClassifyPages(&processes_memory);
529 if (short_output) 529 if (short_output)
530 DumpProcessesMemoryMapsInShortFormat(processes_memory); 530 DumpProcessesMemoryMapsInShortFormat(processes_memory);
531 else 531 else
532 DumpProcessesMemoryMapsInExtendedFormat(processes_memory); 532 DumpProcessesMemoryMapsInExtendedFormat(processes_memory);
533 return EXIT_SUCCESS; 533 return EXIT_SUCCESS;
534 } 534 }
OLDNEW
« no previous file with comments | « tools/android/forwarder2/common.h ('k') | tools/ipc_fuzzer/ipclist/ipclist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698