aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/minidump_writer
diff options
context:
space:
mode:
authorrmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-04-08 17:36:11 +0000
committerrmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-04-08 17:36:11 +0000
commitfff818514d6b3b56c4a9a49773678fdd887068f4 (patch)
tree73a3dd7b62999c9aadc54da41d69f5ddf0b2029f /src/client/linux/minidump_writer
parentMove build configuration to root of repository. (diff)
downloadbreakpad-fff818514d6b3b56c4a9a49773678fdd887068f4.tar.xz
Add Arm64 support to breakpad unittests.
BUG=354405,335641 R=mark@chromium.org Review URL: https://breakpad.appspot.com/1424002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1305 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/minidump_writer')
-rw-r--r--src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc2
-rw-r--r--src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc2
-rw-r--r--src/client/linux/minidump_writer/minidump_writer_unittest.cc17
3 files changed, 9 insertions, 12 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
index 461a6cfe..4ccb7201 100644
--- a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
@@ -43,6 +43,8 @@
#if defined(__ARM_EABI__)
#define TID_PTR_REGISTER "r3"
+#elif defined(__aarch64__)
+#define TID_PTR_REGISTER "x3"
#elif defined(__i386)
#define TID_PTR_REGISTER "ecx"
#elif defined(__x86_64)
diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
index 15a66ce2..010ec67c 100644
--- a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
+++ b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
@@ -433,6 +433,8 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
// specific register. Check that we can recover its value.
#if defined(__ARM_EABI__)
pid_t* process_tid_location = (pid_t*)(one_thread.regs.uregs[3]);
+#elif defined(__aarch64__)
+ pid_t* process_tid_location = (pid_t*)(one_thread.regs.regs[3]);
#elif defined(__i386)
pid_t* process_tid_location = (pid_t*)(one_thread.regs.ecx);
#elif defined(__x86_64)
diff --git a/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/src/client/linux/minidump_writer/minidump_writer_unittest.cc
index 1ef064b1..e1046e12 100644
--- a/src/client/linux/minidump_writer/minidump_writer_unittest.cc
+++ b/src/client/linux/minidump_writer/minidump_writer_unittest.cc
@@ -525,26 +525,19 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
// Fake the child's stack pointer for its crashing thread. NOTE: This must
// be an invalid memory address for the child process (stack or otherwise).
-#if defined(__i386)
// Try 1MB below the current stack.
uintptr_t invalid_stack_pointer =
reinterpret_cast<uintptr_t>(&context) - 1024*1024;
+#if defined(__i386)
context.context.uc_mcontext.gregs[REG_ESP] = invalid_stack_pointer;
#elif defined(__x86_64)
- // Try 1MB below the current stack.
- uintptr_t invalid_stack_pointer =
- reinterpret_cast<uintptr_t>(&context) - 1024*1024;
context.context.uc_mcontext.gregs[REG_RSP] = invalid_stack_pointer;
#elif defined(__ARM_EABI__)
- // Try 1MB below the current stack.
- uintptr_t invalid_stack_pointer =
- reinterpret_cast<uintptr_t>(&context) - 1024*1024;
context.context.uc_mcontext.arm_sp = invalid_stack_pointer;
+#elif defined(__aarch64__)
+ context.context.uc_mcontext.sp = invalid_stack_pointer;
#elif defined(__mips__)
- // Try 1MB below the current stack.
- uintptr_t invalid_stack_pointer =
- reinterpret_cast<uintptr_t>(&context) - 1024 * 1024;
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
+ context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
invalid_stack_pointer;
#else
# error "This code has not been ported to your platform yet."
@@ -629,7 +622,7 @@ TEST(MinidumpWriterTest, MinidumpSizeLimit) {
ASSERT_EQ(1, r);
ASSERT_TRUE(pfd.revents & POLLIN);
uint8_t junk;
- ASSERT_EQ(read(fds[0], &junk, sizeof(junk)),
+ ASSERT_EQ(read(fds[0], &junk, sizeof(junk)),
static_cast<ssize_t>(sizeof(junk)));
}
close(fds[0]);