| 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 25 matching lines...) Expand all Loading... |
| 36 const size_t kModuleListStreamOffset = | 36 const size_t kModuleListStreamOffset = |
| 37 kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); | 37 kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); |
| 38 const size_t kModulesOffset = | 38 const size_t kModulesOffset = |
| 39 kModuleListStreamOffset + sizeof(MINIDUMP_MODULE_LIST); | 39 kModuleListStreamOffset + sizeof(MINIDUMP_MODULE_LIST); |
| 40 | 40 |
| 41 ASSERT_GE(file_contents.size(), kModulesOffset); | 41 ASSERT_GE(file_contents.size(), kModulesOffset); |
| 42 | 42 |
| 43 const MINIDUMP_HEADER* header = | 43 const MINIDUMP_HEADER* header = |
| 44 reinterpret_cast<const MINIDUMP_HEADER*>(&file_contents[0]); | 44 reinterpret_cast<const MINIDUMP_HEADER*>(&file_contents[0]); |
| 45 | 45 |
| 46 VerifyMinidumpHeader(header, 1, 0); | 46 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0)); |
| 47 if (testing::Test::HasFatalFailure()) { | |
| 48 return; | |
| 49 } | |
| 50 | 47 |
| 51 const MINIDUMP_DIRECTORY* directory = | 48 const MINIDUMP_DIRECTORY* directory = |
| 52 reinterpret_cast<const MINIDUMP_DIRECTORY*>( | 49 reinterpret_cast<const MINIDUMP_DIRECTORY*>( |
| 53 &file_contents[kDirectoryOffset]); | 50 &file_contents[kDirectoryOffset]); |
| 54 | 51 |
| 55 ASSERT_EQ(kMinidumpStreamTypeModuleList, directory->StreamType); | 52 ASSERT_EQ(kMinidumpStreamTypeModuleList, directory->StreamType); |
| 56 ASSERT_GE(directory->Location.DataSize, sizeof(MINIDUMP_MODULE_LIST)); | 53 ASSERT_GE(directory->Location.DataSize, sizeof(MINIDUMP_MODULE_LIST)); |
| 57 ASSERT_EQ(kModuleListStreamOffset, directory->Location.Rva); | 54 ASSERT_EQ(kModuleListStreamOffset, directory->Location.Rva); |
| 58 | 55 |
| 59 *module_list = reinterpret_cast<const MINIDUMP_MODULE_LIST*>( | 56 *module_list = reinterpret_cast<const MINIDUMP_MODULE_LIST*>( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 minidump_file_writer.AddStream(&module_list_writer); | 68 minidump_file_writer.AddStream(&module_list_writer); |
| 72 | 69 |
| 73 StringFileWriter file_writer; | 70 StringFileWriter file_writer; |
| 74 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 71 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
| 75 | 72 |
| 76 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 73 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
| 77 sizeof(MINIDUMP_MODULE_LIST), | 74 sizeof(MINIDUMP_MODULE_LIST), |
| 78 file_writer.string().size()); | 75 file_writer.string().size()); |
| 79 | 76 |
| 80 const MINIDUMP_MODULE_LIST* module_list; | 77 const MINIDUMP_MODULE_LIST* module_list; |
| 81 GetModuleListStream(file_writer.string(), &module_list); | 78 ASSERT_NO_FATAL_FAILURE( |
| 82 if (Test::HasFatalFailure()) { | 79 GetModuleListStream(file_writer.string(), &module_list)); |
| 83 return; | |
| 84 } | |
| 85 | 80 |
| 86 EXPECT_EQ(0u, module_list->NumberOfModules); | 81 EXPECT_EQ(0u, module_list->NumberOfModules); |
| 87 } | 82 } |
| 88 | 83 |
| 89 // If |expected_pdb_name| is non-NULL, |codeview_record| is used to locate a | 84 // If |expected_pdb_name| is non-NULL, |codeview_record| is used to locate a |
| 90 // CodeView record in |file_contents|, and its fields are compared against the | 85 // CodeView record in |file_contents|, and its fields are compared against the |
| 91 // the |expected_pdb_*| values. If |expected_pdb_uuid| is supplied, the CodeView | 86 // the |expected_pdb_*| values. If |expected_pdb_uuid| is supplied, the CodeView |
| 92 // record must be a PDB 7.0 link, otherwise, it must be a PDB 2.0 link. If | 87 // record must be a PDB 7.0 link, otherwise, it must be a PDB 2.0 link. If |
| 93 // |expected_pdb_name| is NULL, |codeview_record| must not point to anything. | 88 // |expected_pdb_name| is NULL, |codeview_record| must not point to anything. |
| 94 void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record, | 89 void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 (module_name->Length + 1), | 264 (module_name->Length + 1), |
| 270 file_contents.size()); | 265 file_contents.size()); |
| 271 ASSERT_EQ(0u, module_name->Length % 2); | 266 ASSERT_EQ(0u, module_name->Length % 2); |
| 272 string16 observed_module_name_utf16( | 267 string16 observed_module_name_utf16( |
| 273 reinterpret_cast<const char16*>( | 268 reinterpret_cast<const char16*>( |
| 274 &file_contents[observed->ModuleNameRva + sizeof(MINIDUMP_STRING)]), | 269 &file_contents[observed->ModuleNameRva + sizeof(MINIDUMP_STRING)]), |
| 275 module_name->Length / 2); | 270 module_name->Length / 2); |
| 276 string16 expected_module_name_utf16 = base::UTF8ToUTF16(expected_module_name); | 271 string16 expected_module_name_utf16 = base::UTF8ToUTF16(expected_module_name); |
| 277 EXPECT_EQ(expected_module_name_utf16, observed_module_name_utf16); | 272 EXPECT_EQ(expected_module_name_utf16, observed_module_name_utf16); |
| 278 | 273 |
| 279 ExpectCodeViewRecord(&observed->CvRecord, | 274 ASSERT_NO_FATAL_FAILURE(ExpectCodeViewRecord(&observed->CvRecord, |
| 280 file_contents, | 275 file_contents, |
| 281 expected_pdb_name, | 276 expected_pdb_name, |
| 282 expected_pdb_uuid, | 277 expected_pdb_uuid, |
| 283 expected_pdb_timestamp, | 278 expected_pdb_timestamp, |
| 284 expected_pdb_age); | 279 expected_pdb_age)); |
| 285 if (testing::Test::HasFatalFailure()) { | |
| 286 return; | |
| 287 } | |
| 288 | 280 |
| 289 ExpectMiscellaneousDebugRecord(&observed->MiscRecord, | 281 ASSERT_NO_FATAL_FAILURE(ExpectMiscellaneousDebugRecord(&observed->MiscRecord, |
| 290 file_contents, | 282 file_contents, |
| 291 expected_debug_name, | 283 expected_debug_name, |
| 292 expected_debug_type, | 284 expected_debug_type, |
| 293 expected_debug_utf16); | 285 expected_debug_utf16)); |
| 294 if (testing::Test::HasFatalFailure()) { | |
| 295 return; | |
| 296 } | |
| 297 } | 286 } |
| 298 | 287 |
| 299 TEST(MinidumpModuleWriter, EmptyModule) { | 288 TEST(MinidumpModuleWriter, EmptyModule) { |
| 300 MinidumpFileWriter minidump_file_writer; | 289 MinidumpFileWriter minidump_file_writer; |
| 301 MinidumpModuleListWriter module_list_writer; | 290 MinidumpModuleListWriter module_list_writer; |
| 302 | 291 |
| 303 const char kModuleName[] = "test_executable"; | 292 const char kModuleName[] = "test_executable"; |
| 304 | 293 |
| 305 MinidumpModuleWriter module_writer; | 294 MinidumpModuleWriter module_writer; |
| 306 module_writer.SetName(kModuleName); | 295 module_writer.SetName(kModuleName); |
| 307 | 296 |
| 308 module_list_writer.AddModule(&module_writer); | 297 module_list_writer.AddModule(&module_writer); |
| 309 minidump_file_writer.AddStream(&module_list_writer); | 298 minidump_file_writer.AddStream(&module_list_writer); |
| 310 | 299 |
| 311 StringFileWriter file_writer; | 300 StringFileWriter file_writer; |
| 312 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 301 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
| 313 | 302 |
| 314 ASSERT_GT(file_writer.string().size(), | 303 ASSERT_GT(file_writer.string().size(), |
| 315 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 304 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
| 316 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); | 305 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); |
| 317 | 306 |
| 318 const MINIDUMP_MODULE_LIST* module_list; | 307 const MINIDUMP_MODULE_LIST* module_list; |
| 319 GetModuleListStream(file_writer.string(), &module_list); | 308 ASSERT_NO_FATAL_FAILURE( |
| 320 if (Test::HasFatalFailure()) { | 309 GetModuleListStream(file_writer.string(), &module_list)); |
| 321 return; | |
| 322 } | |
| 323 | 310 |
| 324 EXPECT_EQ(1u, module_list->NumberOfModules); | 311 EXPECT_EQ(1u, module_list->NumberOfModules); |
| 325 | 312 |
| 326 MINIDUMP_MODULE expected = {}; | 313 MINIDUMP_MODULE expected = {}; |
| 327 ExpectModule(&expected, | 314 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, |
| 328 &module_list->Modules[0], | 315 &module_list->Modules[0], |
| 329 file_writer.string(), | 316 file_writer.string(), |
| 330 kModuleName, | 317 kModuleName, |
| 331 NULL, | 318 NULL, |
| 332 NULL, | 319 NULL, |
| 333 0, | 320 0, |
| 334 0, | 321 0, |
| 335 NULL, | 322 NULL, |
| 336 0, | 323 0, |
| 337 false); | 324 false)); |
| 338 if (Test::HasFatalFailure()) { | |
| 339 return; | |
| 340 } | |
| 341 } | 325 } |
| 342 | 326 |
| 343 TEST(MinidumpModuleWriter, OneModule) { | 327 TEST(MinidumpModuleWriter, OneModule) { |
| 344 MinidumpFileWriter minidump_file_writer; | 328 MinidumpFileWriter minidump_file_writer; |
| 345 MinidumpModuleListWriter module_list_writer; | 329 MinidumpModuleListWriter module_list_writer; |
| 346 | 330 |
| 347 const char kModuleName[] = "statically_linked"; | 331 const char kModuleName[] = "statically_linked"; |
| 348 const uint64_t kModuleBase = 0x10da69000; | 332 const uint64_t kModuleBase = 0x10da69000; |
| 349 const uint32_t kModuleSize = 0x1000; | 333 const uint32_t kModuleSize = 0x1000; |
| 350 const uint32_t kChecksum = 0x76543210; | 334 const uint32_t kChecksum = 0x76543210; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 minidump_file_writer.AddStream(&module_list_writer); | 387 minidump_file_writer.AddStream(&module_list_writer); |
| 404 | 388 |
| 405 StringFileWriter file_writer; | 389 StringFileWriter file_writer; |
| 406 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 390 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
| 407 | 391 |
| 408 ASSERT_GT(file_writer.string().size(), | 392 ASSERT_GT(file_writer.string().size(), |
| 409 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 393 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
| 410 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); | 394 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); |
| 411 | 395 |
| 412 const MINIDUMP_MODULE_LIST* module_list; | 396 const MINIDUMP_MODULE_LIST* module_list; |
| 413 GetModuleListStream(file_writer.string(), &module_list); | 397 ASSERT_NO_FATAL_FAILURE( |
| 414 if (Test::HasFatalFailure()) { | 398 GetModuleListStream(file_writer.string(), &module_list)); |
| 415 return; | |
| 416 } | |
| 417 | 399 |
| 418 EXPECT_EQ(1u, module_list->NumberOfModules); | 400 EXPECT_EQ(1u, module_list->NumberOfModules); |
| 419 | 401 |
| 420 MINIDUMP_MODULE expected = {}; | 402 MINIDUMP_MODULE expected = {}; |
| 421 expected.BaseOfImage = kModuleBase; | 403 expected.BaseOfImage = kModuleBase; |
| 422 expected.SizeOfImage = kModuleSize; | 404 expected.SizeOfImage = kModuleSize; |
| 423 expected.CheckSum = kChecksum; | 405 expected.CheckSum = kChecksum; |
| 424 expected.TimeDateStamp = kTimestamp; | 406 expected.TimeDateStamp = kTimestamp; |
| 425 expected.VersionInfo.dwFileVersionMS = kFileVersionMS; | 407 expected.VersionInfo.dwFileVersionMS = kFileVersionMS; |
| 426 expected.VersionInfo.dwFileVersionLS = kFileVersionLS; | 408 expected.VersionInfo.dwFileVersionLS = kFileVersionLS; |
| 427 expected.VersionInfo.dwProductVersionMS = kProductVersionMS; | 409 expected.VersionInfo.dwProductVersionMS = kProductVersionMS; |
| 428 expected.VersionInfo.dwProductVersionLS = kProductVersionLS; | 410 expected.VersionInfo.dwProductVersionLS = kProductVersionLS; |
| 429 expected.VersionInfo.dwFileFlagsMask = kFileFlagsMask; | 411 expected.VersionInfo.dwFileFlagsMask = kFileFlagsMask; |
| 430 expected.VersionInfo.dwFileFlags = kFileFlags; | 412 expected.VersionInfo.dwFileFlags = kFileFlags; |
| 431 expected.VersionInfo.dwFileOS = kFileOS; | 413 expected.VersionInfo.dwFileOS = kFileOS; |
| 432 expected.VersionInfo.dwFileType = kFileType; | 414 expected.VersionInfo.dwFileType = kFileType; |
| 433 expected.VersionInfo.dwFileSubtype = kFileSubtype; | 415 expected.VersionInfo.dwFileSubtype = kFileSubtype; |
| 434 | 416 |
| 435 ExpectModule(&expected, | 417 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, |
| 436 &module_list->Modules[0], | 418 &module_list->Modules[0], |
| 437 file_writer.string(), | 419 file_writer.string(), |
| 438 kModuleName, | 420 kModuleName, |
| 439 kPDBName, | 421 kPDBName, |
| 440 &pdb_uuid, | 422 &pdb_uuid, |
| 441 0, | 423 0, |
| 442 kPDBAge, | 424 kPDBAge, |
| 443 kDebugName, | 425 kDebugName, |
| 444 kDebugType, | 426 kDebugType, |
| 445 kDebugUTF16); | 427 kDebugUTF16)); |
| 446 if (Test::HasFatalFailure()) { | |
| 447 return; | |
| 448 } | |
| 449 } | 428 } |
| 450 | 429 |
| 451 TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) { | 430 TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) { |
| 452 // MinidumpModuleWriter.OneModule tested with a PDB 7.0 link as the CodeView | 431 // MinidumpModuleWriter.OneModule tested with a PDB 7.0 link as the CodeView |
| 453 // record and an IMAGE_DEBUG_MISC record in UTF-8. This test exercises the | 432 // record and an IMAGE_DEBUG_MISC record in UTF-8. This test exercises the |
| 454 // alternatives, a PDB 2.0 link as the CodeView record and an IMAGE_DEBUG_MISC | 433 // alternatives, a PDB 2.0 link as the CodeView record and an IMAGE_DEBUG_MISC |
| 455 // record with UTF-16 data. | 434 // record with UTF-16 data. |
| 456 MinidumpFileWriter minidump_file_writer; | 435 MinidumpFileWriter minidump_file_writer; |
| 457 MinidumpModuleListWriter module_list_writer; | 436 MinidumpModuleListWriter module_list_writer; |
| 458 | 437 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 481 minidump_file_writer.AddStream(&module_list_writer); | 460 minidump_file_writer.AddStream(&module_list_writer); |
| 482 | 461 |
| 483 StringFileWriter file_writer; | 462 StringFileWriter file_writer; |
| 484 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 463 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
| 485 | 464 |
| 486 ASSERT_GT(file_writer.string().size(), | 465 ASSERT_GT(file_writer.string().size(), |
| 487 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 466 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
| 488 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); | 467 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); |
| 489 | 468 |
| 490 const MINIDUMP_MODULE_LIST* module_list; | 469 const MINIDUMP_MODULE_LIST* module_list; |
| 491 GetModuleListStream(file_writer.string(), &module_list); | 470 ASSERT_NO_FATAL_FAILURE( |
| 492 if (Test::HasFatalFailure()) { | 471 GetModuleListStream(file_writer.string(), &module_list)); |
| 493 return; | |
| 494 } | |
| 495 | 472 |
| 496 EXPECT_EQ(1u, module_list->NumberOfModules); | 473 EXPECT_EQ(1u, module_list->NumberOfModules); |
| 497 | 474 |
| 498 MINIDUMP_MODULE expected = {}; | 475 MINIDUMP_MODULE expected = {}; |
| 499 | 476 |
| 500 ExpectModule(&expected, | 477 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, |
| 501 &module_list->Modules[0], | 478 &module_list->Modules[0], |
| 502 file_writer.string(), | 479 file_writer.string(), |
| 503 kModuleName, | 480 kModuleName, |
| 504 kPDBName, | 481 kPDBName, |
| 505 NULL, | 482 NULL, |
| 506 kPDBTimestamp, | 483 kPDBTimestamp, |
| 507 kPDBAge, | 484 kPDBAge, |
| 508 kDebugName, | 485 kDebugName, |
| 509 kDebugType, | 486 kDebugType, |
| 510 kDebugUTF16); | 487 kDebugUTF16)); |
| 511 if (Test::HasFatalFailure()) { | |
| 512 return; | |
| 513 } | |
| 514 } | 488 } |
| 515 | 489 |
| 516 TEST(MinidumpModuleWriter, ThreeModules) { | 490 TEST(MinidumpModuleWriter, ThreeModules) { |
| 517 // As good exercise, this test uses three modules, one with a PDB 7.0 link as | 491 // As good exercise, this test uses three modules, one with a PDB 7.0 link as |
| 518 // its CodeView record, one with no CodeView record, and one with a PDB 2.0 | 492 // its CodeView record, one with no CodeView record, and one with a PDB 2.0 |
| 519 // link as its CodeView record. | 493 // link as its CodeView record. |
| 520 MinidumpFileWriter minidump_file_writer; | 494 MinidumpFileWriter minidump_file_writer; |
| 521 MinidumpModuleListWriter module_list_writer; | 495 MinidumpModuleListWriter module_list_writer; |
| 522 | 496 |
| 523 const char kModuleName1[] = "main"; | 497 const char kModuleName1[] = "main"; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 minidump_file_writer.AddStream(&module_list_writer); | 550 minidump_file_writer.AddStream(&module_list_writer); |
| 577 | 551 |
| 578 StringFileWriter file_writer; | 552 StringFileWriter file_writer; |
| 579 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); | 553 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); |
| 580 | 554 |
| 581 ASSERT_GT(file_writer.string().size(), | 555 ASSERT_GT(file_writer.string().size(), |
| 582 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + | 556 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + |
| 583 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); | 557 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); |
| 584 | 558 |
| 585 const MINIDUMP_MODULE_LIST* module_list; | 559 const MINIDUMP_MODULE_LIST* module_list; |
| 586 GetModuleListStream(file_writer.string(), &module_list); | 560 ASSERT_NO_FATAL_FAILURE( |
| 587 if (Test::HasFatalFailure()) { | 561 GetModuleListStream(file_writer.string(), &module_list)); |
| 588 return; | |
| 589 } | |
| 590 | 562 |
| 591 EXPECT_EQ(3u, module_list->NumberOfModules); | 563 EXPECT_EQ(3u, module_list->NumberOfModules); |
| 592 | 564 |
| 593 MINIDUMP_MODULE expected = {}; | 565 MINIDUMP_MODULE expected = {}; |
| 594 | 566 |
| 595 { | 567 { |
| 596 SCOPED_TRACE("module 0"); | 568 SCOPED_TRACE("module 0"); |
| 597 | 569 |
| 598 expected.BaseOfImage = kModuleBase1; | 570 expected.BaseOfImage = kModuleBase1; |
| 599 expected.SizeOfImage = kModuleSize1; | 571 expected.SizeOfImage = kModuleSize1; |
| 600 | 572 |
| 601 ExpectModule(&expected, | 573 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, |
| 602 &module_list->Modules[0], | 574 &module_list->Modules[0], |
| 603 file_writer.string(), | 575 file_writer.string(), |
| 604 kModuleName1, | 576 kModuleName1, |
| 605 kPDBName1, | 577 kPDBName1, |
| 606 &pdb_uuid_1, | 578 &pdb_uuid_1, |
| 607 0, | 579 0, |
| 608 kPDBAge1, | 580 kPDBAge1, |
| 609 NULL, | 581 NULL, |
| 610 0, | 582 0, |
| 611 false); | 583 false)); |
| 612 if (Test::HasFatalFailure()) { | |
| 613 return; | |
| 614 } | |
| 615 } | 584 } |
| 616 | 585 |
| 617 { | 586 { |
| 618 SCOPED_TRACE("module 1"); | 587 SCOPED_TRACE("module 1"); |
| 619 | 588 |
| 620 expected.BaseOfImage = kModuleBase2; | 589 expected.BaseOfImage = kModuleBase2; |
| 621 expected.SizeOfImage = kModuleSize2; | 590 expected.SizeOfImage = kModuleSize2; |
| 622 | 591 |
| 623 ExpectModule(&expected, | 592 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, |
| 624 &module_list->Modules[1], | 593 &module_list->Modules[1], |
| 625 file_writer.string(), | 594 file_writer.string(), |
| 626 kModuleName2, | 595 kModuleName2, |
| 627 NULL, | 596 NULL, |
| 628 NULL, | 597 NULL, |
| 629 0, | 598 0, |
| 630 0, | 599 0, |
| 631 NULL, | 600 NULL, |
| 632 0, | 601 0, |
| 633 false); | 602 false)); |
| 634 if (Test::HasFatalFailure()) { | |
| 635 return; | |
| 636 } | |
| 637 } | 603 } |
| 638 | 604 |
| 639 { | 605 { |
| 640 SCOPED_TRACE("module 2"); | 606 SCOPED_TRACE("module 2"); |
| 641 | 607 |
| 642 expected.BaseOfImage = kModuleBase3; | 608 expected.BaseOfImage = kModuleBase3; |
| 643 expected.SizeOfImage = kModuleSize3; | 609 expected.SizeOfImage = kModuleSize3; |
| 644 | 610 |
| 645 ExpectModule(&expected, | 611 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, |
| 646 &module_list->Modules[2], | 612 &module_list->Modules[2], |
| 647 file_writer.string(), | 613 file_writer.string(), |
| 648 kModuleName3, | 614 kModuleName3, |
| 649 kPDBName3, | 615 kPDBName3, |
| 650 NULL, | 616 NULL, |
| 651 kPDBTimestamp3, | 617 kPDBTimestamp3, |
| 652 kPDBAge3, | 618 kPDBAge3, |
| 653 NULL, | 619 NULL, |
| 654 0, | 620 0, |
| 655 false); | 621 false)); |
| 656 if (Test::HasFatalFailure()) { | |
| 657 return; | |
| 658 } | |
| 659 } | 622 } |
| 660 } | 623 } |
| 661 | 624 |
| 662 TEST(MinidumpSystemInfoWriterDeathTest, NoModuleName) { | 625 TEST(MinidumpSystemInfoWriterDeathTest, NoModuleName) { |
| 663 MinidumpFileWriter minidump_file_writer; | 626 MinidumpFileWriter minidump_file_writer; |
| 664 MinidumpModuleListWriter module_list_writer; | 627 MinidumpModuleListWriter module_list_writer; |
| 665 MinidumpModuleWriter module_writer; | 628 MinidumpModuleWriter module_writer; |
| 666 module_list_writer.AddModule(&module_writer); | 629 module_list_writer.AddModule(&module_writer); |
| 667 minidump_file_writer.AddStream(&module_list_writer); | 630 minidump_file_writer.AddStream(&module_list_writer); |
| 668 | 631 |
| 669 StringFileWriter file_writer; | 632 StringFileWriter file_writer; |
| 670 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); | 633 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); |
| 671 } | 634 } |
| 672 | 635 |
| 673 } // namespace | 636 } // namespace |
| 674 } // namespace test | 637 } // namespace test |
| 675 } // namespace crashpad | 638 } // namespace crashpad |
| OLD | NEW |