[google-breakpad] r1474 committed - add aarch64 support to minidump-2-core...

171 views
Skip to first unread message

google-...@googlecode.com

unread,
Jul 20, 2015, 6:21:37 AM7/20/15
to google-br...@googlegroups.com
Revision: 1474
Author: vap...@chromium.org
Date: Mon Jul 20 10:21:27 2015 UTC
Log: add aarch64 support to minidump-2-core

The thread info expects the struct names as they expect in asm/ptrace.h,
but the header doesn't include that, it includes sys/user.h. Rename the
reg structs to match that header.

Rename the elf_siginfo to _elf_siginfo to avoid conflicting with the one
in the sys/procfs.h. It is only used locally in one place, so we don't
need to update any callers.

Otherwise, drop in aarch64 support into the minidump-2-core file.

BUG=chromium:334368

https://code.google.com/p/google-breakpad/source/detail?r=1474

Modified:
/trunk/src/client/linux/dump_writer_common/thread_info.h
/trunk/src/tools/linux/md2core/minidump-2-core.cc

=======================================
--- /trunk/src/client/linux/dump_writer_common/thread_info.h Tue Apr 21
21:34:14 2015 UTC
+++ /trunk/src/client/linux/dump_writer_common/thread_info.h Mon Jul 20
10:21:27 2015 UTC
@@ -65,9 +65,9 @@
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;
+ // Use the structures defined in <sys/user.h>
+ struct user_regs_struct regs;
+ struct user_fpsimd_struct fpregs;
#elif defined(__mips__)
// Use the structure defined in <sys/ucontext.h>.
mcontext_t mcontext;
=======================================
--- /trunk/src/tools/linux/md2core/minidump-2-core.cc Tue Apr 21 21:34:14
2015 UTC
+++ /trunk/src/tools/linux/md2core/minidump-2-core.cc Mon Jul 20 10:21:27
2015 UTC
@@ -74,6 +74,8 @@
#define ELF_ARCH EM_ARM
#elif defined(__mips__)
#define ELF_ARCH EM_MIPS
+#elif defined(__aarch64__)
+ #define ELF_ARCH EM_AARCH64
#endif

#if defined(__arm__)
@@ -136,14 +138,14 @@
long tv_usec; /*
Microseconds */
} elf_timeval;

-typedef struct elf_siginfo { /* Information about signal
(unused) */
+typedef struct _elf_siginfo { /* Information about signal
(unused) */
int32_t si_signo; /* Signal
number */
int32_t si_code; /* Extra
code */
int32_t si_errno; /*
Errno */
-} elf_siginfo;
+} _elf_siginfo;

typedef struct prstatus { /* Information about thread; includes CPU
reg*/
- elf_siginfo pr_info; /* Info associated with
signal */
+ _elf_siginfo pr_info; /* Info associated with
signal */
uint16_t pr_cursig; /* Current
signal */
unsigned long pr_sigpend; /* Set of pending
signals */
unsigned long pr_sighold; /* Set of held
signals */
@@ -213,15 +215,18 @@
pid_t tid;
#if defined(__mips__)
mcontext_t mcontext;
-#else // __mips__
+#else
user_regs_struct regs;
+#endif
#if defined(__i386__) || defined(__x86_64__)
user_fpregs_struct fpregs;
-#endif // __i386__ || __x86_64__
+#endif
#if defined(__i386__)
user_fpxregs_struct fpxregs;
-#endif // __i386__
-#endif // __mips__
+#endif
+#if defined(__aarch64__)
+ user_fpsimd_struct fpregs;
+#endif
uintptr_t stack_addr;
const uint8_t* stack;
size_t stack_length;
@@ -371,6 +376,22 @@
thread->regs.uregs[16] = rawregs->cpsr;
thread->regs.uregs[17] = 0; // what is ORIG_r0 exactly?
}
+#elif defined(__aarch64__)
+static void
+ParseThreadRegisters(CrashedProcess::Thread* thread,
+ const MinidumpMemoryRange& range) {
+ const MDRawContextARM64* rawregs = range.GetData<MDRawContextARM64>(0);
+
+ for (int i = 0; i < 31; ++i)
+ thread->regs.regs[i] = rawregs->iregs[i];
+ thread->regs.sp = rawregs->iregs[MD_CONTEXT_ARM64_REG_SP];
+ thread->regs.pc = rawregs->iregs[MD_CONTEXT_ARM64_REG_PC];
+ thread->regs.pstate = rawregs->cpsr;
+
+ memcpy(thread->fpregs.vregs, rawregs->float_save.regs, 8 * 32);
+ thread->fpregs.fpsr = rawregs->float_save.fpsr;
+ thread->fpregs.fpcr = rawregs->float_save.fpcr;
+}
#elif defined(__mips__)
static void
ParseThreadRegisters(CrashedProcess::Thread* thread,
@@ -466,6 +487,12 @@
"This version of minidump-2-core only supports ARM
(32bit).\n");
_exit(1);
}
+#elif defined(__aarch64__)
+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_ARM64) {
+ fprintf(stderr,
+ "This version of minidump-2-core only supports ARM
(64bit).\n");
+ _exit(1);
+ }
#elif defined(__mips__)
if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_MIPS) {
fprintf(stderr,
Reply all
Reply to author
Forward
0 new messages