Commit graph

1853 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Tobias Sargeant
c4335f0435 Fix memory leak in ppc64 stackwalker
BUG=757166

Change-Id: I967a6903332b9c3d16b583f7fa4d3c9c44c2f729
Reviewed-on: https://chromium-review.googlesource.com/643267
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-08-30 17:28:54 +00:00
Tobias Sargeant
2b3be5179e Add crash reason extraction to microdump processor
BUG=754715

Change-Id: I00fe62ed06dbbab4c8f6c416d56e2d444be11571
Reviewed-on: https://chromium-review.googlesource.com/621307
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-08-21 10:19:07 +00:00
Tobias Sargeant
b1e7ec065d Fix memory leak in ppc stackwalker
BUG=756317

Change-Id: Id096372e5a0d1e7c70e95304b1f0c181f57d3882
Reviewed-on: https://chromium-review.googlesource.com/619126
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-08-18 10:24:52 +00:00
Tobias Sargeant
38cbbfed71 Add crash reason and address to microdumps.
This will allow us to provide the right information for webview renderer
crashes. At the moment the crash information for the browser process is
captured (from the debuggerd output) instead.

BUG=754715

Change-Id: I409546311b6e38fe1cf804097c18d7bb2a015d83
Reviewed-on: https://chromium-review.googlesource.com/612381
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-08-14 09:49:51 +00:00
Lars Volker
1b704857f1 Increase maximum number of regions for minidump_stackwalk.
Change I361d8812df7b2977fe2630289059d31c3c9a4cc3 increased the maximum
number of threads for minidump_stackwalk. This change also increases the
maximum number of regions.

Change-Id: I61efd4453df8809bd9cd657546d1d6727cd10281
Reviewed-on: https://chromium-review.googlesource.com/588384
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-07-28 22:28:15 +00:00
Leonard Mosescu
01431c2f61 Handle very large stack traces
The main motivation for this change is to handle very large stack
traces, normally the result of infinite recursion. This part is
actually fairly simple, relaxing a few self-imposed limits on how
many frames we can unwind and the max size for stack memory.

Relaxing these limits requires stricter and more consistent checks for
stack unwinding. There are a number of unwinding invariants that apply
to all the platforms:

1. stack pointer (and frame pointer) must be within the stack memory
   (frame pointer, if preset, must point to the right frame too)
2. unwinding must monotonically increase SP
   (except for the first frame unwind, this must be a strict increase)
3. Instruction pointer (return address) must point to a valid location
4. stack pointer (and frame pointer) must be appropriately aligned

This change is focused on 2), which is enough to guarantee that the
unwinding doesn't get stuck in an infinite loop.

1) is implicitly validated part of accessing the stack memory
   (explicit checks might be nice though).
4) is ABI specific and while it may be valuable in catching suspicious
   frames is not in the scope of this change.
3) is also an interesting check but thanks to just-in-time compilation
   it's more complex than just calling 
   StackWalker::InstructionAddressSeemsValid() 
   and we don't want to drop parts of the callstack due to an overly
   conservative check.

Bug: chromium:735989

Change-Id: I9aaba77c7fd028942d77c87d51b5e6f94e136ddd
Reviewed-on: https://chromium-review.googlesource.com/563771
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-07-12 17:53:15 +00:00
Leonard Mosescu
5f112cb174 A couple of minor fixes
1. Fixing ExceptionHandlerTest.FirstChanceHandlerRuns:
   exit() is not an async-signal-safe function (http://man7.org/linux/man-pages/man7/signal-safety.7.html)

2. Fixing entry point signature in minidump_dump
  Changed "const char* argv[]" to "char* argv[]" to match the standard entry point signature

3. Updating .gitignore to exclude unit test artifacts

Change-Id: I9662898d0bd97769621fb6476a720105821c60f0
Reviewed-on: https://chromium-review.googlesource.com/562356
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-07-11 17:24:47 +00:00
Eric Holk
66856d617b Fix asan builds
When rolling this into Chrome, we got compile failures due to
DoNullPointerDereference being undefined but the new FirstChanceHandlerRuns
tests depends on this and was still defined.

The fix is to only enable the FirstChanceHandlerRuns test on non-asan builds.

Bug:
Change-Id: I5a3da0a21e2d0dd663ffc01137496d16905293a6
Reviewed-on: https://chromium-review.googlesource.com/544186
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-22 17:17:43 +00:00
Eric Holk
1628d99f7b Add first chance exception handler API
This change adds the option for Breakpad hosts to register a callback
that gets the first chance to handle an exception. The handler will 
return true if it handled the exception and false otherwise.

The primary use case is V8's trap-based bounds checking support for
WebAssembly.

Bug:
Change-Id: I5aa5b87d1229f1cef905a00404fa2027ee86be56
Reviewed-on: https://chromium-review.googlesource.com/509994
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-06-19 18:23:41 +00:00
Peter Collingbourne
94b6309aec Merge exec and non-exec segments while merging executable bit.
The bfd and gold linkers create segments like this: r/x, r/w where
the r/x segment covers the start of the ELF file.

lld's segments look like this: r, r/x, r/w where the r segment covers
the start of the ELF file.

So we cannot rely on the location of the r/x to tell where the start
of the ELF is. But we can still rely on the r and r/x mappings being
adjacent. So what we do is when we see an r segment followed by an r/x,
merge the r into the r/x and claim that it is executable. This way,
the minidump writer will continue to see a single executable segment
covering the entire executable.

Testing: "make check" passes when breakpad is compiled with
lld compiled from trunk (requires bug fix from LLVM r303689).

Also patched change into chromium and tested these builds:

$ cat args.gn
is_chrome_branded = true
is_debug = false
is_official_build = true
use_lld = true
allow_posix_link_time_opt = false
is_cfi = false

$ cat args.gn
target_os = "android"
target_cpu = "arm"
is_debug = false
is_official_build = true
is_chrome_branded = true

With both builds breakpad_unittests passes and
chrome/chrome_modern_public_apk create good minidumps after navigating
to chrome://inducebrowsercrashforrealz (checked that minidump contains
stack trace entry for content::HandleDebugURL).

Bug: chromium:716484
Change-Id: Ib6ed3a8420b83acf4a5962843930fb006734cb95
Reviewed-on: https://chromium-review.googlesource.com/513610
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2017-05-26 16:51:46 +00:00
Peter Collingbourne
08bea455d4 Teach the ELF parser to handle multiple PT_NOTE phdrs.
It is legal for an ELF to contain multiple PT_NOTEs, and that is in
fact what lld's output looks like.

Testing: "make check" and breakpad_unittests when patched into
chromium.

Bug: chromium:716484
Change-Id: I01d3f8679961e2cb7e789d4007de8914c6af357d
Reviewed-on: https://chromium-review.googlesource.com/513512
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Ted Mielczarek <ted@mielczarek.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-05-26 16:43:47 +00:00
Markus Stange
8880afb762 Make the cross-compilation glue for dump_syms Mac handle x86_64h.
x86_64h has a different cpusubtype from x86_64. The h is for Haswell.

BUG=

Change-Id: Icf884e5699fe120c12d13aa57cd62db5b69a2ce6
Reviewed-on: https://chromium-review.googlesource.com/457171
Reviewed-by: Ted Mielczarek <ted@mielczarek.org>
2017-05-26 16:03:39 +00:00
John Budorick
dc3ba60f0f Don't attempt to use PTRACE_GETREGS if it isn't defined.
Follow up to https://chromium-review.googlesource.com/c/484479/, which
does not compile on arm64.

Bug: chromium:725754
Change-Id: Iaa6fbc332564909a10e2602a1026c14fb25625f4
Reviewed-on: https://chromium-review.googlesource.com/515044
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-05-25 14:44:22 +00:00
Peter Collingbourne
fbfd41af5f Simplify ELF parser code.
The layout of Elf32_Nhdr and Elf64_Nhdr is the same, so remove
templating and code that extracts the elfclass from the ELF file.

Testing: "make check" and breakpad_unittests when patched into
chromium.

Bug: chromium:716484
Change-Id: I41442cfff48afc6ae1a5b604d22b67550a910376
Reviewed-on: https://chromium-review.googlesource.com/514450
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-05-25 00:14:08 +00:00
John Budorick
77305c3ae6 Wrap config.h include in HAVE_CONFIG_H.
Bug: breakpad:730
Change-Id: I5a24b96258e1114378061512239d3e18f3f753f0
Reviewed-on: https://chromium-review.googlesource.com/514283
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-05-24 20:44:03 +00:00
John Budorick
16f5b5f512 Use __NR_exit_group in MinidumpWriterTest.MinidumpStacksSkippedIfRequested.
Also adds waits for all child processes spawned in MinidumpWriterTest.

Bug: 725754
Change-Id: I3248925993dede2c113ab1989b322a9d9c8f24bd
Reviewed-on: https://chromium-review.googlesource.com/513480
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-05-24 16:05:24 +00:00
Lars Volker
ffe3e47865 Only use O_CLOEXEC on platforms that support it
Change a9fca58 made use of the O_CLOEXEC flag, which is not supported on
older Linux kernels. This change makes the use contingent on kernel
support.

Testing: I manually compiled breakpad on CentOS 5.8 running kernel
2.6.18-308.8.2.el5.centos.plusxen.

