breakpad/src/client/linux
Peter Collingbourne 94b6309aec Merge exec and non-exec segments while merging executable bit.
The bfd and gold linkers create segments like this: r/x, r/w where
the r/x segment covers the start of the ELF file.

lld's segments look like this: r, r/x, r/w where the r segment covers
the start of the ELF file.

So we cannot rely on the location of the r/x to tell where the start
of the ELF is. But we can still rely on the r and r/x mappings being
adjacent. So what we do is when we see an r segment followed by an r/x,
merge the r into the r/x and claim that it is executable. This way,
the minidump writer will continue to see a single executable segment
covering the entire executable.

Testing: "make check" passes when breakpad is compiled with
lld compiled from trunk (requires bug fix from LLVM r303689).

Also patched change into chromium and tested these builds:

$ cat args.gn
is_chrome_branded = true
is_debug = false
is_official_build = true
use_lld = true
allow_posix_link_time_opt = false
is_cfi = false

$ cat args.gn
target_os = "android"
target_cpu = "arm"
is_debug = false
is_official_build = true
is_chrome_branded = true

With both builds breakpad_unittests passes and
chrome/chrome_modern_public_apk create good minidumps after navigating
to chrome://inducebrowsercrashforrealz (checked that minidump contains
stack trace entry for content::HandleDebugURL).

Bug: chromium:716484
Change-Id: Ib6ed3a8420b83acf4a5962843930fb006734cb95
Reviewed-on: https://chromium-review.googlesource.com/513610
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2017-05-26 16:51:46 +00:00
..
crash_generation crash_generation: fix bad call to close 2016-12-09 15:56:26 +00:00
data The symbol files necessary for the processor to walk stacks on Linux that have __kernel_vsyscall at innermost frame. Special symbol files ar eneeded because EBP does not point to the frame when a thread is inside a system call. 2009-06-25 21:36:39 +00:00
dump_writer_common Add API to skip dump if crashing thread doesn't reference a given module 2017-01-18 15:41:07 +00:00
handler Fix race in ExceptionHandler::GenerateDump() 2017-05-10 18:02:37 +00:00
log [microdump] Move microdump writes to the crash ring-buffer log 2015-08-17 10:32:26 +00:00
microdump_writer Treat the process stack as the top of memory for free space histograms. 2017-03-29 10:42:31 +00:00
minidump_writer Merge exec and non-exec segments while merging executable bit. 2017-05-26 16:51:46 +00:00
sender GoogleCrashdumpUploader: adds Upload(string*) API to get the HTTP response. 2014-09-18 16:48:49 +00:00