Commit Graph

1990 Commits

Author SHA1 Message Date
Gabriele Svelto
13b234ce24 Make the minidump processor correctly populate the CPU information string for Microsoft-style ARM64 minidumps
This affects the output of tools like minidump_stackwalk which currently
print out the hexadecimal representation of the architecture instead of
the "arm64" string.

BUG=780

Change-Id: Id1d9d65fa5f3509c8c6580e2e3042f7d682b52be
Reviewed-on: https://chromium-review.googlesource.com/c/1412004
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-01-30 16:20:00 +00:00
Andreas Haas
9b06049ed9 Introduce SetFirstChanceHandler with more strict signature
Eventually, I want to remove the current version of
SetFirstChanceHandler. That is why I changed the name of the current
callback type to FirstChanceHandlerDeprecated.

I also made sure that it is not possible to have two different
FirstChanceHandlers set at the same time.

This is the first of a set of CLs to clean up the API between Chrome,
BreakPad, and V8. See more information in the tracking bug.

R=mark@chromium.org

Bug: chromium:921971
Change-Id: Ia8c2fd9bd875c36dd7ae8bb4a02e538556bc67a1
Reviewed-on: https://chromium-review.googlesource.com/c/1411776
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-01-15 15:14:20 +00:00
Tom Tan
b988fa74ec Extract intruction pointer correctly for Windows ARM64
Bug: 893460
Change-Id: Ibbdf734e72c29c4779b6a701dceec1626056a9ba
Reviewed-on: https://chromium-review.googlesource.com/c/1393763
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-01-03 00:10:28 +00:00
Mike Frysinger
5467393a3d support mistaken-pull-closer for automatically clearing incoming PRs
Change-Id: I2f69a8152958bc1425efe569bace1b6f9702896d
Reviewed-on: https://chromium-review.googlesource.com/c/1366918
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-07 01:49:55 +00:00
Joshua Peraza
3bc301d4f9 Conditionally define BPLOG_LAZY_STREAM
This allows BPLOG_LAZY_STREAM to be overridden by BP_LOGGING_INCLUDE

Change-Id: I5c9ec19b619ad5db9e97f3a1813b0f965a357b38
Reviewed-on: https://chromium-review.googlesource.com/c/1351361
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2018-11-27 16:12:23 +00:00
Joshua Peraza
e42f2456b7 Add mac dump_syms support for arm64e
Change-Id: I6a25b47d4fc5e42ff9fa30107b563dcf1d51c0d1
Reviewed-on: https://chromium-review.googlesource.com/c/1351352
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-11-26 18:29:35 +00:00
Joshua Peraza
5cbd3c69e0 fix dump_syms xcode project
dwarf_range_list_handler.{cc,h} were added in 16e08520.

Default to building with c++11.

Change-Id: Iceb29ab665260a9e71a30920fdfb5623d10a9cfa
Reviewed-on: https://chromium-review.googlesource.com/c/1351351
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-11-26 18:29:16 +00:00
Ludovic Guegan
12ecff373a Skip empty DWARF code range when mapping lines
BUG=777

Change-Id: Ic6d05eee3ff4660b6d087999a8cea04a1ee3e92b
Reviewed-on: https://chromium-review.googlesource.com/c/1333507
Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
2018-11-21 15:38:37 +00:00
Joshua Peraza
66571f4838 Conditionally define BPLOG_IF
This allows BPLOG_IF to be overriden by defines in BP_LOGGING_INCLUDE.

Change-Id: Ic6e8373476cc4d1f73d55e13a23686a2c8309fdc
Reviewed-on: https://chromium-review.googlesource.com/c/1278104
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2018-10-12 17:49:54 +00:00
Evan Bernstein
315d1368a7 Adds method to get the date of the most recent iOS crash report.
Also adds method to determine if breakpad is started.

Change-Id: I272765e7ac6bbc07d77ca2d8dcc34d51c205116e
Reviewed-on: https://chromium-review.googlesource.com/c/1260625
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-10-08 16:40:19 +00:00
Lei Zhang
54fa71efbe Swap MDCVInfoELF::cv_signature if needed.
BUG=chromium:877888

