Commit graph

2046 commits

Author SHA1 Message Date
Lars Volker
ac4a549e29 Extend ifdef to include helper functions
The previous change to fix compiling on Android < N forgot to include a
helper in the ifdef, thus not fixing the problem. This change extends
the ifdef to include all helpers used by the test.

Change-Id: Ibb3030f54a81b5609a0b55ccef387a3cba22d088
Reviewed-on: https://chromium-review.googlesource.com/895240
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-01-31 21:02:06 +00:00
Lars Volker
242327485d Remove barrier to fix Android build.
The unittest for #752 made use of pthread_barrier_t, which is not
supported on Android. This change replaces the barrier code with a
simple sleep, which proved sufficient to trigger the race. It only
affects the test and does not affect the original fix for #752.

Change-Id: I82c32cf00899176fa09089e716ed85850b8711e6
Reviewed-on: https://chromium-review.googlesource.com/895168
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-01-31 20:09:18 +00:00
Nico Weber
fd99ff473c Make breakpad build with -Wimplicit-fallthrough (on linux)
Fixes a bug where MD_EXCEPTION_CODE_MAC_PPC_ALTIVEC_ASSIST
would unintentionally get two reason strings appended.

Bug: 177475
Change-Id: I4957268328a242c7c75bbff8add98e9a48ba83ad
Reviewed-on: https://chromium-review.googlesource.com/895705
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-31 16:39:12 +00:00
Peter Collingbourne
6d001e7159 Do not use non-standard stdext::checked_array_iterator with libc++.
Bug: chromium:801780
Change-Id: Id1b0b2330d7d609bda62869bcda5bb2f6fde12bd
Reviewed-on: https://chromium-review.googlesource.com/872458
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-18 14:55:11 +00:00
Lars Volker
97a9883676 Only restore the signal handler if sigaction has not changed
Restoring the signal handler in ExceptionHandler::SignalHandler() can
lead to a race in scenarios where multiple threads crash within a short
time. This can cause threads to alternately try to write a minidump
without ever terminating the process.

The first thread to write a minidump will reset the signal handler to
the SIG_DFL using signal() in InstallDefaultHandler(). The next thread
to execute SignalHandler() will detect this and will reset the signal
handler to SignalHandler(). If the first thread takes too long to write
its minidump (e.g. when there are many threads), the chances increase
that the second thread will enter SignalHandler() before the first one
leaves the critical section.

After resetting the signal handler, the second thread will fail to write
a minidump (since the file already exists) and will try to reset the
signal handler to the default by calling RestoreHandlersLocked().
However, in the meantime the first thread will have entered
SignalHandler() again and will overwrite it one more time.

After that, no further attempts will be made to restore the default
signal handler and both threads will continue to re-raise the signal and
attempt to write minidump files.

This change adds a check to make sure that cur_handler.sa_sigaction is
still pointing to SignalHandler() before re-installing the handler.

To test this we start a large number of sleeping threads and two threads
that will crash simultaneously. Without the fix, this would reproducibly
lead to a loop between the two crashing threads.

Bug: 752
Change-Id: I784328cfff17ddc7476d6668354570ab867ba405
Reviewed-on: https://chromium-review.googlesource.com/855137
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-01-09 16:22:07 +00:00
Syed Nisar Ul Haq
ceef4a517d Fixed file extention for minidump_upload in tools_linux.gypi
Bug:
Change-Id: I02ceca2ff7cb87bb2b8f0cf02d31f9ab6d46a8da
src/tools/linux/tools_linux.gypi was using 'symupload/minidump_upload.m' whereas it should have been 'symupload/minidump_upload.cc' for linux. '.m' is for mac.
Reviewed-on: https://chromium-review.googlesource.com/840622
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-01-04 08:43:43 +00:00
bsheedy
4a02ec0303 Add asm and machine headers
Adds asm/ and machine/ directories to src/common/android/include. This
is necessary because some required files for MIPS were removed in newer
Android NDK versions, which broke Breakpad compilation.

