aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/minidump_writer/linux_dumper.h
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org>2014-10-01 09:51:23 +0000
committerprimiano@chromium.org <primiano@chromium.org>2014-10-01 09:51:23 +0000
commit9f150ee33e99b6c076f8047f1c33586e95ce9584 (patch)
tree944df97066057ea69ca3a7f00139816106d97595 /src/client/linux/minidump_writer/linux_dumper.h
parentFix some nits raised by Timur for r1385. (diff)
downloadbreakpad-9f150ee33e99b6c076f8047f1c33586e95ce9584.tar.xz
Microdumps: refactor out common parts of minidump_writer.cc
This change is a pure refactoring of the common bits of minidump_writer.cc that will be shared soon with the upcoming microdump_writer.cc. In particular, this CL is extracting the following classes: - ThreadInfo: handles the state of the threads in the crashing process. - RawContextCPU: typedef for arch-specific CPU context structure. - UContextReader: Fills out a dump RawContextCPU structure from the ucontext struct provided by the kernel (arch-dependent). - SeccompUnwinder: cleans out the stack frames of the Seccomp sandbox on the supported architectures. - MappingInfo: handles information about mappings BUG=chromium:410294 R=mmandlis@chromium.org Review URL: https://breakpad.appspot.com/4684002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1388 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/minidump_writer/linux_dumper.h')
-rw-r--r--src/client/linux/minidump_writer/linux_dumper.h50
1 files changed, 2 insertions, 48 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper.h b/src/client/linux/minidump_writer/linux_dumper.h
index ad2af018..e37ed179 100644
--- a/src/client/linux/minidump_writer/linux_dumper.h
+++ b/src/client/linux/minidump_writer/linux_dumper.h
@@ -44,15 +44,13 @@
#include <sys/types.h>
#include <sys/user.h>
+#include "client/linux/dump_writer_common/mapping_info.h"
+#include "client/linux/dump_writer_common/thread_info.h"
#include "common/memory.h"
#include "google_breakpad/common/minidump_format.h"
namespace google_breakpad {
-#if defined(__i386) || defined(__x86_64)
-typedef typeof(((struct user*) 0)->u_debugreg[0]) debugreg_t;
-#endif
-
// Typedef for our parsing of the auxv variables in /proc/pid/auxv.
#if defined(__i386) || defined(__ARM_EABI__) || defined(__mips__)
typedef Elf32_auxv_t elf_aux_entry;
@@ -67,50 +65,6 @@ typedef typeof(((elf_aux_entry*) 0)->a_un.a_val) elf_aux_val_t;
// This should always be less than NAME_MAX!
const char kLinuxGateLibraryName[] = "linux-gate.so";
-// We produce one of these structures for each thread in the crashed process.
-struct ThreadInfo {
- pid_t tgid; // thread group id
- pid_t ppid; // parent process
-
- uintptr_t stack_pointer; // thread stack pointer
-
-
-#if defined(__i386) || defined(__x86_64)
- user_regs_struct regs;
- user_fpregs_struct fpregs;
- static const unsigned kNumDebugRegisters = 8;
- debugreg_t dregs[8];
-#if defined(__i386)
- user_fpxregs_struct fpxregs;
-#endif // defined(__i386)
-
-#elif defined(__ARM_EABI__)
- // Mimicking how strace does this(see syscall.c, search for GETREGS)
- struct user_regs regs;
- struct user_fpregs fpregs;
-#elif defined(__aarch64__)
- // Use the structures defined in <asm/ptrace.h>
- struct user_pt_regs regs;
- struct user_fpsimd_state fpregs;
-#elif defined(__mips__)
- user_regs_struct regs;
- user_fpregs_struct fpregs;
- uint32_t hi[3];
- uint32_t lo[3];
- uint32_t dsp_control;
-#endif
-};
-
-// One of these is produced for each mapping in the process (i.e. line in
-// /proc/$x/maps).
-struct MappingInfo {
- uintptr_t start_addr;
- size_t size;
- size_t offset; // offset into the backed file.
- bool exec; // true if the mapping has the execute bit set.
- char name[NAME_MAX];
-};
-
class LinuxDumper {
public:
explicit LinuxDumper(pid_t pid);