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) || defined(OS_ANDROID) |
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/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 | 16 |
17 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) && !defined(__LP64__) |
18 // Bionic's inttypes.h defines PRI/SCNxPTR as an unsigned long int, which | 18 // In 32-bit mode, Bionic's inttypes.h defines PRI/SCNxPTR as an |
19 // is incompatible with Bionic's stdint.h defining uintptr_t as a unsigned int: | 19 // unsigned long int, which is incompatible with Bionic's stdint.h |
| 20 // defining uintptr_t as an unsigned int: |
20 // https://code.google.com/p/android/issues/detail?id=57218 | 21 // https://code.google.com/p/android/issues/detail?id=57218 |
21 #undef SCNxPTR | 22 #undef SCNxPTR |
22 #define SCNxPTR "x" | 23 #define SCNxPTR "x" |
23 #endif | 24 #endif |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 namespace debug { | 27 namespace debug { |
27 | 28 |
28 // Scans |proc_maps| starting from |pos| returning true if the gate VMA was | 29 // Scans |proc_maps| starting from |pos| returning true if the gate VMA was |
29 // found, otherwise returns false. | 30 // found, otherwise returns false. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 regions.push_back(region); | 154 regions.push_back(region); |
154 regions.back().path.assign(line + path_index); | 155 regions.back().path.assign(line + path_index); |
155 } | 156 } |
156 | 157 |
157 regions_out->swap(regions); | 158 regions_out->swap(regions); |
158 return true; | 159 return true; |
159 } | 160 } |
160 | 161 |
161 } // namespace debug | 162 } // namespace debug |
162 } // namespace base | 163 } // namespace base |
OLD | NEW |