OLD | NEW |
---|---|
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 "base/debug/proc_maps_linux.h" | 5 #include "base/debug/proc_maps_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #if defined(OS_LINUX) | 9 #if defined(OS_LINUX) |
10 #include <inttypes.h> | 10 #include <inttypes.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
15 | 15 |
16 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
17 // Bionic's inttypes.h defines PRI/SCNxPTR as an unsigned long int, which | 17 // Bionic's inttypes.h defines PRI/SCNxPTR as an unsigned long int, which |
18 // is incompatible with Bionic's stdint.h defining uintptr_t as a unsigned int: | 18 // is incompatible with Bionic's stdint.h defining uintptr_t as a unsigned int: |
Mark Mentovai
2014/03/03 14:25:35
What does Bionic’s inttypes.h define PRI/SCNxPTR a
| |
19 // https://code.google.com/p/android/issues/detail?id=57218 | 19 // https://code.google.com/p/android/issues/detail?id=57218 |
20 #undef SCNxPTR | 20 #undef SCNxPTR |
21 #ifdef __LP64__ | |
22 #define SCNxPTR "lx" | |
23 #else | |
21 #define SCNxPTR "x" | 24 #define SCNxPTR "x" |
22 #endif | 25 #endif |
26 #endif | |
23 | 27 |
24 namespace base { | 28 namespace base { |
25 namespace debug { | 29 namespace debug { |
26 | 30 |
27 // Scans |proc_maps| starting from |pos| returning true if the gate VMA was | 31 // Scans |proc_maps| starting from |pos| returning true if the gate VMA was |
28 // found, otherwise returns false. | 32 // found, otherwise returns false. |
29 static bool ContainsGateVMA(std::string* proc_maps, size_t pos) { | 33 static bool ContainsGateVMA(std::string* proc_maps, size_t pos) { |
30 #if defined(ARCH_CPU_ARM_FAMILY) | 34 #if defined(ARCH_CPU_ARM_FAMILY) |
31 // The gate VMA on ARM kernels is the interrupt vectors page. | 35 // The gate VMA on ARM kernels is the interrupt vectors page. |
32 return proc_maps->find(" [vectors]\n", pos) != std::string::npos; | 36 return proc_maps->find(" [vectors]\n", pos) != std::string::npos; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 regions.push_back(region); | 157 regions.push_back(region); |
154 regions.back().path.assign(line + path_index); | 158 regions.back().path.assign(line + path_index); |
155 } | 159 } |
156 | 160 |
157 regions_out->swap(regions); | 161 regions_out->swap(regions); |
158 return true; | 162 return true; |
159 } | 163 } |
160 | 164 |
161 } // namespace debug | 165 } // namespace debug |
162 } // namespace base | 166 } // namespace base |
OLD | NEW |