Breakpad Linux dumper: Don't map file into memory a second time just to compute file ID

At present, the Linux symbol dumper maps the ELF file into memory to
examine the debugging information it contains, but then also calls
google_breakpad::FileID::ElfFileIdentifier, which maps the ELF file into
memory again. Some of our object files are large; Mozilla's libxul.so is
1.1GiB. Trying to map such files twice can interfere with tools like
valgrind that map themselves into high addresses (in an attempt to stay out
of the way of ordinary programs).

The FileID class has another method, ElfFileIdentifierFromMappedFile, that
operates on an already-loaded image of the file; use that instead.

a=jimblandy, r=thestig


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@625 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
jimblandy 2010-07-17 05:08:04 +00:00
parent 56eac4dd7a
commit c5f5e0ae65

View file

@ -685,7 +685,7 @@ bool WriteSymbolFile(const std::string &obj_file,
unsigned char identifier[16]; unsigned char identifier[16];
google_breakpad::FileID file_id(obj_file.c_str()); google_breakpad::FileID file_id(obj_file.c_str());
if (!file_id.ElfFileIdentifier(identifier)) { if (!file_id.ElfFileIdentifierFromMappedFile(elf_header, identifier)) {
fprintf(stderr, "%s: unable to generate file identifier\n", fprintf(stderr, "%s: unable to generate file identifier\n",
obj_file.c_str()); obj_file.c_str());
return false; return false;