Change-Id: Ie4437228dfc32619ce5feb1769ba1644a4ea8ca2
Reviewed-on: https://chromium-review.googlesource.com/1192963
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-08-28 17:41:06 +00:00
Joshua Peraza
ee6f67d3b0 win: fix formatting after 21c98747
Change-Id: If50c3563fec7a8a9edf05c22f7d157201184df38
Reviewed-on: https://chromium-review.googlesource.com/1191671
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-08-27 20:58:44 +00:00
Joshua Peraza
21c9874722 win: replace a while loop with a for loop
This is the recommended resolution to warning C4127.
https://msdn.microsoft.com/en-us/library/6t66728h.aspx

Change-Id: Ifcffe68e21d9a6383bb9aef07503cbb034caca19
Reviewed-on: https://chromium-review.googlesource.com/1191661
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2018-08-27 19:44:50 +00:00
Joshua Peraza
1459e5df74 Fix debug build after 16e0852
Also remove ranges_handler_ which is unused.

Change-Id: I771bf4b5fc4410f0406bf26e1e405905b55389ab
Reviewed-on: https://chromium-review.googlesource.com/1180587
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-18 01:46:46 +00:00
Joshua Peraza
47b4a1c105 Make a parameter a const reference
Change-Id: I7d232dd9be3a03b5bd9f1d46c307d080fadf9116
Reviewed-on: https://chromium-review.googlesource.com/1179978
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-17 17:02:52 +00:00
Joshua Peraza
6ee298a346 Treat high_pc as an address for DW_FORM_GNU_addr_index
The high_pc is an address and has already been read from .debug_addr
before being passed into FuncHandler::ProcessAttributeUnsigned.

Bug:870908
Change-Id: I950098e360b5193f26bf767b8fa0a5f9d59e66ce
Reviewed-on: https://chromium-review.googlesource.com/1178760
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-17 04:26:39 +00:00
Mark Mentovai
acf983292a Fix Windows client_tests GYP build after 88d8114fda
Bug: google-breakpad:770
Change-Id: I5539cda6053c39a11c354fba7f3e689ae02d3019
Reviewed-on: https://chromium-review.googlesource.com/1176126
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-08-15 18:25:08 +00:00
Gabriele Svelto
658a77e532 Fixed a typo introduced in revision 16e08520e6
BUG=769

Change-Id: I1e118fe31b4a4031275b8b49c4c1eb98745ce21a
Reviewed-on: https://chromium-review.googlesource.com/1174571
Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
2018-08-14 14:12:51 +00:00
Gabriele Svelto
16e08520e6 Add support for parsing the DW_AT_ranges attributes
This enables the DWARF reader to properly parse DW_AT_ranges attributes
in compilation units and functions. Code covered by a function is now
represented by a vector of ranges instead of a single contiguous range
and DW_AT_ranges entries are used to populate it. All the code and tests
that assumed functions to be contiguous entities has been updated to
reflect the change. DW_AT_ranges attributes found in compilation units
are parsed but no data is generated for them as it is not currently needed.

BUG=754

Change-Id: I310391b525aaba0dd329f1e3187486f2e0c6d442
Reviewed-on: https://chromium-review.googlesource.com/1124721
Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
2018-08-13 19:12:00 +00:00
Joshua Peraza
7b98edabb6 Set new ARM64 context flags
Change-Id: I4749459ec37b076b226fa734824380a7254f1064
Reviewed-on: https://chromium-review.googlesource.com/1163826
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-06 18:02:41 +00:00
Joshua Peraza
f12b689789 processor: Fix memory leak after 88d8114f
This was mistakenly deleted in
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1155938/12

Change-Id: I95e5d84b36e2f89a7a364ee278ccb128b7d34b50
Reviewed-on: https://chromium-review.googlesource.com/1159525
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-02 00:02:10 +00:00
Joshua Peraza
88d8114fda Define and use a a new MDRawContextARM64
This struct matches the layout defined by Microsoft and replaces
Breakpad's MDRawContextARM64_Old. This CL updates the processor to
understand either the old or new structs, but clients continue to write
the old structs.

Change-Id: I8dedd9ddb2ec083b802723b9ac87beb18d98edbd
Reviewed-on: https://chromium-review.googlesource.com/1155938
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-01 19:27:25 +00:00
Joshua Peraza
627ef0cb9c Rename MDRawContextARM64 and its context flags
This makes way for the addition of a struct matching Microsoft's layout
for ARM64.

