| 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 #ifndef BASE_DEBUG_PROC_MAPS_LINUX_H_ |   5 #ifndef BASE_DEBUG_PROC_MAPS_LINUX_H_ | 
|   6 #define BASE_DEBUG_PROC_MAPS_LINUX_H_ |   6 #define BASE_DEBUG_PROC_MAPS_LINUX_H_ | 
|   7  |   7  | 
 |   8 #include <stdint.h> | 
 |   9  | 
|   8 #include <string> |  10 #include <string> | 
|   9 #include <vector> |  11 #include <vector> | 
|  10  |  12  | 
|  11 #include "base/base_export.h" |  13 #include "base/base_export.h" | 
|  12 #include "base/basictypes.h" |  | 
|  13  |  14  | 
|  14 namespace base { |  15 namespace base { | 
|  15 namespace debug { |  16 namespace debug { | 
|  16  |  17  | 
|  17 // Describes a region of mapped memory and the path of the file mapped. |  18 // Describes a region of mapped memory and the path of the file mapped. | 
|  18 struct MappedMemoryRegion { |  19 struct MappedMemoryRegion { | 
|  19   enum Permission { |  20   enum Permission { | 
|  20     READ = 1 << 0, |  21     READ = 1 << 0, | 
|  21     WRITE = 1 << 1, |  22     WRITE = 1 << 1, | 
|  22     EXECUTE = 1 << 2, |  23     EXECUTE = 1 << 2, | 
|  23     PRIVATE = 1 << 3,  // If set, region is private, otherwise it is shared. |  24     PRIVATE = 1 << 3,  // If set, region is private, otherwise it is shared. | 
|  24   }; |  25   }; | 
|  25  |  26  | 
|  26   // The address range [start,end) of mapped memory. |  27   // The address range [start,end) of mapped memory. | 
|  27   uintptr_t start; |  28   uintptr_t start; | 
|  28   uintptr_t end; |  29   uintptr_t end; | 
|  29  |  30  | 
|  30   // Byte offset into |path| of the range mapped into memory. |  31   // Byte offset into |path| of the range mapped into memory. | 
|  31   unsigned long long offset; |  32   unsigned long long offset; | 
|  32  |  33  | 
|  33   // Bitmask of read/write/execute/private/shared permissions. |  34   // Bitmask of read/write/execute/private/shared permissions. | 
|  34   uint8 permissions; |  35   uint8_t permissions; | 
|  35  |  36  | 
|  36   // Name of the file mapped into memory. |  37   // Name of the file mapped into memory. | 
|  37   // |  38   // | 
|  38   // NOTE: path names aren't guaranteed to point at valid files. For example, |  39   // NOTE: path names aren't guaranteed to point at valid files. For example, | 
|  39   // "[heap]" and "[stack]" are used to represent the location of the process' |  40   // "[heap]" and "[stack]" are used to represent the location of the process' | 
|  40   // heap and stack, respectively. |  41   // heap and stack, respectively. | 
|  41   std::string path; |  42   std::string path; | 
|  42 }; |  43 }; | 
|  43  |  44  | 
|  44 // Reads the data from /proc/self/maps and stores the result in |proc_maps|. |  45 // Reads the data from /proc/self/maps and stores the result in |proc_maps|. | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  81  |  82  | 
|  82 // Parses /proc/<pid>/maps input data and stores in |regions|. Returns true |  83 // Parses /proc/<pid>/maps input data and stores in |regions|. Returns true | 
|  83 // and updates |regions| if and only if all of |input| was successfully parsed. |  84 // and updates |regions| if and only if all of |input| was successfully parsed. | 
|  84 BASE_EXPORT bool ParseProcMaps(const std::string& input, |  85 BASE_EXPORT bool ParseProcMaps(const std::string& input, | 
|  85                                std::vector<MappedMemoryRegion>* regions); |  86                                std::vector<MappedMemoryRegion>* regions); | 
|  86  |  87  | 
|  87 }  // namespace debug |  88 }  // namespace debug | 
|  88 }  // namespace base |  89 }  // namespace base | 
|  89  |  90  | 
|  90 #endif  // BASE_DEBUG_PROC_MAPS_LINUX_H_ |  91 #endif  // BASE_DEBUG_PROC_MAPS_LINUX_H_ | 
| OLD | NEW |