OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/trace_event/process_memory_maps_dump_provider.h" | 5 #include "base/trace_event/process_memory_maps_dump_provider.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 #include <fstream> | 8 #include <fstream> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (end_addr > region->start_address) { | 40 if (end_addr > region->start_address) { |
41 region->size_in_bytes = end_addr - region->start_address; | 41 region->size_in_bytes = end_addr - region->start_address; |
42 } else { | 42 } else { |
43 // This is not just paranoia, it can actually happen (See crbug.com/461237). | 43 // This is not just paranoia, it can actually happen (See crbug.com/461237). |
44 region->size_in_bytes = 0; | 44 region->size_in_bytes = 0; |
45 res = false; | 45 res = false; |
46 } | 46 } |
47 | 47 |
48 region->protection_flags = 0; | 48 region->protection_flags = 0; |
49 *smaps >> protection_flags; | 49 *smaps >> protection_flags; |
50 CHECK(4UL == protection_flags.size()); | 50 CHECK_EQ(4UL, protection_flags.size()); |
51 if (protection_flags[0] == 'r') { | 51 if (protection_flags[0] == 'r') { |
52 region->protection_flags |= | 52 region->protection_flags |= |
53 ProcessMemoryMaps::VMRegion::kProtectionFlagsRead; | 53 ProcessMemoryMaps::VMRegion::kProtectionFlagsRead; |
54 } | 54 } |
55 if (protection_flags[1] == 'w') { | 55 if (protection_flags[1] == 'w') { |
56 region->protection_flags |= | 56 region->protection_flags |= |
57 ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite; | 57 ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite; |
58 } | 58 } |
59 if (protection_flags[2] == 'x') { | 59 if (protection_flags[2] == 'x') { |
60 region->protection_flags |= | 60 region->protection_flags |= |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 return false; | 179 return false; |
180 } | 180 } |
181 | 181 |
182 const char* ProcessMemoryMapsDumpProvider::GetFriendlyName() const { | 182 const char* ProcessMemoryMapsDumpProvider::GetFriendlyName() const { |
183 return kDumperFriendlyName; | 183 return kDumperFriendlyName; |
184 } | 184 } |
185 | 185 |
186 } // namespace trace_event | 186 } // namespace trace_event |
187 } // namespace base | 187 } // namespace base |
OLD | NEW |