Change-Id: I115f25290863e7438852691d1ec3c9324a42f7a5
Reviewed-on: https://chromium-review.googlesource.com/1152158
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-08-01 19:26:38 +00:00
Joshua Peraza
948ce04ed7 mac: Fix broken xcode projects
Change-Id: I1cd8f0b0224c9b629dda720c11f6c081b175f8bd
Reviewed-on: https://chromium-review.googlesource.com/1157121
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-07-31 18:52:20 +00:00
Ivan Penkov
9fecc95c72 Add path_helper.cc and path_helper.h to dump_syms.xcodeproj.
Fixes a build break of dump_syms with Xcode.

Patch provided by Hiroyuki Komatsu.

Change-Id: I3bd3772060afee9f78dc99c75cd94f96a56c7617
Reviewed-on: https://chromium-review.googlesource.com/1144604
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-07-24 17:12:32 +00:00
Joshua Peraza
ecbbfbeb9d Update lss to a89bf7903f3169e6bc7b8efc10a73a7571de21cf
a89bf79 Remove sysconf override
4ce4c48 fix return value in pipe polyfill

Change-Id: Icf9cf8b50f3d48b02a5aa21d6ff6b4dfd0300b82
Reviewed-on: https://chromium-review.googlesource.com/1132459
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-07-10 22:34:03 +00:00
Joshua Peraza
c79e349bec ios: Fix build of exception_handler_no_mach
Change-Id: I2a9f85e78f6d3189f018824ad98e39af30d2ecf8
Reviewed-on: https://chromium-review.googlesource.com/1129465
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2018-07-09 19:25:39 +00:00
Joshua Peraza
5dc88243a6 Use hash_map and hash_set from __gnu_cxx
Change-Id: Ia8521e5cfd8424c5dec247503532454eb8806c48
Reviewed-on: https://chromium-review.googlesource.com/1129203
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2018-07-09 19:25:18 +00:00
Joshua Peraza
89e7a8615f iOS: disable using CFI in stackwalking
dump_syms produces incomplete CFI info on iOS because it doesn't support
converting compact unwind to Breakpad symbols. Attempting to use
incomplete CFI can result in infinte stack traces.

Bug: google-breakpad:764
Change-Id: Id042aa515d17928cb5503a79038607d95c56238d
Reviewed-on: https://chromium-review.googlesource.com/1128252
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2018-07-06 21:22:45 +00:00
Lei Zhang
79ba6a494f Ignore duplicate module list entries.
BUG=chromium:838322

Change-Id: Ie19c1a39e49332b650a618758f925b127026bddf
Reviewed-on: https://chromium-review.googlesource.com/1115437
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-06-28 00:20:21 +00:00
Lei Zhang
fac0e886c8 Only do Android-specific adjustments for Android minidumps.
Change-Id: I33b1f988766f79b473127c4b56b1c81021b89631
Reviewed-on: https://chromium-review.googlesource.com/1115436
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-06-28 00:20:01 +00:00
Lei Zhang
d531e1b2ba Refactor code out of MinidumpModuleList::Read().
Add a StoreRange() helper method and an IsDevAshmem() helper function.

Change-Id: Iaec9dee1e08bd0155f1c33cfe9af722b0dcaef31
Reviewed-on: https://chromium-review.googlesource.com/1114188
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-06-28 00:19:24 +00:00
Lei Zhang
d0241bb91c Add an anonymous namespace in minidump.cc.
Change-Id: I1b064013b5d6253fe887245ebda7a861688d3cd6
Reviewed-on: https://chromium-review.googlesource.com/1114089
Reviewed-by: Will Harris <wfh@chromium.org>
2018-06-28 00:18:51 +00:00
Mike Hommey
69c2c51dd8 Fall back to the raw symbol name from DW_AT_MIPS_linkage_name when there is nothing else
When DW_AT_MIPS_linkage_name doesn't demangle, breakpad currently throws
the symbol completely, but in some cases, there is no DW_AT_name or
DW_AT_abstract_origin to figure out a name, and the raw value from
DW_AT_MIPS_linkage_name is still better than nothing. Fall back to that
in when there is nothing else.

R=ted@mielczarek.org

