LEFT | RIGHT |
(no file at all) | |
1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 uint8_t identifier[kMDGUIDSize]) { | 142 uint8_t identifier[kMDGUIDSize]) { |
143 // Look for a build id note first. | 143 // Look for a build id note first. |
144 if (FindElfBuildIDNote(base, identifier)) | 144 if (FindElfBuildIDNote(base, identifier)) |
145 return true; | 145 return true; |
146 | 146 |
147 // Fall back on hashing the first page of the text section. | 147 // Fall back on hashing the first page of the text section. |
148 return HashElfTextSection(base, identifier); | 148 return HashElfTextSection(base, identifier); |
149 } | 149 } |
150 | 150 |
151 bool FileID::ElfFileIdentifier(uint8_t identifier[kMDGUIDSize]) { | 151 bool FileID::ElfFileIdentifier(uint8_t identifier[kMDGUIDSize]) { |
152 MemoryMappedFile mapped_file(path_.c_str()); | 152 MemoryMappedFile mapped_file(path_.c_str(), 0); |
153 if (!mapped_file.data()) // Should probably check if size >= ElfW(Ehdr)? | 153 if (!mapped_file.data()) // Should probably check if size >= ElfW(Ehdr)? |
154 return false; | 154 return false; |
155 | 155 |
156 return ElfFileIdentifierFromMappedFile(mapped_file.data(), identifier); | 156 return ElfFileIdentifierFromMappedFile(mapped_file.data(), identifier); |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 void FileID::ConvertIdentifierToString(const uint8_t identifier[kMDGUIDSize], | 160 void FileID::ConvertIdentifierToString(const uint8_t identifier[kMDGUIDSize], |
161 char* buffer, int buffer_length) { | 161 char* buffer, int buffer_length) { |
162 uint8_t identifier_swapped[kMDGUIDSize]; | 162 uint8_t identifier_swapped[kMDGUIDSize]; |
(...skipping 19 matching lines...) Expand all Loading... |
182 | 182 |
183 buffer[buffer_idx++] = (hi >= 10) ? 'A' + hi - 10 : '0' + hi; | 183 buffer[buffer_idx++] = (hi >= 10) ? 'A' + hi - 10 : '0' + hi; |
184 buffer[buffer_idx++] = (lo >= 10) ? 'A' + lo - 10 : '0' + lo; | 184 buffer[buffer_idx++] = (lo >= 10) ? 'A' + lo - 10 : '0' + lo; |
185 } | 185 } |
186 | 186 |
187 // NULL terminate | 187 // NULL terminate |
188 buffer[(buffer_idx < buffer_length) ? buffer_idx : buffer_idx - 1] = 0; | 188 buffer[(buffer_idx < buffer_length) ? buffer_idx : buffer_idx - 1] = 0; |
189 } | 189 } |
190 | 190 |
191 } // namespace google_breakpad | 191 } // namespace google_breakpad |
LEFT | RIGHT |