Index: src/client/linux/minidump_writer/linux_dumper.h |
diff --git a/src/client/linux/minidump_writer/linux_dumper.h b/src/client/linux/minidump_writer/linux_dumper.h |
index 6a3a100f32376e125490a64376c7318a76c4486f..f7fe1dd9dfa39ca6c9b9cd32b994dba9ac574f5c 100644 |
--- a/src/client/linux/minidump_writer/linux_dumper.h |
+++ b/src/client/linux/minidump_writer/linux_dumper.h |
@@ -72,7 +72,9 @@ const char kLinuxGateLibraryName[] = "linux-gate.so"; |
class LinuxDumper { |
public: |
- explicit LinuxDumper(pid_t pid); |
+ // The |root_prefix| is prepended to mapping paths before opening them, which |
+ // is useful if the crash originates from a chroot. |
+ explicit LinuxDumper(pid_t pid, const char* root_prefix = ""); |
virtual ~LinuxDumper(); |
@@ -140,16 +142,21 @@ class LinuxDumper { |
pid_t crash_thread() const { return crash_thread_; } |
void set_crash_thread(pid_t crash_thread) { crash_thread_ = crash_thread; } |
+ // Concatenates the |root_prefix_| and |mapping| path. Writes into |path| and |
+ // returns true unless the string is too long. |
+ bool GetMappingAbsolutePath(const MappingInfo& mapping, |
+ char path[PATH_MAX]) const; |
+ |
// Extracts the effective path and file name of from |mapping|. In most cases |
// the effective name/path are just the mapping's path and basename. In some |
// other cases, however, a library can be mapped from an archive (e.g., when |
// loading .so libs from an apk on Android) and this method is able to |
// reconstruct the original file name. |
- static void GetMappingEffectiveNameAndPath(const MappingInfo& mapping, |
- char* file_path, |
- size_t file_path_size, |
- char* file_name, |
- size_t file_name_size); |
+ void GetMappingEffectiveNameAndPath(const MappingInfo& mapping, |
+ char* file_path, |
+ size_t file_path_size, |
+ char* file_name, |
+ size_t file_name_size); |
protected: |
bool ReadAuxv(); |
@@ -172,6 +179,9 @@ class LinuxDumper { |
// ID of the crashed process. |
const pid_t pid_; |
+ // Path of the root directory to which mapping paths are relative. |
+ const char* const root_prefix_; |
+ |
// Virtual address at which the process crashed. |
uintptr_t crash_address_; |