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

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: add link 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 {
Mark Mentovai 2013/07/02 19:36:57 Aren’t we not doing second-level nested namespaces
scherkus (not reviewing) 2013/07/02 21:43:01 here's the most relevant discussion I could find:
17
18 #if defined(OS_LINUX) || defined(OS_ANDROID)
Mark Mentovai 2013/07/02 19:36:57 Get rid of this. Just rename the file with _linux
scherkus (not reviewing) 2013/07/02 21:43:01 Done.
19
20 // Describes a region of mapped memory and the path of the file mapped.
21 struct MappedMemoryRegion {
22 enum Permissions {
Mark Mentovai 2013/07/02 19:36:57 The members of this enum are single permissions, s
scherkus (not reviewing) 2013/07/02 21:43:01 Done.
23 READ = 1 << 0,
24 WRITE = 1 << 1,
25 EXECUTE = 1 << 2,
26 PRIVATE = 1 << 3, // If set, region is private otherwise it is shared.
Mark Mentovai 2013/07/02 19:36:57 Missing comma?
scherkus (not reviewing) 2013/07/02 21:43:01 Hrm. Not sure which comma is missing. I assume you
Mark Mentovai 2013/07/02 22:21:35 scherkus wrote:
27 };
28
29 // The address range [start,end) of mapped memory.
30 uintptr_t start;
31 uintptr_t end;
32
33 // Byte offset into |path| of the range mapped into memory.
34 size_t offset;
35
36 // Bitmask of read/write/execute/private/shared permissions.
37 uint8 permissions;
38
39 // Path of the file mapped into memory.
40 FilePath path;
41 };
42
43 // Reads the data from /proc/self/maps. Returns an empty string if unable to
44 // do so.
Mark Mentovai 2013/07/02 19:36:57 What’s it return otherwise? Just the contents of /
scherkus (not reviewing) 2013/07/02 21:43:01 Done.
45 BASE_EXPORT std::string ReadProcMaps();
46
47 // Parses /proc/<pid>/maps input data and stores in |regions|. Returns true
48 // and updates |regions| if and only if all of |input| was successfully parsed.
49 //
50 // NOTE: Parsed path names aren't guaranteed to point at valid files. For
51 // example, "[heap]" and "[stack]" are used to represent the location of the
52 // process' heap and stack, respectively.
53 BASE_EXPORT bool ParseProcMaps(const std::string& input,
54 std::vector<MappedMemoryRegion>* regions);
55
56 #endif
57
58 } // namespace debug
59 } // namespace base
60
61 #endif // BASE_DEBUG_PROC_MAPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698