Commit Graph

1628 Commits

Author SHA1 Message Date
Mike Frysinger
f820ead901 test: allow use of system gmock/gtest libs
Some systems provide prebuilt copies of gmock/gtest (such as Chromium
OS).  Add a configure flag so they can take advantage of that.  This
allows for a smaller checkout as they don't need to include the full
testing/ tree.

BUG=chromium:579384
TEST=`make check` passes w/--enable-system-test-libs
TEST=`make check` passes w/--disable-system-test-libs
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1638653002 .
2016-01-25 19:27:56 -05:00
Mike Frysinger
4b5dcd0e69 build: clean up .dwo files
When building with -gsplit-dwarf, the generated dwo files are left behind
even when you `make clean`.  Fix that up.

BUG=chromium:579384
TEST=`./configure CXXFLAGS='-O -gsplit-dwarf' && make && make clean` removes dwo files now
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1633893002 .
2016-01-25 18:40:56 -05:00
Mike Frysinger
83523e066b test: stop building tons of copies of gtest/gmock objects
The current makefile ends up building ~17 copies of the gtest/gmock
objects -- every test that refers to the cc files directly will have
its own copy.  This is because the build doesn't know if CFLAGS and
such have changed between each target (and in some cases, they are).

Create a new libtesting.a target to hold a single copy of these files
and update all of the unittests to link that in.  This speeds up the
build a bit especially when you aren't using ccache.

This does mean we can no longer build gtest/gmock with unique flags,
but we haven't wanted that so far, so clearly no one wants that.

BUG=chromium:579384
TEST=`make check` passes
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1633903002 .
2016-01-25 17:41:53 -05:00
Mike Frysinger
e4cf26b851 linux_client_unittest_shlib: fix cleaning
The EXTRA_PROGRAMS knob does not automatically trigger clean up of
targets listed in it.  Use CLEANFILES so we make sure `make clean`
will delete the linux_client_unittest_shlib lib.

BUG=chromium:579384
TEST=`make check` passes
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1618593002 .
2016-01-25 16:53:16 -05:00
Mike Frysinger
92280b3c67 tests: unify duplicate build settings
Rather than copy & paste the same set of -I flags many times over,
create a single varible to hold it.

BUG=chromium:579384
TEST=`make check` passes
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1613763002 .
2016-01-25 15:12:03 -05:00
Mike Frysinger
aa5ceea25b DEPS: roll test libs up to the latest release
BUG=chromium:579384
TEST=`make check` passes
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1607413003 .
2016-01-25 15:10:38 -05:00
Olivier Robin
658eb44f3f Revert "Fix deprecatation warning when building for recent SDKs on iOS/OS X."
This reverts CL https://codereview.chromium.org/1563223004/
This reverts commit 7cc0d8562bf8b20b88cc941ba72593cb7230ecf6.

CL 1563223004 introduces two bugs on iOS.
- Encoding the minidump name with extra percent causing crash server to fail
  processing the file.
- Using a released pointer causing random crashes on upload. The
  data, resp, err pointers returned in the NSURLSession completion
  handler is released at the end of the block. When used later (to get
  the crash ID), it causes a crash.

BUG=569158
R=blundell@chromium.org, mark@chromium.org

Review URL: https://codereview.chromium.org/1619603002 .

Patch from Olivier Robin <olivierrobin@chromium.org>.
2016-01-21 11:34:12 -05:00
Mike Frysinger
8baa236daa exploitability_unittest: fix warnings
The std::getline function always returns its first arg (which is an
iostream object) and cannot return anything else.  Thus, testing its
value is pointless, and even leads to build errors w/at least gcc-5
due to gtest ASSERT_TRUE funcs only taking bool types:

.../exploitability_unittest.cc: In member function 'virtual void {anonymous}::ExploitabilityLinuxUtilsTest_DisassembleBytesTest_Test::TestBody()':
.../exploitability_unittest.cc:200:136: error: no matching function for call to 'testing::AssertionResult::AssertionResult(std::basic_istream<char>&)'
In file included from .../breakpad_googletest_includes.h:33:0,
                 from .../exploitability_unittest.cc:35:
.../gtest.h:262:12: note: candidate: testing::AssertionResult::AssertionResult(bool)

Since we know this never fails, simply drop the ASSERT_TRUE usage.
The next line already checks the content of the buffer we read.

