Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: common/linux/dump_symbols.cc

Issue 1189823002: Update breakpad for Android packed relocations. (Closed) Base URL: https://chromium.googlesource.com/external/google-breakpad/src.git@master
Patch Set: Update for more review comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/linux/minidump_writer/minidump_writer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #ifndef NO_STABS_SUPPORT 88 #ifndef NO_STABS_SUPPORT
89 using google_breakpad::StabsToModule; 89 using google_breakpad::StabsToModule;
90 #endif 90 #endif
91 using google_breakpad::scoped_ptr; 91 using google_breakpad::scoped_ptr;
92 92
93 // Define AARCH64 ELF architecture if host machine does not include this define. 93 // Define AARCH64 ELF architecture if host machine does not include this define.
94 #ifndef EM_AARCH64 94 #ifndef EM_AARCH64
95 #define EM_AARCH64 183 95 #define EM_AARCH64 183
96 #endif 96 #endif
97 97
98 // Define SHT_ANDROID_REL and SHT_ANDROID_RELA if not defined by the host.
99 // Sections with this type contain Android packed relocations.
100 #ifndef SHT_ANDROID_REL
101 #define SHT_ANDROID_REL (SHT_LOOS + 1)
102 #endif
103 #ifndef SHT_ANDROID_RELA
104 #define SHT_ANDROID_RELA (SHT_LOOS + 2)
105 #endif
106
98 // 107 //
99 // FDWrapper 108 // FDWrapper
100 // 109 //
101 // Wrapper class to make sure opened file is closed. 110 // Wrapper class to make sure opened file is closed.
102 // 111 //
103 class FDWrapper { 112 class FDWrapper {
104 public: 113 public:
105 explicit FDWrapper(int fd) : 114 explicit FDWrapper(int fd) :
106 fd_(fd) {} 115 fd_(fd) {}
107 ~FDWrapper() { 116 ~FDWrapper() {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 elf_header->e_machine == EM_MIPS ? SHT_MIPS_DWARF : SHT_PROGBITS; 613 elf_header->e_machine == EM_MIPS ? SHT_MIPS_DWARF : SHT_PROGBITS;
605 const Shdr* sections = 614 const Shdr* sections =
606 GetOffset<ElfClass, Shdr>(elf_header, elf_header->e_shoff); 615 GetOffset<ElfClass, Shdr>(elf_header, elf_header->e_shoff);
607 const Shdr* section_names = sections + elf_header->e_shstrndx; 616 const Shdr* section_names = sections + elf_header->e_shstrndx;
608 const char* names = 617 const char* names =
609 GetOffset<ElfClass, char>(elf_header, section_names->sh_offset); 618 GetOffset<ElfClass, char>(elf_header, section_names->sh_offset);
610 const char *names_end = names + section_names->sh_size; 619 const char *names_end = names + section_names->sh_size;
611 bool found_debug_info_section = false; 620 bool found_debug_info_section = false;
612 bool found_usable_info = false; 621 bool found_usable_info = false;
613 622
623 // Reject files that contain Android packed relocations. The pre-packed
624 // version of the file should be symbolized; the packed version is only
625 // intended for use on the target system.
626 if (FindElfSectionByName<ElfClass>(".rel.dyn", SHT_ANDROID_REL,
627 sections, names,
628 names_end, elf_header->e_shnum)) {
629 fprintf(stderr, "%s: file contains a \".rel.dyn\" section "
630 "with type SHT_ANDROID_REL\n", obj_file.c_str());
631 fprintf(stderr, "Files containing Android packed relocations "
632 "may not be symbolized.\n");
633 return false;
634 }
635 if (FindElfSectionByName<ElfClass>(".rela.dyn", SHT_ANDROID_RELA,
636 sections, names,
637 names_end, elf_header->e_shnum)) {
638 fprintf(stderr, "%s: file contains a \".rela.dyn\" section "
639 "with type SHT_ANDROID_RELA\n", obj_file.c_str());
640 fprintf(stderr, "Files containing Android packed relocations "
641 "may not be symbolized.\n");
642 return false;
643 }
644
614 if (options.symbol_data != ONLY_CFI) { 645 if (options.symbol_data != ONLY_CFI) {
615 #ifndef NO_STABS_SUPPORT 646 #ifndef NO_STABS_SUPPORT
616 // Look for STABS debugging information, and load it if present. 647 // Look for STABS debugging information, and load it if present.
617 const Shdr* stab_section = 648 const Shdr* stab_section =
618 FindElfSectionByName<ElfClass>(".stab", SHT_PROGBITS, 649 FindElfSectionByName<ElfClass>(".stab", SHT_PROGBITS,
619 sections, names, names_end, 650 sections, names, names_end,
620 elf_header->e_shnum); 651 elf_header->e_shnum);
621 if (stab_section) { 652 if (stab_section) {
622 const Shdr* stabstr_section = stab_section->sh_link + sections; 653 const Shdr* stabstr_section = stab_section->sh_link + sections;
623 if (stabstr_section) { 654 if (stabstr_section) {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 MmapWrapper map_wrapper; 998 MmapWrapper map_wrapper;
968 void* elf_header = NULL; 999 void* elf_header = NULL;
969 if (!LoadELF(obj_file, &map_wrapper, &elf_header)) 1000 if (!LoadELF(obj_file, &map_wrapper, &elf_header))
970 return false; 1001 return false;
971 1002
972 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header), 1003 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header),
973 obj_file, debug_dirs, options, module); 1004 obj_file, debug_dirs, options, module);
974 } 1005 }
975 1006
976 } // namespace google_breakpad 1007 } // namespace google_breakpad
OLDNEW
« no previous file with comments | « client/linux/minidump_writer/minidump_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698