OLD | NEW |
1 // Copyright (c) 2010, Google Inc. | 1 // Copyright (c) 2010, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 618 |
619 const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); | 619 const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); |
620 ASSERT_TRUE(md_module != NULL); | 620 ASSERT_TRUE(md_module != NULL); |
621 // just the build_id, directly | 621 // just the build_id, directly |
622 ASSERT_EQ("5fa9cdb4", md_module->code_identifier()); | 622 ASSERT_EQ("5fa9cdb4", md_module->code_identifier()); |
623 // build_id expanded to GUID length and treated as such, with zero | 623 // build_id expanded to GUID length and treated as such, with zero |
624 // age appended | 624 // age appended |
625 ASSERT_EQ("B4CDA95F0000000000000000000000000", md_module->debug_identifier()); | 625 ASSERT_EQ("B4CDA95F0000000000000000000000000", md_module->debug_identifier()); |
626 } | 626 } |
627 | 627 |
| 628 // Test that a build_id that's very long is handled properly. |
| 629 TEST(Dump, CVELFLong) { |
| 630 Dump dump(0, kLittleEndian); |
| 631 String module_name(dump, "elf module"); |
| 632 Section cv_info(dump); |
| 633 cv_info |
| 634 .D32(MD_CVINFOELF_SIGNATURE) // signature |
| 635 // build_id, lots of bytes |
| 636 .Append("\x5f\xa9\xcd\xb4\x10\x53\xdf\x1b\x86\xfa\xb7\x33\xb4\xdf" |
| 637 "\x37\x38\xce\xa3\x4a\x87\x01\x02\x03\x04\x05\x06\x07\x08" |
| 638 "\x09\x0a\x0b\x0c\x0d\x0e\x0f"); |
| 639 |
| 640 |
| 641 const MDRawSystemInfo linux_x86 = { |
| 642 MD_CPU_ARCHITECTURE_X86, // processor_architecture |
| 643 6, // processor_level |
| 644 0xd08, // processor_revision |
| 645 1, // number_of_processors |
| 646 0, // product_type |
| 647 0, // major_version |
| 648 0, // minor_version |
| 649 0, // build_number |
| 650 MD_OS_LINUX, // platform_id |
| 651 0xdeadbeef, // csd_version_rva |
| 652 0x100, // suite_mask |
| 653 0, // reserved2 |
| 654 { // cpu |
| 655 { // x86_cpu_info |
| 656 { 0x756e6547, 0x49656e69, 0x6c65746e }, // vendor_id |
| 657 0x6d8, // version_information |
| 658 0xafe9fbff, // feature_information |
| 659 0xffffffff // amd_extended_cpu_features |
| 660 } |
| 661 } |
| 662 }; |
| 663 String csd_version(dump, "Literally Linux"); |
| 664 SystemInfo system_info(dump, linux_x86, csd_version); |
| 665 |
| 666 Module module(dump, 0xa90206ca83eb2852ULL, 0xada542bd, |
| 667 module_name, |
| 668 0xb1054d2a, |
| 669 0x34571371, |
| 670 fixed_file_info, // from synth_minidump_unittest_data.h |
| 671 &cv_info, nullptr); |
| 672 |
| 673 dump.Add(&module); |
| 674 dump.Add(&module_name); |
| 675 dump.Add(&cv_info); |
| 676 dump.Add(&system_info); |
| 677 dump.Add(&csd_version); |
| 678 dump.Finish(); |
| 679 |
| 680 string contents; |
| 681 ASSERT_TRUE(dump.GetContents(&contents)); |
| 682 istringstream minidump_stream(contents); |
| 683 Minidump minidump(minidump_stream); |
| 684 ASSERT_TRUE(minidump.Read()); |
| 685 ASSERT_EQ(2U, minidump.GetDirectoryEntryCount()); |
| 686 |
| 687 MinidumpModuleList *md_module_list = minidump.GetModuleList(); |
| 688 ASSERT_TRUE(md_module_list != NULL); |
| 689 ASSERT_EQ(1U, md_module_list->module_count()); |
| 690 |
| 691 const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); |
| 692 ASSERT_TRUE(md_module != NULL); |
| 693 // just the build_id, directly |
| 694 ASSERT_EQ( |
| 695 "5fa9cdb41053df1b86fab733b4df3738cea34a870102030405060708090a0b0c0d0e0f", |
| 696 md_module->code_identifier()); |
| 697 // build_id truncated to GUID length and treated as such, with zero |
| 698 // age appended. |
| 699 ASSERT_EQ("B4CDA95F53101BDF86FAB733B4DF37380", md_module->debug_identifier()); |
| 700 } |
| 701 |
628 TEST(Dump, OneSystemInfo) { | 702 TEST(Dump, OneSystemInfo) { |
629 Dump dump(0, kLittleEndian); | 703 Dump dump(0, kLittleEndian); |
630 String csd_version(dump, "Petulant Pierogi"); | 704 String csd_version(dump, "Petulant Pierogi"); |
631 SystemInfo system_info(dump, SystemInfo::windows_x86, csd_version); | 705 SystemInfo system_info(dump, SystemInfo::windows_x86, csd_version); |
632 | 706 |
633 dump.Add(&system_info); | 707 dump.Add(&system_info); |
634 dump.Add(&csd_version); | 708 dump.Add(&csd_version); |
635 dump.Finish(); | 709 dump.Finish(); |
636 | 710 |
637 string contents; | 711 string contents; |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 EXPECT_EQ(0x1e2db2ceU, raw_context.iregs[25]); | 1512 EXPECT_EQ(0x1e2db2ceU, raw_context.iregs[25]); |
1439 EXPECT_EQ(0xaaa4659cU, raw_context.iregs[26]); | 1513 EXPECT_EQ(0xaaa4659cU, raw_context.iregs[26]); |
1440 EXPECT_EQ(0xd0c0f0e0U, raw_context.iregs[27]); | 1514 EXPECT_EQ(0xd0c0f0e0U, raw_context.iregs[27]); |
1441 EXPECT_EQ(0xc7d6a9b8U, raw_context.iregs[28]); | 1515 EXPECT_EQ(0xc7d6a9b8U, raw_context.iregs[28]); |
1442 EXPECT_EQ(0x56781234U, raw_context.iregs[29]); | 1516 EXPECT_EQ(0x56781234U, raw_context.iregs[29]); |
1443 EXPECT_EQ(0x1234abcdU, raw_context.iregs[30]); | 1517 EXPECT_EQ(0x1234abcdU, raw_context.iregs[30]); |
1444 EXPECT_EQ(0x30401020U, raw_context.iregs[31]); | 1518 EXPECT_EQ(0x30401020U, raw_context.iregs[31]); |
1445 } | 1519 } |
1446 | 1520 |
1447 } // namespace | 1521 } // namespace |
OLD | NEW |