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/minidump_thread_writer.h" | 15 #include "minidump/minidump_thread_writer.h" |
16 | 16 |
17 #include <windows.h> | 17 #include <windows.h> |
18 #include <dbghelp.h> | 18 #include <dbghelp.h> |
19 #include <sys/types.h> | 19 #include <sys/types.h> |
20 | 20 |
21 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
| 22 #include "base/format_macros.h" |
22 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
23 #include "gtest/gtest.h" | 24 #include "gtest/gtest.h" |
24 #include "minidump/minidump_context_writer.h" | 25 #include "minidump/minidump_context_writer.h" |
25 #include "minidump/minidump_memory_writer.h" | 26 #include "minidump/minidump_memory_writer.h" |
26 #include "minidump/minidump_file_writer.h" | 27 #include "minidump/minidump_file_writer.h" |
27 #include "minidump/minidump_thread_id_map.h" | 28 #include "minidump/minidump_thread_id_map.h" |
28 #include "minidump/test/minidump_context_test_util.h" | 29 #include "minidump/test/minidump_context_test_util.h" |
29 #include "minidump/test/minidump_memory_writer_test_util.h" | 30 #include "minidump/test/minidump_memory_writer_test_util.h" |
30 #include "minidump/test/minidump_file_writer_test_util.h" | 31 #include "minidump/test/minidump_file_writer_test_util.h" |
31 #include "minidump/test/minidump_writable_test_util.h" | 32 #include "minidump/test/minidump_writable_test_util.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 const MINIDUMP_THREAD_LIST* thread_list = nullptr; | 613 const MINIDUMP_THREAD_LIST* thread_list = nullptr; |
613 const MINIDUMP_MEMORY_LIST* memory_list = nullptr; | 614 const MINIDUMP_MEMORY_LIST* memory_list = nullptr; |
614 ASSERT_NO_FATAL_FAILURE( | 615 ASSERT_NO_FATAL_FAILURE( |
615 GetThreadListStream(file_writer.string(), &thread_list, &memory_list)); | 616 GetThreadListStream(file_writer.string(), &thread_list, &memory_list)); |
616 | 617 |
617 ASSERT_EQ(3u, thread_list->NumberOfThreads); | 618 ASSERT_EQ(3u, thread_list->NumberOfThreads); |
618 ASSERT_EQ(2u, memory_list->NumberOfMemoryRanges); | 619 ASSERT_EQ(2u, memory_list->NumberOfMemoryRanges); |
619 | 620 |
620 size_t memory_index = 0; | 621 size_t memory_index = 0; |
621 for (size_t index = 0; index < thread_list->NumberOfThreads; ++index) { | 622 for (size_t index = 0; index < thread_list->NumberOfThreads; ++index) { |
622 SCOPED_TRACE(base::StringPrintf("index %zu", index)); | 623 SCOPED_TRACE(base::StringPrintf("index %" PRIuS, index)); |
623 | 624 |
624 const MINIDUMP_MEMORY_DESCRIPTOR* observed_stack = nullptr; | 625 const MINIDUMP_MEMORY_DESCRIPTOR* observed_stack = nullptr; |
625 const MINIDUMP_MEMORY_DESCRIPTOR** observed_stack_p = | 626 const MINIDUMP_MEMORY_DESCRIPTOR** observed_stack_p = |
626 expect_threads[index].Stack.Memory.DataSize ? &observed_stack : nullptr; | 627 expect_threads[index].Stack.Memory.DataSize ? &observed_stack : nullptr; |
627 const MinidumpContextType* observed_context = nullptr; | 628 const MinidumpContextType* observed_context = nullptr; |
628 ASSERT_NO_FATAL_FAILURE( | 629 ASSERT_NO_FATAL_FAILURE( |
629 ExpectThread(&expect_threads[index], | 630 ExpectThread(&expect_threads[index], |
630 &thread_list->Threads[index], | 631 &thread_list->Threads[index], |
631 file_writer.string(), | 632 file_writer.string(), |
632 observed_stack_p, | 633 observed_stack_p, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 679 |
679 TEST(MinidumpThreadWriterDeathTest, InitializeFromSnapshot_NoContext) { | 680 TEST(MinidumpThreadWriterDeathTest, InitializeFromSnapshot_NoContext) { |
680 ASSERT_DEATH( | 681 ASSERT_DEATH( |
681 RunInitializeFromSnapshotTest<InitializeFromSnapshotNoContextTraits>( | 682 RunInitializeFromSnapshotTest<InitializeFromSnapshotNoContextTraits>( |
682 false), "context_"); | 683 false), "context_"); |
683 } | 684 } |
684 | 685 |
685 } // namespace | 686 } // namespace |
686 } // namespace test | 687 } // namespace test |
687 } // namespace crashpad | 688 } // namespace crashpad |
OLD | NEW |