Bug: 771171
Change-Id: Ie6a079b6b8130b549ebc6d0bc4aef0e47e7bd6c2
Reviewed-on: https://chromium-review.googlesource.com/835282
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-03 21:22:16 +00:00
Mike Frysinger
9bcfabcaa7 android: drop sgidefs.h hack for LSS
Breakpad shouldn't be hacking up headers for LSS.  This was eventually
fixed in LSS directly in https://codereview.chromium.org/1248033002, so
we can drop this hack on our side.

Change-Id: Iff29efe7f6af40835e0aab1f6ac3fd8d167045ef
Reviewed-on: https://chromium-review.googlesource.com/843124
Reviewed-by: Mark Seaborn <mseaborn@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-23 13:21:00 +00:00
Yunlian Jiang
4af3e83b10 Fix minidump on ChromeOS
Chrome somehow changed the memory mapping with hugepage enabled.
This makes the hack in CrOSPostProcessMappings more general.

BUG=chromium:793452
TEST=with this patch on Chromium,
         minidump_dump *dmp shows the right information on chrome

Change-Id: Iff58bf1a712a6e66cbd2d813422db7549a3080a5
Reviewed-on: https://chromium-review.googlesource.com/837963
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-20 23:46:35 +00:00
Robert Sesek
c283630201 Reconcile -[BreakpadController withBreakpadRef:] with its documentation.
The header states that if the controller is not -start:'ed that it will call
the block with a NULL BreakpadRef. As previously implemented, it asserted if
it was not started.

Change-Id: I3a329a773c0484dc1b74013717b68426758ea2cd
Reviewed-on: https://chromium-review.googlesource.com/829834
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-15 16:50:42 +00:00
Mike Wittman
aebee55695 Update binaries with dump_syms changes to write new field
Incorporates the changes in
897a12cd26

Bug: google-breakpad:751
Change-Id: I8c6de8c0477c0b1e6d7a65551ecb116c95e1a696
Reviewed-on: https://chromium-review.googlesource.com/820567
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-12 03:49:04 +00:00
Mike Wittman
897a12cd26 Write field indicating multiple symbols at an address in dump_syms
Updates dump_syms to write the optional 'm' first field in FUNCTION and
PUBLIC records to indicate that the address corresponds to more than one
symbol.

Bug: google-breakpad:751
Change-Id: I850b0122324ed5f9ec747aa92ba354a3126a7ef9
Reviewed-on: https://chromium-review.googlesource.com/820711
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-11 22:36:40 +00:00
Adam Harrison
23ad65d54a Remove duplicate import.
The mac exception_handler is included in a conditional below.
Change-Id: I505fad7ef6731706a39b7aaacc9a948800fc3069
Reviewed-on: https://chromium-review.googlesource.com/809306
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-05 19:18:39 +00:00
Mike Wittman
a61afe7a3e Make iterator string types match map container string types
Fixes a compilation error when ::string != std::string.

Bug:
Change-Id: Ifa782da65dd08973de1fc4215f658c798ae5160b
Reviewed-on: https://chromium-review.googlesource.com/802324
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-01 18:57:52 +00:00
Mike Wittman
b1226959a2 Add optional field indicating multiple symbols at an address
Adds an optional 'm' as the first field in FUNCTION and PUBLIC records
to indicate that the address corresponds to more than one symbol.
Controls this by a command line flag for now to give symbol file users
a chance to update.

Also reduces the number of IDiaSymbols retained in memory to one per
address. This reduces memory consumption by 8% when processing
chrome.dll.pdb.

Updates the processor to parse the new optional field.

Bug: google-breakpad:751
Change-Id: I6503edaf057312d21a1d63d9c84e5a4fa019dc46
Reviewed-on: https://chromium-review.googlesource.com/773418
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-29 21:33:23 +00:00
Mike Wittman
4eeb384f3e Update test data for identical-code-folded symbol changes
Bug: google-breakpad:749
Change-Id: I2e56c8414c98c95372bd73811581cf1e98efe88e
Reviewed-on: https://chromium-review.googlesource.com/791914
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-28 04:01:03 +00:00
Mike Wittman
70914b2d38 Make identical-code-folded symbol output more consistent between runs
Consistently output the "least" symbol by decorated name when
multiple symbols share an address.

