[MIPS] Fix core dump related unit tests for Android on MIPS

This change fixes failing unittests in Android on MIPS:
LinuxCoreDumperTest.VerifyDumpWithMultipleThreads
ElfCoreDumpTest.ValidCoreFile

BUG=None
TEST=Running breakpad_unittests on MIPS Android device

Review URL: https://breakpad.appspot.com/3664002



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1330 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
gordana.cmiljanovic@imgtec.com 2014-05-14 09:11:35 +00:00
parent 9eb13afd54
commit 412b68396c
3 changed files with 65 additions and 0 deletions

View file

@ -188,7 +188,19 @@ bool LinuxCoreDumper::EnumerateThreads() {
memset(&info, 0, sizeof(ThreadInfo)); memset(&info, 0, sizeof(ThreadInfo));
info.tgid = status->pr_pgrp; info.tgid = status->pr_pgrp;
info.ppid = status->pr_ppid; info.ppid = status->pr_ppid;
#if defined(__mips__)
for (int i = EF_REG0; i <= EF_REG31; i++)
info.regs.regs[i - EF_REG0] = status->pr_reg[i];
info.regs.lo = status->pr_reg[EF_LO];
info.regs.hi = status->pr_reg[EF_HI];
info.regs.epc = status->pr_reg[EF_CP0_EPC];
info.regs.badvaddr = status->pr_reg[EF_CP0_BADVADDR];
info.regs.status = status->pr_reg[EF_CP0_STATUS];
info.regs.cause = status->pr_reg[EF_CP0_CAUSE];
#else
memcpy(&info.regs, status->pr_reg, sizeof(info.regs)); memcpy(&info.regs, status->pr_reg, sizeof(info.regs));
#endif
if (first_thread) { if (first_thread) {
crash_thread_ = pid; crash_thread_ = pid;
crash_signal_ = status->pr_info.si_signo; crash_signal_ = status->pr_info.si_signo;

View file

@ -55,6 +55,8 @@ typedef unsigned long elf_greg_t;
#define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t)) #define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t))
#elif defined(__aarch64__) #elif defined(__aarch64__)
#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t)) #define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
#elif defined(__mips__)
#define ELF_NGREG 45
#else #else
#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
#endif #endif
@ -95,6 +97,9 @@ struct elf_prpsinfo {
#ifdef __x86_64__ #ifdef __x86_64__
unsigned int pr_uid; unsigned int pr_uid;
unsigned int pr_gid; unsigned int pr_gid;
#elif defined(__mips__)
unsigned long pr_uid;
unsigned long pr_gid;
#else #else
unsigned short pr_uid; unsigned short pr_uid;
unsigned short pr_gid; unsigned short pr_gid;

View file

@ -127,6 +127,54 @@ struct user {
#define _ASM_USER_H 1 // Prevent <asm/user.h> conflicts #define _ASM_USER_H 1 // Prevent <asm/user.h> conflicts
#define EF_REG0 6
#define EF_REG1 7
#define EF_REG2 8
#define EF_REG3 9
#define EF_REG4 10
#define EF_REG5 11
#define EF_REG6 12
#define EF_REG7 13
#define EF_REG8 14
#define EF_REG9 15
#define EF_REG10 16
#define EF_REG11 17
#define EF_REG12 18
#define EF_REG13 19
#define EF_REG14 20
#define EF_REG15 21
#define EF_REG16 22
#define EF_REG17 23
#define EF_REG18 24
#define EF_REG19 25
#define EF_REG20 26
#define EF_REG21 27
#define EF_REG22 28
#define EF_REG23 29
#define EF_REG24 30
#define EF_REG25 31
/*
* k0/k1 unsaved
*/
#define EF_REG26 32
#define EF_REG27 33
#define EF_REG28 34
#define EF_REG29 35
#define EF_REG30 36
#define EF_REG31 37
/*
* Saved special registers
*/
#define EF_LO 38
#define EF_HI 39
#define EF_CP0_EPC 40
#define EF_CP0_BADVADDR 41
#define EF_CP0_STATUS 42
#define EF_CP0_CAUSE 43
struct user_regs_struct { struct user_regs_struct {
unsigned long long regs[32]; unsigned long long regs[32];
unsigned long long lo; unsigned long long lo;