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

Side by Side Diff: src/common/linux/elfutils.h

Issue 2052263002: Dump INFO CODE_ID containing Build ID in Linux dump_syms (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Oops, it's supposed to be INFO CODE_ID Created 4 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 | « src/common/linux/dump_symbols_unittest.cc ('k') | src/common/linux/file_id.h » ('j') | 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) 2012, Google Inc. 1 // Copyright (c) 2012, 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Traits classes so consumers can write templatized code to deal 42 // Traits classes so consumers can write templatized code to deal
43 // with specific ELF bits. 43 // with specific ELF bits.
44 struct ElfClass32 { 44 struct ElfClass32 {
45 typedef Elf32_Addr Addr; 45 typedef Elf32_Addr Addr;
46 typedef Elf32_Ehdr Ehdr; 46 typedef Elf32_Ehdr Ehdr;
47 typedef Elf32_Nhdr Nhdr; 47 typedef Elf32_Nhdr Nhdr;
48 typedef Elf32_Phdr Phdr; 48 typedef Elf32_Phdr Phdr;
49 typedef Elf32_Shdr Shdr; 49 typedef Elf32_Shdr Shdr;
50 typedef Elf32_Half Half; 50 typedef Elf32_Half Half;
51 typedef Elf32_Off Off; 51 typedef Elf32_Off Off;
52 typedef Elf32_Sym Sym;
52 typedef Elf32_Word Word; 53 typedef Elf32_Word Word;
54
53 static const int kClass = ELFCLASS32; 55 static const int kClass = ELFCLASS32;
56 static const uint16_t kMachine = EM_386;
54 static const size_t kAddrSize = sizeof(Elf32_Addr); 57 static const size_t kAddrSize = sizeof(Elf32_Addr);
58 static constexpr const char* kMachineName = "x86";
55 }; 59 };
56 60
57 struct ElfClass64 { 61 struct ElfClass64 {
58 typedef Elf64_Addr Addr; 62 typedef Elf64_Addr Addr;
59 typedef Elf64_Ehdr Ehdr; 63 typedef Elf64_Ehdr Ehdr;
60 typedef Elf64_Nhdr Nhdr; 64 typedef Elf64_Nhdr Nhdr;
61 typedef Elf64_Phdr Phdr; 65 typedef Elf64_Phdr Phdr;
62 typedef Elf64_Shdr Shdr; 66 typedef Elf64_Shdr Shdr;
63 typedef Elf64_Half Half; 67 typedef Elf64_Half Half;
64 typedef Elf64_Off Off; 68 typedef Elf64_Off Off;
69 typedef Elf64_Sym Sym;
65 typedef Elf64_Word Word; 70 typedef Elf64_Word Word;
71
66 static const int kClass = ELFCLASS64; 72 static const int kClass = ELFCLASS64;
73 static const uint16_t kMachine = EM_X86_64;
67 static const size_t kAddrSize = sizeof(Elf64_Addr); 74 static const size_t kAddrSize = sizeof(Elf64_Addr);
75 static constexpr const char* kMachineName = "x86_64";
68 }; 76 };
69 77
70 bool IsValidElf(const void* elf_header); 78 bool IsValidElf(const void* elf_header);
71 int ElfClass(const void* elf_base); 79 int ElfClass(const void* elf_base);
72 80
73 // Attempt to find a section named |section_name| of type |section_type| 81 // Attempt to find a section named |section_name| of type |section_type|
74 // in the ELF binary data at |elf_mapped_base|. On success, returns true 82 // in the ELF binary data at |elf_mapped_base|. On success, returns true
75 // and sets |*section_start| to point to the start of the section data, 83 // and sets |*section_start| to point to the start of the section data,
76 // and |*section_size| to the size of the section's data. If |elfclass| 84 // and |*section_size| to the size of the section's data. If |elfclass|
77 // is not NULL, set |*elfclass| to the ELF file class. 85 // is not NULL, set |*elfclass| to the ELF file class.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // to specify the return type to avoid having to dynamic_cast the 117 // to specify the return type to avoid having to dynamic_cast the
110 // result. 118 // result.
111 template<typename ElfClass, typename T> 119 template<typename ElfClass, typename T>
112 const T* 120 const T*
113 GetOffset(const typename ElfClass::Ehdr* elf_header, 121 GetOffset(const typename ElfClass::Ehdr* elf_header,
114 typename ElfClass::Off offset); 122 typename ElfClass::Off offset);
115 123
116 } // namespace google_breakpad 124 } // namespace google_breakpad
117 125
118 #endif // COMMON_LINUX_ELFUTILS_H_ 126 #endif // COMMON_LINUX_ELFUTILS_H_
OLDNEW
« no previous file with comments | « src/common/linux/dump_symbols_unittest.cc ('k') | src/common/linux/file_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698