Testing with chrome.dll.pdb the diffs between the new and old output
look sensible, and this is actually ~20% faster than the existing
implementation.

Bug: 749
Change-Id: Ie638559b63f0eb2dcb80b1ebb579228d62c63bb2
Reviewed-on: https://chromium-review.googlesource.com/758885
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-14 14:31:22 +00:00
Tomas Popela
615ad2b6f4 List missing 64-bit arches in the bundled curl
Currently the bundled curl fails to build on ppc64/ppc64le or s390x, because
it has an incomplete list of 64-bit arches (where long is 64-bit).

Similar version is currently used as a downstream patch in Fedora
https://src.fedoraproject.org/rpms/firefox/blob/master/f/build-ppc64-s390x-curl.patch
Change-Id: Id27bfe1ca048340c45926f5435336941c080f132
Reviewed-on: https://chromium-review.googlesource.com/765453
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-11-13 19:50:29 +00:00
Robert Sesek
8a0edac9ab Add index-based set functionality to NonAllocatingMap.
This enables repeatedly setting a value based on index, which avoids a
linear scan of the entry table after the first SetKeyValue().

Bug: chromium:598854
Change-Id: I9964670a09dcd8ff76180d031a373f20990bf4d8
Reviewed-on: https://chromium-review.googlesource.com/757579
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-07 23:24:48 +00:00
Peter Collingbourne
3bbf3fb0db dump_symbols: Stop rejecting files with Android packed relocation sections.
The lld linker has native support for creating packed relocation
sections, and as a result we can expect files with these sections to
have symbols.

Bug: chromium:742655
Change-Id: I48a50bff041146f51b3a8b730d7a778f832787f6
Reviewed-on: https://chromium-review.googlesource.com/754239
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-07 14:56:36 +00:00
Yi Wang
8e9080bc53 Create LongStringDictionary and replace SimpleStringDictionary on iOS
This relands fd0a0d2b7a which was reverted
in 5dad29423e, with a fix for guarding
kMaxSuffixLength which only used in assert()s with macros which breaks
chromium.mac/ios-device.

Change-Id: I5ee21b7f290517d6e7a0ef90b693b97f92392549
Reviewed-on: https://chromium-review.googlesource.com/751922
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-03 17:06:05 +00:00
Adam Harrison
550c6227bb Don’t set exit_after_write to false for tvOS.
On tvOS, the app fails to shutdown after write.
Allow exit_after_write to be false for tvOS in order to force an exit() after write.

Change-Id: Ib2e1e1d03264a2972f5607b3070f4a6287aa0a98
Reviewed-on: https://chromium-review.googlesource.com/752071
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-03 02:53:56 +00:00
Mark Mentovai
5dad29423e Revert "Create LongStringDictionary and replace SimpleStringDictionary usages in client/ios/Breakpad.mm."
This reverts commit fd0a0d2b7a.

Reason for revert: Build failures reported at https://chromium-review.googlesource.com/c/chromium/src/+/750591#message-cc4f7dd486fa1da7373ad5d83d56f550d607d429

Failed build on chromium.mac/ios-device: https://build.chromium.org/p/chromium.mac/builders/ios-device/builds/73163, https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.mac%2Fios-device%2F73163%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout

[637/3593] CXX obj/third_party/breakpad/client/long_string_dictionary.o
FAILED: obj/third_party/breakpad/client/long_string_dictionary.o 
[…]
../../third_party/breakpad/breakpad/src/common/long_string_dictionary.cc:46:16: error: unused variable 'kMaxSuffixLength' [-Werror,-Wunused-const-variable]
  const size_t kMaxSuffixLength = 4;
               ^
1 error generated.
[…]
[641/3593] CXX ios_clang_arm64/obj/third_party/breakpad/client/long_string_dictionary.o
FAILED: ios_clang_arm64/obj/third_party/breakpad/client/long_string_dictionary.o 
../../third_party/breakpad/breakpad/src/common/long_string_dictionary.cc:46:16: error: unused variable 'kMaxSuffixLength' [-Werror,-Wunused-const-variable]
  const size_t kMaxSuffixLength = 4;
               ^
