OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_DEBUG_PROC_MAPS_H_ | |
6 #define BASE_DEBUG_PROC_MAPS_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/base_export.h" | |
12 #include "base/basictypes.h" | |
13 #include "base/files/file_path.h" | |
14 | |
15 namespace base { | |
16 namespace debug { | |
17 | |
18 #if defined(OS_LINUX) || defined(OS_ANDROID) | |
19 | |
20 // Describes a region of mapped memory and the path of the file mapped. | |
21 // start: Starting address of memory range. | |
22 // end: Ending address of memory range. | |
23 // offset: The starting offset of the file that is mapped into memory. | |
24 // path: The path of the object file that is mapped into memory. | |
25 struct MappedMemoryRegion { | |
26 uintptr_t start; | |
27 uintptr_t end; | |
28 size_t offset; | |
29 FilePath path; | |
satorux1
2013/07/01 03:59:56
maybe add the permission bits? that info would be
scherkus (not reviewing)
2013/07/01 21:59:45
Done. I'll make my stack trace code check for r+x
| |
30 }; | |
31 | |
32 // Reads the data from /proc/self/maps. Returns an empty string if unable to | |
33 // do so. | |
34 BASE_EXPORT std::string ReadProcMaps(); | |
35 | |
36 // Parses /proc/<pid>/maps input data and stores in |regions|. Invalid input | |
37 // data is skipped i.e., if |input| contains no valid data, then |regions| | |
38 // will be empty. | |
39 // | |
40 // NOTE: Parsed path names aren't guaranteed to point at valid files. For | |
41 // example, "[heap]" and "[stack]" are used to represent the location of the | |
42 // process' heap and stack, respectively. | |
43 BASE_EXPORT void ParseProcMaps(const std::string& input, | |
satorux1
2013/07/01 03:59:56
Maybe return a boolean to report an error?
scherkus (not reviewing)
2013/07/01 21:59:45
Done, but made this function an all-or-nothing fun
| |
44 std::vector<MappedMemoryRegion>* regions); | |
45 #endif | |
46 | |
47 } // namespace debug | |
48 } // namespace base | |
49 | |
50 #endif // BASE_DEBUG_PROC_MAPS_H_ | |
OLD | NEW |