| 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/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 22 #include "gtest/gtest.h" | 23 #include "gtest/gtest.h" |
| 23 #include "minidump/minidump_context_writer.h" | 24 #include "minidump/minidump_context_writer.h" |
| 24 #include "minidump/minidump_memory_writer.h" | 25 #include "minidump/minidump_memory_writer.h" |
| 25 #include "minidump/minidump_file_writer.h" | 26 #include "minidump/minidump_file_writer.h" |
| 26 #include "minidump/minidump_thread_id_map.h" | 27 #include "minidump/minidump_thread_id_map.h" |
| 27 #include "minidump/test/minidump_context_test_util.h" | 28 #include "minidump/test/minidump_context_test_util.h" |
| 28 #include "minidump/test/minidump_memory_writer_test_util.h" | 29 #include "minidump/test/minidump_memory_writer_test_util.h" |
| 29 #include "minidump/test/minidump_file_writer_test_util.h" | 30 #include "minidump/test/minidump_file_writer_test_util.h" |
| 30 #include "minidump/test/minidump_writable_test_util.h" | 31 #include "minidump/test/minidump_writable_test_util.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 thread_writer->SetThreadID(kThreadID); | 213 thread_writer->SetThreadID(kThreadID); |
| 213 thread_writer->SetSuspendCount(kSuspendCount); | 214 thread_writer->SetSuspendCount(kSuspendCount); |
| 214 thread_writer->SetPriorityClass(kPriorityClass); | 215 thread_writer->SetPriorityClass(kPriorityClass); |
| 215 thread_writer->SetPriority(kPriority); | 216 thread_writer->SetPriority(kPriority); |
| 216 thread_writer->SetTEB(kTEB); | 217 thread_writer->SetTEB(kTEB); |
| 217 | 218 |
| 218 auto memory_writer = make_scoped_ptr( | 219 auto memory_writer = make_scoped_ptr( |
| 219 new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue)); | 220 new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue)); |
| 220 thread_writer->SetStack(memory_writer.Pass()); | 221 thread_writer->SetStack(memory_writer.Pass()); |
| 221 | 222 |
| 222 MSVC_SUPPRESS_WARNING(4316) // Object allocated on heap may not be aligned. | 223 MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned. |
| 223 auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer()); | 224 auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer()); |
| 224 InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed); | 225 InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed); |
| 225 thread_writer->SetContext(context_amd64_writer.Pass()); | 226 thread_writer->SetContext(context_amd64_writer.Pass()); |
| 226 | 227 |
| 227 thread_list_writer->AddThread(thread_writer.Pass()); | 228 thread_list_writer->AddThread(thread_writer.Pass()); |
| 228 minidump_file_writer.AddStream(thread_list_writer.Pass()); | 229 minidump_file_writer.AddStream(thread_list_writer.Pass()); |
| 229 | 230 |
| 230 StringFileWriter file_writer; | 231 StringFileWriter file_writer; |
| 231 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 232 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
| 232 | 233 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 678 |
| 678 TEST(MinidumpThreadWriterDeathTest, InitializeFromSnapshot_NoContext) { | 679 TEST(MinidumpThreadWriterDeathTest, InitializeFromSnapshot_NoContext) { |
| 679 ASSERT_DEATH( | 680 ASSERT_DEATH( |
| 680 RunInitializeFromSnapshotTest<InitializeFromSnapshotNoContextTraits>( | 681 RunInitializeFromSnapshotTest<InitializeFromSnapshotNoContextTraits>( |
| 681 false), "context_"); | 682 false), "context_"); |
| 682 } | 683 } |
| 683 | 684 |
| 684 } // namespace | 685 } // namespace |
| 685 } // namespace test | 686 } // namespace test |
| 686 } // namespace crashpad | 687 } // namespace crashpad |
| OLD | NEW |