diff options
author | benchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-04-03 16:50:06 +0000 |
---|---|---|
committer | benchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-04-03 16:50:06 +0000 |
commit | 66460ce1d979618851bace0635b438d2be3f116a (patch) | |
tree | fd202ade88a957f4b5e958e90afbc5e81271cc03 /src | |
parent | Add Arm64 version of breakpad_getcontext for Android. (diff) | |
download | breakpad-66460ce1d979618851bace0635b438d2be3f116a.tar.xz |
Fix ElfCoreDumpTest.ValidCoreFile unit test.
The ElfCoreDumpTest.ValidCoreFile unit test assumed that the number of
NT_FPREGSET / NT_PRXFPREG notes in the core dump file equals to the number of
threads of the crashed process. This assumption isn't always true as the kernel
skips filling the NT_FPREGSET / NT_PRXFPREG note of a thread if the FPU state
isn't available. The kernel indicates the availability of NT_FPREGSET /
NT_PRXFPREG via the pr_fpvalid field of the NT_PRSTATUS note. This CL modifies
the ElfCoreDumpTest.ValidCoreFile unit test to verify the number of NT_FPREGSET
and NT_PRXFPREG notes based on the pr_fpvalid field of the NT_PRSTATUS notes.
BUG=577
TEST=Run unit tests on x86 and x86_64 Linux platform.
R=vapier@chromium.org
Review URL: https://breakpad.appspot.com/1404002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1303 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r-- | src/common/linux/elf_core_dump_unittest.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/linux/elf_core_dump_unittest.cc b/src/common/linux/elf_core_dump_unittest.cc index 7c122aa6..4eae9680 100644 --- a/src/common/linux/elf_core_dump_unittest.cc +++ b/src/common/linux/elf_core_dump_unittest.cc @@ -176,6 +176,7 @@ TEST(ElfCoreDumpTest, ValidCoreFile) { size_t num_nt_prpsinfo = 0; size_t num_nt_prstatus = 0; + size_t num_pr_fpvalid = 0; #if defined(__i386__) || defined(__x86_64__) size_t num_nt_fpregset = 0; #endif @@ -207,6 +208,8 @@ TEST(ElfCoreDumpTest, ValidCoreFile) { EXPECT_EQ(kCrashSignal, status->pr_info.si_signo); } ++num_nt_prstatus; + if (status->pr_fpvalid) + ++num_pr_fpvalid; break; } #if defined(__i386__) || defined(__x86_64__) @@ -235,9 +238,9 @@ TEST(ElfCoreDumpTest, ValidCoreFile) { EXPECT_EQ(1U, num_nt_prpsinfo); EXPECT_EQ(kNumOfThreads, num_nt_prstatus); #if defined(__i386__) || defined(__x86_64__) - EXPECT_EQ(kNumOfThreads, num_nt_fpregset); + EXPECT_EQ(num_pr_fpvalid, num_nt_fpregset); #endif #if defined(__i386__) - EXPECT_EQ(kNumOfThreads, num_nt_prxfpreg); + EXPECT_EQ(num_pr_fpvalid, num_nt_prxfpreg); #endif } |