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

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

Issue 1688743002: Switch the Linux minidump writer to use MDCVInfoELF for CV data. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Created 4 years, 10 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // This namespace contains helper functions. 75 // This namespace contains helper functions.
76 namespace { 76 namespace {
77 77
78 using google_breakpad::DumpOptions; 78 using google_breakpad::DumpOptions;
79 using google_breakpad::DwarfCFIToModule; 79 using google_breakpad::DwarfCFIToModule;
80 using google_breakpad::DwarfCUToModule; 80 using google_breakpad::DwarfCUToModule;
81 using google_breakpad::DwarfLineToModule; 81 using google_breakpad::DwarfLineToModule;
82 using google_breakpad::ElfClass; 82 using google_breakpad::ElfClass;
83 using google_breakpad::ElfClass32; 83 using google_breakpad::ElfClass32;
84 using google_breakpad::ElfClass64; 84 using google_breakpad::ElfClass64;
85 using google_breakpad::FileID;
85 using google_breakpad::FindElfSectionByName; 86 using google_breakpad::FindElfSectionByName;
86 using google_breakpad::GetOffset; 87 using google_breakpad::GetOffset;
87 using google_breakpad::IsValidElf; 88 using google_breakpad::IsValidElf;
89 using google_breakpad::kMaxBuildID;
88 using google_breakpad::Module; 90 using google_breakpad::Module;
89 #ifndef NO_STABS_SUPPORT 91 #ifndef NO_STABS_SUPPORT
90 using google_breakpad::StabsToModule; 92 using google_breakpad::StabsToModule;
91 #endif 93 #endif
92 using google_breakpad::scoped_ptr; 94 using google_breakpad::scoped_ptr;
93 95
94 // Define AARCH64 ELF architecture if host machine does not include this define. 96 // Define AARCH64 ELF architecture if host machine does not include this define.
95 #ifndef EM_AARCH64 97 #ifndef EM_AARCH64
96 #define EM_AARCH64 183 98 #define EM_AARCH64 183
97 #endif 99 #endif
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 case EM_S390: return "s390"; 822 case EM_S390: return "s390";
821 case EM_SPARC: return "sparc"; 823 case EM_SPARC: return "sparc";
822 case EM_SPARCV9: return "sparcv9"; 824 case EM_SPARCV9: return "sparcv9";
823 case EM_X86_64: return "x86_64"; 825 case EM_X86_64: return "x86_64";
824 default: return NULL; 826 default: return NULL;
825 } 827 }
826 } 828 }
827 829
828 // Format the Elf file identifier in IDENTIFIER as a UUID with the 830 // Format the Elf file identifier in IDENTIFIER as a UUID with the
829 // dashes removed. 831 // dashes removed.
830 string FormatIdentifier(unsigned char identifier[16]) { 832 string FormatIdentifier(unsigned char identifier[kMaxBuildID]) {
831 char identifier_str[40]; 833 char identifier_str[40];
832 google_breakpad::FileID::ConvertIdentifierToString( 834 FileID::ConvertIdentifierToString(
833 identifier, 835 identifier,
834 identifier_str, 836 identifier_str,
835 sizeof(identifier_str)); 837 sizeof(identifier_str));
836 string id_no_dash; 838 string id_no_dash;
837 for (int i = 0; identifier_str[i] != '\0'; ++i) 839 for (int i = 0; identifier_str[i] != '\0'; ++i)
838 if (identifier_str[i] != '-') 840 if (identifier_str[i] != '-')
839 id_no_dash += identifier_str[i]; 841 id_no_dash += identifier_str[i];
840 // Add an extra "0" by the end. PDB files on Windows have an 'age' 842 // Add an extra "0" by the end. PDB files on Windows have an 'age'
841 // number appended to the end of the file identifier; this isn't 843 // number appended to the end of the file identifier; this isn't
842 // really used or necessary on other platforms, but be consistent. 844 // really used or necessary on other platforms, but be consistent.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 template<typename ElfClass> 890 template<typename ElfClass>
889 bool ReadSymbolDataElfClass(const typename ElfClass::Ehdr* elf_header, 891 bool ReadSymbolDataElfClass(const typename ElfClass::Ehdr* elf_header,
890 const string& obj_filename, 892 const string& obj_filename,
891 const std::vector<string>& debug_dirs, 893 const std::vector<string>& debug_dirs,
892 const DumpOptions& options, 894 const DumpOptions& options,
893 Module** out_module) { 895 Module** out_module) {
894 typedef typename ElfClass::Ehdr Ehdr; 896 typedef typename ElfClass::Ehdr Ehdr;
895 897
896 *out_module = NULL; 898 *out_module = NULL;
897 899
898 unsigned char identifier[16]; 900 unsigned char identifier[kMaxBuildID];
899 if (!google_breakpad::FileID::ElfFileIdentifierFromMappedFile(elf_header, 901 size_t identifier_length;
900 identifier)) { 902 if (!FileID::ElfFileIdentifierFromMappedFile(elf_header,
903 identifier,
904 &identifier_length)) {
901 fprintf(stderr, "%s: unable to generate file identifier\n", 905 fprintf(stderr, "%s: unable to generate file identifier\n",
902 obj_filename.c_str()); 906 obj_filename.c_str());
903 return false; 907 return false;
904 } 908 }
905 909
906 const char *architecture = ElfArchitecture<ElfClass>(elf_header); 910 const char *architecture = ElfArchitecture<ElfClass>(elf_header);
907 if (!architecture) { 911 if (!architecture) {
908 fprintf(stderr, "%s: unrecognized ELF machine architecture: %d\n", 912 fprintf(stderr, "%s: unrecognized ELF machine architecture: %d\n",
909 obj_filename.c_str(), elf_header->e_machine); 913 obj_filename.c_str(), elf_header->e_machine);
910 return false; 914 return false;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 MmapWrapper map_wrapper; 1004 MmapWrapper map_wrapper;
1001 void* elf_header = NULL; 1005 void* elf_header = NULL;
1002 if (!LoadELF(obj_file, &map_wrapper, &elf_header)) 1006 if (!LoadELF(obj_file, &map_wrapper, &elf_header))
1003 return false; 1007 return false;
1004 1008
1005 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header), 1009 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header),
1006 obj_file, debug_dirs, options, module); 1010 obj_file, debug_dirs, options, module);
1007 } 1011 }
1008 1012
1009 } // namespace google_breakpad 1013 } // namespace google_breakpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698