Commit graph

1583 commits

Author SHA1 Message Date
Mike Frysinger
333ed18eb0 aclocal: regenerate properly
Rather than manually include m4 files in configure.ac, let aclocal
do its thing and manage aclocal.m4 automatically for us.

Change-Id: I50689ec78a85651949aab104e7f4de46b14bca5a
Reviewed-on: https://chromium-review.googlesource.com/438544
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-08 19:52:52 +00:00
Mike Frysinger
8b0a1053e2 fix write() unused-result warning
src/client/linux/microdump_writer/microdump_writer_unittest.cc:98:47: error:
  ignoring return value of 'ssize_t write(int, const void*, size_t)',
  declared with attribute warn_unused_result [-Werror=unused-result]
   write(STDOUT_FILENO, identifiable_string, 0);

Change-Id: I3f2305fbec0dbd1464de9aeff051e7cba2ee69a2
Reviewed-on: https://chromium-review.googlesource.com/438545
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-02-08 05:50:30 +00:00
Joshua Peraza
64c2eda38a Fixed leak of unloaded module lists.
BUG=

Change-Id: I6d03820082f793a2eac3c3c2abd184b4acf66aa4
Reviewed-on: https://chromium-review.googlesource.com/438755
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-02-07 22:41:43 +00:00
Tobias Sargeant
7ba80c7284 Address post-submit review comments related to CL #430050
See: https://chromium-review.googlesource.com/c/430050/

BUG=664460

Change-Id: I3cbfbd5b00725bd501f06427eebd976267c4f617
Reviewed-on: https://chromium-review.googlesource.com/438444
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2017-02-07 16:34:17 +00:00
Mike Frysinger
6c78460419 md5: fix strict aliasing warnings
Change-Id: I64f4570610c625b1325249fd5fa1b9edc3a89ae4
Reviewed-on: https://chromium-review.googlesource.com/438864
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-02-07 01:10:12 +00:00
Mike Frysinger
8f5741078d autotools: refresh config.{sub,guess} 2017-02-06 13:57:59 -05:00
Tobias Sargeant
cff58cdd0a Remove debugging fprintf in unittest code that prevents rolling breakpad
BUG=664460

Change-Id: I40d8567c659e97415db65cb308c0d39391c44353
Reviewed-on: https://chromium-review.googlesource.com/438364
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2017-02-06 15:27:19 +00:00
Tobias Sargeant
049a1532e5 Wire up stack sanitization and skipping to WriteMinidump
This makes the parameters stored in the MinidumpDescriptor structure
functional for minidumps, analogously to how they are applied to
microdumps.

BUG=664460

Change-Id: I7578e7a1638cea8f0445b18d4bbdaf5e0a32d808
Reviewed-on: https://chromium-review.googlesource.com/435380
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-03 10:01:12 +00:00
Roman Margold
24c359d329 Revert "Several fixes for broken Mac build"
This reverts commit 5c521532fc.
2017-02-01 16:26:39 -08:00
Roman Margold
2c4c039118 Revert "iOS client identifies itself via URL params"
This reverts commit 262a3f50fe.
2017-02-01 16:26:29 -08:00
Roman Margold
262a3f50fe iOS client identifies itself via URL params
Recently, Crash started applying quotas for crash report uploads to protect the service and its client products from misbehaving product or product version. For the protection to be effective, products need to identify themselves during report upload via URL parameters. This new code makes iOS apps using Breakpad provide the parameters automatically.
2017-02-01 09:06:31 -08:00
Roman Margold
5c521532fc Several fixes for broken Mac build 2017-02-01 08:33:44 -08:00
Tobias Sargeant
7c2799f3ba Sanitize dumped stacks to remove data that may be identifiable.
In order to sanitize the stack contents we erase any pointer-aligned
word that could not be interpreted as a pointer into one of the
processes' memory mappings, or a small integer (+/-4096).

This still retains enough information to unwind stack frames, and also
to recover some register values.

BUG=682278

Change-Id: I541a13b2e92a9d1aea2c06a50bd769a9e25601d3
Reviewed-on: https://chromium-review.googlesource.com/430050
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-01-31 14:13:48 +00:00
Joshua Peraza
cb94b71d28 Fixed a bug where cv record size was not correctly checked.
BUG=

Change-Id: I6c1d78cfe344c7b90a03f6df35193d67623bfd89
Reviewed-on: https://chromium-review.googlesource.com/434094
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-01-30 21:07:24 +00:00
Bruce Dawson
76a48f4aa9 Change symbol upload message to include 'breakpad'
The breakpad symbol uploader prints messages of this form:

    Uploaded symbols for windows-x86/eventlog_provider.dll.pdb/...

