aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/minidump_writer/linux_dumper.cc
Commit message (Collapse)AuthorAgeFilesLines
* Don't merge the mappings if their exec bit are different.Primiano Tucci2016-03-081-1/+2
| | | | | | | BUG=585534 R=primiano@chromium.org Review URL: https://codereview.chromium.org/1750033002 .
* Add an optional root prefix to Linux dumpersDominik Laskowski2016-03-071-24/+24
| | | | | | | | | | | The Linux dumpers use absolute paths for shared libraries referenced by dumps, so they fail to locate them if the crash originated in a chroot. This CL enables callers to specify a root prefix, which is prepended to mapping paths before opening them. BUG=chromium:591792 TEST=make check Review URL: https://codereview.chromium.org/1761023002/
* Adjust breakpad module size to match adjusted start_addr.rmcilroy@chromium.org2015-06-301-4/+9
| | | | | | | | | | | | | | | | | | When changing a module's start_addr to account for Android packed relocations, also adjust its size field so that the apparent module end addr calculated by the breakpad processor does not alter. Ensures that the mapping entry from a packed library is consistent with that which an unpacked one would produce. BUG=499747 R=primiano@chromium.org, rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1211863002. Patch from Simon Baldwin <simonb@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1465 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Update breakpad for Android packed relocations.rmcilroy@chromium.org2015-06-191-0/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | Shared libraries containing Android packed relocations have a load bias that differs from the start address in /proc/$$/maps. Current breakpad assumes that the load bias and mapping start address are the same. Fixed by changing the client to detect the presence of Android packed relocations in the address space of a loaded library, and adjusting the stored mapping start address of any that are packed so that it contains the linker's load bias. For this to work properly, it is important that the non-packed library is symbolized for breakpad. Either packed or non-packed libraries may be run on the device; the client detects which has been loaded by the linker. BUG=499747 R=primiano@chromium.org, rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1189823002. Patch from Simon Baldwin <simonb@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1459 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Refactor .so name detection logic in minidump/linux_dumper.primiano@chromium.org2014-10-171-3/+43
| | | | | | | | | | | | | | | | This is a refactoring of the logic which determines the module name and path for a given MappingInfo in minidump_writer.cc. Such logic, which will be soon shared also with the upcoming microdump_writer.cc, is simply being moved to linux_dumper.cc, extracting a GetMappingEffectiveNameAndPath method. No behavioral change is intended. BUG=chromium:410294 R=thestig@chromium.org Review URL: https://breakpad.appspot.com/7734002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1392 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix clang compilation error introduced in r1380.rmcilroy@chromium.org2014-09-221-1/+1
| | | | | | | | | | | | | | | | Fixes: .../linux_dumper.cc:308:25: error: address of array 'module->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] module->name && module->name[0] == '/' && ~~~~~~~~^~~~ BUG=chromium:394703 R=rmcilroy@chromium.org Review URL: https://breakpad.appspot.com/5724002 Patch from Simon Baldwin <simonb@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1384 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Extend mapping merge to include reserved but unused mappings.rmcilroy@chromium.org2014-09-191-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When parsing /proc/pid/maps, current code merges adjacent entries that refer to the same library and where the start of the second is equal to the end of the first, for example: 40022000-40025000 r-xp 00000000 b3:11 827 /system/lib/liblog.so 40025000-40026000 r--p 00002000 b3:11 827 /system/lib/liblog.so 40026000-40027000 rw-p 00003000 b3:11 827 /system/lib/liblog.so When the system linker loads a library it first reserves all the address space required, from the smallest start to the largest end address, using an anonymous mapping, and then maps loaded segments inside that reservation. If the loaded segments do not fully occupy the reservation this leaves gaps, and these gaps prevent merges that should occur from occurring: 40417000-4044a000 r-xp 00000000 b3:11 820 /system/lib/libjpeg.so > 4044a000-4044b000 ---p 00000000 00:00 0 4044b000-4044c000 r--p 00033000 b3:11 820 /system/lib/libjpeg.so 4044c000-4044d000 rw-p 00034000 b3:11 820 /system/lib/libjpeg.so Where the segments that follow this gap do not contain executable code the failure to merge does not affect breakpad operation. However, where they do then the merge needs to occur. Packing relocations in a large library splits the executable segment into two, resulting in: 73b0c000-73b21000 r-xp 00000000 b3:19 786460 /data/.../libchrome.2160.0.so > 73b21000-73d12000 ---p 00000000 00:00 0 73d12000-75a90000 r-xp 00014000 b3:19 786460 /data/.../libchrome.2160.0.so 75a90000-75c0d000 rw-p 01d91000 b3:19 786460 /data/.../libchrome.2160.0.so Here the mapping at 73d12000-75a90000 must be merged into 73b0c000-73b21000 so that breakpad correctly calculates the base address for text. This change enables the full merge by also merging anonymous maps which result from unused reservation, identified as '---p' with offset 0, and which follow on from an executable mapping, into that executable mapping. BUG=chromium:394703 R=rmcilroy@chromium.org, thestig@chromium.org Review URL: https://breakpad.appspot.com/7714003 Patch from Simon Baldwin <simonb@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1380 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Chrome on Android now supports loading the shared library directly from the ↵rmcilroy@chromium.org2014-07-221-4/+83
| | | | | | | | | | | | | | | | | | | | | | APK file. This patch makes two changes to breakpad to enable crash reporting to work correctly when the library is inside another file (an archive): - Do not filter mappings which map an executable at a non-zero offset. - If such an executable is mapped look in the ELF information for the shared object name and use that name in the minidump. Note this change doesn't care about the archive format and isn't Android specific (though loading the shared library this way is currently only done on Android). BUG=390618 R=thestig@chromium.org Review URL: https://breakpad.appspot.com/7684002 Patch from Anton Carver <anton@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1355 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fixing several instances of std::vector::operator[] out of range accessivan.penkov@gmail.com2013-05-211-3/+6
| | | | | | Review URL: https://breakpad.appspot.com/597002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1187 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Ensure a proper LinuxDumper::crash_thread_ valueted.mielczarek@gmail.com2013-05-171-1/+1
| | | | | | Patch by Mike Hommey <mh@glandium.org>, R=me at https://breakpad.appspot.com/582002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1185 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Get the complete linux gate mapping instead of only one pageted.mielczarek@gmail.com2013-03-291-3/+2
| | | | | | | A=Mike Hommey <mh@glandium.org> R=ted at https://breakpad.appspot.com/542002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1134 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Minidumps never contain MD_LINUX_DSO_DEBUG info when breakpad is in a shared ↵ted.mielczarek@gmail.com2012-09-191-45/+23
| | | | | | | | | library A=Mike Hommey <mh@glandium.org> R=ted at http://breakpad.appspot.com/422002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1044 4c0a9323-5329-0410-9bdc-e9ce6186880e
* SORRY. It seems I've screwed up my commit for ↵digit@chromium.org2012-08-031-8/+8
| | | | | | | | | | http://breakpad.appspot.com/411002/, since revision 1001 only contains the new src/client/linux/linux_libc_support.cc and none of the other required files. I'm not sure what happened, but I'm re-uploading the patch has another issue. Review URL: https://breakpad.appspot.com/426002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1002 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix for putting main module as first one in minidumpmkrebs@chromium.org2012-03-301-2/+50
| | | | | | | | | | | | | | The first module in a minidump is expected to be for the main executable. We used to assume that /proc/<pid>/maps always showed that one first, but in some cases that is no longer true (see comment #7 of the bug). So this change makes use of the entry point stored in auxv to make sure we put the correct module first. BUG=chromium-os:25355 TEST=Ran Breakpad tests Review URL: https://breakpad.appspot.com/366002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@942 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Implement core dump to minidump conversion.benchan@chromium.org2012-01-191-266/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Turn the LinuxDumper class into a base class and move ptrace related code into a new derived class, LinuxPtraceDumper. 2. Add a LinuxCoreDumper class, which is derived from LinuxDumper, to extract information from a crashed process via a core dump file instead of ptrace. 3. Add a WriteMinidumpFromCore function to src/client/linux/minidump_writer/minidump_writer.h, which uses LinuxCoreDumper to extract information from a core dump file. 4. Add a core2md utility, which simply wraps WriteMinidumpFromCore, for converting a core dump to a minidump. BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. 4. Run Chromium OS tests to test core2md. Review URL: http://breakpad.appspot.com/343001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@905 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Refactor LinuxDumper and MinidumpWriter.benchan@chromium.org2012-01-111-14/+22
| | | | | | | | | | | | | | | | | | | | | | | This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Add two convenient methods, back() and empty(), to the wasteful_vector class. 2. Refactor the LinuxDumper class such that it can later be splitted into a base class and two derived classes, one uses the current ptrace implementation and one uses a core file. 3. Refactor the MinidumpWriter class such that it can later use different derived implementations of LinuxDumper. BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. Review URL: http://breakpad.appspot.com/340001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@902 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Replace readlink calls with a safer version that guarantees NULL-termination.benchan@chromium.org2011-12-211-3/+2
| | | | | | | | | | | | | | | | | | | | | This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Add a SafeReadLink function that wraps sys_readlink() to resolve a symbolic link but guarantees the result is NULL-terminated on success. 2. Refactor other source code to use SafeReadLink instead of readlink() or sys_readlink(). BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. 4. Run minidump-2-core to covnert a minidump file to a core file. Review URL: http://breakpad.appspot.com/334001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@896 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Refactor code in preparation of merging with the fork in Chromium OS.benchan@chromium.org2011-12-161-16/+5
| | | | | | | | | | | | | | | | | | | | | | This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Add a MemoryRange class for encapsulating and checking read access to a contiguous range of memory. 2. Add a MemoryMappedFile class for mapping a file into memory for read-only access. 3. Refactor other source code to use MemoryMappedFile. BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. 4. Run minidump-2-core to covnert a minidump file to a core file. Review URL: http://breakpad.appspot.com/332001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@895 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix linux-gate handling in LinuxDumper so it gets a valid debug IDted.mielczarek2011-05-061-0/+15
| | | | | | A=ted R=nealsid at http://breakpad.appspot.com/284001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@788 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Another attempt at signed / unsigned int resolution for linux minidump writer.jessicag.feedback@gmail.com2011-03-301-3/+4
| | | | git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@785 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Merge adjacent mappings with the same name into one module in LinuxDumper.ted.mielczarek2011-03-141-11/+22
| | | | | | A=Mike Hommey <mh+mozilla@glandium.org> R=ted at https://bugzilla.mozilla.org/show_bug.cgi?id=637316 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@781 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Updating to ints from unsigned ints so -1 will be an acceptable value.jessicag.feedback@gmail.com2011-03-031-1/+1
| | | | git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@777 4c0a9323-5329-0410-9bdc-e9ce6186880e
* allow passing info about known memory mappings to MinidumpWriter and ↵ted.mielczarek2010-12-131-11/+14
| | | | | | | | ExceptionHandler r=thestig at http://breakpad.appspot.com/242001/show git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@741 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Reuse code and fix inconsistent array boundaries.kmixter@chromium.org2010-12-081-4/+4
| | | | | | | R=ted.mielczarek Review URL: http://breakpad.appspot.com/237001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@740 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Linux: Attempt to generate an ELF identifier for deleted running binaries.thestig@chromium.org2010-11-191-14/+59
| | | | | | Review URL: http://breakpad.appspot.com/228001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@733 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add asm/ptrace.h include to linux_dumper.cc to fix the silly scratchbox ↵ted.mielczarek2010-10-211-8/+7
| | | | | | toolchain we're using for Maemo builds. Also shuffle around the include order to comply with style guidelines, while I'm here. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@718 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add support for building the Linux client code using the Android NDKted.mielczarek2010-10-201-3/+10
| | | | | | r=mwu at http://breakpad.appspot.com/212001/show git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@716 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Import linux_syscall_support.h from linux-syscall-support.googlecode.com ↵thestig@chromium.org2010-09-151-1/+1
| | | | | | | | instead of using our own copy. Review URL: http://breakpad.appspot.com/192001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@686 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix a couple of bugs where we generate incorrect minidump files on Linux.othestig@chromium.org2010-08-141-4/+32
| | | | | | | | | Patch by Markus Gutschke <markus@chromium.org>. R=thestig Review URL: http://breakpad.appspot.com/150001 Review URL: http://breakpad.appspot.com/155001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@649 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Changes to fix build warnings on newer versions of GCC, and a fix to not try ↵nealsid2010-05-101-0/+17
| | | | | | | | | | | to open certain mapped files. A=ZhurunZ, Tristan Schmelcher R=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@593 4c0a9323-5329-0410-9bdc-e9ce6186880e
* ARM support, with some build system changes to support x86-64, arm, and i386 ↵nealsid2010-03-021-28/+20
| | | | | | | | | | | in an autoconf style build in Linux. The O2 build for the unit tests is still broken but I'm checking this in to unblock people A=nealsid R=ajwong, hannahtang, ted.mielczarek git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@541 4c0a9323-5329-0410-9bdc-e9ce6186880e
* fix compilation on 64-bit, followup from issue 357ted.mielczarek2009-12-231-0/+3
| | | | git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@463 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Issue 357: New Linux file_id code doesn't persist across strip. ↵ted.mielczarek2009-12-231-0/+29
| | | | | | 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
* Fix some build warningsnealsid2009-12-101-1/+1
| | | | | | | | | A=zhurunz R=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@439 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Upstreaming several patches from Chrome:nealsid2009-12-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Build fix for systems where sys/user.h needs sys/types.h.... http://breakpad.appspot.com/40002 MDRawSystemInfo.processor_level refers to the CPU family, not the cpuid level.. http://breakpad.appspot.com/40003 Use MD_MODULE_SIZE in place of sizeof(MDRawModule). http://breakpad.appspot.com/39003 Linux x64 compile fix. http://breakpad.appspot.com/40004 Include linux_syscall_support.h to get definition of NT_PRXFPREG. This is Chromium commit 23659. http://breakpad.appspot.com/40005 Build breakpad / crash reporting on Linux 64-bit. This is Chromium commit 23396. http://breakpad.appspot.com/40006 Fix #includes in a couple unit tests. http://breakpad.appspot.com/41001 Clean up unused headers / files for Linux dump_syms. http://breakpad.appspot.com/40002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@432 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Merge of Breakpad Chrome Linux forknealsid2009-08-171-0/+419
A=agl, Lei Zhang R=nealsid, agl git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@384 4c0a9323-5329-0410-9bdc-e9ce6186880e