diff options
author | ted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2009-12-23 17:09:27 +0000 |
---|---|---|
committer | ted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2009-12-23 17:09:27 +0000 |
commit | 0a5fc5d663054eb836eafc258cc2f6792358e2c9 (patch) | |
tree | eeffa69d84976079078e2c82b510fca0f60e552c /src/client/linux/minidump_writer/linux_dumper.cc | |
parent | fix a badly-applied patch, and also re-run automake which I forgot to do (diff) | |
download | breakpad-0a5fc5d663054eb836eafc258cc2f6792358e2c9.tar.xz |
Issue 357: New Linux file_id code doesn't persist across strip. r=agl,nealsid at http://breakpad.appspot.com/49008
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@461 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/minidump_writer/linux_dumper.cc')
-rw-r--r-- | src/client/linux/minidump_writer/linux_dumper.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc index 28729b34..d752608d 100644 --- a/src/client/linux/minidump_writer/linux_dumper.cc +++ b/src/client/linux/minidump_writer/linux_dumper.cc @@ -42,15 +42,20 @@ #include <string.h> #include <unistd.h> +#include <elf.h> #include <errno.h> #include <fcntl.h> +#include <link.h> #include <sys/types.h> #include <sys/ptrace.h> #include <sys/wait.h> +#include <algorithm> + #include "client/linux/minidump_writer/directory_reader.h" #include "client/linux/minidump_writer/line_reader.h" +#include "common/linux/file_id.h" #include "common/linux/linux_libc_support.h" #include "common/linux/linux_syscall_support.h" @@ -156,6 +161,30 @@ LinuxDumper::BuildProcPath(char* path, pid_t pid, const char* node) const { memcpy(path + total_length, "\0", 1); } +bool +LinuxDumper::ElfFileIdentifierForMapping(unsigned int mapping_id, + uint8_t identifier[sizeof(MDGUID)]) +{ + assert(mapping_id < mappings_.size()); + const MappingInfo* mapping = mappings_[mapping_id]; + int fd = sys_open(mapping->name, O_RDONLY, 0); + if (fd < 0) + return false; + struct kernel_stat st; + if (sys_fstat(fd, &st) != 0) { + sys_close(fd); + return false; + } + void* base = sys_mmap2(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); + sys_close(fd); + if (base == MAP_FAILED) + return false; + + bool success = FileID::ElfFileIdentifierFromMappedFile(base, identifier); + sys_munmap(base, st.st_size); + return success; +} + void* LinuxDumper::FindBeginningOfLinuxGateSharedLibrary(const pid_t pid) const { char auxv_path[80]; |