Bug: 730
Change-Id: I21dff928cfba3c156a56708913f65a0c7b5396a6
Reviewed-on: https://chromium-review.googlesource.com/498528
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-05-10 21:32:37 +00:00
Lars Volker
54a54702a1 Fix race in ExceptionHandler::GenerateDump()
When writing a minidump on Linux, we called clone() in
linux/handler/exception_handler.cc with the CLONE_FILES flag. If the
parent process died while the child waited for the continuation signal,
the write side of the pipe 'fdes' stayed open in the child. The child
would not receive a SIGPIPE and would wait forever.

To fix this, we clone without CLONE_FILES and then close the
read-side of fdes in the master before the ptrace call. That way, if the
master dies, the child will receive a SIGPIPE and will die, too.

To test this I added a sleep() call before SendContinueSignalToChild()
and then killed the master, manually observing that the child would die,
too.

Bug: 728
Change-Id: Ifd72de835a34e7d9852ae1a362e707fdc6c96c7e
Reviewed-on: https://chromium-review.googlesource.com/464708
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-05-10 18:02:37 +00:00
Andrew Ermakovich
67649c6185 Fixing breakpad on old linux kernel
Try to read the trace's registers by PTRACE_GETREGS if kernel doesn't support PTRACE_GETREGSET.

Bug:

Change-Id: I881f3a868789747ca217f22a93370c6914881f9a
Reviewed-on: https://chromium-review.googlesource.com/484479
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-04-21 17:28:03 +00:00
Gabriele Svelto
a9fca58305 Make minidump name generation on Linux as random as possible
This patch ensures that two crashes taken within the same second have
different minidump names. The random characters used in the minidump
filename are now read from /dev/urandom where possible or generated via
arc4random(). If neither is available we fall back to regular rand() but
mixing the address of an object to the current time when generating the
random seed to make it slightly less predictable.

BUG=681

Change-Id: I2e97454859ed386e199b2628d6b7e87e16481b75
Reviewed-on: https://chromium-review.googlesource.com/445784
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-04-12 18:51:24 +00:00
Robert Sesek
aa7115cfde Dump MH_DYLINKER images in upload_system_symbols.
Change-Id: I18291efe211f88ae0607a9055d027b520ef13291
Reviewed-on: https://chromium-review.googlesource.com/462676
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-30 03:31:20 +00:00
Tobias Sargeant
846b6335c5 Treat the process stack as the top of memory for free space histograms.
Because we can't determine the top of userspace mappable memory
directly, we rely on the fact that the process stack is allocated at the
top of the address space (minus some randomization). Anything after that
should not count as free space.

BUG=695382

Change-Id: I68453aac9732c2bd4b87236b234518068dec6640
Reviewed-on: https://chromium-review.googlesource.com/446100
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2017-03-29 10:42:31 +00:00
Lars Volker
219d0b15c4 Increase maximum number of threads for minidump_stackwalk.
BUG=

Change-Id: I361d8812df7b2977fe2630289059d31c3c9a4cc3
Reviewed-on: https://chromium-review.googlesource.com/459010
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-03-28 19:41:00 +00:00
Mike Frysinger
7a8374fc4c minidump_dump: fix up init paths
Fix some build & test failures in the previous minidump_dump code.

BUG=chromium:598947

