aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/minidump_writer/linux_dumper.h
diff options
context:
space:
mode:
authorDominik Laskowski <domlaskowski@chromium.org>2016-03-03 16:14:00 -0500
committerMike Frysinger <vapier@chromium.org>2016-03-07 21:35:43 -0500
commit4d690507171bff0f29dcf382b6909888d2f3bd17 (patch)
treefe354e7b4b6ca1885de68547cea5194e7f6da632 /src/client/linux/minidump_writer/linux_dumper.h
parentHandle multiple microdumps in system log. (diff)
downloadbreakpad-4d690507171bff0f29dcf382b6909888d2f3bd17.tar.xz
Add an optional root prefix to Linux dumpers
The Linux dumpers use absolute paths for shared libraries referenced by dumps, so they fail to locate them if the crash originated in a chroot. This CL enables callers to specify a root prefix, which is prepended to mapping paths before opening them. BUG=chromium:591792 TEST=make check Review URL: https://codereview.chromium.org/1761023002/
Diffstat (limited to 'src/client/linux/minidump_writer/linux_dumper.h')
-rw-r--r--src/client/linux/minidump_writer/linux_dumper.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper.h b/src/client/linux/minidump_writer/linux_dumper.h
index 6a3a100f..f7fe1dd9 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_;