Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 Google Inc. | 1 // Copyright (c) 2011 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 found_usable_info = true; | 677 found_usable_info = true; |
| 678 info->LoadedSection(".debug_info"); | 678 info->LoadedSection(".debug_info"); |
| 679 if (!LoadDwarf<ElfClass>(obj_file, elf_header, big_endian, | 679 if (!LoadDwarf<ElfClass>(obj_file, elf_header, big_endian, |
| 680 options.handle_inter_cu_refs, module)) { | 680 options.handle_inter_cu_refs, module)) { |
| 681 fprintf(stderr, "%s: \".debug_info\" section found, but failed to load " | 681 fprintf(stderr, "%s: \".debug_info\" section found, but failed to load " |
| 682 "DWARF debugging information\n", obj_file.c_str()); | 682 "DWARF debugging information\n", obj_file.c_str()); |
| 683 } | 683 } |
| 684 } | 684 } |
| 685 | 685 |
| 686 // See if there are export symbols available. | 686 // See if there are export symbols available. |
| 687 const Shdr* dynsym_section = | 687 const Shdr* symtab_section = |
| 688 FindElfSectionByName<ElfClass>(".dynsym", SHT_DYNSYM, | 688 FindElfSectionByName<ElfClass>(".symtab", SHT_SYMTAB, |
| 689 sections, names, names_end, | 689 sections, names, names_end, |
| 690 elf_header->e_shnum); | 690 elf_header->e_shnum); |
| 691 const Shdr* dynstr_section = | 691 const Shdr* strtab_section = |
| 692 FindElfSectionByName<ElfClass>(".dynstr", SHT_STRTAB, | 692 FindElfSectionByName<ElfClass>(".strtab", SHT_STRTAB, |
| 693 sections, names, names_end, | 693 sections, names, names_end, |
| 694 elf_header->e_shnum); | 694 elf_header->e_shnum); |
| 695 if (dynsym_section && dynstr_section) { | 695 if (symtab_section && strtab_section) { |
| 696 info->LoadedSection(".dynsym"); | 696 info->LoadedSection(".symtab"); |
| 697 | 697 |
| 698 const uint8_t* dynsyms = | 698 const uint8_t* symtab = |
| 699 GetOffset<ElfClass, uint8_t>(elf_header, | 699 GetOffset<ElfClass, uint8_t>(elf_header, |
| 700 dynsym_section->sh_offset); | 700 symtab_section->sh_offset); |
| 701 const uint8_t* dynstrs = | 701 const uint8_t* strtab = |
| 702 GetOffset<ElfClass, uint8_t>(elf_header, | 702 GetOffset<ElfClass, uint8_t>(elf_header, |
| 703 dynstr_section->sh_offset); | 703 strtab_section->sh_offset); |
| 704 bool result = | 704 bool result = |
| 705 ELFSymbolsToModule(dynsyms, | 705 ELFSymbolsToModule(symtab, |
| 706 dynsym_section->sh_size, | 706 symtab_section->sh_size, |
| 707 dynstrs, | 707 strtab, |
| 708 dynstr_section->sh_size, | 708 strtab_section->sh_size, |
| 709 big_endian, | 709 big_endian, |
| 710 ElfClass::kAddrSize, | 710 ElfClass::kAddrSize, |
| 711 module); | 711 module); |
| 712 found_usable_info = found_usable_info || result; | 712 found_usable_info = found_usable_info || result; |
| 713 } else { | |
| 714 // Look in dynsym only if full symbol table was not available. | |
| 715 const Shdr* dynsym_section = | |
| 716 FindElfSectionByName<ElfClass>(".dynsym", SHT_SYMTAB, | |
| 717 sections, names, names_end, | |
| 718 elf_header->e_shnum); | |
| 719 const Shdr* dynstr_section = | |
| 720 FindElfSectionByName<ElfClass>(".dynstr", SHT_STRTAB, | |
| 721 sections, names, names_end, | |
| 722 elf_header->e_shnum); | |
| 723 if (dynsym_section && dynstr_section) { | |
| 724 info->LoadedSection(".symtab"); | |
|
Mark Mentovai
2016/03/22 21:03:11
.dynsym?
David Yen
2016/03/22 21:14:08
Oops, good catch. Done.
| |
| 725 | |
| 726 const uint8_t* dynsyms = | |
| 727 GetOffset<ElfClass, uint8_t>(elf_header, | |
| 728 dynsym_section->sh_offset); | |
| 729 const uint8_t* dynstrs = | |
| 730 GetOffset<ElfClass, uint8_t>(elf_header, | |
| 731 dynstr_section->sh_offset); | |
| 732 bool result = | |
| 733 ELFSymbolsToModule(dynsyms, | |
| 734 dynsym_section->sh_size, | |
| 735 dynstrs, | |
| 736 dynstr_section->sh_size, | |
| 737 big_endian, | |
| 738 ElfClass::kAddrSize, | |
| 739 module); | |
| 740 found_usable_info = found_usable_info || result; | |
| 741 } | |
| 713 } | 742 } |
| 714 } | 743 } |
| 715 | 744 |
| 716 if (options.symbol_data != NO_CFI) { | 745 if (options.symbol_data != NO_CFI) { |
| 717 // Dwarf Call Frame Information (CFI) is actually independent from | 746 // Dwarf Call Frame Information (CFI) is actually independent from |
| 718 // the other DWARF debugging information, and can be used alone. | 747 // the other DWARF debugging information, and can be used alone. |
| 719 const Shdr* dwarf_cfi_section = | 748 const Shdr* dwarf_cfi_section = |
| 720 FindElfSectionByName<ElfClass>(".debug_frame", debug_section_type, | 749 FindElfSectionByName<ElfClass>(".debug_frame", debug_section_type, |
| 721 sections, names, names_end, | 750 sections, names, names_end, |
| 722 elf_header->e_shnum); | 751 elf_header->e_shnum); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 MmapWrapper map_wrapper; | 1029 MmapWrapper map_wrapper; |
| 1001 void* elf_header = NULL; | 1030 void* elf_header = NULL; |
| 1002 if (!LoadELF(obj_file, &map_wrapper, &elf_header)) | 1031 if (!LoadELF(obj_file, &map_wrapper, &elf_header)) |
| 1003 return false; | 1032 return false; |
| 1004 | 1033 |
| 1005 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header), | 1034 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header), |
| 1006 obj_file, debug_dirs, options, module); | 1035 obj_file, debug_dirs, options, module); |
| 1007 } | 1036 } |
| 1008 | 1037 |
| 1009 } // namespace google_breakpad | 1038 } // namespace google_breakpad |
| OLD | NEW |