Change-Id: I5cc7580244f2b99f5f1f279d09b904031cae1a37
Reviewed-on: https://chromium-review.googlesource.com/1082176
Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
2018-06-19 10:44:10 +00:00
Aaron Dierking
7b3afa9258 Avoid endl when writing symbol files
endl flushes output after each line. Using "\n" instead significantly improves
I/O efficiency.

Change-Id: If6a5549fc3613ca3a7c9a71838ec36c5b7a20580
Reviewed-on: https://chromium-review.googlesource.com/1077626
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-30 19:05:54 +00:00
Max Moroz
27c001192b Add SEVERITY_CRITICAL to logging, that would help to suppress logs from the fuzz target.
Follow-up CL will be https://chromium-review.googlesource.com/c/chromium/src/+/1073395

Bug: 846721
Change-Id: Ie9e6dc5c5ef6b035c414fbdc4f711f995b52f4d7
Reviewed-on: https://chromium-review.googlesource.com/1073394
Reviewed-by: Will Harris <wfh@chromium.org>
2018-05-29 19:24:32 +00:00
Lei Zhang
9eac2058b7 Read Linux si_code in minidump_processor.
For common signals: SIGILL, SIGFPE, SIGSEGV, and SIGBUS.

Change-Id: I80048f70445c3fa6accd548704c5700b3bed12a4
Reviewed-on: https://chromium-review.googlesource.com/1012589
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2018-04-13 18:59:09 +00:00
Sergey Abbakumov
c83fcf6470 Initialize variables for MSAN
The variables in the CL are not initialized. Even if it's safe not to
initialize them here, MSAN doesn't know that.

Bug: 394028
Change-Id: I597a7d76aa19d5789decd0f85150fa31c9655269
Reviewed-on: https://chromium-review.googlesource.com/1001573
Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-04-10 17:13:20 +00:00
Lei Zhang
adcc90ddb8 Linux: Write out si_code for SIGBUS exceptions.
Store the information in the exception record's exception_information
field.

Change-Id: Ie215cae2f070fdab63c3d05cc1bc4fb4b7b095fa
Reviewed-on: https://chromium-review.googlesource.com/990799
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-04-03 16:35:14 +00:00
Takuto Ikuta
e93f852a3c Add missing header for free function
Change-Id: I8ff2dcb546849493f2883777895341e043e44fb3
Reviewed-on: https://chromium-review.googlesource.com/981965
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-27 14:57:55 +00:00
Ted Mielczarek
2d80611fed Allow minidump_dump to print module lists that would normally be rejected
for being too long.

We've seen some minidumps that fail to process because they contain
a ridiculous number of modules (usually due to something leaking shm
mappings, it looks like). They're annoying to investigate because even
minidump_dump fails to load and print the module list. This patch makes
minidump_dump effectively remove the limit on the number of modules it
will load, so inspecting the dump by hand is possible.

R=vapier@chromium.org

Change-Id: I7a55387ca4aaad8664cd4d2651052da989366027
Reviewed-on: https://chromium-review.googlesource.com/957130
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-03-12 09:59:33 +00:00
Daniel Bratell
88e9a460de Fixing incorrect include guard (missing #define)
Noticed while adding an include guard presubmit check in
Chromium.

Change-Id: I9e677412d881b32a58d695208045b575bb8f8be6
Reviewed-on: https://chromium-review.googlesource.com/934448
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-23 14:30:08 +00:00
Lars Volker
49907e1c34 Fix Travis build by running tests as root
A recent configuration change made it necessary to run our tests on
Travis as root.

This change also increases the timeout of ParallelChildCrashesDontHang
to make it pass in Travis virtualized containers.

Bug: google-breakpad:753
Change-Id: I6ca8ff4513c6ea3e0646f22457f28b5c4fca6654
Reviewed-on: https://chromium-review.googlesource.com/890564
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2018-02-20 11:08:52 +00:00
Adam Harrison
6bb6c9b26a Fix crash when an NSException is thrown.
old_handlers is zeroish whenever an NSException is thrown. This caused PROT_WRITE to never be set and resulted in an EXC_BAD_ACCESS when trying to set the handler to NULL.

Change-Id: Ibb7da448204431c7602b1001f3a5216303c4c9d1
Reviewed-on: https://chromium-review.googlesource.com/899907
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-02 20:18:46 +00:00
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