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

Unified Diff: src/common/linux/file_id.h

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: Rework to handle arbitrary size build ids Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/common/linux/dump_symbols.cc ('k') | src/common/linux/file_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/common/linux/dump_symbols.cc ('k') | src/common/linux/file_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698