This is confusing because many people see this message and assume that
symbols are being uploaded to a symbol server. This changes the message
to clarify what is happening.

BUG=677226

Change-Id: Id6fdd8497d0cb97be43c4af010058aab9d84375c
Reviewed-on: https://chromium-review.googlesource.com/434187
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-01-28 03:11:17 +00:00
Joshua Peraza
0924d424e4 Populate stack frames with unloaded module info.
This CL hits lots of source files because:
 1. An update to the CodeModule virtual class. I added an is_loaded
  method to specify whether the module is loaded. There were several
  mocks/test classes that needed to be updated with an implementation.
  An alternative to this route would be to modify
  MinidumpUnloadedModule::code_file to prepend "Unloaded_" to the
  module name.

 2. Added an unloaded_modules parameter to
  StackFrameSymbolizer::FillSourceLineInfo.

BUG=

Change-Id: Ic9c7f7c7b7e932a154a5d4ccf292c1527d8da09f
Reviewed-on: https://chromium-review.googlesource.com/430241
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-01-19 19:33:56 +00:00
Tobias Sargeant
e7dfafc16e Add API to skip dump if crashing thread doesn't reference a given module (2)
Follow-up CL to add relevant code to the copy constructor and assignment
operator for MinidumpDescriptor

BUG=664460

Change-Id: I71c0ad01d8686a9215a718cebc9d11a215ea342c
Reviewed-on: https://chromium-review.googlesource.com/430711
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-01-19 16:33:00 +00:00
Tobias Sargeant
833cadc0a1 Add API to skip dump if crashing thread doesn't reference a given module
This CL makes it possible to skip a dump if the crashing thread doesn't
have any pointers to a given module. The concrete use case is WebView
where we would like to skip generating microdump output when webview
is unreferenced by the stack and thus cannot be responsible for the
crash in a way that would be debuggable.

The range of interesting addresses is chosen by examining the process
mappings to find the one that contains a pointer that is known to be in
the right shared object (i.e. an appropriately chosen function pointer)
passed from the client.

If the extracted stack does not contain a pointer in this range, then we
do not generate a microdump. If the stack extraction fails, we still
generate a microdump (without a stack).

BUG=664460

Change-Id: If19406a13168264f7751245fc39591bd6cdbf5df
Reviewed-on: https://chromium-review.googlesource.com/419476
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2017-01-18 15:41:07 +00:00
Joshua Peraza
c2d969cb10 Added classes to support reading unloaded module lists in minidumps.
The implementations of Module/UnloadedModule and
ModuleList/UnloadedModuleList are very similar. They have been made
separate classes because they operate on different structs, complicating
factoring code into a base class and have sufficiently different
implementation that templates would not be suitable.

When unloaded modules have partially overlapping ranges, the module
shrink down feature is used to move the start of the higher range to the
end of the lower range. If two unloaded modules overlap identically, the
second module will not be added to the range map and the failure
ignored.

Places where MinidumpUnloadedModule differs from MinidumpModule:
  code_identifier: the android/linux case is deleted since cv_records
    never exist.
  debug_file/debug_identifier/version: always return empty strings.
  Read: an expected size is provided as opposed to MD_MODULE_SIZE. A
    seek is used if there are extra, unused bytes.

Places where MinidumpUnloadedModuleList differs from
  MinidumpModuleList:
  Read: entry and header size is provided in the header in
    addition to count. This changes the checks and handling of padding.
    Failures from StoreRange are ignored.
  GetMainModule: always returns NULL.

BUG=

Change-Id: I52e93d3ccc38483f50a6418fede8b506ec879aaa
Reviewed-on: https://chromium-review.googlesource.com/421566
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2016-12-16 20:15:04 +00:00
Tobias Sargeant
f78d953511 Fix unit tests expecting no output when a microdump is suppressed.
BUG=

Change-Id: Ie4d190c68ecbd8709874a3f1ceb872b94b36914f
Reviewed-on: https://chromium-review.googlesource.com/419036
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2016-12-12 16:16:22 +00:00
Mike Percy
5c42d7288a Fix sign-compare compiler warning in MicrodumpWriterTest
Commit 7a8980997d introduced additional
tests into MicrodumpWriterTest, two of which throw warnings which break
"make check" under default settings on Linux, because the Makefiles are
configured with -Werror=sign-compare.

