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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ASSERT_EQ(kMinidumpStreamTypeMemoryList, directory[1].StreamType); | 63 ASSERT_EQ(kMinidumpStreamTypeMemoryList, directory[1].StreamType); |
64 | 64 |
65 *memory_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>( | 65 *memory_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>( |
66 file_contents, directory[1].Location); | 66 file_contents, directory[1].Location); |
67 ASSERT_TRUE(*memory_list); | 67 ASSERT_TRUE(*memory_list); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 TEST(MinidumpThreadWriter, EmptyThreadList) { | 71 TEST(MinidumpThreadWriter, EmptyThreadList) { |
72 MinidumpFileWriter minidump_file_writer; | 72 MinidumpFileWriter minidump_file_writer; |
73 MinidumpThreadListWriter thread_list_writer; | 73 auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter()); |
74 | 74 |
75 minidump_file_writer.AddStream(&thread_list_writer); | 75 minidump_file_writer.AddStream(thread_list_writer.Pass()); |
76 | 76 |
77 StringFileWriter file_writer; | 77 StringFileWriter file_writer; |
78 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 78 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
79 | 79 |
80 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 80 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
81 sizeof(MINIDUMP_THREAD_LIST), | 81 sizeof(MINIDUMP_THREAD_LIST), |
82 file_writer.string().size()); | 82 file_writer.string().size()); |
83 | 83 |
84 const MINIDUMP_THREAD_LIST* thread_list; | 84 const MINIDUMP_THREAD_LIST* thread_list; |
85 ASSERT_NO_FATAL_FAILURE( | 85 ASSERT_NO_FATAL_FAILURE( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 EXPECT_EQ(expected->ThreadContext.DataSize, observed->ThreadContext.DataSize); | 124 EXPECT_EQ(expected->ThreadContext.DataSize, observed->ThreadContext.DataSize); |
125 ASSERT_NE(0u, observed->ThreadContext.DataSize); | 125 ASSERT_NE(0u, observed->ThreadContext.DataSize); |
126 ASSERT_NE(0u, observed->ThreadContext.Rva); | 126 ASSERT_NE(0u, observed->ThreadContext.Rva); |
127 ASSERT_GE(file_contents.size(), | 127 ASSERT_GE(file_contents.size(), |
128 observed->ThreadContext.Rva + expected->ThreadContext.DataSize); | 128 observed->ThreadContext.Rva + expected->ThreadContext.DataSize); |
129 *context_base = &file_contents[observed->ThreadContext.Rva]; | 129 *context_base = &file_contents[observed->ThreadContext.Rva]; |
130 } | 130 } |
131 | 131 |
132 TEST(MinidumpThreadWriter, OneThread_x86_NoStack) { | 132 TEST(MinidumpThreadWriter, OneThread_x86_NoStack) { |
133 MinidumpFileWriter minidump_file_writer; | 133 MinidumpFileWriter minidump_file_writer; |
134 MinidumpThreadListWriter thread_list_writer; | 134 auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter()); |
135 | 135 |
136 const uint32_t kThreadID = 0x11111111; | 136 const uint32_t kThreadID = 0x11111111; |
137 const uint32_t kSuspendCount = 1; | 137 const uint32_t kSuspendCount = 1; |
138 const uint32_t kPriorityClass = 0x20; | 138 const uint32_t kPriorityClass = 0x20; |
139 const uint32_t kPriority = 10; | 139 const uint32_t kPriority = 10; |
140 const uint64_t kTEB = 0x55555555; | 140 const uint64_t kTEB = 0x55555555; |
141 const uint32_t kSeed = 123; | 141 const uint32_t kSeed = 123; |
142 | 142 |
143 MinidumpThreadWriter thread_writer; | 143 auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter()); |
144 thread_writer.SetThreadID(kThreadID); | 144 thread_writer->SetThreadID(kThreadID); |
145 thread_writer.SetSuspendCount(kSuspendCount); | 145 thread_writer->SetSuspendCount(kSuspendCount); |
146 thread_writer.SetPriorityClass(kPriorityClass); | 146 thread_writer->SetPriorityClass(kPriorityClass); |
147 thread_writer.SetPriority(kPriority); | 147 thread_writer->SetPriority(kPriority); |
148 thread_writer.SetTEB(kTEB); | 148 thread_writer->SetTEB(kTEB); |
149 | 149 |
150 MinidumpContextX86Writer context_x86_writer; | 150 auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer()); |
151 InitializeMinidumpContextX86(context_x86_writer.context(), kSeed); | 151 InitializeMinidumpContextX86(context_x86_writer->context(), kSeed); |
152 thread_writer.SetContext(&context_x86_writer); | 152 thread_writer->SetContext(context_x86_writer.Pass()); |
153 | 153 |
154 thread_list_writer.AddThread(&thread_writer); | 154 thread_list_writer->AddThread(thread_writer.Pass()); |
155 minidump_file_writer.AddStream(&thread_list_writer); | 155 minidump_file_writer.AddStream(thread_list_writer.Pass()); |
156 | 156 |
157 StringFileWriter file_writer; | 157 StringFileWriter file_writer; |
158 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 158 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
159 | 159 |
160 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 160 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
161 sizeof(MINIDUMP_THREAD_LIST) + 1 * sizeof(MINIDUMP_THREAD) + | 161 sizeof(MINIDUMP_THREAD_LIST) + 1 * sizeof(MINIDUMP_THREAD) + |
162 1 * sizeof(MinidumpContextX86), | 162 1 * sizeof(MinidumpContextX86), |
163 file_writer.string().size()); | 163 file_writer.string().size()); |
164 | 164 |
165 const MINIDUMP_THREAD_LIST* thread_list; | 165 const MINIDUMP_THREAD_LIST* thread_list; |
(...skipping 16 matching lines...) Expand all Loading... |
182 &thread_list->Threads[0], | 182 &thread_list->Threads[0], |
183 file_writer.string(), | 183 file_writer.string(), |
184 nullptr, | 184 nullptr, |
185 reinterpret_cast<const void**>(&observed_context))); | 185 reinterpret_cast<const void**>(&observed_context))); |
186 | 186 |
187 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed, observed_context)); | 187 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed, observed_context)); |
188 } | 188 } |
189 | 189 |
190 TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) { | 190 TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) { |
191 MinidumpFileWriter minidump_file_writer; | 191 MinidumpFileWriter minidump_file_writer; |
192 MinidumpThreadListWriter thread_list_writer; | 192 auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter()); |
193 | 193 |
194 const uint32_t kThreadID = 0x22222222; | 194 const uint32_t kThreadID = 0x22222222; |
195 const uint32_t kSuspendCount = 2; | 195 const uint32_t kSuspendCount = 2; |
196 const uint32_t kPriorityClass = 0x30; | 196 const uint32_t kPriorityClass = 0x30; |
197 const uint32_t kPriority = 20; | 197 const uint32_t kPriority = 20; |
198 const uint64_t kTEB = 0x5555555555555555; | 198 const uint64_t kTEB = 0x5555555555555555; |
199 const uint64_t kMemoryBase = 0x765432100000; | 199 const uint64_t kMemoryBase = 0x765432100000; |
200 const size_t kMemorySize = 32; | 200 const size_t kMemorySize = 32; |
201 const uint8_t kMemoryValue = 99; | 201 const uint8_t kMemoryValue = 99; |
202 const uint32_t kSeed = 456; | 202 const uint32_t kSeed = 456; |
203 | 203 |
204 MinidumpThreadWriter thread_writer; | 204 auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter()); |
205 thread_writer.SetThreadID(kThreadID); | 205 thread_writer->SetThreadID(kThreadID); |
206 thread_writer.SetSuspendCount(kSuspendCount); | 206 thread_writer->SetSuspendCount(kSuspendCount); |
207 thread_writer.SetPriorityClass(kPriorityClass); | 207 thread_writer->SetPriorityClass(kPriorityClass); |
208 thread_writer.SetPriority(kPriority); | 208 thread_writer->SetPriority(kPriority); |
209 thread_writer.SetTEB(kTEB); | 209 thread_writer->SetTEB(kTEB); |
210 | 210 |
211 TestMinidumpMemoryWriter memory_writer( | 211 auto memory_writer = make_scoped_ptr( |
212 kMemoryBase, kMemorySize, kMemoryValue); | 212 new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue)); |
213 thread_writer.SetStack(&memory_writer); | 213 thread_writer->SetStack(memory_writer.Pass()); |
214 | 214 |
215 MinidumpContextAMD64Writer context_amd64_writer; | 215 auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer()); |
216 InitializeMinidumpContextAMD64(context_amd64_writer.context(), kSeed); | 216 InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed); |
217 thread_writer.SetContext(&context_amd64_writer); | 217 thread_writer->SetContext(context_amd64_writer.Pass()); |
218 | 218 |
219 thread_list_writer.AddThread(&thread_writer); | 219 thread_list_writer->AddThread(thread_writer.Pass()); |
220 minidump_file_writer.AddStream(&thread_list_writer); | 220 minidump_file_writer.AddStream(thread_list_writer.Pass()); |
221 | 221 |
222 StringFileWriter file_writer; | 222 StringFileWriter file_writer; |
223 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 223 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
224 | 224 |
225 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 225 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
226 sizeof(MINIDUMP_THREAD_LIST) + 1 * sizeof(MINIDUMP_THREAD) + | 226 sizeof(MINIDUMP_THREAD_LIST) + 1 * sizeof(MINIDUMP_THREAD) + |
227 1 * sizeof(MinidumpContextAMD64) + kMemorySize, | 227 1 * sizeof(MinidumpContextAMD64) + kMemorySize, |
228 file_writer.string().size()); | 228 file_writer.string().size()); |
229 | 229 |
230 const MINIDUMP_THREAD_LIST* thread_list; | 230 const MINIDUMP_THREAD_LIST* thread_list; |
(...skipping 25 matching lines...) Expand all Loading... |
256 ExpectMinidumpMemoryDescriptorAndContents(&expected.Stack, | 256 ExpectMinidumpMemoryDescriptorAndContents(&expected.Stack, |
257 observed_stack, | 257 observed_stack, |
258 file_writer.string(), | 258 file_writer.string(), |
259 kMemoryValue, | 259 kMemoryValue, |
260 true)); | 260 true)); |
261 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextAMD64(kSeed, observed_context)); | 261 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextAMD64(kSeed, observed_context)); |
262 } | 262 } |
263 | 263 |
264 TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) { | 264 TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) { |
265 MinidumpFileWriter minidump_file_writer; | 265 MinidumpFileWriter minidump_file_writer; |
266 MinidumpThreadListWriter thread_list_writer; | 266 auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter()); |
267 MinidumpMemoryListWriter memory_list_writer; | 267 auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter()); |
268 thread_list_writer.SetMemoryListWriter(&memory_list_writer); | 268 thread_list_writer->SetMemoryListWriter(memory_list_writer.get()); |
269 | 269 |
270 const uint32_t kThreadID0 = 1111111; | 270 const uint32_t kThreadID0 = 1111111; |
271 const uint32_t kSuspendCount0 = 111111; | 271 const uint32_t kSuspendCount0 = 111111; |
272 const uint32_t kPriorityClass0 = 11111; | 272 const uint32_t kPriorityClass0 = 11111; |
273 const uint32_t kPriority0 = 1111; | 273 const uint32_t kPriority0 = 1111; |
274 const uint64_t kTEB0 = 111; | 274 const uint64_t kTEB0 = 111; |
275 const uint64_t kMemoryBase0 = 0x1110; | 275 const uint64_t kMemoryBase0 = 0x1110; |
276 const size_t kMemorySize0 = 16; | 276 const size_t kMemorySize0 = 16; |
277 const uint8_t kMemoryValue0 = 11; | 277 const uint8_t kMemoryValue0 = 11; |
278 const uint32_t kSeed0 = 1; | 278 const uint32_t kSeed0 = 1; |
279 | 279 |
280 MinidumpThreadWriter thread_writer_0; | 280 auto thread_writer_0 = make_scoped_ptr(new MinidumpThreadWriter()); |
281 thread_writer_0.SetThreadID(kThreadID0); | 281 thread_writer_0->SetThreadID(kThreadID0); |
282 thread_writer_0.SetSuspendCount(kSuspendCount0); | 282 thread_writer_0->SetSuspendCount(kSuspendCount0); |
283 thread_writer_0.SetPriorityClass(kPriorityClass0); | 283 thread_writer_0->SetPriorityClass(kPriorityClass0); |
284 thread_writer_0.SetPriority(kPriority0); | 284 thread_writer_0->SetPriority(kPriority0); |
285 thread_writer_0.SetTEB(kTEB0); | 285 thread_writer_0->SetTEB(kTEB0); |
286 | 286 |
287 TestMinidumpMemoryWriter memory_writer_0( | 287 auto memory_writer_0 = make_scoped_ptr( |
288 kMemoryBase0, kMemorySize0, kMemoryValue0); | 288 new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0)); |
289 thread_writer_0.SetStack(&memory_writer_0); | 289 thread_writer_0->SetStack(memory_writer_0.Pass()); |
290 | 290 |
291 MinidumpContextX86Writer context_x86_writer_0; | 291 auto context_x86_writer_0 = make_scoped_ptr(new MinidumpContextX86Writer()); |
292 InitializeMinidumpContextX86(context_x86_writer_0.context(), kSeed0); | 292 InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0); |
293 thread_writer_0.SetContext(&context_x86_writer_0); | 293 thread_writer_0->SetContext(context_x86_writer_0.Pass()); |
294 | 294 |
295 thread_list_writer.AddThread(&thread_writer_0); | 295 thread_list_writer->AddThread(thread_writer_0.Pass()); |
296 | 296 |
297 const uint32_t kThreadID1 = 2222222; | 297 const uint32_t kThreadID1 = 2222222; |
298 const uint32_t kSuspendCount1 = 222222; | 298 const uint32_t kSuspendCount1 = 222222; |
299 const uint32_t kPriorityClass1 = 22222; | 299 const uint32_t kPriorityClass1 = 22222; |
300 const uint32_t kPriority1 = 2222; | 300 const uint32_t kPriority1 = 2222; |
301 const uint64_t kTEB1 = 222; | 301 const uint64_t kTEB1 = 222; |
302 const uint64_t kMemoryBase1 = 0x2220; | 302 const uint64_t kMemoryBase1 = 0x2220; |
303 const size_t kMemorySize1 = 32; | 303 const size_t kMemorySize1 = 32; |
304 const uint8_t kMemoryValue1 = 22; | 304 const uint8_t kMemoryValue1 = 22; |
305 const uint32_t kSeed1 = 2; | 305 const uint32_t kSeed1 = 2; |
306 | 306 |
307 MinidumpThreadWriter thread_writer_1; | 307 auto thread_writer_1 = make_scoped_ptr(new MinidumpThreadWriter()); |
308 thread_writer_1.SetThreadID(kThreadID1); | 308 thread_writer_1->SetThreadID(kThreadID1); |
309 thread_writer_1.SetSuspendCount(kSuspendCount1); | 309 thread_writer_1->SetSuspendCount(kSuspendCount1); |
310 thread_writer_1.SetPriorityClass(kPriorityClass1); | 310 thread_writer_1->SetPriorityClass(kPriorityClass1); |
311 thread_writer_1.SetPriority(kPriority1); | 311 thread_writer_1->SetPriority(kPriority1); |
312 thread_writer_1.SetTEB(kTEB1); | 312 thread_writer_1->SetTEB(kTEB1); |
313 | 313 |
314 TestMinidumpMemoryWriter memory_writer_1( | 314 auto memory_writer_1 = make_scoped_ptr( |
315 kMemoryBase1, kMemorySize1, kMemoryValue1); | 315 new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1)); |
316 thread_writer_1.SetStack(&memory_writer_1); | 316 thread_writer_1->SetStack(memory_writer_1.Pass()); |
317 | 317 |
318 MinidumpContextX86Writer context_x86_writer_1; | 318 auto context_x86_writer_1 = make_scoped_ptr(new MinidumpContextX86Writer()); |
319 InitializeMinidumpContextX86(context_x86_writer_1.context(), kSeed1); | 319 InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1); |
320 thread_writer_1.SetContext(&context_x86_writer_1); | 320 thread_writer_1->SetContext(context_x86_writer_1.Pass()); |
321 | 321 |
322 thread_list_writer.AddThread(&thread_writer_1); | 322 thread_list_writer->AddThread(thread_writer_1.Pass()); |
323 | 323 |
324 const uint32_t kThreadID2 = 3333333; | 324 const uint32_t kThreadID2 = 3333333; |
325 const uint32_t kSuspendCount2 = 333333; | 325 const uint32_t kSuspendCount2 = 333333; |
326 const uint32_t kPriorityClass2 = 33333; | 326 const uint32_t kPriorityClass2 = 33333; |
327 const uint32_t kPriority2 = 3333; | 327 const uint32_t kPriority2 = 3333; |
328 const uint64_t kTEB2 = 333; | 328 const uint64_t kTEB2 = 333; |
329 const uint64_t kMemoryBase2 = 0x3330; | 329 const uint64_t kMemoryBase2 = 0x3330; |
330 const size_t kMemorySize2 = 48; | 330 const size_t kMemorySize2 = 48; |
331 const uint8_t kMemoryValue2 = 33; | 331 const uint8_t kMemoryValue2 = 33; |
332 const uint32_t kSeed2 = 3; | 332 const uint32_t kSeed2 = 3; |
333 | 333 |
334 MinidumpThreadWriter thread_writer_2; | 334 auto thread_writer_2 = make_scoped_ptr(new MinidumpThreadWriter()); |
335 thread_writer_2.SetThreadID(kThreadID2); | 335 thread_writer_2->SetThreadID(kThreadID2); |
336 thread_writer_2.SetSuspendCount(kSuspendCount2); | 336 thread_writer_2->SetSuspendCount(kSuspendCount2); |
337 thread_writer_2.SetPriorityClass(kPriorityClass2); | 337 thread_writer_2->SetPriorityClass(kPriorityClass2); |
338 thread_writer_2.SetPriority(kPriority2); | 338 thread_writer_2->SetPriority(kPriority2); |
339 thread_writer_2.SetTEB(kTEB2); | 339 thread_writer_2->SetTEB(kTEB2); |
340 | 340 |
341 TestMinidumpMemoryWriter memory_writer_2( | 341 auto memory_writer_2 = make_scoped_ptr( |
342 kMemoryBase2, kMemorySize2, kMemoryValue2); | 342 new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2)); |
343 thread_writer_2.SetStack(&memory_writer_2); | 343 thread_writer_2->SetStack(memory_writer_2.Pass()); |
344 | 344 |
345 MinidumpContextX86Writer context_x86_writer_2; | 345 auto context_x86_writer_2 = make_scoped_ptr(new MinidumpContextX86Writer()); |
346 InitializeMinidumpContextX86(context_x86_writer_2.context(), kSeed2); | 346 InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2); |
347 thread_writer_2.SetContext(&context_x86_writer_2); | 347 thread_writer_2->SetContext(context_x86_writer_2.Pass()); |
348 | 348 |
349 thread_list_writer.AddThread(&thread_writer_2); | 349 thread_list_writer->AddThread(thread_writer_2.Pass()); |
350 | 350 |
351 minidump_file_writer.AddStream(&thread_list_writer); | 351 minidump_file_writer.AddStream(thread_list_writer.Pass()); |
352 minidump_file_writer.AddStream(&memory_list_writer); | 352 minidump_file_writer.AddStream(memory_list_writer.Pass()); |
353 | 353 |
354 StringFileWriter file_writer; | 354 StringFileWriter file_writer; |
355 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 355 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
356 | 356 |
357 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + 2 * sizeof(MINIDUMP_DIRECTORY) + | 357 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + 2 * sizeof(MINIDUMP_DIRECTORY) + |
358 sizeof(MINIDUMP_THREAD_LIST) + 3 * sizeof(MINIDUMP_THREAD) + | 358 sizeof(MINIDUMP_THREAD_LIST) + 3 * sizeof(MINIDUMP_THREAD) + |
359 sizeof(MINIDUMP_MEMORY_LIST) + | 359 sizeof(MINIDUMP_MEMORY_LIST) + |
360 3 * sizeof(MINIDUMP_MEMORY_DESCRIPTOR) + | 360 3 * sizeof(MINIDUMP_MEMORY_DESCRIPTOR) + |
361 3 * sizeof(MinidumpContextX86) + kMemorySize0 + kMemorySize1 + | 361 3 * sizeof(MinidumpContextX86) + kMemorySize0 + kMemorySize1 + |
362 kMemorySize2 + 12, // 12 for alignment | 362 kMemorySize2 + 12, // 12 for alignment |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 kMemoryValue2, | 465 kMemoryValue2, |
466 true)); | 466 true)); |
467 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed2, observed_context)); | 467 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed2, observed_context)); |
468 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpMemoryDescriptor( | 468 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpMemoryDescriptor( |
469 observed_stack, &memory_list->MemoryRanges[2])); | 469 observed_stack, &memory_list->MemoryRanges[2])); |
470 } | 470 } |
471 } | 471 } |
472 | 472 |
473 TEST(MinidumpThreadWriterDeathTest, NoContext) { | 473 TEST(MinidumpThreadWriterDeathTest, NoContext) { |
474 MinidumpFileWriter minidump_file_writer; | 474 MinidumpFileWriter minidump_file_writer; |
475 MinidumpThreadListWriter thread_list_writer; | 475 auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter()); |
476 | 476 |
477 MinidumpThreadWriter thread_writer; | 477 auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter()); |
478 | 478 |
479 thread_list_writer.AddThread(&thread_writer); | 479 thread_list_writer->AddThread(thread_writer.Pass()); |
480 minidump_file_writer.AddStream(&thread_list_writer); | 480 minidump_file_writer.AddStream(thread_list_writer.Pass()); |
481 | 481 |
482 StringFileWriter file_writer; | 482 StringFileWriter file_writer; |
483 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "context_"); | 483 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "context_"); |
484 } | 484 } |
485 | 485 |
486 } // namespace | 486 } // namespace |
487 } // namespace test | 487 } // namespace test |
488 } // namespace crashpad | 488 } // namespace crashpad |
OLD | NEW |