2022-09-06 19:14:07 -04:00
|
|
|
|
// Copyright 2014 The Crashpad Authors
|
2014-10-07 17:27:11 -04:00
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
|
|
#include "minidump/minidump_context_writer.h"
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
#include <string>
|
|
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
|
|
#include "base/notreached.h"
|
2014-10-07 17:27:11 -04:00
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
#include "minidump/minidump_context.h"
|
2014-10-20 12:11:14 -04:00
|
|
|
|
#include "minidump/test/minidump_context_test_util.h"
|
2014-10-22 18:35:18 -04:00
|
|
|
|
#include "minidump/test/minidump_writable_test_util.h"
|
2014-11-03 17:43:39 -05:00
|
|
|
|
#include "snapshot/cpu_context.h"
|
|
|
|
|
#include "snapshot/test/test_cpu_context.h"
|
2015-02-18 14:15:38 -05:00
|
|
|
|
#include "util/file/string_file.h"
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
namespace crashpad {
|
|
|
|
|
namespace test {
|
|
|
|
|
namespace {
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
template <typename Writer, typename Context, typename RVAType>
|
2018-01-30 12:41:09 -08:00
|
|
|
|
void EmptyContextTest(void (*expect_context)(uint32_t, const Context*, bool)) {
|
|
|
|
|
Writer context_writer;
|
|
|
|
|
StringFile string_file;
|
|
|
|
|
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
|
|
|
|
ASSERT_EQ(string_file.string().size(), sizeof(Context));
|
|
|
|
|
|
|
|
|
|
const Context* observed =
|
2022-06-02 12:27:37 -06:00
|
|
|
|
MinidumpWritableAtRVA<Context>(string_file.string(), RVAType(0));
|
2018-01-30 12:41:09 -08:00
|
|
|
|
ASSERT_TRUE(observed);
|
|
|
|
|
|
|
|
|
|
expect_context(0, observed, false);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
class TestTypeNames {
|
|
|
|
|
public:
|
|
|
|
|
template <typename T>
|
|
|
|
|
static std::string GetName(int) {
|
|
|
|
|
if (std::is_same<T, RVA>()) {
|
|
|
|
|
return "RVA";
|
|
|
|
|
}
|
|
|
|
|
if (std::is_same<T, RVA64>()) {
|
|
|
|
|
return "RVA64";
|
|
|
|
|
}
|
2024-05-17 06:53:13 -07:00
|
|
|
|
NOTREACHED_IN_MIGRATION();
|
2022-06-02 12:27:37 -06:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename RVAType>
|
|
|
|
|
class MinidumpContextWriter : public ::testing::Test {};
|
|
|
|
|
|
|
|
|
|
using RVATypes = ::testing::Types<RVA, RVA64>;
|
|
|
|
|
TYPED_TEST_SUITE(MinidumpContextWriter, RVATypes, TestTypeNames);
|
|
|
|
|
|
|
|
|
|
TYPED_TEST(MinidumpContextWriter, MinidumpContextX86Writer) {
|
2015-02-18 14:15:38 -05:00
|
|
|
|
StringFile string_file;
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Make sure that a context writer that’s untouched writes a zeroed-out
|
|
|
|
|
// context.
|
|
|
|
|
SCOPED_TRACE("zero");
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
EmptyContextTest<MinidumpContextX86Writer, MinidumpContextX86, TypeParam>(
|
2018-01-30 12:41:09 -08:00
|
|
|
|
ExpectMinidumpContextX86);
|
2014-10-07 17:27:11 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
SCOPED_TRACE("nonzero");
|
|
|
|
|
|
2015-02-18 14:15:38 -05:00
|
|
|
|
string_file.Reset();
|
2017-07-25 19:15:48 -04:00
|
|
|
|
constexpr uint32_t kSeed = 0x8086;
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
MinidumpContextX86Writer context_writer;
|
|
|
|
|
InitializeMinidumpContextX86(context_writer.context(), kSeed);
|
|
|
|
|
|
2015-02-18 14:15:38 -05:00
|
|
|
|
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
ASSERT_EQ(string_file.string().size(), sizeof(MinidumpContextX86));
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
const MinidumpContextX86* observed =
|
2022-06-02 12:27:37 -06:00
|
|
|
|
MinidumpWritableAtRVA<MinidumpContextX86>(string_file.string(),
|
|
|
|
|
TypeParam(0));
|
2014-11-03 17:43:39 -05:00
|
|
|
|
ASSERT_TRUE(observed);
|
|
|
|
|
|
|
|
|
|
ExpectMinidumpContextX86(kSeed, observed, false);
|
2014-10-07 17:27:11 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, MinidumpContextAMD64Writer) {
|
2017-10-31 22:25:34 -04:00
|
|
|
|
{
|
|
|
|
|
// Make sure that a heap-allocated context writer has the proper alignment,
|
|
|
|
|
// because it may be nonstandard.
|
|
|
|
|
auto context_writer = std::make_unique<MinidumpContextAMD64Writer>();
|
|
|
|
|
EXPECT_EQ(reinterpret_cast<uintptr_t>(context_writer.get()) &
|
|
|
|
|
(alignof(MinidumpContextAMD64Writer) - 1),
|
|
|
|
|
0u);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-18 14:15:38 -05:00
|
|
|
|
StringFile string_file;
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Make sure that a context writer that’s untouched writes a zeroed-out
|
|
|
|
|
// context.
|
|
|
|
|
SCOPED_TRACE("zero");
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
EmptyContextTest<MinidumpContextAMD64Writer,
|
|
|
|
|
MinidumpContextAMD64,
|
|
|
|
|
TypeParam>(ExpectMinidumpContextAMD64);
|
2014-10-07 17:27:11 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
SCOPED_TRACE("nonzero");
|
|
|
|
|
|
2015-02-18 14:15:38 -05:00
|
|
|
|
string_file.Reset();
|
2017-07-25 19:15:48 -04:00
|
|
|
|
constexpr uint32_t kSeed = 0x808664;
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
MinidumpContextAMD64Writer context_writer;
|
|
|
|
|
InitializeMinidumpContextAMD64(context_writer.context(), kSeed);
|
|
|
|
|
|
2015-02-18 14:15:38 -05:00
|
|
|
|
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
ASSERT_EQ(string_file.string().size(), sizeof(MinidumpContextAMD64));
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
const MinidumpContextAMD64* observed =
|
2022-06-02 12:27:37 -06:00
|
|
|
|
MinidumpWritableAtRVA<MinidumpContextAMD64>(string_file.string(),
|
|
|
|
|
TypeParam(0));
|
2014-11-03 17:43:39 -05:00
|
|
|
|
ASSERT_TRUE(observed);
|
|
|
|
|
|
|
|
|
|
ExpectMinidumpContextAMD64(kSeed, observed, false);
|
2014-10-07 17:27:11 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-08 21:08:54 +00:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, MinidumpContextRISCV64Writer) {
|
|
|
|
|
{
|
|
|
|
|
// Make sure that a heap-allocated context writer has the proper alignment,
|
|
|
|
|
// because it may be nonstandard.
|
|
|
|
|
auto context_writer = std::make_unique<MinidumpContextRISCV64Writer>();
|
|
|
|
|
EXPECT_EQ(reinterpret_cast<uintptr_t>(context_writer.get()) &
|
|
|
|
|
(alignof(MinidumpContextRISCV64Writer) - 1),
|
|
|
|
|
0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringFile string_file;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Make sure that a context writer that’s untouched writes a zeroed-out
|
|
|
|
|
// context.
|
|
|
|
|
SCOPED_TRACE("zero");
|
|
|
|
|
|
|
|
|
|
EmptyContextTest<MinidumpContextRISCV64Writer,
|
|
|
|
|
MinidumpContextRISCV64,
|
|
|
|
|
TypeParam>(ExpectMinidumpContextRISCV64);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
SCOPED_TRACE("nonzero");
|
|
|
|
|
|
|
|
|
|
string_file.Reset();
|
|
|
|
|
constexpr uint32_t kSeed = 0x808664;
|
|
|
|
|
|
|
|
|
|
MinidumpContextRISCV64Writer context_writer;
|
|
|
|
|
InitializeMinidumpContextRISCV64(context_writer.context(), kSeed);
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(context_writer.WriteEverything(&string_file));
|
|
|
|
|
ASSERT_EQ(string_file.string().size(), sizeof(MinidumpContextRISCV64));
|
|
|
|
|
|
|
|
|
|
const MinidumpContextRISCV64* observed =
|
|
|
|
|
MinidumpWritableAtRVA<MinidumpContextRISCV64>(string_file.string(),
|
|
|
|
|
TypeParam(0));
|
|
|
|
|
ASSERT_TRUE(observed);
|
|
|
|
|
|
|
|
|
|
ExpectMinidumpContextRISCV64(kSeed, observed, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
template <typename Writer, typename Context, typename RVAType>
|
2018-01-30 12:41:09 -08:00
|
|
|
|
void FromSnapshotTest(const CPUContext& snapshot_context,
|
|
|
|
|
void (*expect_context)(uint32_t, const Context*, bool),
|
|
|
|
|
uint32_t seed) {
|
2022-06-02 12:27:37 -06:00
|
|
|
|
std::unique_ptr<::crashpad::MinidumpContextWriter> context_writer =
|
|
|
|
|
::crashpad::MinidumpContextWriter::CreateFromSnapshot(&snapshot_context);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
ASSERT_TRUE(context_writer);
|
|
|
|
|
|
2015-02-18 14:15:38 -05:00
|
|
|
|
StringFile string_file;
|
|
|
|
|
ASSERT_TRUE(context_writer->WriteEverything(&string_file));
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
2018-01-30 12:41:09 -08:00
|
|
|
|
const Context* observed =
|
2022-06-02 12:27:37 -06:00
|
|
|
|
MinidumpWritableAtRVA<Context>(string_file.string(), RVAType(0));
|
2014-11-03 17:43:39 -05:00
|
|
|
|
ASSERT_TRUE(observed);
|
|
|
|
|
|
2018-01-30 12:41:09 -08:00
|
|
|
|
expect_context(seed, observed, true);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, X86_FromSnapshot) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
constexpr uint32_t kSeed = 32;
|
|
|
|
|
CPUContextX86 context_x86;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.x86 = &context_x86;
|
|
|
|
|
InitializeCPUContextX86(&context, kSeed);
|
2022-06-02 12:27:37 -06:00
|
|
|
|
FromSnapshotTest<MinidumpContextX86Writer, MinidumpContextX86, TypeParam>(
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context, ExpectMinidumpContextX86, kSeed);
|
|
|
|
|
}
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, AMD64_FromSnapshot) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
constexpr uint32_t kSeed = 64;
|
|
|
|
|
CPUContextX86_64 context_x86_64;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.x86_64 = &context_x86_64;
|
|
|
|
|
InitializeCPUContextX86_64(&context, kSeed);
|
2022-06-02 12:27:37 -06:00
|
|
|
|
FromSnapshotTest<MinidumpContextAMD64Writer, MinidumpContextAMD64, TypeParam>(
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context, ExpectMinidumpContextAMD64, kSeed);
|
|
|
|
|
}
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, AMD64_CetFromSnapshot) {
|
2022-05-14 22:40:24 -07:00
|
|
|
|
constexpr uint32_t kSeed = 77;
|
|
|
|
|
CPUContextX86_64 context_x86_64;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.x86_64 = &context_x86_64;
|
|
|
|
|
InitializeCPUContextX86_64(&context, kSeed);
|
|
|
|
|
context_x86_64.xstate.enabled_features |= XSTATE_MASK_CET_U;
|
|
|
|
|
context_x86_64.xstate.cet_u.cetmsr = 1;
|
|
|
|
|
context_x86_64.xstate.cet_u.ssp = kSeed * kSeed;
|
|
|
|
|
// We cannot use FromSnapshotTest as we write more than the fixed context.
|
2022-06-02 12:27:37 -06:00
|
|
|
|
std::unique_ptr<::crashpad::MinidumpContextWriter> context_writer =
|
|
|
|
|
::crashpad::MinidumpContextWriter::CreateFromSnapshot(&context);
|
2022-05-14 22:40:24 -07:00
|
|
|
|
ASSERT_TRUE(context_writer);
|
|
|
|
|
|
|
|
|
|
StringFile string_file;
|
|
|
|
|
ASSERT_TRUE(context_writer->WriteEverything(&string_file));
|
|
|
|
|
|
|
|
|
|
const MinidumpContextAMD64* observed =
|
2022-06-02 12:27:37 -06:00
|
|
|
|
MinidumpWritableAtRVA<MinidumpContextAMD64>(string_file.string(),
|
|
|
|
|
TypeParam(0));
|
2022-05-14 22:40:24 -07:00
|
|
|
|
ASSERT_TRUE(observed);
|
|
|
|
|
|
|
|
|
|
ExpectMinidumpContextAMD64(kSeed, observed, true);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, ARM_Zeros) {
|
|
|
|
|
EmptyContextTest<MinidumpContextARMWriter, MinidumpContextARM, TypeParam>(
|
2018-01-30 12:41:09 -08:00
|
|
|
|
ExpectMinidumpContextARM);
|
|
|
|
|
}
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, ARM64_Zeros) {
|
|
|
|
|
EmptyContextTest<MinidumpContextARM64Writer, MinidumpContextARM64, TypeParam>(
|
2018-01-30 12:41:09 -08:00
|
|
|
|
ExpectMinidumpContextARM64);
|
|
|
|
|
}
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, ARM_FromSnapshot) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
constexpr uint32_t kSeed = 32;
|
|
|
|
|
CPUContextARM context_arm;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.arm = &context_arm;
|
|
|
|
|
InitializeCPUContextARM(&context, kSeed);
|
2022-06-02 12:27:37 -06:00
|
|
|
|
FromSnapshotTest<MinidumpContextARMWriter, MinidumpContextARM, TypeParam>(
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context, ExpectMinidumpContextARM, kSeed);
|
|
|
|
|
}
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, ARM64_FromSnapshot) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
constexpr uint32_t kSeed = 64;
|
|
|
|
|
CPUContextARM64 context_arm64;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.arm64 = &context_arm64;
|
|
|
|
|
InitializeCPUContextARM64(&context, kSeed);
|
2022-06-02 12:27:37 -06:00
|
|
|
|
FromSnapshotTest<MinidumpContextARM64Writer, MinidumpContextARM64, TypeParam>(
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context, ExpectMinidumpContextARM64, kSeed);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, MIPS_Zeros) {
|
|
|
|
|
EmptyContextTest<MinidumpContextMIPSWriter, MinidumpContextMIPS, TypeParam>(
|
2018-07-10 11:17:22 +02:00
|
|
|
|
ExpectMinidumpContextMIPS);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, MIPS64_Zeros) {
|
|
|
|
|
EmptyContextTest<MinidumpContextMIPS64Writer,
|
|
|
|
|
MinidumpContextMIPS64,
|
|
|
|
|
TypeParam>(ExpectMinidumpContextMIPS64);
|
2018-07-10 11:17:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, MIPS_FromSnapshot) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
constexpr uint32_t kSeed = 32;
|
|
|
|
|
CPUContextMIPS context_mips;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.mipsel = &context_mips;
|
|
|
|
|
InitializeCPUContextMIPS(&context, kSeed);
|
2022-06-02 12:27:37 -06:00
|
|
|
|
FromSnapshotTest<MinidumpContextMIPSWriter, MinidumpContextMIPS, TypeParam>(
|
2018-07-10 11:17:22 +02:00
|
|
|
|
context, ExpectMinidumpContextMIPS, kSeed);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 12:27:37 -06:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
constexpr uint32_t kSeed = 64;
|
|
|
|
|
CPUContextMIPS64 context_mips;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.mips64 = &context_mips;
|
|
|
|
|
InitializeCPUContextMIPS64(&context, kSeed);
|
2022-06-02 12:27:37 -06:00
|
|
|
|
FromSnapshotTest<MinidumpContextMIPS64Writer,
|
|
|
|
|
MinidumpContextMIPS64,
|
|
|
|
|
TypeParam>(context, ExpectMinidumpContextMIPS64, kSeed);
|
2018-07-10 11:17:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-08 21:08:54 +00:00
|
|
|
|
TYPED_TEST(MinidumpContextWriter, RISCV64_Zeros) {
|
|
|
|
|
EmptyContextTest<MinidumpContextRISCV64Writer,
|
|
|
|
|
MinidumpContextRISCV64,
|
|
|
|
|
TypeParam>(ExpectMinidumpContextRISCV64);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TYPED_TEST(MinidumpContextWriter, RISCV64_FromSnapshot) {
|
|
|
|
|
constexpr uint32_t kSeed = 64;
|
|
|
|
|
CPUContextRISCV64 context_riscv64;
|
|
|
|
|
CPUContext context;
|
|
|
|
|
context.riscv64 = &context_riscv64;
|
|
|
|
|
InitializeCPUContextRISCV64(&context, kSeed);
|
|
|
|
|
FromSnapshotTest<MinidumpContextRISCV64Writer,
|
|
|
|
|
MinidumpContextRISCV64,
|
|
|
|
|
TypeParam>(context, ExpectMinidumpContextRISCV64, kSeed);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-07 17:27:11 -04:00
|
|
|
|
} // namespace
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace crashpad
|