This patch just makes the signedness of the assertion arguments match.

Change-Id: Ib522f44205c84f91bc9b93276fad60ebbf005f60
Reviewed-on: https://chromium-review.googlesource.com/418938
Reviewed-by: Tobias Sargeant <tobiasjs@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-12-10 17:53:36 +00:00
Mike Frysinger
c13d6fa467 crash_generation: fix bad call to close
If signal_fd is -1 still, we end up calling close(-1).  Not generally
a problem, but it's bad form, and coverity is upset by it.

Change-Id: I46f9c7ca4be7b43af5b609dd8e3f03a0700af418
Reviewed-on: https://chromium-review.googlesource.com/414544
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2016-12-09 15:56:26 +00:00
Tobias Sargeant
596fbb61bc Log a message when microdump output is suppressed.
Change-Id: I11542ea9b702055e8f0b99c26cad2fea8681bce0
Reviewed-on: https://chromium-review.googlesource.com/417824
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2016-12-07 21:44:22 +00:00
Orgad Shaneh
87e444e17d Remove comparison of this with nullptr
GCC6 optimizes it out, leading to crash.

Change-Id: I8425d456c1364929d135ce3860121b8098bab1f7
Reviewed-on: https://chromium-review.googlesource.com/413120
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-12-06 13:58:40 +00:00
Tobias Sargeant
7a8980997d Do not generate a microdump if there are no webview pointers on the stack.
The stack interest range is passed in MicrodumpExtraInfo from the client.
If the extracted stack does not contain a pointer in this range, then we
assume that this is not a WebView crash, and do not generate a microdump.
If the stack extraction fails, we still generate a microdump (without a
stack).

BUG=664460

Change-Id: Ic762497f76f074a3621c7ec88a8c20ed768b9211
Reviewed-on: https://chromium-review.googlesource.com/412781
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2016-12-01 17:22:27 +00:00
Orgad Shaneh
e6ef06f13d Comment out an unused function argument
Change-Id: I09c90d496edc67d4cad3e2b99f4347dc04713bdb
Reviewed-on: https://chromium-review.googlesource.com/414357
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-11-29 21:04:21 +00:00
Mike Frysinger
7515ab1376 microdump_stackwalk_test: fix bashism in test
These are /bin/sh scripts, and `source` is a bash-specific command.
Switch to the portable `.` command instead.

Change-Id: I51d8253b26aa61c130bb5fdc4789f8d623c6d9db
Reviewed-on: https://chromium-review.googlesource.com/414524
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2016-11-25 04:53:01 +00:00
Orgad Shaneh
33c24776f3 Upgrade google test to 1.8.0
Some test fail on recent debian with 1.7.0 due to crashes.

Change-Id: Ia25625c27968671e24826a3eeae70dbfa5c67c95
Reviewed-on: https://chromium-review.googlesource.com/412701
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-11-23 23:04:33 +00:00
Orgad Shaneh
11d7510c08 Update links
code.google.com is obsolete.

Fix all broken markdown links while at it.

Change-Id: I6a337bf4b84eacd5f5c749a4ee61331553279009
Reviewed-on: https://chromium-review.googlesource.com/411800
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-11-18 17:24:37 +00:00
Orgad Shaneh
8e2448bceb GitIgnore: Add dump_syms_mac
Change-Id: I4bbeb614e7477a42f096e1ba3fa7c00344827e0c
Reviewed-on: https://chromium-review.googlesource.com/411105
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-11-14 20:16:05 +00:00
Pierre-Antoine Manzagol
4eb76cbc9e Add a crash reason string for the simulated crashpad exception code
BUG=

Change-Id: I19a1abf1d00f208943db1c362cc426ca8bd2068e
Reviewed-on: https://chromium-review.googlesource.com/409632
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-10 14:46:53 +00:00
Ivan Penkov
2f6cb866d6 Allow compiling the google-breakpad code using a global ::string class instead of std::string.
For more details take a look at common/using_std_string.h

BUG=

Change-Id: Ifebfc57f691ef3a3bef8cfed7106c567985edffc
Reviewed-on: https://chromium-review.googlesource.com/399738
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-08 01:29:06 +00:00
Scott Graham
1f574b52c6 Basic handling of CIE version 4 in dwarf reading
CIE looks like it's been emitted by clang since ~May 2015 [1]. This
means that we didn't have any CFI because this parse aborted, which
meant that all stack walks reverted to stack scanning. Allow expected
values for address size and segment descriptor size through so that
dump_syms can generate at least somewhat reasonable data.

