Commit graph

1549 commits

Author SHA1 Message Date
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
Ivan Penkov
704f41ec90 This change allows 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: I11f1ce697be23e13f12ea8f0468bbe02fa63c967
Reviewed-on: https://chromium-review.googlesource.com/378159
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-30 23:31:43 +00:00
Ivan Penkov
3fef603b65 Fixing some casts in order to be able to build with new Xcode and SDK versions (tested with Xcode 7.3, SDK 10.11).
Patch provided by Thomas Schweitzer.

BUG=

Change-Id: Ib35cdf766e73e4936e66f75474d83c2602f8ceb4
Reviewed-on: https://chromium-review.googlesource.com/378059
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-30 20:59:37 +00:00
Ben Scarlato
968c388922 Updating ExploitabilityLinux to check memory mapping names against a prefix
instead of a specific name.

This will prevent false positives on systems which use a format such as
“[stack:69616]” for stack memory mapping names.

Change-Id: I51aeda2fe856c1f37f0d18ac06cce69fec2fffa2
Reviewed-on: https://chromium-review.googlesource.com/377086
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-08-29 18:39:01 +00:00
Rafal Chlodnicki
a2196179cc Fix breakpad compilation issue with clang on Windows
Fix unused variable error. Code that uses the kWaitForHandlerThreadMs
constant is inside and ifdef so in some compile configurations constant
was unused. Move it where it's used.

And do the same with other constants as requested during review.

BUG=

Change-Id: I4f4c8f36c982092d53438ed6d2a0a97772402d69
Reviewed-on: https://chromium-review.googlesource.com/374378
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-25 21:43:05 +00:00
Gabriele Svelto
c9f80bf1a8 Update MDRawMiscInfo to support version 5 of the MINIDUMP_MISC_INFO_N structure.
The routines used to read from the structure were also modified to accomodate for unknown future versions by skipping over the unsupported part instead of failing.

R=ted.mielczarek@gmail.com

Review URL: https://codereview.chromium.org/2109063004/ .
2016-08-19 13:29:36 -04:00
Sylvain Defresne
13c634f6a1 Revert "Don't define |r_debug| and |link_map| on Android releases 21 and later"
This reverts commit 0fc6d0c8df because it
does not compile in Chromium due to the following error:

In file included from ../../breakpad/src/client/linux/minidump_writer/linux_dumper.h:43:0,
                 from ../../breakpad/src/client/linux/minidump_writer/minidump_writer.h:41,
                 from ../../breakpad/src/client/linux/handler/exception_handler.h:42,
                 from ../../components/crash/content/app/breakpad_linux.cc:44:
../../breakpad/src/common/android/include/link.h:46:9: error: multi-line comment [-Werror=comment]
 #endif  // !defined(__aarch64__) && !defined(__x86_64__) && \
         ^

> Don't define |r_debug| and |link_map| on Android releases 21 and later
>
> NDKs for Android 21 and later have the data structures |r_debug| and
> |link_map| defined in their header files. Defining them multiple times
> generates a compiler error.
>
> This patch protects both data structures from definition on Android 21
> and later.
>
> BUG=629088
> R=rmcilroy@chromium.org
>
> Review URL: https://codereview.chromium.org/2156173002 .
>
> Patch from Thomas Zimmermann <tzimmermann@mozilla.com>.
>
> Committed: 0ebdc4a10a

BUG=629088

Change-Id: Ia8d7d0eff060d661113e544d732813820bcb69e0
Reviewed-on: https://chromium-review.googlesource.com/367717
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-10 22:01:39 +00:00
Sylvain Defresne
600ec35c5b Fail with a proper error message if input file is not found.
Previously, if the input file was missing, the symupload tool on Mac
would happily process, try to parse it (calling a method on nil) and
fail when trying to create the payload to send to the server as one
of the method raised a NSInvalidArgumentException when receiving a
nil value.

Change to code to instead check the file for existence which makes it
easier to understand what is happening when part of the build system
is misconfigured and invoke symupload without first creating the symbol
file.

BUG=449348

Change-Id: Icc0f08958114da4be0cbbd7a7c2aeef905bc0db1
Reviewed-on: https://chromium-review.googlesource.com/367260
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-09 23:13:07 +00:00
Thomas Zimmermann
0fc6d0c8df Don't define |r_debug| and |link_map| on Android releases 21 and later
NDKs for Android 21 and later have the data structures |r_debug| and
|link_map| defined in their header files. Defining them multiple times
generates a compiler error.

This patch protects both data structures from definition on Android 21
and later.

BUG=629088
R=rmcilroy@chromium.org

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