1 error generated.

Change-Id: I285eaac6abfcb7d173a0d1e4998b92d5c8dd6ecb
Reviewed-on: https://chromium-review.googlesource.com/751723
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-02 17:56:17 +00:00
Peter Collingbourne
2d85d492ae Rename an argument named "register" to "reg".
This silences a warning in newer versions of clang that complains
about "register" being a deprecated keyword.

Bug: chromium:780692
Change-Id: If354b9b18421e3e910849b385c44207e0ce02590
Reviewed-on: https://chromium-review.googlesource.com/750362
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-02 02:40:39 +00:00
Nicholas Baldwin
7e3c165000 Fix double declaration of tgkill when using Android NDK Headers.
As of Android API level 16 tgkill is declared in the NDK version of
signal.h, which conflicts with the static definition found in
src/client/linux/handler/exception_handler.cc. This change removes
the static tgkill definition and replaces its use with sys_tgkill
from the linux syscall support library.

Bug:
Change-Id: Ic70addd8a064cfa36345d86b7e36409e2089e909
Reviewed-on: https://chromium-review.googlesource.com/738912
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-10-30 17:23:56 +00:00
Yi Wang
fd0a0d2b7a Create LongStringDictionary and replace SimpleStringDictionary usages in client/ios/Breakpad.mm.
Bug:
Change-Id: I401028f5d90417d79fb109b510aaa9660a039b44
Reviewed-on: https://chromium-review.googlesource.com/688301
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-10-27 17:47:03 +00:00
Bruce Dawson
73d2773f9f Avoid skipping an initializer with a goto
C++ doesn't allow skipping initialization with a goto. This means that
this code is illegal:

  void func(bool b) {
    if(b) goto END;
    int value = 0; //error C2362 with /permissive-
    //... value used here
  END:
    return;
  }

Adding an extra scope makes the code legal. This problem is only
detected with /permissive- but now that compiling with this
switch is practical we might as well stay /permissive- clean:
https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/

Note that compiling /permissive- clean only works with the 10.0.16299.0
SDK which currently has other issues...

Bug: 773476
Change-Id: I54e64aaef46d70a817cf7da272f76d9ae5f6a6f7
Reviewed-on: https://chromium-review.googlesource.com/740287
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-10-26 22:25:57 +00:00
Torne (Richard Coles)
2aaeead73f Roll src/src/third_party/lss/ a91633d17..e6527b0cd (1 commit)
https://chromium.googlesource.com/linux-syscall-support/+log/a91633d17240..e6527b0cd469

$ git log a91633d17..e6527b0cd --date=short --no-merges --format='%ad %ae %s'
2017-10-03 torne Fix use of non-whitelisted syscalls on Android.

Created with:
  roll-dep src/src/third_party/lss
Bug: 770449

Change-Id: Ia9556ba31f61c0bd8a5dcd4b032cdb1f321d7a57
Reviewed-on: https://chromium-review.googlesource.com/728357
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-10-19 18:43:22 +00:00
Tobias Sargeant
072f86ca83 Provide helper wrappers for basename(3) and dirname(3)
This hides the need to provide mutable C strings, and unifies
existing basename calls and variations in a single location.

Change-Id: Idfb449c47b1421f1a751efc3d7404f15f8b369ca
Reviewed-on: https://chromium-review.googlesource.com/725731
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-10-18 15:44:59 +00:00
Peter Collingbourne
9b23ca3a7c Move main executable handling out of procmaps parser loop.
If the mapping for the main executable needed to be merged (for
example, if it was linked with lld and therefore contains an r mapping
followed by an r/x mapping), we would never reach the code that makes
it the first module. Handle that situation by moving that code into
a separate loop.

This fixes an issue where breakpad_unittests fails on Android devices
when linked with lld. It appears that the glibc dynamic loader
happens to always load executables (or at least the executables that
we create) at a lower address than DSOs, so we never hit this bug on
desktop Linux.

Testing: "make check" with both gold and lld as linker. Also
breakpad_unittests when patched into Chromium on Linux (lld) and
Android (gold and lld).