[1]: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150518/277292.html

R=mark@chromium.org
BUG=chromium:627529

Change-Id: I6dc92f51c4afd25c2adff92c09ccb8bb03bf9112
Reviewed-on: https://chromium-review.googlesource.com/406012
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-02 02:52:37 +00:00
Mike Frysinger
7df62a96eb minidump-2-core: add more control over filenames
The code has been rewriting the location of the shared lib lookup
completely which breaks normal sysroot usage with gdb.  Split out
the behavior into dedicated flags so people can opt into it.  You
can see examples of -i/-f in the usage() text.

We also change the -S behavior so that it's no longer enabled by
default -- if people want /var/lib/breakpad/, they can pass the -S
flag explicitly.

BUG=chromium:598947

Change-Id: Ic81726c27b4ad6c271c70696f2ac62798f07ccfb
Reviewed-on: https://chromium-review.googlesource.com/402909
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-01 03:48:58 +00:00
Hans Wennborg
26ed3386af Fix pointer arithmetic in UTF8ToUTF16Char
Found by PVS-Studio!

BUG=chromium:660198

Change-Id: I2605de2b1499f85c6e01d19e87e9eeb6af8486f3
Reviewed-on: https://chromium-review.googlesource.com/404552
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-10-27 23:27:56 +00:00
Mike Wittman
325120efbd Generate reason for bad function table exception
This exception is being seen in Chrome during stack unwinding.

BUG=

Change-Id: Ica3f721ca605dff835ffc3814c60bab9f6f9b192
Reviewed-on: https://chromium-review.googlesource.com/404332
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-27 21:40:12 +00:00
Mike Frysinger
54b524be13 minidump-2-core: add an -o flag for controlling core output
Always writing to stdout makes it hard to debug, and hard to use in
some script environments.  Add an explicit -o flag to make it easier.

BUG=chromium:598947

Change-Id: I79667d033c8bdc8412d3a44fe3557d65f704968f
Reviewed-on: https://chromium-review.googlesource.com/403988
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-26 18:44:42 +00:00
Mike Frysinger
ed7dcced19 minidump-2-core: rewrite argument processing
This uses the same general framework as other minidump tools by using
getopt to parse command line options, and then passing the parsed state
around as a struct rather than via globals.

This does change the --sobasedir flag to -S because we don't support
getopt_long anywhere in the tree.  Unfortunate, but better to match
all the other breakpad tools which only accept short options.

BUG=chromium:598947

Change-Id: I473081a29a8e3ef07a370848343f1a9e6681fd4e
Reviewed-on: https://chromium-review.googlesource.com/402908
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-26 17:57:43 +00:00
Ted Mielczarek
2ecb2baba8 Don't demangle Rust symbols by default, but allow linking to rust-demangle.
The Rust compiler uses GCC C++ name mangling, but it has another layer of
encoding so abi::cxa_demangle doesn't produce great results. This patch
changes dump_syms to dump unmangled names by default so that consumers can
demangle them after-the-fact.

It also adds a tiny bit of support for linking against a Rust library I wrote
that can demangle Rust symbols nicely:
https://github.com/luser/rust-demangle-capi

BUG=

Change-Id: I63a425035ebb7ac516f067fed2aa782849ea9604
Reviewed-on: https://chromium-review.googlesource.com/402308
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-25 10:43:00 +00:00
Gabriele Svelto
e6d1c032ba Fix iterating over the MDXStateFeature entries on 32-bit hosts
On 32-bit hosts the new code for dumping version 5 of the MDRawMiscInfo
structure uses a 32-bit left shift to select flags corresponding to the
entries in the MDXStateFeature array. Since the array is made of 64
element this automatically skipped half of it.

