Chromium Code Reviews| Index: src/google_breakpad/processor/proc_maps_linux.h |
| =================================================================== |
| --- src/google_breakpad/processor/proc_maps_linux.h (revision 0) |
| +++ src/google_breakpad/processor/proc_maps_linux.h (working copy) |
| @@ -0,0 +1,52 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_DEBUG_PROC_MAPS_LINUX_H_ |
| +#define BASE_DEBUG_PROC_MAPS_LINUX_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#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.
|
| + |
| +// 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.
|
| +struct MappedMemoryRegion { |
| + enum Permission { |
| + READ = 1 << 0, |
| + WRITE = 1 << 1, |
| + EXECUTE = 1 << 2, |
| + PRIVATE = 1 << 3, // If set, region is private, otherwise it is shared. |
| + }; |
| + |
| + // The address range [start,end) of mapped memory. |
| + uintptr_t start; |
| + uintptr_t end; |
| + |
| + // Byte offset into |path| of the range mapped into memory. |
| + unsigned long long offset; |
| + |
| + // Bitmask of read/write/execute/private/shared permissions. |
| + uint8_t permissions; |
| + |
| + // Major and minor devices. |
| + uint8_t major_device; |
| + uint8_t minor_device; |
| + |
| + // Value of the inode. |
| + long inode; |
| + |
| + // Name of the file mapped into memory. |
| + // |
| + // NOTE: path names aren't guaranteed to point at valid files. For example, |
| + // "[heap]" and "[stack]" are used to represent the location of the process' |
| + // heap and stack, respectively. |
| + 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.
|
| +}; |
| + |
| +// Parses /proc/<pid>/maps input data and stores in |regions|. Returns true |
| +// and updates |regions| if and only if all of |input| was successfully parsed. |
| +bool ParseProcMaps(const std::string& input, |
| + std::vector<MappedMemoryRegion>* regions); |
| + |
| +#endif // BASE_DEBUG_PROC_MAPS_LINUX_H_ |