Bug: chromium:469376
Change-Id: I6329e4afd2f1bf44c25a6c3e684495e21dba83a6
Reviewed-on: https://chromium-review.googlesource.com/722286
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-10-17 20:19:03 +00:00
Ted Mielczarek
8bb3d55af7 Rename src/common/memory.h to memory_allocator.h.
memory.h shadows a system header which normally isn't a problem
because of the include paths in Breakpad, but the Firefox build
system winds up with src/common in the include path so we've had
a workaround for this for years. Renaming the file lets us get
rid of that workaround and shouldn't hurt anything.

Change-Id: I3b7c4239dc77f3b2b7cf2b572a0cad88cd7e8522
Reviewed-on: https://chromium-review.googlesource.com/723261
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-10-17 14:02:43 +00:00
Tobias Sargeant
3d6076efc2 Add -s flag to microdump_stackwalk for dumping stack contents.
Note that the current MicrodumpProcessor::Process implementation has a
bug due to the fact that it creates a local Microdump instance, and then
holds onto a pointer to the object returned by microdump.GetMemory()
which is destroyed when microdump goes out of scope. This CL fixes the
crash by making Microdump outlive MicrodumpProcessor, which is the same
pattern that Minidump/MinidumpProcessor uses.

Bug: google-breakpad:748
Change-Id: I554b46d309649cf404523722bd9ee39e17a10139
Reviewed-on: https://chromium-review.googlesource.com/720809
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-10-17 10:22:46 +00:00
Tobias Sargeant
623c4a0f42 Convert {mini|micro}dump_stackwalk argument parsing to getopt.
Bug: google-breakpad:748
Change-Id: I70b16ba6456df0be038d6c7170eb22b093fdc65d
Reviewed-on: https://chromium-review.googlesource.com/718756
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-10-16 09:13:02 +00:00
Adam Harrison
bc8fb88648 ios: Adds a no-Mach exception handler
This exception_handler_no_mach does not use Mach for exception handling
so that clients such as tvOS and watchOS that do not support mach
messages can handle POSIX signals.

Change-Id: I4a4574e58834bc590e110e6ecd1825f8af1437a2
Reviewed-on: https://chromium-review.googlesource.com/714276
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-10-12 00:21:31 +00:00
Joshua Peraza
1c3f8d1002 Android: Use sys/types.h instead of stdint.h for sys/user.h
When using traditional headers, sys/types.h is needed to define __u64
for sys/user.h. Previously, we thought this would be provided by
stdint.h, but it is not.

Change-Id: I0e648712f4ef1e303104a5264d3d2d0b218f5d45
Reviewed-on: https://chromium-review.googlesource.com/705267
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-10-06 18:19:40 +00:00
Mark Mentovai
0bdf616c7e Fix minidump_dump_test after 6d0287851f
Change-Id: I9957f27cd134f862b9831e4b1d90f8a014eb37b6
Reviewed-on: https://chromium-review.googlesource.com/701740
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-10-05 15:18:12 +00:00
Mark Mentovai
6d0287851f Dump Crashpad extension structures in minidump_dump
This is currently mostly useful to expose the annotations that Crashpad
stores in minidumps.

Example output:

MDRawCrashpadInfo
  version = 1
  report_id = 01234567-89ab-cdef-0123-456789abcdef
  client_id = fedcba98-7654-3210-fedc-ba9876543210
  simple_annotations["channel"] = canary
  simple_annotations["plat"] = OS X
  simple_annotations["prod"] = Chrome_Mac
  simple_annotations["ver"] = 59.0.3069.0
  module_list[0].minidump_module_list_index = 0
  module_list[0].version = 1
  module_list[0].simple_annotations["ptype"] = crashpad-handler
  module_list[1].minidump_module_list_index = 28
  module_list[1].version = 1
  module_list[1].list_annotations[0] = abort() called

