Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: base/debug/proc_maps.h

Issue 18178015: Implement /proc/self/maps/ parsing code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/debug/proc_maps.cc » ('j') | base/debug/proc_maps.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698