| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include "minidump/test/minidump_context_test_util.h" | 15 #include "minidump/test/minidump_context_test_util.h" |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/format_macros.h" |
| 18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 19 #include "gtest/gtest.h" | 20 #include "gtest/gtest.h" |
| 20 #include "snapshot/cpu_context.h" | 21 #include "snapshot/cpu_context.h" |
| 21 #include "snapshot/test/test_cpu_context.h" | 22 #include "snapshot/test/test_cpu_context.h" |
| 22 | 23 |
| 23 namespace crashpad { | 24 namespace crashpad { |
| 24 namespace test { | 25 namespace test { |
| 25 | 26 |
| 26 void InitializeMinidumpContextX86(MinidumpContextX86* context, uint32_t seed) { | 27 void InitializeMinidumpContextX86(MinidumpContextX86* context, uint32_t seed) { |
| 27 if (seed == 0) { | 28 if (seed == 0) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 EXPECT_EQ(expected->fpu_cs, observed->fpu_cs); | 177 EXPECT_EQ(expected->fpu_cs, observed->fpu_cs); |
| 177 EXPECT_EQ(expected->reserved_2, observed->reserved_2); | 178 EXPECT_EQ(expected->reserved_2, observed->reserved_2); |
| 178 EXPECT_EQ(expected->fpu_dp, observed->fpu_dp); | 179 EXPECT_EQ(expected->fpu_dp, observed->fpu_dp); |
| 179 EXPECT_EQ(expected->fpu_ds, observed->fpu_ds); | 180 EXPECT_EQ(expected->fpu_ds, observed->fpu_ds); |
| 180 EXPECT_EQ(expected->reserved_3, observed->reserved_3); | 181 EXPECT_EQ(expected->reserved_3, observed->reserved_3); |
| 181 EXPECT_EQ(expected->mxcsr, observed->mxcsr); | 182 EXPECT_EQ(expected->mxcsr, observed->mxcsr); |
| 182 EXPECT_EQ(expected->mxcsr_mask, observed->mxcsr_mask); | 183 EXPECT_EQ(expected->mxcsr_mask, observed->mxcsr_mask); |
| 183 for (size_t st_mm_index = 0; | 184 for (size_t st_mm_index = 0; |
| 184 st_mm_index < arraysize(expected->st_mm); | 185 st_mm_index < arraysize(expected->st_mm); |
| 185 ++st_mm_index) { | 186 ++st_mm_index) { |
| 186 SCOPED_TRACE(base::StringPrintf("st_mm_index %zu", st_mm_index)); | 187 SCOPED_TRACE(base::StringPrintf("st_mm_index %" PRIuS, st_mm_index)); |
| 187 for (size_t byte = 0; | 188 for (size_t byte = 0; |
| 188 byte < arraysize(expected->st_mm[st_mm_index].st); | 189 byte < arraysize(expected->st_mm[st_mm_index].st); |
| 189 ++byte) { | 190 ++byte) { |
| 190 EXPECT_EQ(expected->st_mm[st_mm_index].st[byte], | 191 EXPECT_EQ(expected->st_mm[st_mm_index].st[byte], |
| 191 observed->st_mm[st_mm_index].st[byte]) << "byte " << byte; | 192 observed->st_mm[st_mm_index].st[byte]) << "byte " << byte; |
| 192 } | 193 } |
| 193 for (size_t byte = 0; | 194 for (size_t byte = 0; |
| 194 byte < arraysize(expected->st_mm[st_mm_index].st_reserved); | 195 byte < arraysize(expected->st_mm[st_mm_index].st_reserved); |
| 195 ++byte) { | 196 ++byte) { |
| 196 EXPECT_EQ(expected->st_mm[st_mm_index].st_reserved[byte], | 197 EXPECT_EQ(expected->st_mm[st_mm_index].st_reserved[byte], |
| 197 observed->st_mm[st_mm_index].st_reserved[byte]) | 198 observed->st_mm[st_mm_index].st_reserved[byte]) |
| 198 << "byte " << byte; | 199 << "byte " << byte; |
| 199 } | 200 } |
| 200 } | 201 } |
| 201 for (size_t xmm_index = 0; | 202 for (size_t xmm_index = 0; |
| 202 xmm_index < arraysize(expected->xmm); | 203 xmm_index < arraysize(expected->xmm); |
| 203 ++xmm_index) { | 204 ++xmm_index) { |
| 204 SCOPED_TRACE(base::StringPrintf("xmm_index %zu", xmm_index)); | 205 SCOPED_TRACE(base::StringPrintf("xmm_index %" PRIuS, xmm_index)); |
| 205 for (size_t byte = 0; byte < arraysize(expected->xmm[xmm_index]); ++byte) { | 206 for (size_t byte = 0; byte < arraysize(expected->xmm[xmm_index]); ++byte) { |
| 206 EXPECT_EQ(expected->xmm[xmm_index][byte], observed->xmm[xmm_index][byte]) | 207 EXPECT_EQ(expected->xmm[xmm_index][byte], observed->xmm[xmm_index][byte]) |
| 207 << "byte " << byte; | 208 << "byte " << byte; |
| 208 } | 209 } |
| 209 } | 210 } |
| 210 for (size_t byte = 0; byte < arraysize(expected->reserved_4); ++byte) { | 211 for (size_t byte = 0; byte < arraysize(expected->reserved_4); ++byte) { |
| 211 EXPECT_EQ(expected->reserved_4[byte], observed->reserved_4[byte]) | 212 EXPECT_EQ(expected->reserved_4[byte], observed->reserved_4[byte]) |
| 212 << "byte " << byte; | 213 << "byte " << byte; |
| 213 } | 214 } |
| 214 for (size_t byte = 0; byte < arraysize(expected->available); ++byte) { | 215 for (size_t byte = 0; byte < arraysize(expected->available); ++byte) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 EXPECT_EQ(expected.last_branch_to_rip, observed->last_branch_to_rip); | 371 EXPECT_EQ(expected.last_branch_to_rip, observed->last_branch_to_rip); |
| 371 EXPECT_EQ(expected.last_branch_from_rip, observed->last_branch_from_rip); | 372 EXPECT_EQ(expected.last_branch_from_rip, observed->last_branch_from_rip); |
| 372 EXPECT_EQ(expected.last_exception_to_rip, observed->last_exception_to_rip); | 373 EXPECT_EQ(expected.last_exception_to_rip, observed->last_exception_to_rip); |
| 373 EXPECT_EQ(expected.last_exception_from_rip, | 374 EXPECT_EQ(expected.last_exception_from_rip, |
| 374 observed->last_exception_from_rip); | 375 observed->last_exception_from_rip); |
| 375 } | 376 } |
| 376 } | 377 } |
| 377 | 378 |
| 378 } // namespace test | 379 } // namespace test |
| 379 } // namespace crashpad | 380 } // namespace crashpad |
| OLD | NEW |