Change-Id: I00ba291f93ea3a37fc3754c651b3ccc542e5b8b2
Reviewed-on: https://chromium-review.googlesource.com/688416
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-09-27 21:27:17 +00:00
Mark Mentovai
cbd7bb4cd2 Only run GYP for Windows targets on Windows
This prevents GYP from running on macOS, where it would produce a bunch
of pointless .xcodeproj directories for Windows libraries and tools that
could never possibly build. Those would pollute “git status” output and
other operations.

Check in a new default.xml generated from DEPS too. It doesn’t
correspond to this change, but I should have done this in 26b988681d.

Change-Id: I034a5b30d13fdcc14911fc1354504375752d6144
Reviewed-on: https://chromium-review.googlesource.com/688045
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-09-27 20:46:16 +00:00
Orgad Shaneh
09df67311f Fix MSVC build on 64-bit
Mostly int<->size_t implicit conversions.

Warning 4366 (The result of the unary '&' operator may be unaligned)
appears in minidump.cc:907, but I don't know why. It looks aligned to me.

Change-Id: I641942adc324f8f9832b20662083dc83498688a8
Reviewed-on: https://chromium-review.googlesource.com/637390
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-09-25 07:10:11 +00:00
Orgad Shaneh
005f41eb8c Refresh refresh_binaries.bat
Change-Id: I15687f35e560eb1e25bb4d7483c8f6fe5fdf210e
Reviewed-on: https://chromium-review.googlesource.com/637391
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-09-24 23:23:20 +00:00
Mark Mentovai
1c6d161396 Restore missing #include <stdint.h> to Android <sys/user.h>
This was lost in afa9c52715, but it turns out that it’s still
necessary.

Bug: google-breakpad:733
Change-Id: I4e0e4e4d2e80c22df1ff6b82e471905773c940a3
Reviewed-on: https://chromium-review.googlesource.com/675732
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-09-20 19:34:39 +00:00
Mark Mentovai
bddcc58860 Replace remaining references to 'struct ucontext' with 'ucontext_t'
This relands
e3035bc406,
which was accidentally committed to breakpad/breakpad/src, the read-only
mirror of src in breakpad/breakpad. (Well, it should have been
read-only.) See https://crbug.com/766164.

This fixes issues with glibc-2.26.

See https://bugs.gentoo.org/show_bug.cgi?id=628782 ,
https://sourceware.org/git/?p=glibc.git;h=251287734e89a52da3db682a8241eb6bccc050c9 , and
https://sourceware.org/ml/libc-alpha/2017-08/msg00010.html for context.
Change-Id: Id66f474d636dd2afa450bab925c5514a800fdd6f
Reviewed-on: https://chromium-review.googlesource.com/674304
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-09-20 11:50:04 +00:00
Mark Mentovai
491f174949 Fix googletest/googlemock build
1. testing.gyp is a gyp file, not a gypi file. It is only referenced in
“dependencies” sections. The gypi extension is used for files that are
included by an “includes” section.

2. Update paths in testing.gyp to reflect the real locations of
googletest and googlemock following their merge into a single
repository.

Change-Id: If9c356d93aa5ffda54af46fbed648baa2274dac6
Reviewed-on: https://chromium-review.googlesource.com/673404
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-09-19 20:51:42 +00:00
Mark Mentovai
afa9c52715 android: Don’t compete with NDK API >= 21 over NDK structures
Chrome uses API 16 for 32-bit builds and API 21 for 64-bit builds. The
NDK’s <link.h> provides r_debug and link_map structure definitions only
at API 21 and above. Breakpad used a custom <link.h> to define these
structures only during 64-bit builds, which worked for Chrome’s
purposes. However, other consumers may wish to build Breakpad at
arbitrary API levels without regard to bitness. This alters Breakpad’s
custom <link.h> to correctly check the NDK API level rather than target
CPU bitness.

Likewise for <sys/user.h> on 32-bit x86, which provided a typedef for
user_fpxregs_struct to user_fxsr_struct. API 21 and above, as well as
the unified headers at any API level, always name the structure
user_fpxregs_struct.

Definitions for 64-bit ARM’s user_regs_struct and user_fpsimd_struct
have been removed from Breakpad’s copy of <sys/user.h>. The header
claims that these fallback definitions are only necessary with NDK r10,
which should no longer be in use even by Chromium, which now uses NDK
r12b. This removes the Chromium-specific ANDROID_NDK_MAJOR_VERSION macro
from use entirely.

