Files
tubestation/testing/tools/fileid/linux_fileid.cpp
Ted Mielczarek cd630012c2 bug 1407368 - rename Breakpad's src/common/memory.h. r=gsvelto
memory.h conflicts with a system header, so we have workarounds to
change include paths to work around this.

This is mostly a cherry-pick of this upstream commit:
8bb3d55af7

..but the patch was applied separately to toolkit/crashreporter/google-breakpad
and toolkit/crashreporter/breakpad-client since we've forked the latter,
and there's also one other fixup of a source file included.

MozReview-Commit-ID: HH92HZG7y9n
2017-10-17 19:44:36 -04:00

42 lines
1.2 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdio.h>
#include <string>
#include "common/linux/file_id.h"
#include "common/memory_allocator.h"
using std::string;
using google_breakpad::auto_wasteful_vector;
using google_breakpad::FileID;
using google_breakpad::PageAllocator;
int main(int argc, char** argv)
{
if (argc != 2) {
fprintf(stderr, "usage: fileid <elf file>\n");
return 1;
}
PageAllocator allocator;
auto_wasteful_vector<uint8_t, sizeof(MDGUID)> identifier(&allocator);
FileID file_id(argv[1]);
if (!file_id.ElfFileIdentifier(identifier)) {
fprintf(stderr, "%s: unable to generate file identifier\n",
argv[1]);
return 1;
}
string result_guid = FileID::ConvertIdentifierToUUIDString(identifier);
// Add an extra "0" at the end. PDB files on Windows have an 'age'
// number appended to the end of the file identifier; this isn't
// really used or necessary on other platforms, but be consistent.
printf("%s0\n", result_guid.c_str());
return 0;
}