Change-Id: Ia8fce453265167368de96747a8a92af930e78245
Reviewed-on: https://chromium-review.googlesource.com/458881
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-03-25 01:37:18 +00:00
Mike Frysinger
e1b3620ec7 minidump_dump: dump stack memory like hexdump
The current stack output is one line byte string which is not easy for
humans to parse.  Extend the print mode to support a hexdump-like view
and switch to that by default.  Now we get something like:
Stack
00000000  20 67 7b 53 94 7f 00 00  01 00 00 00 00 00 00 00  | g{S...........|
00000010  00 70 c4 44 9a 25 00 00  08 65 7a 53 94 7f 00 00  |.p.D.%...ezS...|

BUG=chromium:598947

Change-Id: I868e1cf4faa435a14c5f1c35f94a5db4a49b6a6d
Reviewed-on: https://chromium-review.googlesource.com/404008
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-24 16:22:21 +00:00
Mike Frysinger
117aa25107 minidump_dump: add proper cli processing
In preparation for adding more flexibility to this tool, add a
proper parser for the command line flags.  This uses the style
as seen in other breakpad tools.

BUG=chromium:598947

Change-Id: I95495e6ca7093be34d0d426f98a6c22880ff24a3
Reviewed-on: https://chromium-review.googlesource.com/457019
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-24 16:21:48 +00:00
Gordana Cmiljanovic
eb6c296472 Remove unused typedef
This removes unused typedef left in change:
https://chromium-review.googlesource.com/c/447697/
and fixes error:
dump_symbols.cc:613:35: error: unused typedef 'Word' [-Werror,-Wunused-local-typedef]

Change-Id: Ib5a82cd8af9a58ebf173b0f338fa9ad341819ef3
Reviewed-on: https://chromium-review.googlesource.com/459518
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-24 14:02:02 +00:00
Tobias Sargeant
0b7c2ea698 Fix ASSERT_EQUAL that should have been ASSERT_EQ.
BUG=703599

Change-Id: I5623705edc41644495aa4f2389056d255e22da8e
Reviewed-on: https://chromium-review.googlesource.com/459617
Reviewed-by: Primiano Tucci <primiano@chromium.org>
2017-03-24 12:05:43 +00:00
Tobias Sargeant
97483928cc Don't generate minidump if crash thread doesn't ref principal mapping.
If the crashing thread doesn't reference the principal mapping we can
assume that not only is that thread uninteresting from a debugging
perspective, the whole crash is uninteresting. In that case we should
not generate a minidump at all.

BUG=703599

Change-Id: Ia25bbb8adb79d04dcaf3992c3d2474f3b9b1f796
Reviewed-on: https://chromium-review.googlesource.com/457338
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-03-23 15:16:01 +00:00
Joshua Peraza
6cfdde4b91 Sanity check frame pointer while stackwalking
BUG=

Change-Id: Ib9b0fd5ba7f829f8be8cf856ab371c6540279ee5
Reviewed-on: https://chromium-review.googlesource.com/458526
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-03-22 23:23:25 +00:00
Joshua Peraza
124035f4fb Use string instead of std::string
BUG=

Change-Id: I06d1a836f8ff59a6abb7e420cd35fe52610ce091
Reviewed-on: https://chromium-review.googlesource.com/457872
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-03-22 23:22:40 +00:00
Gordana Cmiljanovic
77411db895 [MIPS] Get (ptrace) value of $pc for a thread
This change is fixing LinuxPtraceDumperTest.SanitizeStackCopy
test case.

Change-Id: I1eb3becfd4b3660bc5529b5d2a5e35db0b6eb6e0
Reviewed-on: https://chromium-review.googlesource.com/458277
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-22 12:47:06 +00:00
Mike Frysinger
0a57d7a32b dump_context: arm: name the registers in the dump output
The current ARM minidump_dump output makes people remember or look up
how registers are mapped in the ISA.  Let's use human friendly names
instead so they don't have to.

Currently it looks like:
MDRawContextARM
  context_flags       = 0x40000006
  iregs[ 0]            = 0x3c48b000
  iregs[ 1]            = 0x3
  iregs[ 2]            = 0x20
  iregs[ 3]            = 0x0
  iregs[ 4]            = 0x1c
  iregs[ 5]            = 0x3c48b000
  iregs[ 6]            = 0x20
  iregs[ 7]            = 0x3c48b04c
  iregs[ 8]            = 0x39100611
  iregs[ 9]            = 0x1c
  iregs[10]            = 0x0
  iregs[11]            = 0xbe61c200
  iregs[12]            = 0xfb9c1fec
  iregs[13]            = 0xbe61bd28
  iregs[14]            = 0x39e19b1c
  iregs[15]            = 0x357dd74c
  cpsr                = 0x680b0010
  float_save.fpscr     = 0x0

Now it looks like:
MDRawContextARM
  context_flags        = 0x40000006
  r0                   = 0x3c48b000
  r1                   = 0x3
  r2                   = 0x20
  r3                   = 0x0
  r4                   = 0x1c
  r5                   = 0x3c48b000
  r6                   = 0x20
  r7                   = 0x3c48b04c
  r8                   = 0x39100611
  r9                   = 0x1c
  r10                  = 0x0
  r11                  = 0xbe61c200
  r12                  = 0xfb9c1fec
  sp                   = 0xbe61bd28
  lr                   = 0x39e19b1c
  pc                   = 0x357dd74c
  cpsr                 = 0x680b0010
  float_save.fpscr     = 0x0

BUG=chromium:665083

Change-Id: I46d87c4ff7303a7efcd60da1d0b67ae7a5465c8f
Reviewed-on: https://chromium-review.googlesource.com/457197
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2017-03-18 03:04:26 +00:00
Jon Turney
0c3b559653 Fix sporadic failure of InstructionPointerMemory test on Windows
If another memory region of interest (e.g. a thread stack) randomly happens
to lie immediately before the page allocated by this test, the memory
regions can be coalesced in the minidump generated.  Relax this test so it
correctly handles the case where the expected 256 bytes around the IP aren't
at the start of the minidump memory region.

Alternatively, that could be avoided by reserving the page before the page
used for this test, in which case this test is degenerate with
InstructionPointerMemoryMinBound and can be removed.

BUG=

Change-Id: Ib1bfb242b2c0acaa090df68334a02ac434ad880c
Reviewed-on: https://chromium-review.googlesource.com/456702
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-03-17 19:15:06 +00:00
Jon Turney
4bb0cd4743 Fix issues with Windows dump_syms_unittest
* Turn DumpSymsRegressionTest into a parameterized test so it's easier to
see which test file is failing

* Convert dump_syms_regtest.sym to DOS line endings, being careful to
preserve the required spaces at the end of 'STACK WIN' lines

* In test #4 (omap_reorder_bbs), since the .exe corresponding to the .pdb is
not present, no INFO line is generated in the .sym file.  Update .sym file.

* Stop collecting stderr from dump_syms.  Future work: perhaps it's worth
collecting stderr to compare with a different file to verify that "Couldn't
locate EXE or DLL file" is output when expected?

* Regenerate testdata for test #5 (dump_syms_regtest64), which currently
does not pass, seemingly due a mis-match in the PDB age between the .pdb
file and the .sym file.  Also add the .exe corresponding to the .pdb
present, to provide CFI

BUG=

Change-Id: I54fab866437c9e1bad3a5534cef4fe4b6ae47cd2
Reviewed-on: https://chromium-review.googlesource.com/453178
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-03-17 17:49:55 +00:00
Dragan Mladjenovic
796a6c9baf [MIPS]: Don't terminate stackwalk when $sp value doesn't change between frames
Currently on MIPS we accidentally terminate stackwalk if $sp value doesn't change between frames 
which results in incomplete callchain terminated at the point of first tailcall encountered.

Change-Id: I8f1ed1df958d8f0a9eb11fd7800062184d8f1ee2
Reviewed-on: https://chromium-review.googlesource.com/449755
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-16 15:59:05 +00:00
Jon Turney
7ec3caf6c7 Fix Windows client ExceptionHandlerTest tests
ExceptionHandlerTest.InvalidParameterMiniDumpTest and
ExceptionHandlerTest.PureVirtualCallMiniDumpTest both also exercise a
feature that if the MiniDumpWithFullMemory MINIDUMP_TYPE is used, both
UUID.dmp and UUID-full.dmp files are written.

This is currently broken, and requesting a minidump with
MiniDumpWithFullMemory MINIDUMP_TYPE fails, as the file handle for the full
dump is not set.

Call GenerateFullDumpFile() if MiniDumpWithFullMemory is requested, to
generate a filename for the full dump file and set the file handle.

Currently GenerateFullDumpFile() also generates another UUID for the full
dump filename, so also make the private method
MinidumpGenerator::GenerateDumpFilePath() idempotent (so the same UUID is
reused)

(Note that calling Generate(|Full)DumpFile() more than once is not
permitted, so there's no behaviour where this changed the UUID to preserve)

BUG=

Change-Id: I74304f38b398f53da1c24f368dedfba8463da9e5
Reviewed-on: https://chromium-review.googlesource.com/452978
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-03-11 20:58:29 +00:00
Roman Margold
dac2223398 iOS client identifies itself via URL params
For iOS apps, product and version information is 
now automatically provided as part of the crash 
report upload URL to allow for early rejections.

Change-Id: Ia19c490c38023f9e23ec8a537f7a203ff1e642d7
Reviewed-on: https://chromium-review.googlesource.com/436164
Reviewed-by: Roman Margold <rmargold@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-03-10 18:30:14 +00:00
George Kola
a784e84497 Use NSURLSession if the min version we support is iOS 7+.
Because many apps still support iOS 8, they were defaulting to
deprecated NSURLConnection even if the code ran on iOS 10.
NSURLConnection requires a run loop and hence the code did not
always upload if the queue ran on a thread without a Run Loop.
This should improve break pad uploads

BUG=

Change-Id: I7bff80ea977fd1ab13c8812ed933ef842dab417f
Reviewed-on: https://chromium-review.googlesource.com/451880
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-09 16:11:07 +00:00
Joshua Peraza
5dbd93a0f8 Fix segfault when interpreting bad debug_file
BUG=chromium:661037

Change-Id: Ia4da0bd9787c232a6a199cfdfccfbed60c2515c2
Reviewed-on: https://chromium-review.googlesource.com/450090
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-03-08 21:31:16 +00:00
Dragan Mladjenovic
32a9e03835 [MIPS]: Relax dwarf section loading to accept both PROGBITS and MIPS_DWARF section types
Change-Id: I0862d930d92687dee47daa8d4dc3a21524c1c893
Reviewed-on: https://chromium-review.googlesource.com/447697
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-03-07 16:09:40 +00:00
Maciej Pawlowski
d61d49b385 Fix dump_syms clang compilation on Windows
Clang complains about bad format strings (DWORD is an unsigned long, not
unsigned int) and signed/unsigned comparison.
This change is necessary for https://codereview.chromium.org/2712423002/

BUG=245456

Change-Id: I58da92d43d90ac535c165fca346ee6866dfce22e
Reviewed-on: https://chromium-review.googlesource.com/448037
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-03-02 13:32:02 +00:00
Scott Graham
88e5b2c880 win: Set LargeAddressAware on symupload
This was set manually on Chrome's built binary before
https://codereview.chromium.org/2173533002 but wasn't added to the build
file.

After this change:

c:\src\breakpad\src\src>dumpbin /headers tools\windows\symupload\Release\symupload.exe | grep large
                   Application can handle large (>2GB) addresses

This change only affects x86 builds.

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

Change-Id: I8f1bd5535af242edde51e70c60cf33b6170855ea
Reviewed-on: https://chromium-review.googlesource.com/447780
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-28 19:27:24 +00:00
Tobias Sargeant
ccf03c13eb Improve stack sanitization unittests.
Rather than relying on the process stack having all the things that
should/shouldn't be sanitized, create synthetic stacks to test all of
the important cases.

BUG=664460

Change-Id: I959266390e94d6fb83ca8ef11ac19fac89e68c31
Reviewed-on: https://chromium-review.googlesource.com/446108
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-24 19:59:03 +00:00
Scott Graham
19af23e3c0 Handle ntdll only emitting PUBLIC at func entry
This handles a case encountered in ntdll.dll symbols for Windows 7,
where a PUBLIC would be emitted only for the entry point to the
function. The body of the function, however, is split in a PGO-ish
fashion to another remote location in the binary. Because of this, there
were large gaps in the RVA space that would be attributed to the "last"
function that happened to have an entry point before the gap. In
practice, something like this:

0x100 Func1
0x110 Func2
0x120 Func3
0x130 Func4
...
0x800 LaterFuncs

The bodies of Func1/2/3 tend to be implemented as a fast-path check,
followed by a jmp to somewhere in the range between 0x130 and 0x800.
Because no symbols are emitted for this range, everything is attributed
to Func4, causing crash misattribution.

In this CL, the change is: after emitting the entry point symbol, also
walk in the original OMAP entries through the untranslated binary, and
for each block until we resolve to a new symbol (via the same mechanism
as we found the entry point) emit another PUBLIC indicating that there's
another block that belongs to that symbol. This effectively breaks up
the "0x130 - 0x800" range above.

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

Change-Id: Ib3741abab2e7158c81e3e34bca4340ce4d3153a1
Reviewed-on: https://chromium-review.googlesource.com/446717
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-23 18:28:02 +00:00
Tobias Sargeant
4a7e088a27 Make stack sanitization elide pointers to non-executable mappings.
The address space of every Android Java process is approximately 50%
mapped, which means that sanitization tends to be ineffective because
most string fragments are plausibly pointers into some mapping.

For example, the zygote on 32 bit devices has the following mappings
made by dalvik and this covers all 4 byte strings starting with a
character between 0x13 and 0x52 (which includes all uppercase characters
up to and including 'R').

12c00000-12d16000
12d16000-32c00000
32c00000-32c01000
32c01000-52c00000

In order to perform stack unwinding we only need pointers into the stack
of the thread in question, and pointers to executable mappings. If we
reduce the set of considered mappings to those mappings alone, then only
~2% of the address space is left unelided.

BUG=664460

Change-Id: I1cc27821659acfb91d658f42a83a24c176505a88
Reviewed-on: https://chromium-review.googlesource.com/446500
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-23 17:47:47 +00:00
Tobias Sargeant
4af8174278 Use the correct PC when determining whether to skip storing a stack.
This addresses a bug in commit 049a1532 that meant that the PC of the
crashing thread was always used to determine whether to include a stack,
instead of using the PC of the thread in question.

BUG=664460

Change-Id: Idcbd5db751e5c00941a1be28607389961c0c75d7
Reviewed-on: https://chromium-review.googlesource.com/446499
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-23 17:47:07 +00:00
Mike Frysinger
4e82b6fa11 minidump: mark Read as override in derived classes
The base class here declares Read as virtual, so make sure it's
marked as override in the derived classes.  This fixes some build
errors with clang.

src/google_breakpad/processor/minidump.h:853:8: error:
  'Read' overrides a member function but is not marked 'override'
  [-Werror,-Winconsistent-missing-override]
  bool Read(uint32_t expected_size_);
       ^
src/google_breakpad/processor/minidump.h:153:16: note:
  overridden virtual function is here
  virtual bool Read(uint32_t expected_size) = 0;
               ^

Change-Id: Ie4e5fec097b7f37739433a9deb39e7ed60471461
Reviewed-on: https://chromium-review.googlesource.com/444385
Reviewed-by: Tobias Sargeant <tobiasjs@chromium.org>
2017-02-20 18:03:14 +00:00
Tobias Sargeant
fd28a5bbe9 Fix compile errors arising from compiling breakpad with clang.
These compile errors occur when building the check target with:
CXX=clang++-3.8
CXXFLAGS="-Werror -Wconstant-conversion -g -O2 -std=c++11"

src/processor/stackwalker_mips.cc:60:9: error: comparison of constant
  18446744073709551615 with expression of type 'bool' is always false
  [Werror,-Wtautological-constant-out-of-range-compare]
        > 0xffffffffffffffff) {
        ^ ~~~~~~~~~~~~~~~~~~
src/processor/stackwalker_mips.cc:68:66: error: comparison of constant
  4294967295 with expression of type 'bool' is always false
  [-Werror,-Wtautological-constant-out-of-range-compare]
    if ((memory_ && memory_->GetBase() + memory_->GetSize() - 1) > 0xffffffff) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~

Change-Id: I29eed8f4a67b9feeb274aa1fc6c79a019135e8d6
Reviewed-on: https://chromium-review.googlesource.com/438445
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-02-17 03:18:05 +00:00
Mike Frysinger
8ba59492ab libdisasm: add upstream/license details
The license file comes from the upstream libdisasm tarball/repo.

Change-Id: I04a4002db72f778dd67dbcd71d3b5d1205a8c21d
Reviewed-on: https://chromium-review.googlesource.com/441884
Reviewed-by: Ted Mielczarek <ted@mielczarek.org>
2017-02-14 11:07:42 +00:00
George Kola
96b79e9bf8 There is no need to use the main queue just for perform selector.
We were using the main queue to queue up a perform selector and then the code
[self sendStoredCrashReports] was immediately doing a dispatch_async.
This unnecessary thread switching is not needed.

We simplify the above logic and use dispatch_after to queue the block on
the
internal queue after a delay

Note that main queue is typically more loaded and it is better for
non-UI code
to not use the main queue. This may also help improve crash log upload.

This change also switches from @synchronized to dispatch_once as that is
faster
Reference:
http://googlemac.blogspot.com/2006/10/synchronized-swimming.html

BUG=

Change-Id: I81035149cbbf13a3058ca3a11e6efd23980f19ad
Reviewed-on: https://chromium-review.googlesource.com/441364
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-02-13 21:45:42 +00:00
Jon Turney
d4676b89a0 Appveyor CI for Windows MSVS build
Add a .gyp file for building all windows tools, and add hook to run gyp
to create corresponding .sln files.

This doesn't try to build for platform:x64.  This fails due to various
errors caused by the assumption that size_t can be converted to an unsigned
int without loss of information, which is not true on Windows x64 (LLP64),
where size_t is 64 bits, but int is only 32 bits.

There are test failures.  client_tests failures are as described in [1].
dump_syms_unittest are as discussed in the description of [2].

[1] https://bugs.chromium.org/p/google-breakpad/issues/detail?id=520
[2] https://codereview.chromium.org/1782453003

BUG=

Change-Id: I965244eb3746f87f30160fd0577e1cc9eb7a8b08
Reviewed-on: https://chromium-review.googlesource.com/441026
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2017-02-13 17:57:15 +00:00
Mike Frysinger
cc1deb4452 processor: drop set-but-unused variable
Change-Id: Idf3fe363c76734caa3e6a6cc20a53fd1d661188d
Reviewed-on: https://chromium-review.googlesource.com/438564
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-12 18:51:56 +00:00
Mike Frysinger
0e45a1268a macho_reader_unittest: use EXPECT_FALSE
This avoids compile time errors:
In file included from ./src/testing/googletest/include/gtest/gtest.h:1874:0,
                 from ./src/breakpad_googletest_includes.h:33,
                 from src/common/mac/macho_reader_unittest.cc:39:
src/common/mac/macho_reader_unittest.cc: In member function 'virtual void LoadCommand_SegmentBE32_Test::TestBody()':
./src/testing/googletest/include/gtest/internal/gtest-internal.h:133:55: error:
  converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
     (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
                                                       ^
...
src/common/mac/macho_reader_unittest.cc:1117:3: note: in expansion of macro 'EXPECT_EQ'
   EXPECT_EQ(false,                        actual_segment.bits_64);

Change-Id: I0cf88160dbe17b0feebed3c91ad65491b81023fd
Reviewed-on: https://chromium-review.googlesource.com/439004
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-12 18:51:38 +00:00
Mike Frysinger
2b7724245b windows: fix build on pre-Win10 systems
The use of DBG_PRINTEXCEPTION_WIDE_C was added for Win10 support,
but that define doesn't exist in older versions which means we fail
to build.  Put it behind an ifdef check to work everywhere.

Change-Id: Ibab8bddd5c19b4b50e356f59edeb3873c3104569
Reviewed-on: https://chromium-review.googlesource.com/441525
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-11 22:36:18 +00:00
Mike Frysinger
12f8ca4855 windows: update gtest/gmock paths
The Windows build has rotted a bit with the gtest/gmock updates.
Update all of the paths to fix things up again.

Change-Id: Id67ce76abfd331c0543aa4bd1138e9cc13a18c75
Reviewed-on: https://chromium-review.googlesource.com/441584
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-11 18:03:31 +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
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
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
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
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
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
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
Primiano Tucci
d269bd0f29 [Android] Update breakpad to NDK r11c.
BUG=599327
R=mark@chromium.org, primiano@chromium.org

Review URL: https://codereview.chromium.org/2025923003 .
2016-06-02 17:07:07 +01:00
Mike Frysinger
bad9e55ea5 fix signed warning errors in unittests
A bunch of gtest assert statements fail due to signed warnings as
unadorned constants are treated as signed integers.  Mark them all
unsigned to avoid that.

One example (focus on the "[with ...]" blocks that show the types):
In file included from src/breakpad_googletest_includes.h:33:0,
                 from src/common/memory_unittest.cc:30:
src/testing/gtest/include/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int]':
src/testing/gtest/include/gtest/gtest.h:1524:23: required from 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, const T2&, typename testing::internal::EnableIf<(! testing::internal::is_pointer<T2>::value)>::type*) [with T1 = int; T2 = long unsigned int; typename testing::internal::EnableIf<(! testing::internal::is_pointer<T2>::value)>::type = void]'
src/common/memory_unittest.cc:41:246: required from here
src/testing/gtest/include/gtest/gtest.h:1448:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   if (expected == actual) {
                ^
cc1plus: some warnings being treated as errors
Makefile:5180: recipe for target 'src/common/src_client_linux_linux_client_unittest_shlib-memory_unittest.o' failed
make[2]: *** [src/common/src_client_linux_linux_client_unittest_shlib-memory_unittest.o] Error 1

R=ted.mielczarek@gmail.com

Review URL: https://codereview.chromium.org/2013893003 .
2016-05-26 10:09:46 -04:00
Mike Frysinger
6368037ef2 elf_reader: drop unused zlib include
This breaks building for targets that don't include zlib.

BUG=chromium:604440
R=ivanpe@chromium.org

Review URL: https://codereview.chromium.org/2010803003 .
2016-05-25 16:38:04 -04:00
Veljko Mihailovic
71a5ee37a5 [MIPS] Rename variable mips to mips32
Renaming variable mips to mips32 since mips is already defined
by the toolchain.

BUG=Compile error in Chromium
R=mark@chromium.org

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

Patch from Veljko Mihailovic <veljko.mihailovic@imgtec.com>.
2016-05-25 10:13:18 -04:00
Ivan Penkov
79901bb99d Fixing an unused-variable warning in microdump_writer.cc
BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=699
R=mark@chromium.org, primiano@chromium.org

Review URL: https://codereview.chromium.org/2006333002 .
2016-05-24 12:08:25 -07:00
Lars Volker
f25a411200 Fix stack collection with size limit
src/client/linux/minidump_writer/minidump_writer.cc:273 obtains the
stack info by calling GetStackInfo(). That method will return the
stack base address, aligned to the bottom of the memory page that
'stack_pointer' is in. After that it will cap the size of the memory
area to be copied into the minidump to 'max_stack_len', starting from
the base address, if the caller requested so. This will be the case
when collecting reduced stacks, as introduced by this change:
https://breakpad.appspot.com/487002/

In such cases the caller will request 2048 bytes of memory. However
GetStackInfo() will have aligned the base address to the page
boundary, by default 4096 bytes. If the stack, which grows towards the
base address from the top ends before the 2048 bytes of the first
block, then we will not collect any useful part of the stack.

As a fix we skip chunks of 'max_stack_len' bytes starting from
the base address until the stack_pointer is actually contained in the
chunk, which we will add to the minidump file.

BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=695
R=ivanpe@chromium.org

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

Patch from Lars Volker <lv@cloudera.com>.
2016-05-24 11:49:35 -07:00
Tobias Sargeant
faeb1f9b2b Functions only called by DumpFreeSpace need to be conditionally compiled.
BUG=525938
R=mark@chromium.org

Review URL: https://codereview.chromium.org/2008553002 .
2016-05-23 18:58:48 +01:00
Primiano Tucci
adca10c8ff Add statistics about free space to microdump format.
When a crash occurs as a result of an allocation failure, it is useful
to know approximately what regions of the virtual address space remain
available, so that we know whether the crash should be attributed to
memory fragmentation, or some other cause.

BUG=525938
R=primiano@chromium.org

Review URL: https://codereview.chromium.org/1796803003 .
2016-05-23 16:06:26 +01:00
Yunlian Jiang
e35167de75 use another elf.h inside the package for common/dwarf/elf_reader
We tried to use common/android/include/elf.h, however it contains
'#include-next elf.h' so it still breaks MAC build. So we use
third_party/musl/include/elf.h instead.

BUG=none
TEST=make; make test passes. There is no '#include-next elf.h' in
     the new elf.h

R=michaelbai@chromium.org

Review URL: https://codereview.chromium.org/1994633003 .
2016-05-18 15:06:38 -07:00
Yunlian Jiang
9eb2c6fe6c Use elf.h inside the package.
MAC does not have elf.h, so use the elf.h inside the package instead
of the one in the system.
One failure example is
https://codereview.chromium.org/1978803003/

TEST=make; make check
BUG=
R=michaelbai@chromium.org

Review URL: https://codereview.chromium.org/1984713002 .
2016-05-18 12:56:22 -07:00
Ted Mielczarek
67d5567177 Don't let PDBSourceLineWriter::GetSymbolFunctionName return empty function names
It's possible for `IDiaSymbol::get_name` to return S_OK and provide
and empty string. I haven't figured out the exact root cause yet
(the symbols in question are coming from the Rust standard library),
but FUNC lines with missing function names break the processor and
so we should never do it. This change makes it output "<name omitted>"
which matches the behavior of the DWARF dumping code.

R=mark@chromium.org
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1272278

Review URL: https://codereview.chromium.org/1985643004 .
2016-05-16 12:30:59 -04:00
Tao Bai
a875991e73 Revert "Write adjusted range back to module"
This is no right fix, we shouldn't allow module overlap.

This reverts commit 4f417c8c0f.

BUG=606972
R=mark@chromium.org

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

Patch from Tao Bai <michaelbai@chromium.org>.
2016-05-13 12:45:44 -04:00
Dave MacLachlan
a84d4fc426 Replaced glibc version of elf.h with musl version of elf.h.
Updated dump_syms xcode project and ran tests.

BUG=
R=vapier@chromium.org

Review URL: https://codereview.chromium.org/1973113002 .
2016-05-12 14:22:59 -07:00
Dave MacLachlan
3d225e288c Fixes up dump_syms build on OS X so it works with ELF.
Adds elf.h header from glibc.
Updates dwarf2reader.cc so it isn't comparing a unique_ptr against NULL.
Moves from MacOS10.5 SDK to latest SDK for Xcode project.
Moves from using gcc to clang for dump_syms tests.
Disables warning about 'Missing Field In Structure Initializers' to temporarily work around https://bugs.chromium.org/p/google-breakpad/issues/detail?id=697.

With this patch all tests form dump_syms pass again using Xcode 7.3 on Mac OS X 10.11.

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

Review URL: https://codereview.chromium.org/1970903002 .
2016-05-12 11:38:09 -07:00
Dave MacLachlan
1bbe2f29c9 Update to handle dsym files that end with a header.
dsym files generated by Xcode for swift (Xcode 7.3) end with a header, and the
code did not handle that case.

BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=689
R=ivanpe@chromium.org

Review URL: https://codereview.chromium.org/1971793002 .
2016-05-11 14:10:23 -07:00
Yunlian Jiang
638066b82e breakpad: fix unittest errors
This fixes the unittest error caused by
https://codereview.chromium.org/1884283002/

TEST=unittest passes on falco board in ChromeOS.
BUG=
R=vapier@chromium.org

Review URL: https://codereview.chromium.org/1952083002 .
2016-05-04 16:48:00 -07:00
Yunlian Jiang
764c21f752 Add debug fission support.
This added debug fission support.
It tries to find the dwp file from the debug dir /usr/lib/debug/*/debug
and read symbols from them.

Most of this patch comes from
https://critique.corp.google.com/#review/52048295
and some fixes after that.
The elf_reader.cc comes from TOT google code. I just
removed some google dependency.

Current problems from this patch
1: Some type mismatch: from uint8_t * to char *.
2: Some hack to find the .dwp file. (replace .debug with .dwp)

BUG=chromium:604440
R=dehao@google.com, ivanpe@chromium.org

Review URL: https://codereview.chromium.org/1884283002 .
2016-05-04 11:09:44 -07:00
Mike Frysinger
b5712766f6 macho: fix printf type mismatches
The %ld expects a long signed integer, but we're passing in a size_t.
Use %zu which is an unsigned size_t type.

R=ted.mielczarek@gmail.com

Review URL: https://codereview.chromium.org/1951603002 .
2016-05-04 13:20:27 -04:00
Tao Bai
4f417c8c0f Write adjusted range back to module
In Android, the mmap could be overlapped by /dev/ashmem, we adjusted
the range in https://breakpad.appspot.com/9744002/, but adjusted
range isn't written back to module, this caused the corresponding
module be dropped in BasicCodeModules copy constructor.

This also fix a lot of 'unable to store module' warnings
when dumping Android's minidump.

BUG=606972
R=mark@chromium.org, wfh@chromium.org

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

Patch from Tao Bai <michaelbai@chromium.org>.
2016-05-03 18:14:28 -04:00
Primiano Tucci
fcb844ee32 Add parentheses to silence clang warning
crrev.com/1887033002 introuced a clang warning (see below).
This fixes it, so that breakpad can be rolled in chrome, where
warnings are always fatal.

From: https://build.chromium.org/p/tryserver.chromium.android/builders/android_chromium_gn_compile_dbg/builds/59031/steps/compile%20%28with%20patch%29/logs/stdio

FAILED: clang_x64/obj/breakpad/dump_syms/dwarf_cu_to_module.o
../../breakpad/src/common/dwarf_cu_to_module.cc:420:20: error: '&&' within '||' [-Werror,-Wlogical-op-parentheses]
if (declaration_ && qualified_name || (unqualified_name && enclosing_name)) {
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ ~~
../../breakpad/src/common/dwarf_cu_to_module.cc:420:20: note: place parentheses around the '&&' expression to silence this warning
if (declaration_ && qualified_name || (unqualified_name && enclosing_name)) {
                 ^
   (                             )

R=mark@chromium.org, petrcermak@chromium.org

Review URL: https://codereview.chromium.org/1928363002 .
2016-05-03 16:56:06 +02:00
Primiano Tucci
17ad0c18b1 Revert of Extend mapping merge to include reserved but unused mappings. (https://breakpad.appspot.com/7714003)
Reason for revert:
It is causing breakpad crash reports to be invalid (see the associated
bug).

Merging empty holes in r-x mappings was originally introduced in
https://breakpad.appspot.com/7714003 to deal with the first generation
of relro packing, which could introduce holes within a .so mapping:

  [libchrome.so]
  [guard region]
  [libchrome.so]

However, the logic is broken for the case of two *different* adjacent
.so mappings with a guard region in the middle:

  [libfoo.so]
  [guard region]
  [libchrome.so]

In this case the guard region is mistakenly associated with libfoo.so,
but that is not the right thing to do. In fact, the second generation of
rerlo packing added the guard region to prevent mmaps from overlapping
and to give room for the non-zero vaddr of relro-packed libraries, which
require an anticipated load bias.

As the first generation of relro packing is not used anymore, there is
no reason to keep this buggy code, which causes failures in decoding
crashes where an arbitrary library is mapped immediately before a rerlo
packed library.

Original issue's description:
> Extend mapping merge to include reserved but unused mappings.
>
> When parsing /proc/pid/maps, current code merges adjacent entries that
> refer to the same library and where the start of the second is equal to
> the end of the first, for example:
>
>   40022000-40025000 r-xp 00000000 b3:11 827        /system/lib/liblog.so
>   40025000-40026000 r--p 00002000 b3:11 827        /system/lib/liblog.so
>   40026000-40027000 rw-p 00003000 b3:11 827        /system/lib/liblog.so
>
> When the system linker loads a library it first reserves all the address
> space required, from the smallest start to the largest end address, using
> an anonymous mapping, and then maps loaded segments inside that reservation.
> If the loaded segments do not fully occupy the reservation this leaves
> gaps, and these gaps prevent merges that should occur from occurring:
>
>   40417000-4044a000 r-xp 00000000 b3:11 820        /system/lib/libjpeg.so
> > 4044a000-4044b000 ---p 00000000 00:00 0
>   4044b000-4044c000 r--p 00033000 b3:11 820        /system/lib/libjpeg.so
>   4044c000-4044d000 rw-p 00034000 b3:11 820        /system/lib/libjpeg.so
>
> Where the segments that follow this gap do not contain executable code
> the failure to merge does not affect breakpad operation.  However, where
> they do then the merge needs to occur.  Packing relocations in a large
> library splits the executable segment into two, resulting in:
>
>   73b0c000-73b21000 r-xp 00000000 b3:19 786460
> /data/.../libchrome.2160.0.so
> > 73b21000-73d12000 ---p 00000000 00:00 0
>   73d12000-75a90000 r-xp 00014000 b3:19 786460
> /data/.../libchrome.2160.0.so
>   75a90000-75c0d000 rw-p 01d91000 b3:19 786460
> /data/.../libchrome.2160.0.so
>
> Here the mapping at 73d12000-75a90000 must be merged into 73b0c000-73b21000
> so that breakpad correctly calculates the base address for text.
>
> This change enables the full merge by also merging anonymous maps which
> result from unused reservation, identified as '---p' with offset 0, and
> which follow on from an executable mapping, into that executable mapping.
>
> BUG=chromium:394703

BUG=chromium:499747
R=primiano@chromium.org, rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1923383002 .
2016-04-28 16:49:44 +01:00
Dave MacLachlan
8762c82297 Remove GTM_ENABLE_LEAKS and GTMGarbageCollection
Removes some archaic Google Toolbox For Mac features.

BUG=
R=ivanpe@chromium.org, mark@chromium.org

Review URL: https://codereview.chromium.org/1912473002 .
2016-04-21 13:20:17 -07:00
Ted Mielczarek
ea2e22b352 Make x86-64 frame pointer unwinding stricter
The x86-64 frame pointer-based unwind method will accept values
that aren't valid for the frame pointer register and the return address.
This fixes it to reject non-8-byte-aligned frame pointers, as
well as non-canonical addresses for the return address it finds.

A colleague of mine asked me why Breakpad gave a bad stack
for a crash in our crash-stats system:
https://crash-stats.mozilla.com/report/index/a472c842-2c7b-4ca7-a267-478cf2160405

Digging in, it turns out that the function in frame 0 is a leaf function,
so MSVC doesn't generate an entry in the unwind table for it, so
dump_syms doesn't produce a STACK CFI entry for it in the symbol file.
The stackwalker tries frame pointer unwinding, and %rbp is set to a
value that sort-of works, so it produces a garbage frame 1 and then
is lost. Either of the two checks in this patch would have stopped
the stackwalker from using the frame pointer.

It's possible we could do something smarter on the dump_syms side,
like enumerating all functions and outputing some default STACK CFI rule
for those that don't have unwind info, but that wouldn't fix crashes
from existing builds without re-dumping symbols for them. In any event,
these checks should always pass for valid frame pointer-using functions.

R=mark@chromium.org
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1263001

Review URL: https://codereview.chromium.org/1902783002 .
2016-04-19 15:20:09 -04:00
Ted Mielczarek
b39ab626ab Bump MinidumpMemoryRegion::max_bytes to 2MB
BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=694
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1883253002 .
2016-04-14 16:27:25 -04:00
Sebastien Marchand
d986b9d311 Add a missing const to an accessor.
R=ivanpe@chromium.org

Review URL: https://codereview.chromium.org/1882833004 .
2016-04-14 14:45:04 -04:00
Ted Mielczarek
2e266396ee Fix DWARF handling of inlined functions in namespaces
Currently an inlined function in a namespace in DWARF will
be given a name comprised of just `namespace::`. This is due
to a logic error in ComputeQualifiedName, where it doesn't
handle an empty `unqualified_name` properly.

We apparently have a fair number of these in our Mac builds,
an example of the DWARF that's being mishandled looks like:
0x117eda40:     TAG_namespace [5] *
                 AT_name( "js" )
                 AT_decl_file( "../../dist/include/js/Utility.h" )
                 AT_decl_line( 35 )

0x11808500:         TAG_subprogram [251] *
                     AT_low_pc( 0x0000000002f12110 )
                     AT_high_pc( 0x0000000002f1216b )
                     AT_APPLE_omit_frame_ptr( 0x01 )
                     AT_frame_base( rsp )
                     AT_abstract_origin( {0x0000000011800a4f}"_ZN2js40TraceManuallyBarrieredGenericPointerEdgeEP8JSTracerPPNS_2gc4CellEPKc" )
                      AT_MIPS_linkage_name( "_ZN2js40TraceManuallyBarrieredGenericPointerEdgeEP8JSTracerPPNS_2gc4CellEPKc" )
                      AT_name( "TraceManuallyBarrieredGenericPointerEdge" )
                      AT_decl_file( "/builds/slave/rel-m-rel-m64_bld-000000000000/build/js/src/gc/Marking.cpp" )
                      AT_decl_line( 547 )
                      AT_external( 0x01 )
                      AT_APPLE_optimized( 0x01 )
                      AT_inline( DW_INL_inlined )

This turned a few instances of this in the file I was testing on into
`<name omitted>`, which seems to just be a symptom of the
"DW_AT_abstract_origin comes later in the file" issue. (Which is probably
also worth fixing given that it occurs some 29k times when dumping
symbols from Firefox's XUL binary, but it's a separate issue.)

R=mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1887033002 .
2016-04-14 10:32:20 -04:00
Ted Mielczarek
fee47f4638 Add some new stream types to MDStreamType
I ran minidump_dump on a dump from Firefox on my Windows 10 machine
and noticed some streams that Breakpad didn't have names for.
Looking in minidumpapiset.h in the Windows 10 SDK finds these values
in MINIDUMP_STREAM_TYPE. There are also struct definitions for the
stream data for some of them (all but JavaScriptData), but I don't have
a particular need for those currently.

R=mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1884943002 .
2016-04-13 12:15:15 -04:00
Ted Mielczarek
205b5ac6ed Fix a dependency issue in automake
Doing a `make -jN check` from a fresh build breaks (and has probably been
broken for a while). linux_client_unittest_shlib is missing $(TEST_LIBS)
from its _DEPENDENCIES. The automake manual says if _DEPENDENCIES are not
specified they'll be computed from _LDADD, but we are specifying it and just
leaving out $(TEST_LIBS).

R=vapier@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1870733005 .
2016-04-12 14:55:18 -04:00
Mike Frysinger
2f1b7adcd3 tweak IGNORE_RET behavior a bit
GCC will still warn about unused return value with the form:
	if (write(...));

Instead, change the semi-colon to an empty set of braces.

BUG=chromium:428478
TEST=build+test still works
2016-04-11 13:05:44 -04:00
David Yen
b0e5f26233 Added an option (-i) to have dump_syms output header information only.
It is often helpful to check if a particular symbol file dumped by
dump_syms actually matches a version of a binary file we have. The
symbol output contains an ID which can be used to see if it matches
the binary file. Unfortunately, this ID is internally calculated
and not a standard hash of the binary file. Being able to output the
header information only will allow users to determine whether their
symbol file is up to date or not.

R=jochen@chromium.org
BUG=561447

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

Patch from David Yen <dyen@chromium.org>.
2016-04-08 04:37:45 +02:00
Yunxiao Ma
32901f6d4c Remove unreferenced local variable which breaks build.
Depending on compiler's setting, the unreferenced local variable may
cause build break.

modified:   src/processor/minidump.cc

R=mark@chromium.org

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

Patch from Yunxiao Ma <yxma@google.com>.
2016-04-05 19:37:13 -04:00
Yunxiao Ma
46359276c8 Rename stdio.h wrapper file to stdio_wrapper.h.
Some projects will get build break because the comipler is confused when
searches for the standard stdio.h. Rename the wrapper file to avoid that.

renamed:    src/common/stdio.h -> src/common/stdio_wrapper.h
modified:   src/processor/minidump.cc
modified:   src/processor/dump_context.cc
modified:   src/processor/logging.cc
modified:   src/processor/minidump.cc
modified:   src/processor/minidump_processor.cc
modified:   src/processor/stackwalk_common.cc
modified:   src/processor/symbolic_constants_win.cc

R=mark@chromium.org, labath@google.com

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

Patch from Yunxiao Ma <yxma@google.com>.
2016-04-05 15:45:30 -04:00
Ted Mielczarek
6c8f80aa8b Switch the Linux minidump writer to use MDCVInfoELF for CV data.
This preserves full build ids in minidumps, which are useful for
tracking down the right version of system libraries from Linux
distributions.

The default build id produced by GNU binutils' ld is a 160-bit SHA-1
hash of some parts of the binary, which is exactly 20 bytes:
https://sourceware.org/binutils/docs-2.26/ld/Options.html#index-g_t_002d_002dbuild_002did-292

The bulk of the changes here are to change the signatures of the
FileID methods to use a wasteful_vector instead of raw pointers, since
build ids can be of arbitrary length.

The previous change that added support for this in the processor code
preserved the return value of `Minidump::debug_identifier()` as the
current `GUID+age` treatment for backwards-compatibility, and exposed
the full build id from `Minidump::code_identifier()`, which was
previously stubbed out for Linux dumps. This change keeps the debug ID
in the `dump_syms` output the same to match.

R=mark@chromium.org, thestig@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1688743002 .
2016-04-05 09:34:20 -04:00
Veljko Mihailovic
6ce752d741 Support processing microdump for mips architecture
Based on changes for ARM, ARM64 and X86, the support for
MIPS and MIPS64 is added in microdump.

TEST=microdump_stackwalk  ~/microdump-mips32.dmp symbols/
BUG=microdump_stackwalk failing for mips architectures

Review URL: https://codereview.chromium.org/1731923002/
2016-04-01 18:50:46 -04:00
Sebastien Marchand
d9c532217e Add the TID to the CallStack.
R=ivanpe@chromium.org

Review URL: https://codereview.chromium.org/1849933002 .
2016-04-01 10:11:10 -04:00
Li Yan
c77c51fae6 Refactor sym_upload in tools to extract code into common/linux, and minor fixes
to code calling libcurl. This change may be used to build a tool to dump and
upload symbols with multi-thread.

BUG=

R=mmandlis@chromium.org
CC=google-breakpad-dev@googlegroups.com

Review URL: https://codereview.chromium.org/1842113002 .
2016-03-30 13:46:21 -07:00
Ted Mielczarek
d091e5103f Make EXC_BAD_ACCESS / EXC_I386_GPFLT print nicely in the processor
Currently EXC_BAD_ACCESS doesn't support EXC_I386_GPFLT as
exception_flags for pretty-printing in the processor, but this happens
for a lot of things:
http://opensource.apple.com/source/xnu/xnu-2050.24.15/osfmk/i386/trap.c
(search for EXC_I386_GPFLT).

And we get a lot of these in the wild:
https://crash-stats.mozilla.com/search/?reason=%3DEXC_BAD_ACCESS+%2F+0x0000000d&cpu_name=amd64&_facets=signature&_facets=address&_columns=date&_columns=signature&_columns=product&_columns=version&_columns=build_id&_columns=platform&_columns=address#crash-reports

This patch makes them show up with a nice name instead of the current
"EXC_BAD_ACCESS / 0x0000000d".

Additionally, this patch fixes some other cases where x86-64 wasn't being handled in the same way as x86, and fixes some x86-specific exception flags to be stringified with I386 in the output.

R=mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1833123002 .
2016-03-29 15:32:47 -04:00
David Yen
512cac3a1b Have dump_syms output the full symbol table.
Some of the symbols in the stack trace are not found in the .dynsym
section but were located in the full symbol table .symtab section
instead. This was causing some of our stack traces to be incomplete or
point to incorrect function names.

Since we only output function names, there are actually not that many
more symbols located in .symtab that aren't in .dynsym. It is better to
simply output all symbols found so our stack traces are complete.

R=mark@chromium.org, thestig@chromium.org
BUG=561447

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

Patch from David Yen <dyen@chromium.org>.
2016-03-23 13:17:41 -04:00
Ivan Penkov
ebba1800e4 Explicitly call non-sized delete on dynamically sized memory for correct behavior under sized-delete.
The code as it stands allocates a chunk of memory of arbitrary size and places an object into it. It stores a pointer to that object and memory into a list telling the compiler that it is a pointer to a char.  When the compiler deletes the objects in the list it thinks that the list contains pointers to chars - not pointers to arbitrarily sized regions of memory.

This is fixing an issue that will reproduces when the following optimization (C++ sized dealocation) is enabled: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3536.html

The fix is to explicitly call the non-sized delete operator, and the library code that supports malloc/free/new/delete will figure out the size of the block of memory from the pointer being passed in.

Patch provided by Darryl Gove.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/1788473002 .
2016-03-11 16:37:46 -08:00
Jon Turney
139693446b Fix format warning in omap.cc
omap.cc(212): warning C4473: 'fprintf' : not enough arguments passed for format string

BUG=None
Review URL: https://codereview.chromium.org/1776613004
2016-03-10 08:51:20 -05:00
Primiano Tucci
8915f7be39 Don't merge the mappings if their exec bit are different.
BUG=585534
R=primiano@chromium.org

Review URL: https://codereview.chromium.org/1750033002 .
2016-03-08 08:46:00 +00:00
Dominik Laskowski
4d69050717 Add an optional root prefix to Linux dumpers
The Linux dumpers use absolute paths for shared libraries referenced by
dumps, so they fail to locate them if the crash originated in a chroot.
This CL enables callers to specify a root prefix, which is prepended to
mapping paths before opening them.

BUG=chromium:591792
TEST=make check
Review URL: https://codereview.chromium.org/1761023002/
2016-03-07 21:35:43 -05:00
Maria Mandlis
f3d28e9c4a Handle multiple microdumps in system log.
Properly handle microdump processing, when the system_log file contains an incomplete microdump section at the top. The processor will process the first complete microdump section.

R=primiano@chromium.org

Review URL: https://codereview.chromium.org/1742843002 .
2016-02-26 18:50:50 -08:00
Maria Mandlis
f97e47e55e Support processing microdumps for x86 architecture.
BUG=587536
R=primiano@chromium.org

Review URL: https://codereview.chromium.org/1704243002 .
2016-02-18 06:13:56 -08:00
Birunthan Mohanathas
25f913e981 Try loading msdiaNNN.dll if CoCreateInstance(CLSID_DiaSource) fails
Because tools/windows/symupload/symupload.cc uses `nullptr` (which
requires VS2010), the CLSID comparison is only performed for msdia100.dll
and later. When compiling with an older (or future) CLSID_DiaSource, we
retain the existing behaviour (i.e. fail if CoCreateInstance fails).

R=ivanpe@chromium.org
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1236343
2016-02-17 11:36:19 -05:00
Ted Mielczarek
7b25f70813 Fix buffer overrun in MinidumpModule::debug_identifier with MDCVInfoELF 2016-02-17 06:20:58 -05:00
Ivan Penkov
dee15c2547 Fixing a flaky Linux exploitability unittest.
BUG=https://code.google.com/p/chromium/issues/detail?id=584174
R=mmandlis@chromium.org

Review URL: https://codereview.chromium.org/1697963002 .
2016-02-16 11:46:04 -08:00
Ted Mielczarek
e132514d80 Ensure Linux minidump writer flushes minidump header early.
If the Linux minidump writer crashes while writing a dump, the dump
might contain some useful information, but the header will be empty
because TypedMDRVA's destructor flushes the data, and the header var
doesn't go out of scope until the end of the `Dump` method. This
fixes that problem by putting the header in a shorter block scope.

We've seen this problem in some Android dumps in the wild, like:
https://crash-stats.mozilla.com/report/index/cef5b777-02d1-43c2-bf40-133ab2160209

R=thestig@chromium.org
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1247978

Review URL: https://codereview.chromium.org/1696573003 .
2016-02-12 15:50:16 -05:00
Maria Mandlis
df280bb631 Parse additional line introduced in the microdump format and containing the GPU infromation in the following format:
G GL_VERSION|GL_VENDOR|GL_RENDERER.

The GPU version, vendor and renderer are extracted during microdump parsing and populated in the appropriate fields in the SystemInfo struct.

This is to match the changes introduced in crrev.com/1343713002 and crrev.com/1334473003

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

Review URL: https://codereview.chromium.org/1678463002 .
2016-02-11 10:04:04 -08:00
Lei Zhang
a8f79b0fde Revert "Added a switch to dump minidump modules in minidump_stackwalk."
This reverts commit cb936a0243c97ae9cd2d4bb19d95dde0421fed6d.

A=dyen@chromium.org
Original Review: https://codereview.chromium.org/1672773002/

R=dyen@chromium.org

Review URL: https://codereview.chromium.org/1688493003 .
2016-02-10 13:11:20 -08:00
Ted Mielczarek
4912669df1 Change MDCVInfoELF into something usable.
This patch changes MDCVInfoELF (which is currently unused, apparently
a vestigal bit of code landed as part of Solaris support) into a supported
CodeView format that simply contains a build id as raw bytes.

Modern ELF toolchains support build ids nicely:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/compiling-build-id.html

It would be useful to have the original build ids of loaded modules in
Linux minidumps, since tools like Fedora's darkserver allow querying by build
id and the current Breakpad code truncates the build id to the size of a GUID,
which loses information:
https://darkserver.fedoraproject.org/

A follow-up patch will change the Linux minidump generation code to produce
MDCVInfoELF in minidumps instead of MDCVInfoPDB70. This patch should be landed
first to ensure that crash processors are able to handle this format before
dumps are generated containing it.

The full build id is exposed as the return value of Minidump::code_identifier(),
which currently just returns "id" for modules in Linux dumps. For
backwards-compatibility, Minidump::debug_identifier() continues to treat
the build id as a GUID, so debug identifiers for existing modules will not
change.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1675413002 .
2016-02-10 09:00:02 -05:00
Sylvain Defresne
afa2539de4 Fix usage of deprecated method sendSynchronousRequest:returningResponse:error:.
The method -[NSURLConnection sendSynchronousRequest:returningResponse:error:]
has been deprecated in 10.11 OS X SDK and 9.0 iOS SDK without replacement. So
emulate a synchronous request by using an asynchronous request and waiting on
a semaphore for the request completion.

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

Review URL: https://codereview.chromium.org/1675243002 .
2016-02-08 17:39:44 +01:00
Sylvain Defresne
c4c887c34a Fix usage of deprecated method stringByAddingPercentEscapesUsingEncoding:.
The method -[NSString stringByAddingPercentEscapesUsingEncoding:] has been
deprecated with 10.11 OS X SDK and 9.0 iOS SDK. The recommended method is
-[NSString stringByAddingPercentEncodingWithAllowedCharacters:] available
since 10.9 OS X SDK and 7.0 iOS SDK.

Use the new method when available using URLQueryAllowedCharacterSet to get
the same encoded string.

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

Review URL: https://codereview.chromium.org/1680663002 .
2016-02-08 17:39:26 +01:00
Sylvain Defresne
f4012f5cd9 Fix usage of deprecated function CFPropertyListCreateFromXMLData.
The function CFPropertyListCreateFromXMLData is deprecated in favor of
the function CFPropertyListCreateWithData that is available since the
10.6 OS X SDK and 4.0 iOS SDK.

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

Review URL: https://codereview.chromium.org/1678063002 .
2016-02-08 17:38:33 +01:00
Mike Frysinger
76c51742c9 [mips64] Support for mips n64
Adding remaining mips n64 support including stackwalker.

BUG=None
TEST=manually tested on Linux/Android
R=vapier@chromium.org

Review URL: https://codereview.chromium.org/1418453011 .
2016-02-06 18:58:39 -05:00
Ivan Penkov
c199f5b122 Remove use of deprecated CFURLCreateDataAndPropertiesFromResource function.
Original change (https://codereview.chromium.org/1527363003/) was failing
in CFReadStreamGetBuffer() call, so changed to CFReadStreamRead() to be
more conservative.

Patch provided by Scott Hancher.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1637433003 .
2016-01-31 18:17:42 -08:00
Lei Zhang
815d51c343 Added a switch to dump minidump modules in minidump_stackwalk.
In order to figure out what symbols we need associated to a minidump,
it is useful to be able to dump all the modules the minidump contains.

A=dyen@chromium.org
Original Review: https://codereview.chromium.org/1651593002/
BUG=563716
R=dyen@chromium.org

Review URL: https://codereview.chromium.org/1650713002 .
2016-01-29 13:59:17 -08:00
Pavel Labath
442b45266d Improvements to GYP build
This updates the GYP build for the processor component (on windows).
- adds/removes references to files which were added or removed from the
  repository
- includes build/common.gypi in the gyp files: needed to correctly
  detect the OS (I think, the generated MSVC solutions were broken
  without it)
- conditionally compiles code platform-specific code for the given
  platform

After this minidump processor nearly compiles with VS2013: the generated
project is correct, but some files still have compilation errors.

Disclaimer: I have not tested the GYP changes on non-windows platform,
as there does not seem to be anyone using it there.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1643633004 .
2016-01-29 11:43:21 +00:00
Mike Frysinger
bc44efdc27 convert to uint8_t* for binary data to fix -Wnarrowing build errors
Newer gcc versions default to -Werror=narrowing when using newer C++
standards (which we do).  This causes issues when we try to stuff a
value like 0xea into a char -- the value is out of range for signed
char bytes.  That's when gcc throws an error:
.../bytereader_unittest.cc: In member function 'virtual void Reader_DW_EH_PE_absptr4_Test::TestBody()':
.../bytereader_unittest.cc:400:55: error: narrowing conversion of '234' from 'int' to 'char' inside { } [-Wnarrowing]

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

Review URL: https://codereview.chromium.org/1605153004 .
2016-01-26 15:38:19 -05:00
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
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
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
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
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
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
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
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
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
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
Primiano Tucci
4d06db5a1f Linux ExceptionHandler: don't allocate the CrashContext on the stack
On Android the size of the alternate stack can be very small (8k).
Even if breakpad uses sigaltstack to increase the size of the alternate
stack during initialization, that call affects only the main thread.
On Android, the libc's pthread initializer reset the sigaltstack to 8k.
When entering a signal handler, the kernel typically pushes the context
on the alternate stack. On arm64, sizeof(CrashContext) is ~5k, which
leaves 3k of usable stack for breakpad.
On top of that, breakpad allocates another struct CrashContext on the
stack. In the case of Android arm64, then, breakpad ends up using
5k + 5k > 8k of stack, which causes a stack overflow.
This got unnoticed in Android L, as the alternate stack didn't have
red-zones between them, so breakpad was often happily overflowing onto
the next thread's stack. This is not the case anymore [1].
This CL moves the CrashContext into a global variable. It should be
safe as the ExceptionHandlers are serialized on a mutex.

[1] 595752f623

BUG=374
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1354923002 .
2015-09-22 09:11:24 +01:00
Ted Mielczarek
3520fc314b Fixup a bad strcmp call landed in previous commit 2015-09-16 19:25:35 -04:00
Ted Mielczarek
8079ae192d Fix Mac Breakpad host tools to build in Linux cross-compile
We're working on building our Firefox Mac builds as a Linux cross-compile
(https://bugzilla.mozilla.org/show_bug.cgi?id=921040) and we need symbol
dumping to work. This change ports the Mac dump_syms tool to build and work
on Linux. I've tested it and it produces identical output to running the
tool on Mac.

The bulk of the work here was converting src/common/mac/dump_syms.mm and
src/tools/mac/dump_syms/dump_syms_tool.mm from ObjC++ to C++ and removing
their use of Foundation classes in favor of standard C/C++.

This won't compile out-of-the-box on Linux, it requires some Mac system
headers that are not included in this patch. I have those tentatively in
a separate patch to land in Gecko
(http://hg.mozilla.org/users/tmielczarek_mozilla.com/mc/rev/5fb8da23c83c),
but I wasn't sure if you'd be interested in having them in the Breakpad tree.
We could almost certainly pare down the set of headers included there, I
didn't spend too much time trying to minimize them (we primarily just need
the Mach-O structs and a few associated bits).

I just realized that this patch is missing updating the XCode project files
(ugh). I'll fix that up in a bit.

R=mark@chromium.org
BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=543111

Review URL: https://codereview.chromium.org/1340543002 .
2015-09-16 06:46:55 -04:00
Mike Frysinger
1dcec01445 solaris: fix spurious ;
As reported in the issue tracker, building on Solaris 8 fails:
.../src/common/solaris/guid_creator.cc:69: error: extra `;'

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

Review URL: https://codereview.chromium.org/1333243002 .
2015-09-11 12:59:53 -04:00
Will Harris
2d450f312b Fix regression on x86 for "Fix compile error with Windows clang"
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/1318013002 .
2015-09-03 16:38:57 -07:00
mmandlis@chromium.org
3f4d090d70 The "CPU architecture" field is being filled from the wrong part of
the microdump. The microdump OS/arch line looks like:
O A arm 04 armv7l 3.4.0-perf-g4d6e88e #1 SMP PREEMPT Mon Mar 30 19:09:30 2015
and currently the field that says "armv7l" or "aarch64" is being used
to fill in the CPU arch field in crash. The problem is that on a
64-bit device this field *always* says "aarch64" even when running in
a 32-bit process, and so currently the crash reports for aarch64 are
a mix of 32-bit and 64-bit crashes. We should be using the first field
instead, which just says "arm" or "arm64" and reflects the actual
version of webview (32-bit or 64-bit) which is running.

BUG=
R=primiano@chromium.org

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

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1498 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-26 16:18:52 +00:00
Liu.andrew.x@gmail.com
f073540795 Add check for Linux minidump ending on bad write for exploitability rating.
If a crash occurred as a result to a write to unwritable memory, it is reason
to suggest exploitability. The processor checks for a bad write by
disassembling the command that caused the crash by piping the raw bytes near
the instruction pointer through objdump. This allows the processor to see if
the instruction that caused the crash is a write to memory and where the
target of the address is located.

R=ivanpe@chromium.org

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

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1497 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-21 16:22:19 +00:00
ted.mielczarek@gmail.com
ee2d76fe90 Don't use strtok_s for mingw builds
R=ivanpe at https://codereview.chromium.org/1292503005/


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1496 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-20 15:09:16 +00:00
rmcilroy@chromium.org
8e8be001cb Add user_regs_struct and user_fpsimd_struct for aarch64 on Android.
Android's sys/user.h is missing user_regs_struct and user_fpsimd_struct.
Add them to the Android specific user.h used by breakpad to workaround
Android / glibc compatibility issues.

A bug has been filed on the Android NDK team to add the missing structures to
the NDK, at which point this hack can be removed.

Also remove the mxcsr_mask hack on x64, which is no longer required since
we have moved to the r10d NDK which fixes this issue.

R=primiano@chromium.org

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

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1495 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-20 14:30:38 +00:00
wfh@chromium.org
9178d8fa03 Fix compile error with Windows clang.
This change fixes the following errors shown during compile with
Windows clang:

error: cannot pass non-trivial object of type 'ATL::CComBSTR' to variadic function; expected type from format string was 'wchar_t *' [-Wnon-pod-varargs]

Original CL: https://codereview.chromium.org/1252913009/

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

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

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1494 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-19 22:28:17 +00:00
primiano@chromium.org
3bc3dad8f8 Fix inttypes format macros in src/processor/proc_maps_linux.cc
crrev.com/1298443002 has introduced a build failure by re-defining
__STDC_FORMAT_MACROS. Fixing it.

BUG=
R=mark@chromium.org, ted.mielczarek@gmail.com

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

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1493 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-19 07:24:21 +00:00
primiano@chromium.org
3365fe7986 Remove obsolete seccomp_unwinder for legacy (pre-BPF) sandbox
The PopSeccompStackFrame was introduced to deal with stack frames
originated in the legacy seccomp sandbox. The only user of that
sandbox was Google Chrome, but the legacy sandbox has been
deprecated in 2013 (crrev.com/1290643003) in favor of the new
bpf sandbox.
Removing this dead code as it has some small bound checking bug
which causes occasional crashes in WebView (which are totally
unrelated to the sandbox).

Note: this will require a corresponding change in the chromium
GYP/GN build files to roll.

BUG=665,chromium:477444
R=jln@chromium.org, mark@chromium.org, torne@chromium.org

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

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1492 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-18 08:38:14 +00:00
ted.mielczarek@gmail.com
dc5c38675c Fix proc_maps_linux compile for non-Linux
R=ivanpe at https://codereview.chromium.org/1298443002/


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1491 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-08-17 11:55:15 +00:00