Fixes https://stackoverflow.com/questions/44141159/ and b/65630828.

Bug: google-breakpad:733
Change-Id: I5841906297cd15b15ce48b73fd8332fd40afc9a0
Reviewed-on: https://chromium-review.googlesource.com/665740
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-09-18 14:00:44 +00:00
Tobias Sargeant
dea867e76f Add new test data to Makefile.am
This should have been done as part of 2b3be5

Bug: google-breakpad:746
Change-Id: I7eae33166cff238d72293e659abc90e724b365dc
Reviewed-on: https://chromium-review.googlesource.com/667102
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-09-14 20:54:34 +00:00
Mike Frysinger
6a4976483b drop bundled gflags from the checkout
The only code using gflags is google_crash_report_sender, and nothing
builds or tests that code currently.  Switch it over to using system
versions of gflags so we can drop the local prebuilts.  Tested local
builds by hand of the tool.

Bug: google-breakpad:360
Change-Id: I75d79b176468c948773079a54d87e70709feaf87
Reviewed-on: https://chromium-review.googlesource.com/665799
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-09-13 23:38:29 +00:00
Mike Frysinger
0842e530e1 google_crashdump_uploader_test: integrate test into normal build
This is turned on in the gyp file, but not our automake build.  Include
it there to make sure we don't break it and keep coverage up.

Bug: google-breakpad:360
Change-Id: If54ff04e62641b1c4a550db8a09f5ac09ff8765c
Reviewed-on: https://chromium-review.googlesource.com/665798
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-09-13 21:56:40 +00:00
Mike Frysinger
d8c6101124 drop glog from the checkout
Nothing appears to be using this anymore, so stop bundling it.

Bug: google-breakpad:360
Change-Id: Id95b36994379da92f8ef2a81754b3da5f1f79cae
Reviewed-on: https://chromium-review.googlesource.com/665503
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-09-13 21:35:17 +00:00
Mark Mentovai
7c409af709 Parse DWARF 4 line tables correctly
Breakpad’s DWARF line table reader only understood line tables at the
level of DWARF 2. This wasn’t a problem because LLVM only produced line
tables at this level, even when generating DWARF 4. But LLVM would like
to output DWARF 4 line tables when generating DWARF 4, and Breakpad
needs to understand this format. (Meanwhile, it seems that GCC has used
DWARF 4 line tables with DWARF 4 output since 4.5.0, 2010-04-14.)

DWARF 3 line tables are fully compatible with DWARF 2 (assuming that
nothing needs “prologue end,” “epilogue begin,” or “isa”, and opcodes
related to these fields are properly skipped). DWARF 4 changes the line
number program header slightly to include a “maximum operations per
instruction” field. This field must be recognized, but can safely be
ignored (and assumed to be always 1) if VLIW architectures are not
supported (they aren’t). DWARF 4 also introduces a “discriminator”,
whose opcode can also be skipped if these values are not needed (they
shouldn’t be).

This recognizes the “maximum operations per instruction” field when
processing DWARF 4 line tables, but asserts that its value is 1 and
otherwise ignores it.

This is not compatible with VLIW architectures that set this field to a
value other than 1. Such architectures are irrelevant to Breakpad, and
mainline GCC and the proposed LLVM patch always set this field to 1.
There are other things that could be extracted from DWARF 3 and 4 line
tables that aren’t currently extracted (although these are currently
irrelevant to Breakpad too).

Bug: google-breakpad:745
Change-Id: I5bf9c0b1aa654849c9cce64e60682447d10be8ba
Reviewed-on: https://chromium-review.googlesource.com/663441
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-09-13 19:50:52 +00:00
Tobias Sargeant
a1dbcdcb43 Increase the maximum number of modules allowed in minidumps.
Bug: google-breakpad:743
Change-Id: I2e40b5cc36c012c18a1c4637634fb139b0d8e14d
Reviewed-on: https://chromium-review.googlesource.com/647886
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-09-01 14:49:17 +00:00