Change-Id: Ic4e3beaf6c56083524b33da9a396c14eec0d2bd2
Reviewed-on: https://chromium-review.googlesource.com/396107
Reviewed-by: Ted Mielczarek <ted@mielczarek.org>
2016-10-18 19:37:33 +00:00
Tim Angus
6b2f69dd10 Also treat DBG_PRINTEXCEPTION* as debug exceptions
Windows 10 now raises an exception when OutputDebugString* are called:
(https://ntquery.wordpress.com/2015/09/07/windows-10-new-anti-debug-outputdebugstringw/)
This change ignores these exception types such that they're not falsely
identified as a crash.

BUG=

Change-Id: I1326212662d46e16407681d5ea6377f63ee188ce
Reviewed-on: https://chromium-review.googlesource.com/398998
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-18 18:08:24 +00:00
Scott Graham
48a13da168 Provide initial EBX value to FPO frame data evaluator
EBX is sometimes used in "WIN FRAME 4" programs. Not providing the
initial value was causing the evaluation in some frames of ntdll,
resulting in a fallback to scanning and a failed stack walk.

R=mark@chromium.org
BUG=chromium:651453

Change-Id: I94a8184e1eed72b0d0e3212fe323fbdd10d56da5
Reviewed-on: https://chromium-review.googlesource.com/398059
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-14 17:51:32 +00:00
Justin Cohen
36d613ef59 Don't call _exit() on iOS.
Calling _exit() is something iOS inherited from Mac OS X Breakpad, and isn't
necessary on iOS.  This is necessary because recently iOS has started
re-launching the application if breakpad catches a startup crash and calls exit
during startup.

BUG=chromium:645146

Change-Id: Ibb5a681282a886259424655aa8506a80a1fd4f4c
Reviewed-on: https://chromium-review.googlesource.com/397058
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-13 04:34:00 +00:00
Mark Mentovai
98b6a6309f Fix dump_syms for C++ after 7398ce15b7
Change-Id: Ifb56d41d8c5c6e766dee459157e1345553088e2a
Reviewed-on: https://chromium-review.googlesource.com/389411
Reviewed-by: Ted Mielczarek <ted@mielczarek.org>
2016-09-26 14:13:13 +00:00
Mark Mentovai
7398ce15b7 Initial support for dumping DWARF corresponding to Swift code
The DWARF data for Swift code has a top-level DW_TAG_module DIE as the
child of the DW_TAG_compile_unit DIE and the parent of the
DW_TAG_subprogram DIEs that dump_syms uses to locate functions.
dump_syms needs to process DW_TAG_module DIEs as introducing nested
scopes to make it work with Swift.

This also reworks demangling to be language-specific, so that the C++
demangler isn't invoked when processing Swift code. The DWARF data for
Swift code presents its mangled names in the same form as used for C++
(DW_AT_MIPS_linkage_name or DW_AT_linkage_name) but the mangling is
Swift-specific (beginning with _T instead of _Z). There is no
programmatic interface to a Swift name demangler as an analogue to C++'s
__cxa_demangle(), so mangled Swift names are exposed as-is. Xcode's
"xcrun swift-demangle" can be used to post-process these mangled Swift
names on macOS.

Support for mangled names presented in a DW_AT_linkage_name attribute,
as used by DWARF 4, is added. This supersedes the earlier use of
DW_AT_MIPS_linkage_name.

BUG=google-breakpad:702,google-breakpad:715
R=ted.mielczarek@gmail.com

Review URL: https://codereview.chromium.org/2147523005 .
2016-09-23 14:22:42 -04:00
Mike Frysinger
138886803c generate a repo manifest from the DEPS file
This allows people to use repo to manage the checkout instead of gclient.
This helps when you're used to the standard repo+gerrit workflow that the
Android & Chromium OS projects use.

Change-Id: I8b720e7995af2a1a8c9ce2ee9aa6c2638441b4a1
Reviewed-on: https://chromium-review.googlesource.com/379736
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-21 20:01:47 +00:00
Ted Mielczarek
d3b9631f81 Fix a win32 build error by moving a #include out of an #ifndef _WIN32 2016-09-20 12:12:56 -04:00
Ivan Penkov
b857dfec2b Fixing the Xcode project for the Breakpad Mac crash reporter.
Added new files elf_reader and corrected the references to dump_syms. Also some corrections to be able to build using a newer Xcode and SDK version (tested with Xcode 7.3, SDK 10.11).

Patch provided by Thomas Schweitzer.

BUG=

Change-Id: I18bd3f8ce0c1d0ceb737aee2fa8305adfcc83139
Reviewed-on: https://chromium-review.googlesource.com/377746
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-02 21:50:30 +00:00
Ivan Penkov
8cb66bcef7 Corrected some old references to mm files, which were renamed to cc files a while ago.
Patch provided by Thomas Schweitzer.

BUG=

Change-Id: I1721db8cab7774b433ff6703a0ddc1eab6620c0b
Reviewed-on: https://chromium-review.googlesource.com/379898
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-01 17:43:04 +00:00
Mike Frysinger
fea963f974 add new dmp file to dist 2016-09-01 12:05:18 -04:00