| 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 24 matching lines...) Expand all Loading... |
| 35 template <typename T> | 35 template <typename T> |
| 36 void GetMiscInfoStream(const std::string& file_contents, const T** misc_info) { | 36 void GetMiscInfoStream(const std::string& file_contents, const T** misc_info) { |
| 37 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); | 37 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); |
| 38 const size_t kMiscInfoStreamOffset = | 38 const size_t kMiscInfoStreamOffset = |
| 39 kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); | 39 kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); |
| 40 const size_t kMiscInfoStreamSize = sizeof(T); | 40 const size_t kMiscInfoStreamSize = sizeof(T); |
| 41 const size_t kFileSize = kMiscInfoStreamOffset + kMiscInfoStreamSize; | 41 const size_t kFileSize = kMiscInfoStreamOffset + kMiscInfoStreamSize; |
| 42 | 42 |
| 43 ASSERT_EQ(kFileSize, file_contents.size()); | 43 ASSERT_EQ(kFileSize, file_contents.size()); |
| 44 | 44 |
| 45 const MINIDUMP_DIRECTORY* directory; |
| 45 const MINIDUMP_HEADER* header = | 46 const MINIDUMP_HEADER* header = |
| 46 reinterpret_cast<const MINIDUMP_HEADER*>(&file_contents[0]); | 47 MinidumpHeaderAtStart(file_contents, &directory); |
| 48 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0)); |
| 49 ASSERT_TRUE(directory); |
| 47 | 50 |
| 48 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0)); | 51 ASSERT_EQ(kMinidumpStreamTypeMiscInfo, directory[0].StreamType); |
| 49 | 52 ASSERT_EQ(kMiscInfoStreamSize, directory[0].Location.DataSize); |
| 50 const MINIDUMP_DIRECTORY* directory = | 53 ASSERT_EQ(kMiscInfoStreamOffset, directory[0].Location.Rva); |
| 51 reinterpret_cast<const MINIDUMP_DIRECTORY*>( | |
| 52 &file_contents[kDirectoryOffset]); | |
| 53 | |
| 54 ASSERT_EQ(kMinidumpStreamTypeMiscInfo, directory->StreamType); | |
| 55 ASSERT_EQ(kMiscInfoStreamSize, directory->Location.DataSize); | |
| 56 ASSERT_EQ(kMiscInfoStreamOffset, directory->Location.Rva); | |
| 57 | 54 |
| 58 *misc_info = | 55 *misc_info = |
| 59 reinterpret_cast<const T*>(&file_contents[kMiscInfoStreamOffset]); | 56 reinterpret_cast<const T*>(&file_contents[kMiscInfoStreamOffset]); |
| 60 | 57 |
| 61 ASSERT_EQ(kMiscInfoStreamSize, (*misc_info)->SizeOfInfo); | 58 ASSERT_EQ(kMiscInfoStreamSize, (*misc_info)->SizeOfInfo); |
| 62 } | 59 } |
| 63 | 60 |
| 64 void ExpectNULPaddedString16Equal(const char16* expected, | 61 void ExpectNULPaddedString16Equal(const char16* expected, |
| 65 const char16* observed, | 62 const char16* observed, |
| 66 size_t size) { | 63 size_t size) { |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 c16lcpy(expected.DbgBldStr, | 608 c16lcpy(expected.DbgBldStr, |
| 612 debug_build_string_utf16.c_str(), | 609 debug_build_string_utf16.c_str(), |
| 613 arraysize(expected.DbgBldStr)); | 610 arraysize(expected.DbgBldStr)); |
| 614 | 611 |
| 615 ExpectMiscInfoEqual(&expected, observed); | 612 ExpectMiscInfoEqual(&expected, observed); |
| 616 } | 613 } |
| 617 | 614 |
| 618 } // namespace | 615 } // namespace |
| 619 } // namespace test | 616 } // namespace test |
| 620 } // namespace crashpad | 617 } // namespace crashpad |
| OLD | NEW |