Chromium Code Reviews| Index: src/common/linux/file_id.h |
| diff --git a/src/common/linux/file_id.h b/src/common/linux/file_id.h |
| index 2642722a630515bbea11f2818d3cd656362f0780..533e4e92279057105ae973a7e43690da82d79b4f 100644 |
| --- a/src/common/linux/file_id.h |
| +++ b/src/common/linux/file_id.h |
| @@ -40,7 +40,10 @@ |
| namespace google_breakpad { |
| -static const size_t kMDGUIDSize = sizeof(MDGUID); |
| +// This is somewhat arbitrary, but GNU binutils' ld defaults to |
| +// 'sha1', which is 160 bits == 20 bytes, so this is enough to fit |
| +// that, which most binaries will use. |
| +const size_t kMaxBuildID = 20; |
|
Lei Zhang
2016/02/10 23:08:50
In src/client/linux/microdump_writer/microdump_wri
|
| class FileID { |
| public: |
| @@ -48,24 +51,28 @@ class FileID { |
| ~FileID() {} |
| // Load the identifier for the elf file path specified in the constructor into |
| - // |identifier|. Return false if the identifier could not be created for the |
| + // |identifier|. Set |identifier_length| to the length of the identifier in |
| + // bytes. Return false if the identifier could not be created for this |
| // file. |
| // The current implementation will look for a .note.gnu.build-id |
| // section and use that as the file id, otherwise it falls back to |
| // XORing the first 4096 bytes of the .text section to generate an identifier. |
| - bool ElfFileIdentifier(uint8_t identifier[kMDGUIDSize]); |
| + bool ElfFileIdentifier(uint8_t identifier[kMaxBuildID], |
| + size_t* identifier_length); |
| // Load the identifier for the elf file mapped into memory at |base| into |
| - // |identifier|. Return false if the identifier could not be created for the |
| + // |identifier|. Set |identifier_length| to the length of the identifier in |
| + // bytes. Return false if the identifier could not be created for this |
| // file. |
| static bool ElfFileIdentifierFromMappedFile(const void* base, |
| - uint8_t identifier[kMDGUIDSize]); |
| + uint8_t identifier[kMaxBuildID], |
| + size_t* identifier_length); |
| // Convert the |identifier| data to a NULL terminated string. The string will |
| // be formatted as a UUID (e.g., 22F065BB-FC9C-49F7-80FE-26A7CEBD7BCE). |
| // The |buffer| should be at least 37 bytes long to receive all of the data |
| // and termination. Shorter buffers will contain truncated data. |
| - static void ConvertIdentifierToString(const uint8_t identifier[kMDGUIDSize], |
| + static void ConvertIdentifierToString(const uint8_t identifier[kMaxBuildID], |
| char* buffer, int buffer_length); |
| private: |