Chromium Code Reviews| Index: src/google_breakpad/processor/minidump.h | 
| =================================================================== | 
| --- src/google_breakpad/processor/minidump.h (revision 1474) | 
| +++ src/google_breakpad/processor/minidump.h (working copy) | 
| @@ -852,7 +852,100 @@ | 
| uint32_t info_count_; | 
| }; | 
| +// MinidumpLinuxMaps wraps information about a single mapped memory region | 
| +// from /proc/self/maps. | 
| +class MinidumpLinuxMaps : public MinidumpObject { | 
| + public: | 
| + virtual ~MinidumpLinuxMaps(); | 
| + // The memory address of the base of the mapped region. | 
| + uint64_t GetBase() const { return valid_ ? base_address_ : 0; } | 
| + // The size of the mapped region. | 
| + uint64_t GetSize() const { return valid_ ? region_size_ : 0; } | 
| + | 
| + // The permissions of the mapped region. | 
| + bool IsReadable() const { return valid_ ? is_readable_ : false; } | 
| + bool IsWriteable() const { return valid_ ? is_writeable_ : false; } | 
| + bool IsExecutable() const { return valid_ ? is_executable_ : false; } | 
| + bool IsShared() const { return valid_ ? is_shared_ : false; } | 
| + | 
| + // The offset of the mapped region. | 
| + uint64_t GetOffset() const { return valid_ ? offset_ : 0; } | 
| + | 
| + // The major device number. | 
| + uint8_t GetMajorDevice() const { return valid_ ? major_device_ : 0; } | 
| + // The minor device number. | 
| + uint8_t GetMinorDevice() const { return valid_ ? minor_device_ : 0; } | 
| + | 
| + // The inode of the mapped region. | 
| + uint32_t GetInode() const { return valid_ ? inode_ : 0; } | 
| + | 
| + // The pathname of the mapped region. | 
| + const string GetPathname() const { return valid_ ? pathname_ : NULL; } | 
| + | 
| + // Print the contents of this mapping. | 
| + void Print(); | 
| + | 
| + private: | 
| + // These objects are managed by MinidumpLinuxMapsList. | 
| + friend class MinidumpLinuxMapsList; | 
| + | 
| + explicit MinidumpLinuxMaps(Minidump *minidump); | 
| 
 
ivanpe
2015/07/23 01:17:12
Please, document who should own the memory for the
 
liuandrew
2015/07/24 23:25:35
Done.
 
 | 
| + | 
| + // Read data about a single mapping from /proc/self/maps and load the data | 
| + // into this object. The input vector is in the same format as a line from | 
| + // /proc/self/maps. | 
| + bool Read(vector<char> *data); | 
| 
 
ivanpe
2015/07/23 01:17:12
Is this an input parameter?  Passing as const vect
 
liuandrew
2015/07/24 23:25:35
Removed method.
 
 | 
| + | 
| + // Instance variables. | 
| 
 
ivanpe
2015/07/23 01:17:12
This comment is not very useful.  Please, comment
 
liuandrew
2015/07/24 23:25:35
Removed these instance variables.
 
 | 
| + uint64_t base_address_; | 
| + uint64_t region_size_; | 
| + bool is_readable_; | 
| + bool is_writeable_; | 
| + bool is_executable_; | 
| + bool is_shared_; | 
| + uint64_t offset_; | 
| + uint8_t major_device_; | 
| + uint8_t minor_device_; | 
| + uint32_t inode_; | 
| + string pathname_; | 
| + vector<char> *raw_linux_maps_; | 
| +}; | 
| 
 
ivanpe
2015/07/23 01:17:12
DISALLOW_COPY_AND_ASSIGN(MinidumpLinuxMaps);
 
liuandrew
2015/07/24 23:25:35
Why do I need this? What does it do? The other cla
 
ivanpe
2015/07/27 18:12:42
If you do not want to support copy/move operations
 
liuandrew
2015/07/27 23:09:26
Done.
 
 | 
| + | 
| +// MinidumpLinuxMapsList corresponds to the Linux-exclusive MD_LINUX_MAPS | 
| +// stream, which contains the contents of /prod/self/maps, which contains | 
| +// the mapped memory regions and their access permissions. | 
| +class MinidumpLinuxMapsList : public MinidumpStream { | 
| + public: | 
| + virtual ~MinidumpLinuxMapsList(); | 
| + | 
| + // Get mapping at the given memory address. | 
| + const MinidumpLinuxMaps *GetLinuxMapsForAddress(uint64_t address) const; | 
| 
 
ivanpe
2015/07/23 01:17:12
Please, document who owns the memory for the retur
 
liuandrew
2015/07/24 23:25:36
Done.
 
 | 
| + // Get mapping at the given index. | 
| + const MinidumpLinuxMaps *GetLinuxMapsAtIndex(unsigned int index) const; | 
| 
 
ivanpe
2015/07/23 01:17:12
Please, document who owns the memory for the retur
 
liuandrew
2015/07/24 23:25:35
Done.
 
 | 
| + | 
| + // Print the contents of /proc/self/maps to stdout. | 
| + void Print(); | 
| + | 
| + private: | 
| + friend class Minidump; | 
| + | 
| + typedef vector<MinidumpLinuxMaps *> MinidumpLinuxMappings; | 
| + | 
| + static const uint32_t kStreamType = MD_LINUX_MAPS; | 
| + | 
| + explicit MinidumpLinuxMapsList(Minidump *minidump); | 
| 
 
ivanpe
2015/07/23 01:17:12
Again, please, describe who owns the passed in poi
 
liuandrew
2015/07/24 23:25:35
Done.
 
 | 
| + | 
| + // Read and load the contents of the process mapping data. | 
| + // The stream should have data in the form of /proc/self/maps. | 
| + bool Read(uint32_t expected_size); | 
| 
 
ivanpe
2015/07/23 01:17:12
Please, document return value?  What happens when
 
liuandrew
2015/07/24 23:25:36
Done.
 
 | 
| + | 
| + // Instance variables. | 
| 
 
ivanpe
2015/07/23 01:17:12
Please, document the individual members instead.
 
liuandrew
2015/07/24 23:25:35
Done.
 
 | 
| + MinidumpLinuxMappings *maps_; | 
| + uint32_t maps_count_; | 
| + vector<char> raw_linux_maps_list_; | 
| +}; | 
| 
 
ivanpe
2015/07/23 01:17:12
DISALLOW_COPY_AND_ASSIGN(MinidumpLinuxMapsList);
 
liuandrew
2015/07/24 23:25:35
See response for similar comment.
 
ivanpe
2015/07/27 18:12:41
Please, take a look at my other response.  Thanks.
 
liuandrew
2015/07/27 23:09:26
Done.
 
 | 
| + | 
| // Minidump is the user's interface to a minidump file. It wraps MDRawHeader | 
| // and provides access to the minidump's top-level stream directory. | 
| class Minidump { | 
| @@ -912,6 +1005,9 @@ | 
| virtual MinidumpBreakpadInfo* GetBreakpadInfo(); | 
| virtual MinidumpMemoryInfoList* GetMemoryInfoList(); | 
| + // The next method also calls GetStream, but is exclusive for Linux dumps. | 
| + virtual MinidumpLinuxMapsList *GetLinuxMapsList(); | 
| + | 
| // The next set of methods are provided for users who wish to access | 
| // data in minidump files directly, while leveraging the rest of | 
| // this class and related classes to handle the basic minidump |