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, |
(...skipping 20 matching lines...) Expand all Loading... |
31 x86_thread_state32.__eax = 1; | 31 x86_thread_state32.__eax = 1; |
32 x86_float_state32.__fpu_ftw = 2; | 32 x86_float_state32.__fpu_ftw = 2; |
33 x86_debug_state32.__dr0 = 3; | 33 x86_debug_state32.__dr0 = 3; |
34 | 34 |
35 // Test the simple case, where everything in the CPUContextX86 argument is set | 35 // Test the simple case, where everything in the CPUContextX86 argument is set |
36 // directly from the supplied thread, float, and debug state parameters. | 36 // directly from the supplied thread, float, and debug state parameters. |
37 { | 37 { |
38 CPUContextX86 cpu_context_x86 = {}; | 38 CPUContextX86 cpu_context_x86 = {}; |
39 internal::InitializeCPUContextX86(&cpu_context_x86, | 39 internal::InitializeCPUContextX86(&cpu_context_x86, |
40 THREAD_STATE_NONE, | 40 THREAD_STATE_NONE, |
41 NULL, | 41 nullptr, |
42 0, | 42 0, |
43 &x86_thread_state32, | 43 &x86_thread_state32, |
44 &x86_float_state32, | 44 &x86_float_state32, |
45 &x86_debug_state32); | 45 &x86_debug_state32); |
46 EXPECT_EQ(1u, cpu_context_x86.eax); | 46 EXPECT_EQ(1u, cpu_context_x86.eax); |
47 EXPECT_EQ(2u, cpu_context_x86.fxsave.ftw); | 47 EXPECT_EQ(2u, cpu_context_x86.fxsave.ftw); |
48 EXPECT_EQ(3u, cpu_context_x86.dr0); | 48 EXPECT_EQ(3u, cpu_context_x86.dr0); |
49 } | 49 } |
50 | 50 |
51 // Supply context in a CPU-specific “flavor” parameter expected to be used | 51 // Supply context in a CPU-specific “flavor” parameter expected to be used |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 x86_thread_state64.__rax = 10; | 226 x86_thread_state64.__rax = 10; |
227 x86_float_state64.__fpu_ftw = 11; | 227 x86_float_state64.__fpu_ftw = 11; |
228 x86_debug_state64.__dr0 = 12; | 228 x86_debug_state64.__dr0 = 12; |
229 | 229 |
230 // Test the simple case, where everything in the CPUContextX86_64 argument is | 230 // Test the simple case, where everything in the CPUContextX86_64 argument is |
231 // set directly from the supplied thread, float, and debug state parameters. | 231 // set directly from the supplied thread, float, and debug state parameters. |
232 { | 232 { |
233 CPUContextX86_64 cpu_context_x86_64 = {}; | 233 CPUContextX86_64 cpu_context_x86_64 = {}; |
234 internal::InitializeCPUContextX86_64(&cpu_context_x86_64, | 234 internal::InitializeCPUContextX86_64(&cpu_context_x86_64, |
235 THREAD_STATE_NONE, | 235 THREAD_STATE_NONE, |
236 NULL, | 236 nullptr, |
237 0, | 237 0, |
238 &x86_thread_state64, | 238 &x86_thread_state64, |
239 &x86_float_state64, | 239 &x86_float_state64, |
240 &x86_debug_state64); | 240 &x86_debug_state64); |
241 EXPECT_EQ(10u, cpu_context_x86_64.rax); | 241 EXPECT_EQ(10u, cpu_context_x86_64.rax); |
242 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw); | 242 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw); |
243 EXPECT_EQ(12u, cpu_context_x86_64.dr0); | 243 EXPECT_EQ(12u, cpu_context_x86_64.dr0); |
244 } | 244 } |
245 | 245 |
246 // Supply context in a CPU-specific “flavor” parameter expected to be used | 246 // Supply context in a CPU-specific “flavor” parameter expected to be used |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw); | 412 EXPECT_EQ(11u, cpu_context_x86_64.fxsave.ftw); |
413 EXPECT_EQ(12u, cpu_context_x86_64.dr0); | 413 EXPECT_EQ(12u, cpu_context_x86_64.dr0); |
414 } | 414 } |
415 } | 415 } |
416 | 416 |
417 #endif | 417 #endif |
418 | 418 |
419 } // namespace | 419 } // namespace |
420 } // namespace test | 420 } // namespace test |
421 } // namespace crashpad | 421 } // namespace crashpad |
OLD | NEW |