Patch from Thomas Zimmermann <tzimmermann@mozilla.com>.

Committed: 0ebdc4a10a
2016-08-03 15:28:43 +01:00
Andrew Bonventre
f7be4815a2 Switch to Gerrit for code reviews
BUG=629128

Change-Id: I687659d9fc78ed31dcd3be3b9268f30c17dd9c01
Reviewed-on: https://chromium-review.googlesource.com/362370
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-07-27 20:07:49 +00:00
Mark Mentovai
f5638b8c2e Test Gerrit
Change-Id: If335bec0a5079dececc0452b88a77d80f775ea97
Reviewed-on: https://chromium-review.googlesource.com/362660
Reviewed-by: Will Harris <wfh@chromium.org>
2016-07-25 13:44:49 +00:00
Aaron Gable
0e4af9d8f9 Add Breakpad codereview.settings entry for Gerrit
R=mark@chromium.org
BUG=629864

Review URL: https://codereview.chromium.org/2166193003 .
2016-07-21 12:45:20 -07:00
Mark Mentovai
5f638d5323 Remove DISALLOW_COPY_AND_ASSIGN from MinidumpStreamInfo
DISALLOW_COPY_AND_ASSIGN was inadvertently added to
Minidump::MinidumpStreamInfo in f04a010f71f6, but this class is used as
the value side of the Minidump::stream_map_ map and must be copyable
(with an old enough C++ library).

This broke:

https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/247141/steps/compile%20%28with%20patch%29/logs/stdio

TBR=ivanpe@chromium.org

Review URL: https://codereview.chromium.org/2158423003 .
2016-07-20 10:08:14 -04:00
Ross McIlroy
b5200a97b7 Revert "Don't define |r_debug| and |link_map| on Android releases 21 and later"
This reverts commit 0fc10739232ac803f7304d01522db6051c7454ff.

Reason: breaks 64bit Android architectures.

BUG=629088
R=primiano@chromium.org

Review URL: https://codereview.chromium.org/2163923002 .
2016-07-20 11:27:11 +01:00
Will Harris
c99d374dde Add new exception code for OOM generated from Chromium.
See also https://codereview.chromium.org/2130293003/ for Chromium-side change and go/internal_cl_for_2130293003 for internal change.

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

Review URL: https://codereview.chromium.org/2160373002 .
2016-07-19 14:41:53 -07:00
Primiano Tucci
5adeef6117 Add process type to MicroDumpExtraInfo
BUG=616774
R=primiano@chromium.org, torne@chromium.org

Review URL: https://codereview.chromium.org/2087413002 .
2016-07-19 17:44:10 +01:00
Thomas Zimmermann
0ebdc4a10a Don't define |r_debug| and |link_map| on Android releases 21 and later
NDKs for Android 21 and later have the data structures |r_debug| and
|link_map| defined in their header files. Defining them multiple times
generates a compiler error.

This patch protects both data structures from definition on Android 21
and later.

BUG=629088
R=rmcilroy@chromium.org

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

Patch from Thomas Zimmermann <tzimmermann@mozilla.com>.
2016-07-19 17:00:51 +01:00
Ting-Yuan (Leo) Huang
41b91d064e Recover memory mappings before writing dump on ChromeOS
On Linux, breakpad relies on /proc/[pid]/maps to associate symbols from
addresses. ChromeOS' hugepage implementation replaces some segments
with anonymous private pages, which is a restriction of current
implementation in Linux kernel at the time of writing. Thus, breakpad
can no longer symbolize addresses from those text segments replaced by
hugepages.

This patch tries to recover the mappings. Because hugepages are always
inserted in between some .text sections, it tries to infer the names and
offsets of the segments, by looking at segments immediately precede and
succeed them.

For example, a text segment before hugepage optimization
  02001000-03002000 r-xp /opt/google/chrome/chrome

can be broken into
  02001000-02200000 r-xp /opt/google/chrome/chrome
  02200000-03000000 r-xp
  03000000-03002000 r-xp /opt/google/chrome/chrome

BUG=crbug.com/628040
R=mark@chromium.org

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

Patch from Ting-Yuan (Leo) Huang <laszio@chromium.org>.
2016-07-18 20:11:07 -04:00
John Budorick
965424f183 [Android] Guard some NDK workarounds by major version.
BUG=599327
R=mark@chromium.org

Review URL: https://codereview.chromium.org/2152153003 .
2016-07-15 12:49:44 -07:00
Ting-Yu Chou
dfd2da7979 Add a new argument to specify the minidump type to write on Windows.
R=ted.mielczarek@gmail.com
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1267329

