| 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..1146d6ca530d529a7ff1175e4e4dc6b83cadfc43 100644
|
| --- a/src/common/linux/file_id.h
|
| +++ b/src/common/linux/file_id.h
|
| @@ -37,10 +37,13 @@
|
| #include <string>
|
|
|
| #include "common/linux/guid_creator.h"
|
| +#include "common/memory.h"
|
|
|
| namespace google_breakpad {
|
|
|
| -static const size_t kMDGUIDSize = sizeof(MDGUID);
|
| +// GNU binutils' ld defaults to 'sha1', which is 160 bits == 20 bytes,
|
| +// so this is enough to fit that, which most binaries will use.
|
| +static const size_t kDefaultBuildIdSize = 20;
|
|
|
| class FileID {
|
| public:
|
| @@ -48,25 +51,25 @@ 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
|
| - // file.
|
| + // |identifier|.
|
| + //
|
| // 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(wasteful_vector<uint8_t>& identifier);
|
|
|
| // 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|. Return false if the identifier could not be created for this
|
| // file.
|
| - static bool ElfFileIdentifierFromMappedFile(const void* base,
|
| - uint8_t identifier[kMDGUIDSize]);
|
| + static bool ElfFileIdentifierFromMappedFile(
|
| + const void* base,
|
| + wasteful_vector<uint8_t>& identifier);
|
|
|
| // 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],
|
| - char* buffer, int buffer_length);
|
| + // be formatted as a UUID in all uppercase without dashes.
|
| + // (e.g., 22F065BBFC9C49F780FE26A7CEBD7BCE).
|
| + static std::string ConvertIdentifierToUUIDString(
|
| + const wasteful_vector<uint8_t>& identifier);
|
|
|
| private:
|
| // Storage for the path specified
|
|
|