| OLD | NEW |
| 1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 // Converts a minidump file to a core file which gdb can read. | 30 // Converts a minidump file to a core file which gdb can read. |
| 31 // Large parts lifted from the userspace core dumper: | 31 // Large parts lifted from the userspace core dumper: |
| 32 // http://code.google.com/p/google-coredumper/ | 32 // http://code.google.com/p/google-coredumper/ |
| 33 // | 33 // |
| 34 // Usage: minidump-2-core [-v] 1234.dmp > core | 34 // Usage: minidump-2-core [-v] 1234.dmp > core |
| 35 | 35 |
| 36 #include <elf.h> | 36 #include <elf.h> |
| 37 #include <errno.h> | 37 #include <errno.h> |
| 38 #include <inttypes.h> | |
| 39 #include <link.h> | 38 #include <link.h> |
| 40 #include <stdio.h> | 39 #include <stdio.h> |
| 41 #include <stdlib.h> | 40 #include <stdlib.h> |
| 42 #include <string.h> | 41 #include <string.h> |
| 43 #include <sys/user.h> | 42 #include <sys/user.h> |
| 44 #include <unistd.h> | 43 #include <unistd.h> |
| 45 | 44 |
| 46 #include <map> | 45 #include <map> |
| 47 #include <string> | 46 #include <string> |
| 48 #include <vector> | 47 #include <vector> |
| 49 | 48 |
| 50 #include "common/linux/memory_mapped_file.h" | 49 #include "common/linux/memory_mapped_file.h" |
| 51 #include "common/minidump_type_helper.h" | 50 #include "common/minidump_type_helper.h" |
| 52 #include "common/scoped_ptr.h" | 51 #include "common/scoped_ptr.h" |
| 52 #include "google_breakpad/common/breakpad_types.h" |
| 53 #include "google_breakpad/common/minidump_format.h" | 53 #include "google_breakpad/common/minidump_format.h" |
| 54 #include "third_party/lss/linux_syscall_support.h" | 54 #include "third_party/lss/linux_syscall_support.h" |
| 55 #include "tools/linux/md2core/minidump_memory_range.h" | 55 #include "tools/linux/md2core/minidump_memory_range.h" |
| 56 | 56 |
| 57 #if __WORDSIZE == 64 | 57 #if __WORDSIZE == 64 |
| 58 #define ELF_CLASS ELFCLASS64 | 58 #define ELF_CLASS ELFCLASS64 |
| 59 #else | 59 #else |
| 60 #define ELF_CLASS ELFCLASS32 | 60 #define ELF_CLASS ELFCLASS32 |
| 61 #endif | 61 #endif |
| 62 #define Ehdr ElfW(Ehdr) | 62 #define Ehdr ElfW(Ehdr) |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 iter != crashinfo.mappings.end(); ++iter) { | 1254 iter != crashinfo.mappings.end(); ++iter) { |
| 1255 const CrashedProcess::Mapping& mapping = iter->second; | 1255 const CrashedProcess::Mapping& mapping = iter->second; |
| 1256 if (mapping.data.size()) { | 1256 if (mapping.data.size()) { |
| 1257 if (!writea(1, mapping.data.c_str(), mapping.data.size())) | 1257 if (!writea(1, mapping.data.c_str(), mapping.data.size())) |
| 1258 return 1; | 1258 return 1; |
| 1259 } | 1259 } |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 return 0; | 1262 return 0; |
| 1263 } | 1263 } |
| OLD | NEW |