Review URL: https://codereview.chromium.org/2107083002/ .
2016-06-29 06:48:26 -04:00
Mike Frysinger
e0f2c17988 travis: note misbehavior by coverity addon when throttled
Example here: https://travis-ci.org/libgd/libgd/builds/139971212
The last line in the log is just the throttle notice.
2016-06-24 05:09:28 -04:00
Mike Frysinger
af8840d910 travis: move configure step to the prepare phase
The main command is more strict in that it has to be a single command.
2016-06-24 04:40:03 -04:00
Mike Frysinger
1600b6054e travis: make build scripts use bash
These are development scripts, so no need for them to be fast or
super portable.  Switch them to bash rather than POSIX shell.
2016-06-22 09:02:23 -04:00
Mike Frysinger
f140a0339f travis: fix cwd when running tests
Make sure we don't go messing with the cwd when running different tests.
This way we can always assume we start in the top level source dir.
2016-06-21 16:55:02 -04:00
Mike Frysinger
5325fd5162 travis: tweak coverity build command
The `build` shell func isn't in scope of the coverity shell script.
2016-06-21 15:10:31 -04:00
Mike Frysinger
83a5552060 travis: add coverity scan integration
R=ted.mielczarek@gmail.com

Review URL: https://codereview.chromium.org/2078283002 .
2016-06-21 11:14:28 -04:00
Ivan Penkov
24f5931c5e Server-side workaround to handle overlapping modules.
This change is resolving an issue that was caused by the combination of:
 - Android system libraries being relro packed in N+.
 - Breakpad dealing with relro packed libraries in a hack way.

This is a fix for http://crbug/611824.

I also found an use-after-free issue (bug in Minidump::SeekToStreamType).  I disallowed the MinidumpStreamInfo copy and assign constructors and the compiler detected another similar issue in Minidump::Print.  Then I disabled the copy and assign constructors for most classes in minidump.h (just in case).  There are a couple of classes where I couldn't disallow them (since assign is used).  This will require a small refactor so I left it out of this CL.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/2060663002 .
2016-06-20 11:14:47 -07:00
Mike Frysinger
67f738b7ad linux-syscall-support: pull in latest version
The sys_mmap/sys_mmap2 weirdness has been cleaned up in lss now and there
is only one API now for everyone -- sys_mmap.

R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/2065493006 .
2016-06-14 14:17:56 -04:00
Ted Mielczarek
c44217f646 Dump INFO CODE_ID containing Build ID in Linux dump_syms
I'd like to have the Build ID available for our symbol server
uploading, and this will make it easy.

Most of this change is me rewriting dump_symbols_unittest to be
typed tests so I could add a new test there.

R=mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/2052263002 .
2016-06-10 13:23:29 -04:00
Nicholas Nethercote
7fc25b8962 Fix a trivial parsing bug caught by static analysis
R=ted
2016-06-10 09:51:14 -04:00
Ralph Giles
c65ed6573e Update symbol file documentation links.
These locations have changed since the move from Google Code.

R=ted.mielczarek@gmail.com
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1275630
2016-06-10 06:29:06 -04:00
Primiano Tucci
a34c929f6f linux/android: add SIGTRAP to the list of signals handled by the client
__builtin_trap() causes a SIGTRAP on arm64 (at least with GCC 4.9).
SIGTRAP is not handled by breakpad, causing crashes induced by
__builtin_trap() to be missed.
Note that on x86 and arm, instead, __builtin_trap() raises a SIGILL,
which is already handled by breakapd.

BUG=chromium:614865
R=vapier@chromium.org

Review URL: https://codereview.chromium.org/2042853002 .
2016-06-08 17:04:49 +01:00
Primiano Tucci
72e94c4ddb [Android] Roll back to r10e.
BUG=599327
R=primiano@chromium.org
TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/2042873003 .
2016-06-06 20:43:36 +01:00
Primiano Tucci
7933830cb7 [Android] Revert x86 workaround changes for NDK r11c.
BUG=599327
R=primiano@chromium.org
TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/2035343002 .
2016-06-06 14:35:51 +01:00
Ivan Penkov
240ed57ee1 Adding support for overlapping ranges to RangeMap.
When enabled, adding of a new range that overlaps with an existing one can be a successful operation.  The range which ends at the higher address will be shrunk down by moving its start position to a higher address so that it does not overlap anymore.

This change is required to fix http://crbug/611824.  The actual fix will come in a separate CL.

R=mmandlis@chromium.org

Review URL: https://codereview.chromium.org/2029953003 .
2016-06-05 22:41:10 -07:00