Chromium Code Reviews| 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_LINUX_H_ | |
| 6 #define BASE_DEBUG_PROC_MAPS_LINUX_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "google_breakpad/common/breakpad_types.h" | |
|
ivanpe
2015/07/27 18:12:42
#include "common/using_std_string.h"
liuandrew
2015/07/27 23:09:26
Done.
| |
| 12 | |
| 13 // Describes a region of mapped memory and the path of the file mapped. | |
|
ivanpe
2015/07/27 18:12:42
You should probably put this into the google_break
liuandrew
2015/07/27 23:09:26
Done.
| |
| 14 struct MappedMemoryRegion { | |
| 15 enum Permission { | |
| 16 READ = 1 << 0, | |
| 17 WRITE = 1 << 1, | |
| 18 EXECUTE = 1 << 2, | |
| 19 PRIVATE = 1 << 3, // If set, region is private, otherwise it is shared. | |
| 20 }; | |
| 21 | |
| 22 // The address range [start,end) of mapped memory. | |
| 23 uintptr_t start; | |
| 24 uintptr_t end; | |
| 25 | |
| 26 // Byte offset into |path| of the range mapped into memory. | |
| 27 unsigned long long offset; | |
| 28 | |
| 29 // Bitmask of read/write/execute/private/shared permissions. | |
| 30 uint8_t permissions; | |
| 31 | |
| 32 // Major and minor devices. | |
| 33 uint8_t major_device; | |
| 34 uint8_t minor_device; | |
| 35 | |
| 36 // Value of the inode. | |
| 37 long inode; | |
| 38 | |
| 39 // Name of the file mapped into memory. | |
| 40 // | |
| 41 // NOTE: path names aren't guaranteed to point at valid files. For example, | |
| 42 // "[heap]" and "[stack]" are used to represent the location of the process' | |
| 43 // heap and stack, respectively. | |
| 44 std::string path; | |
|
ivanpe
2015/07/27 18:12:42
Please, don't use std::string in breakpad code. I
liuandrew
2015/07/27 23:09:26
Done.
| |
| 45 }; | |
| 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 bool ParseProcMaps(const std::string& input, | |
| 50 std::vector<MappedMemoryRegion>* regions); | |
| 51 | |
| 52 #endif // BASE_DEBUG_PROC_MAPS_LINUX_H_ | |
| OLD | NEW |