mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-01 00:34:18 +01:00
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
This commit is contained in:
parent
611f8b7f32
commit
fff818514d
@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
#if defined(__ARM_EABI__)
|
#if defined(__ARM_EABI__)
|
||||||
#define TID_PTR_REGISTER "r3"
|
#define TID_PTR_REGISTER "r3"
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define TID_PTR_REGISTER "x3"
|
||||||
#elif defined(__i386)
|
#elif defined(__i386)
|
||||||
#define TID_PTR_REGISTER "ecx"
|
#define TID_PTR_REGISTER "ecx"
|
||||||
#elif defined(__x86_64)
|
#elif defined(__x86_64)
|
||||||
|
@ -433,6 +433,8 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
|
|||||||
// specific register. Check that we can recover its value.
|
// specific register. Check that we can recover its value.
|
||||||
#if defined(__ARM_EABI__)
|
#if defined(__ARM_EABI__)
|
||||||
pid_t* process_tid_location = (pid_t*)(one_thread.regs.uregs[3]);
|
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)
|
#elif defined(__i386)
|
||||||
pid_t* process_tid_location = (pid_t*)(one_thread.regs.ecx);
|
pid_t* process_tid_location = (pid_t*)(one_thread.regs.ecx);
|
||||||
#elif defined(__x86_64)
|
#elif defined(__x86_64)
|
||||||
|
@ -525,26 +525,19 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
|
|||||||
|
|
||||||
// Fake the child's stack pointer for its crashing thread. NOTE: This must
|
// 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).
|
// be an invalid memory address for the child process (stack or otherwise).
|
||||||
#if defined(__i386)
|
|
||||||
// Try 1MB below the current stack.
|
// Try 1MB below the current stack.
|
||||||
uintptr_t invalid_stack_pointer =
|
uintptr_t invalid_stack_pointer =
|
||||||
reinterpret_cast<uintptr_t>(&context) - 1024*1024;
|
reinterpret_cast<uintptr_t>(&context) - 1024*1024;
|
||||||
|
#if defined(__i386)
|
||||||
context.context.uc_mcontext.gregs[REG_ESP] = invalid_stack_pointer;
|
context.context.uc_mcontext.gregs[REG_ESP] = invalid_stack_pointer;
|
||||||
#elif defined(__x86_64)
|
#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;
|
context.context.uc_mcontext.gregs[REG_RSP] = invalid_stack_pointer;
|
||||||
#elif defined(__ARM_EABI__)
|
#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;
|
context.context.uc_mcontext.arm_sp = invalid_stack_pointer;
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
context.context.uc_mcontext.sp = invalid_stack_pointer;
|
||||||
#elif defined(__mips__)
|
#elif defined(__mips__)
|
||||||
// Try 1MB below the current stack.
|
context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
|
||||||
uintptr_t invalid_stack_pointer =
|
|
||||||
reinterpret_cast<uintptr_t>(&context) - 1024 * 1024;
|
|
||||||
context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
|
|
||||||
invalid_stack_pointer;
|
invalid_stack_pointer;
|
||||||
#else
|
#else
|
||||||
# error "This code has not been ported to your platform yet."
|
# error "This code has not been ported to your platform yet."
|
||||||
@ -629,7 +622,7 @@ TEST(MinidumpWriterTest, MinidumpSizeLimit) {
|
|||||||
ASSERT_EQ(1, r);
|
ASSERT_EQ(1, r);
|
||||||
ASSERT_TRUE(pfd.revents & POLLIN);
|
ASSERT_TRUE(pfd.revents & POLLIN);
|
||||||
uint8_t junk;
|
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)));
|
static_cast<ssize_t>(sizeof(junk)));
|
||||||
}
|
}
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include <asm/ptrace.h>
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/user.h>
|
#include <sys/user.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user