Further on in the file, we hit some signed warnings:
In file included from .../breakpad_googletest_includes.h:33:0,
                 from .../exploitability_unittest.cc:35:
.../gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]':
.../gtest.h:1484:23:   required from 'static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]'
.../exploitability_unittest.cc:241:289:   required from here
.../gtest.h:1448:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   if (expected == actual) {

This is because we compare the register value (a uint64_t) directly to
an integer constant, and those are signed by default.  Stick a U suffix
on them to fix things up.

BUG=chromium:579384
TEST=`make check` passes
R=ivanpe@chromium.org

Review URL: https://codereview.chromium.org/1611763002 .
2016-01-21 00:50:28 -05:00
Pavel Labath
48673cdb8c Fix usage of snprintf for MSVC
Older versions of MSVC don't have a snprintf functions. Some files
were already working around that, but not all of them. Instead of
copying the logic into every file, I centralize it into a new
stdio.h wrapper file and make other files include that.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1602563003 .

Patch from Pavel Labath <labath@google.com>.
2016-01-19 21:28:44 -05:00
Mike Frysinger
126a938fef breakpad: fix unittest failure when building with clang.
In C/C++, the result of signed integer overflow is undefined.

The expression "base + size - 1" is parsed as "(base + size) - 1", and
"base + size" can overflow even if "base + (size - 1)" <= INT_MAX.

See http://g/c-compiler-chrome/461JohPKakE/JI3rEBg6FwAJ for more.

BUG=None
TEST='CC=clang CXX=clang++ ./configure && make check'
R=vapier@chromium.org

Review URL: https://codereview.chromium.org/1591793002 .
2016-01-15 13:29:32 -05:00
Mike Frysinger
081cbd64d7 README: add more links to breakpad sites
R=andybons@chromium.org

Review URL: https://codereview.chromium.org/1583163003 .
2016-01-14 13:32:20 -05:00
Mike Frysinger
ac69c577d8 Move core2md objects to libbreakpad_client.a
This CL exports LinuxCoreDumper and ElfCoreDump in the client library. The ARC collector, which is an alternative to core2md optimized for large core dumps, needs these symbols for core dump parsing and conversion to minidump.

BUG=http://b/25773929
TEST=nm src/client/linux/libbreakpad_client.a | grep LinuxCoreDumper

Review URL: https://codereview.chromium.org/1576053002 .
2016-01-13 15:30:21 -05:00
Pavel Labath
4f512397f5 libdisasm: Remove inclusion of windows.h
windows.h defines exception_code as a macro, which conflicts with our
use of the identifier in exception records. It appears that this
particular include of windows.h is not needed, so instead of undefining
the macro, I simply delete the include. Build tested with MSVC 2013.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1579623004 .

Patch from Pavel Labath <labath@google.com>.
2016-01-12 10:43:06 -05:00
Pavel Labath
a1784ae81f Define intptr and uintptr in a more generic way
MSVC does not have the __PTRDIFF_TYPE__ macro defined, so I use the
standard [u]intptr_t types instead. Compilation tested on windows, linux
and mac.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1571293003 .

Patch from Pavel Labath <labath@google.com>.
2016-01-11 12:38:28 -05:00
Pavel Labath
2dda5fefdc libdisasm: Don't depend on sizeof(void)
Due to operator precedence, the address was first cast to void*
and then incremented, which resulted in an error on windows, as
sizeof(void) is undefined and MSVC takes this seriously. Changing
the precedence to perform the addition first.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/1570843002 .

Patch from Pavel Labath <labath@google.com>.
2016-01-08 12:52:04 -05:00
Pavel Labath
68039850bc disassembler_x86: Remove unused include
This file is not present on windows, and it's causing build errors
there. As far as I can tell, nothing in this file actually uses
that include, so I just remove it.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1475353002 .

Patch from Pavel Labath <labath@google.com>.
2016-01-08 10:07:04 -05:00
Sylvain Defresne
7b0d7a976e Fix compilation of breakpad on Linux.
Fix some copy/paste errors from commit 41440eaa.

BUG=None
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1564293002 .
2016-01-08 09:34:27 +01:00
Lei Zhang
728bcdff61 Check for C++11 support in the configure script.
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1570013002 .
2016-01-08 00:27:48 -08:00
Sylvain Defresne
98bea93a3e Fix deprecatation warning when building for recent SDKs on iOS/OS X.
Fixes the following compilation warning when using recent version of
the iOS or OS X SDK by using the recommended new API:

../../breakpad/src/common/mac/HTTPMultipartUpload.m:56:10: error: 'stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid. [-Werror,-Wdeprecated-declarations]
    [key stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
         ^
CFURLCreateStringByAddingPercentEscapes

../../breakpad/src/common/mac/HTTPMultipartUpload.m:207:29: error: 'sendSynchronousRequest:returningResponse:error:' is deprecated: first deprecated in iOS 9.0 - Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h [-Werror,-Wdeprecated-declarations]
    data = [NSURLConnection sendSynchronousRequest:req
                            ^

../../breakpad/src/client/mac/handler/minidump_generator.cc:158:6: error: 'CFPropertyListCreateFromXMLData' is deprecated: first deprecated in iOS 8.0 - Use CFPropertyListCreateWithData instead. [-Werror,-Wdeprecated-declarations]
    (CFPropertyListCreateFromXMLData(NULL, data, kCFPropertyListImmutable,
     ^

BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=675
BUG=569158
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1563223004 .
2016-01-07 19:48:21 +01:00
Lei Zhang
bcf4cc2f9a Use range-based for loops in linux/minidump_writer/minidump_writer.cc.
Also fix lint errors.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/1562273002 .
2016-01-07 00:53:06 -08:00
Mike Frysinger
b1d3cdba8b switch to git for external projects
Now that all the projects we care about use git and have repos available,
switch to them and away from the old googlecode svn repos.

TEST=`gclient sync` migrated svn->git fine
TEST=`make check` still passes
TEST=manual `diff -ur` on the new/old repos shows same content
BUG=
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1560913002 .
2016-01-06 19:44:41 -05:00
Lei Zhang
8c49d62005 Avoid comparing size_t to be < 0 on AArch64.
cpu_features_entries is empty on AArch64 and causes tautological-compare
warning when compiling with Clang.

A=dskiba@google.com
Original Review: https://codereview.chromium.org/1562223002/

BUG=chromium:539781

Review URL: https://codereview.chromium.org/1566893002 .
2016-01-06 16:16:01 -08:00
Lei Zhang
ee4d8ffed4 Make minidump-2-core.cc build with -Wformat.
A=thakis@chromium.org
BUG=chromium:574817
Original Review: https://codereview.chromium.org/1562983002/

R=thakis@chromium.org

Review URL: https://codereview.chromium.org/1563043002 .
2016-01-06 14:17:16 -08:00
Lei Zhang
f9b60452e1 Fix -Wunused-function warnings in ASAN builds.
A=thakis@chromium.org
BUG=chromium:573250
Original Review: https://codereview.chromium.org/1551963002/

Review URL: https://codereview.chromium.org/1551983002 .
2015-12-30 15:44:02 -08:00
Lei Zhang
257123ca70 Let breakpad build with -Wall on OS X and Linux.
A=thakis@chromium.org
Original Review: https://codereview.chromium.org/1550933002/

R=thakis@chromium.org

Review URL: https://codereview.chromium.org/1554613002 .
2015-12-29 13:42:49 -08:00
Ivan Penkov
1be3027941 Remove use of deprecated CFURLCreateDataAndPropertiesFromResource function.
Patch by Scott Hancher

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1527363003 .
2015-12-18 10:26:21 -08:00
Ted Mielczarek
524508ff2f Fix ExploitabilityLinuxUtilsTest::DisassembleBytesTest to not fail when temp file ends with 0
R=ivanpe@chromium.org
BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=668

Review URL: https://codereview.chromium.org/1482363003 .
2015-11-30 14:05:08 -05:00
Ted Mielczarek
a22992081f Rename src/tools/mac/dump_syms binary to dump_syms_mac in autotools build to fix make install
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1474673004 .
2015-11-25 14:27:53 -05:00
Mike Frysinger
dc16e41747 dump_syms: add a -v flag
dump_syms generates a lot of warnings.
This CL puts logging behind a command line flag

URL=https://android-review.googlesource.com/181558
BUG=b:25460551
BUG=google-breakpad:441
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1437763002 .
2015-11-11 13:52:03 -05:00
Mike Frysinger
f217ae431f build: detect the right ar tool
Use automake's AM_PROG_AR helper instead of the default of hardcoding
`ar` all the time.  When cross-compiling, this can often be the wrong
one to use.

BUG=google-breakpad:519
R=ted.mielczarek@gmail.com

Review URL: https://codereview.chromium.org/1435813002 .
2015-11-11 13:43:14 -05:00
Mike Frysinger
39e372dab6 gitignore: add mac/dump_syms
BUG=google-breakpad:670
2015-11-11 01:47:33 -05:00
Mike Frysinger
fc62e72539 autotools: refresh config.{sub,guess} 2015-11-11 01:38:23 -05:00
Mike Frysinger
2d1b97a1ff Don't include libdisasm.a in libbreakpad.a
libbreakpad.a pointlessly contains libdisasm.a

This looks like a left-over from when libtool was used

Since this has no useful effect (as the linker doesn't recursively search
archive members which aren't objects), anything which requires the objects in
libdisasm.a must already be linking with it, so simply remove it.

BUG=https://code.google.com/p/google-breakpad/issues/detail?id=484

Review URL: https://codereview.chromium.org/1399003002 .
2015-11-11 01:17:45 -05:00
Mike Frysinger
ac2a3e466f Fix file descriptor leaks in linux CrashGenerationServer
R=ted.mielczarek@gmail.com

Review URL: https://codereview.chromium.org/1137423004 .
2015-11-11 01:12:20 -05:00
Mike Frysinger
ee69060bfd Install headers under client/linux/dump_writer_common
Automake did not install headers under c/l/dwc, which caused
compile errors when building against an installed breakpad, since
other headers (e.g. client/linux/handler/exception_handler.h)
depended on it. This commit adds these headers to the list of
automake installed files.

R=vapier@chromium.org

Review URL: https://codereview.chromium.org/1127393006 .
2015-11-11 01:11:00 -05:00
Boris Vidolov
beee5c2e71 Make dump_syms buildable under newer versions of Xcode.
R=mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1438483002 .
2015-11-10 13:23:38 -08:00
Lei Zhang
aa5ff205cb Android: Workaround for ftruncate() issues.
This works around a bug in M that prevents Breakpad from using
ftruncate() in the renderer process.

To do this, skip the calls to ftruncate() when allocating bigger
minidump files and strictly depends on write() to append to the end.

It might be less efficient but this is probably less of an issue on
SD cards. It is much better than not getting crash reports.

BUG=542840

Original CL: https://codereview.appspot.com/273880044/
Original CL Author: acleung@chromium.org

Review URL: https://codereview.chromium.org/1407233016 .
2015-11-05 15:45:01 -08:00
Ivan Penkov
b458f36762 Issue in StackwalkerAMD64::GetCallerByFramePointerRecovery.
There is an issue in StackwalkerAMD64::GetCallerByFramePointerRecovery.
Occasionally it produces invalid frames (instruction pointer == 0) which
prevents the AMD64 stack walker from proceeding to do stack scanning and
instead leads to premature termination of the stack walking process.

For more details: http://crbug/537444

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1408973002 .
2015-10-15 20:47:15 -07:00
Benjamin Lerman
ef7575d35a Only release current_breakpad_ if it is defined.
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1402453006 .
2015-10-14 17:35:47 +02:00
Mike Frysinger
a31f601d90 Revert "[Docs] Add wiki content to Markdown docs"
This reverts commit 7ed2476eea2c2a50fd40ec3e711dcb311d472753.

This was supposed to be committed to the linux-syscall-support
project.  The two CLs landing at the sametime confused me.

Note: LSS has been updated via commit 08056836f2b4a5747daff75435d10d6.

Review URL: https://codereview.chromium.org/1395743002 .
2015-10-07 17:04:43 -04:00
Ted Mielczarek
4ee6f3cd1c Fix Windows crash_generation_server for debug builds without -D_DEBUG
Debug Gecko builds don't build with -D_DEBUG, so the ifdef in
crash_generation_server doesn't work right. The MSDN documentation for
assert says that it's enabled based on the absence of the NDEBUG define,
so using that seems sensible.

R=thestig@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1398453002 .
2015-10-07 14:19:23 -04:00
David Major
7685dfc567 Support for multiple upload files in CrashReportSender/HTTPUpload
A=David Major <dmajor@mozilla.com>
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1048091
R=ted@mielczarek.org

Review URL: https://bugzilla.mozilla.org/show_bug.cgi?id=1048091 .
2015-10-06 11:05:12 -04:00
Ted Mielczarek
dbf56c53a0 Fix MSVC build (including on 2015), drop some workarounds for MSVC older than 2013.
The Windows client gyp files were missing proc_maps_linux.cc for the
unittest build. Adding that revealed some build errors due to it
unconditionally including <inttypes.h>. Removing the workarounds in
breakpad_types.h (and a few other places) made that build, which means
that Visual C++ 2013 is now our minimum supported version of MSVC.

Additionally I tried building with VC++ 2015 and fixed a few warnings
(which were failing the build because we have /WX enabled) to ensure
that that builds as well.

BUG=https://code.google.com/p/google-breakpad/issues/detail?id=669
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1353893002 .
2015-10-06 08:03:57 -04:00
Ivan Penkov
f948d8d623 Increasing the Breakpad stack walker max scan limit from 30 to 40.
Chrome started hitting some crashes in v8 jitted code which happens to be
non ABI compliant and debuggers (including WinDBG) are unable to produce
meaningful stack traces.

The Breakpad stack walker has some builtin heuristics to deal with such cases.
More specifically, when unable to find a good parent frame, it scans the raw
stack to find a suitable parent frame.  The max scan size was set at 30
pointers which was (apparently) not enough to recover in this case.

I'm increasing it to 40 pointers.  I confirmed that at 34 pointers it was able
to recover however I'm setting it to 40 in order to it some slack.

I needed to update two unittests which were expecting the previous scan limit.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1379433005 .
2015-10-05 11:35:09 -07:00
Pavel Labath
01c8f7cf46 [mac] Teach dump_syms to handle additional zerofill sections
This patch allows dump_syms to handle S_THREAD_LOCAL_ZEROFILL
and S_GB_ZEROFILL section in the same way as the more common
S_ZEROFILL section.  Previously, dump_syms would fail to dump
a binary containing a __DATA,__thread_bss section, because it
tried to look up its data (and failed).

R=mark@chromium.org

Review URL: https://codereview.chromium.org/1369233003 .

Patch from Pavel Labath <labath@google.com>.
2015-09-30 08:20:42 -04:00
Primiano Tucci
679d70f50b Fix automake files after README.md -> README rename
Minor followup to crrev.com/1357773004 and
crrev.com/1361993002 which moved the README and forgot
to update the automake files.
This is to make "./configure && make" work.

TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/1368363002 .
2015-09-28 14:02:08 +01:00
Primiano Tucci
0d53bdd43d Add GPU fingerprint information to breakpad microdumps.
Although strictly the GPU fingerprint is defined by the build fingerprint,
there is not currently a straightforward mapping from build fingerprint
to useful GPU / GL driver information.

In order to aid debugging of WebView crashes that occur in GL drivers,
and to better understand the range of drivers and versions for feature
blacklisting purposes, it is useful to have GPU fingerprints in breakpad
microdumps.

Landing this patch on behalf of Tobias Sargeant<tobiasjs@chromium.org>

BUG=chromium:536769
R=primiano@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1334473003 .
2015-09-28 13:52:54 +01:00
Mike Frysinger
08a727d8f0 [Docs] Add wiki content to Markdown docs
BUG=none
R=vapier@chromium.org, mseaborn@chromium.org

Review URL: https://codereview.chromium.org/1356253003 .
2015-09-24 11:32:37 -04:00
Mark Mentovai
f74c85df88 Update configure to look for README.md instead of README
This is required after daed3a43836e. configure won't run as-is, reported
in https://codereview.chromium.org/1357773004/.

R=andybons@chromium.org

Review URL: https://codereview.chromium.org/1361993002 .
2015-09-23 10:46:55 -04:00
Andy Bonventre
0ff15b41ed [Docs] add markdown docs (converted from Wiki)
BUG=none
R=mark
CC=google-breakpad-dev@googlegroups.com

Review URL: https://codereview.chromium.org/1357773004 .

Patch from Andy Bonventre <andybons@chromium.org>.
2015-09-22 17:29:52 -04:00