Commit graph

2084 commits

Author SHA1 Message Date
Lei Zhang b024566c44 Fix Cygwin builds after enabling c++17 mode.
Remove the "noext" argument to AX_CXX_COMPILE_STDCXX(), so the configure
script can figure out what works, instead of only allowing strict
conformance mode.

See discussion on https://crrev.com/c/3954471, which lead to this CL.

Change-Id: I7688db2e267485003ae8f776fa3ca0dd63205b47
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4072453
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-19 18:04:53 +00:00
Leonard Grey dd0ca9d70a Mac dump_syms: work around NXFindBestFatArch bug
On macOS 13 x86_64 machines, NXFindBestFatArch does not correctly find
arm64e slices. This is filed as FB11955188.

I was hoping manually masking the subtype with CPU_SUBTYPE_MASK would
be sufficient to work around but no luck. So let's just fall through
to doing an exact* match if NXFindBestFatArch fails.

* "Exact" meaning with CPU_SUBTYPE_MASK now masked off. But
libmacho/arch.c calls that exact too, so I'm just going to go with it.

Bug: 1400770
Change-Id: Id497946d3c719285c5d7508e589e4a466da1ceca
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4178621
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-19 16:09:17 +00:00
Leonard Grey 934d6b2a5d upload_system_symbols: Make /System/Library/Components optional
Bug: 1400770
Change-Id: I81cb981bb9ca208ac2af9e27c00e75cab1c14717
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4178413
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-01-18 16:36:34 +00:00
Robert Sesek bae7147e78 Decode Mach EXC_RESOURCE and EXC_GUARD exception reasons
Change-Id: Iafe85ae2149961f13ba44664c99e18d92d1ec654
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4172753
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-17 18:11:34 +00:00
Ian Barkley-Yeung 1eafed6806 Fix more memory leaks with proper smart pointer usage
Fix more memory leaks, specifically for Module::Extern and
Module::StackFrameEntry that were outside the Module's AddressRange.

To fix this, and to prevent issues like the one fixed by
79326ebe94
in the future, switched to proper use of std::unique_ptr for Module's
Extern and StackFrameEntry functions. These should enforce ownership
correctly and make the ownership flow much more visible and clear.

Change-Id: I7c943dff3501836a5e303febedc1b312e6f0a1fe
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4129821
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-01-10 18:46:49 +00:00
Leonard Grey d91b6cb75a upload_system_symbols: Don't retry if file already exists on the server
Bug: 1400770
Change-Id: I4c9c683c91848f7eb404ff3c86187dfa63d06e37
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4117730
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-01-04 13:40:20 +00:00
Ian Barkley-Yeung 79326ebe94 Fix memory leak in Module::AddExtern
If adding a duplicate extern, we need to `delete` the extra `Extern`
object regardless of the value of enable_multiple_field_.

Fixes ASAN build of ChromeOS:
https://logs.chromium.org/logs/chromeos/buildbucket/cr-buildbucket/8793433395207218433/+/u/run_ebuild_tests/chromeos-base_google-breakpad_log

BUG=b:263148951

Change-Id: Ib6c20e9c7aa38b1530e4bac8acbf481cc9136c36
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4129701
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-12-29 21:21:33 +00:00
Ian Barkley-Yeung 6e03dc0f20 Fix test breakage from 9aa786f
After
9aa786f03d,
attempts to roll breakpad into ChromeOS fail with:

make[1]: *** No rule to make target 'src/testing/googletest/src/gtest-all.cc', needed by 'src/testing/googletest/src/client_linux_linux_client_unittest_shlib-gtest-all.o'.  Stop.

(see
https://logs.chromium.org/logs/chromeos/buildbucket/cr-buildbucket/8794115289064657457/+/u/run_SDK_package_unit_tests/call_chromite.api.TestService_BuildTargetUnitTest/stdout,
the result of dry-running
https://chrome-internal-review.googlesource.com/c/chromeos/manifest-internal/+/5238479,
which just updates the breakpad revision to
b14bb95d5de268b6231dc8c667fb0f7d73676856.)

Change-Id: Ia6e47c044e74499a849f8b615594f403893d7653
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4120547
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-12-27 18:38:17 +00:00
Ian Barkley-Yeung b14bb95d5d Handle compressed DWARF data in LoadDwarfCFI
Emit STACK CFI records even in the presence of clang's "-gz" linker
option. Needed for ChromeOS ARM boards' chrome binary.

BUG=b:263148951,google-breakpad:874
Fixed: google-breakpad:874

Change-Id: I2fe697a56d3421609128d4e291ab1adc73314864
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4117692
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-12-21 21:16:29 +00:00
Leonard Grey 80430d73ae upload_system_symbols: Fix sym-upload-v2 when uploading dumped symbols
This was previously setting the right upload servers too late to
use them when uploading previously dumped symbols (the
`--upload-from` use case)

Bug: 1400770
Change-Id: If5bb749707b9f0a181585619f30ec9cb011db5ed
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4111102
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2022-12-15 22:21:20 +00:00
Zequan Wu 63af0cd752 Cleanup strncmp and use string_view in elf_reader.cc.
Change-Id: I74c755f1ade80bb4313e4fd14e5dc6bab419a0a6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4099505
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-12-15 13:57:12 +00:00
Leonard Grey 6b7e8a80ba Mac dump_syms: delete unused WriteSymbolFile
Bug: None
Change-Id: I5aec8c07a01ee180c817fa79db39f9c2eb933e37
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4004598
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-12-14 19:37:46 +00:00
Leonard Grey 387a002c89 Add option to use API key in upload_system_symbols
Adds a new option, `-api-key`. If passed, `symupload` is invoked with
the `sym-upload-v2` protocol, the key is passed through, and the V2 API
upload servers are used.

Bug: 1400770
Change-Id: I81255dccc54038a57900058a050603b89e37d716
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4103749
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2022-12-14 19:33:36 +00:00
Leonard Grey 33b8438986 Remove tools/mac/crash_report
This is pretty rotted and unmaintained, and nobody seems to be using it.

Bug: None
Change-Id: I965393dd75d995d5c7d55bea6d9b256e89a7421b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4107469
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-12-14 18:42:38 +00:00
Zequan Wu 9acaa082c8 Fix build failures.
- Fix a test build failure introduced by cc7abac08b.
- Use strcmp from <string> instead of std::strcmp from <cstring>.

Bug: google-breakpad:867
Change-Id: I8dcbc7d5ac8ea799b4d5287ddbbf5d6626992123
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4095054
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-12-12 10:03:38 +00:00
Leonard Grey cc7abac08b Add option to enable multiple symbol field in Linux tool
Bug: google-breakpad:751
Change-Id: I63a4d652413ef7311da7494fbd8fb816445eb353
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4089183
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-12-08 18:28:34 +00:00
Mike Frysinger d31ce76161 gyp: drop unused build system
Chromium moved to GN a long time ago, and CrOS has never used this.
Let's remove one of the build systems to make it easier on people.
Especially since the GYP tool is completely unmaintained now.

Change-Id: I0371ca1427811f307dc30f88ed6d1bf61d7fab89
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4054941
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-12-05 01:38:54 +00:00
Leonard Grey 87b60390f0 Mac: add option to dump_syms to mark folded symbols
Bug: google-breakpad:751
Change-Id: I12afcc8399fa9808aace9f465622bd074eab13f4
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4034827
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-12-01 20:20:39 +00:00
Marvin Scholz 9aa786f03d Restructure Makefile conditionals/targets
As the conditionals and targets was becoming quite hard to
grasp with lots of conditionals applied unnecessarily to target
properties, there were issues with targets being defined without
any sources.
This commit fixes that while restructuring the Makefile so that
all targets are declared (conditionally if needed) upfront and
then all the target properties are defined (source, flags, deps, etc.)

Change-Id: I666d153c476fbf1aafabb89cee7af4eee5795ab6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3928024
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-11-29 09:27:01 +00:00
Mark Brand 41474d905f Fix Linux ASan Afl build error.
Bug: 1385147
Change-Id: I69ebfa1adbc1c2a17decf0079812c4f507e3332c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4046961
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-11-22 14:03:08 +00:00
Nelson Billing 4d0c21b9a5 Add a flag to google_converter to keep Breakpad/PE/PDB files after conversion.
Change-Id: I8948e1aba598d42369d70ca1cc1168ce3841ab40
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4038509
Reviewed-by: Zequan Wu <zequanwu@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-11-21 20:47:11 +00:00
Nelson Billing c7acbcef04 Fix Windows native symbol uploads.
- We were appending a CRLF to uploaded files, which is okay for Breakpad
  symbols but breaks binaries (PE/PDB).
- Removed the CRLF after files in the request body to fix issue. Tested with
  Breakpad, PE, and PDB uploads.

Change-Id: I95ee7c51bf981cdb2e55cc720a7813cf7afa21ce
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4038506
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Zequan Wu <zequanwu@google.com>
2022-11-21 20:46:50 +00:00
Leonard Grey 522bd2337a Speed up testing for multiple functions at an address on Posix
The way this was originally written blows up on large enough targets
(like...Chromium :/). This change adds a set for amortized constant
time lookup of whether a FUNC already exists at a given address.

Bug: google-breakpad:751
Change-Id: I10a322da70f769c106e1e5f5b2dc3dc3f79444fd
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4031580
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-11-17 18:38:51 +00:00
Lei Zhang 442456a68c Fix compile error in disassembler_objdump.cc for non-Linux build.
A couple of pointer parameters should be references instead.

Change-Id: Ic1850d9330194374f7fe2108815267ede6f3ca32
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4021971
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-11-14 22:12:41 +00:00
Leonard Grey 989f862134 Support marking folded symbols on Posix
This is similar to the Windows change at
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/773418/

When a `Module` is created with `enable_multiple_field_` = true,
all FUNCs and PUBLICs that share the same address will be collapsed
into a single entry, and that entry will be marked with `m` for
multiple in the final output.

`enable_multiple_field_` is temporary just in case people are
depending on the current behavior.

Support for `dump_syms` executables will be added in a follow-up.

Bug: google-breakpad:751
Change-Id: I631a148ed00138924c7bcb5ad6db8b9a6610dd03
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3905122
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-11-01 16:53:01 +00:00
Christopher Di Bella 1f9903c161 names anonymous structs in elfutils.h
Fixed: chromium:1378800
Change-Id: I8215c091c72e796b1683753e2512d6e6adc4167f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3984802
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-10-27 02:55:38 +00:00
Konstantin Mandrika de086a9859 Add support for compressed section headers to dump_syms.
Change-Id: I019cc9ffd66850ec5259f6dfcd9af8ac6c37d2c0
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3938926
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-10-26 20:29:20 +00:00
mingtaoxt xt 7ea7ded187 mainline version gcc-13 cannot use "uintptr_t" via "#include <string>"
Change-Id: I0049bb92658b4226e32783ad4d8271787deef5f3
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3964166
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-10-20 09:36:42 +00:00
mingtaoxt xt 73c29370ce Update LSS dep to the latest commit
Change-Id: I39e459f519922433de82c62385d08c6db34328f0
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3964165
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-10-19 12:36:01 +00:00
Christopher Di Bella b90119e3f3 replaces sizeof(raw_context) with sizeof(*raw_context)
Using `sizeof(raw_context)` generates the following warning (which is
an error in ChromeOS):

```
'memset' call operates on objects of type 'MDRawContextX86' while the size
is based on a different type 'MDRawContextX86 *'
```

This commit follows the implied advice of this warning and adjusts the
expression.

Bug: b:238678030, b:243982778
Test: Locally
Change-Id: I26111c6ff7a1223223e6096a75ad52c48d941e89
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3960915
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-10-17 20:41:17 +00:00
Christopher Di Bella f9bf260e94 enables C++17 mode
Breakpad has started to use C++17 features, and needs to be compiled
using C++17.

Bug: b:238678030, b:243982778
Test: Locally, CQ
Change-Id: Ia339f0815d2efd2a49fa9b788044b5b0163f95fa
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3954471
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-10-14 19:08:12 +00:00
Christopher Di Bella ef443fbf77 Changes FunctionNames.Mangled to check for regex instead of equality
The demangled name has recently joined two angle brackets, where there
was previously a space. This commit makes it possible for both options
to pass, since they're both valid source.

Bug: b:238678030
Test: Tested locally
Fixed: b:243982778
Change-Id: Ic4464709fb8cc5c730a9d14a8627294b24ae70c3
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3949474
Reviewed-by: Lei Zhang <thestig@chromium.org>
2022-10-12 19:22:15 +00:00
Mark Brand 57d1743662 Fixup non-canonical fault addresses for amd64.
This uses DisassemblerObjdump to add a processing step in
MinidumpProcessor to compute the true faulting address from register
state and disassembly of the fault instruction when the fault address
is suspicious (-1).

Bug: 901847
Change-Id: Ia1f77d542c4055c82ce2504db8c84a9e52001866
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3932957
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2022-10-12 17:32:28 +00:00
Mark Brand 6289830b67 Add DisassemblerObjdump.
This extracts the existing objdump-based disassembler engine used in
ExploitabilityLinux into a seperate reusable class, and adds support
for most common address operand formats.

This is a precursor to using DisassemblerObjdump to handle address
resolution for non-canonical address dereferences on amd64.

Bug: 901847
Change-Id: I1a06a86fc2e7c76b4d0e79eca5f8a6c501379f47
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3720740
Reviewed-by: Ivan Penkov <ivanpe@google.com>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2022-10-12 17:19:44 +00:00
Marvin Scholz bcffe4fe60 test: exploitability: Fix preprocessor guards for Linux
Guard the Linux specific tests by checking for __linux__, as it does
not only not work on Windows but not on macOS either.
Change-Id: I0e710a6da8e6686f11bc8ea23e07ac19f3b4beb2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3928026
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-30 12:24:06 +00:00
Leonard Grey e3af4457b8 Clean up module_unittest
This change rewrites the tests to have `Module` as a prefix and
rearranges them a little. This is prep for adding this file to
breakpad_unittests Chromium-side.

Bug: google-breakpad:751
Change-Id: I8a77f60a0080d06af13dd30d9cf7627dce045d90
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3915004
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-09-22 19:52:43 +00:00
Iacopo Colonnelli 28cf16bc34 Added riscv and riscv64 support for Linux
Change-Id: I62cd157d00a87720db001072662a81d8eb9112b0
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3873291
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-09 08:44:46 +00:00
Iacopo Colonnelli e059dad5ea Polling in ParallelChildCrashesDontHang test
Instead of (arbitrarily) wait 1s for the child process to terminate, the
parent now polls the child process every 100ms to check if it's
terminated, and it does so for a much longer total time of 10s.

This implementation ensures correct check for slower architectures, and
fast success for faster ones.

Change-Id: I2ff38458bf747de5b74268a4e22fd6164450419b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3876346
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-08 08:32:08 +00:00
Mark Mentovai 4febb34583 Update copyright boilerplate, 2022 edition (Breakpad)
sed -i '' -E -e 's/Copyright (\(c\) )?([0-9-]+),? (Google|The Chromium Authors).*(\r)?$/Copyright \2 Google LLC\4/' -e '/^((\/\/|#| \*) )?All rights reserved\.?\r?$/d' -e 's/name of Google Inc\. nor the/name of Google LLC nor the/' -e 's/POSSIBILITY OF SUCH DAMAGE$/POSSIBILITY OF SUCH DAMAGE./' $(git grep -El 'Copyright (\(c\) )?([0-9-]+),? (Google|The Chromium Authors).*$')

Plus manual fixes for src/processor/disassembler_x86.{cc,h}.

Plus some conversions from CRLF to LF line endings in .cc and .h files.

Bug: chromium:1098010
Change-Id: I8030e804eecd9f5a1ec9d66ae166efd8418c2a67
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3878302
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-07 16:59:53 +00:00
Lei Zhang 00f76018cc Fix fread() check in ExploitabilityLinux.
This fread() call did not intend to always fill the buffer, so the
change in https://crrev.com/c/3872234 is incorrect. Revert that one line
change.

Change-Id: I3fbe38fce11c24aa77b39dc229c7c5ed2a8d6960
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3879289
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-07 16:46:48 +00:00
GlassOfWhiskey e69677e93d Added crash context float state flag
Instead of listing everywhere the set of architectures that do not
require/support explicit float state in their crash context, a new
GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE preprocessor macro has
been defined.

Adding novel architectures will only require to manage the
macro definition in a single place.

Change-Id: I2732982f2cdfc9fcd2f71d6e5e122617faff9e82
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3876345
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-07 12:28:57 +00:00
Lei Zhang 30c7f3cfc1 Fix some Coverity defects.
Fix a few issues Coverity detected in exploitability_linux.cc:

CID 277681, 277682, 277683

Change-Id: I8ad0581f075da7346b9be8100b3690555a358b16
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3872234
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-06 16:28:56 +00:00
GlassOfWhiskey 5d6d250150 Update LSS dep to the last commit
Change-Id: I35f35d9d31d97c8237f0d90170be04716d820028
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3873644
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-09-06 12:53:40 +00:00
Joshua Peraza 46e00d30cd fix includes
Change-Id: Ibfe719c3ed303cd45884863746cf07ec22dba45d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3863388
Reviewed-by: Nelson Billing <nbilling@google.com>
2022-08-30 21:25:28 +00:00
Nelson Billing cb55d48154 Add product name metadata to converter and symupload.
Change-Id: Iefea0aea13deb86d71d663c8344a2d3c658caf4a
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3756171
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2022-08-22 19:48:52 +00:00
Mirko Bonadei e085b3b50b Fix -Wdeprecated-declarations when macOS 13 SDK is used.
This CL fixes the following error detected on a WebRTC bot:

FAILED: obj/third_party/breakpad/utilities/ConfigFile.o
/opt/s/w/ir/cache/goma/client/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/breakpad/utilities/ConfigFile.o.d -DCR_XCODE_VERSION=1400 -DCR_CLANG_REVISION=\"llvmorg-16-init-907-g8b740747-1\" -D_LIBCPP_ABI_NAMESPACE=Cr -D_LIBCPP_ABI_VERSION=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_NODISCARD -DCR_LIBCXX_REVISION=9f503bebdb9a89f5ee82b82142109b26d688f40c -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/breakpad/breakpad/src  -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector -femit-dwarf-unwind=no-compact-unwind -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -arch x86_64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O2 -fno-omit-frame-pointer -g2 -gdwarf-aranges -Xclang -debug-info-kind=limited -isysroot sdk/xcode_links/MacOSX13.0.sdk -mmacos-version-min=10.13 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Werror -Wall -Wno-unused-variable -Wno-c++11-narrowing -Wno-unused-but-set-variable -Wno-misleading-indentation -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -std=c++17 -Wno-trigraphs -fobjc-call-cxx-cdtors -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -fvisibility-inlines-hidden -c ../../third_party/breakpad/breakpad/src/client/mac/crash_generation/ConfigFile.mm -o obj/third_party/breakpad/utilities/ConfigFile.o
../../third_party/breakpad/breakpad/src/client/mac/crash_generation/ConfigFile.mm:108:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    sprintf(processUptimeString, "%llu",
    ^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/sys/cdefs.h:214:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
../../third_party/breakpad/breakpad/src/client/mac/crash_generation/ConfigFile.mm:114:3: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
  sprintf(processCrashtimeString, "%zd", tv.tv_sec);
  ^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
sdk/xcode_links/MacOSX13.0.sdk/usr/include/sys/cdefs.h:214:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))

Bug: webrtc:14342
Change-Id: I923ab3f9155eb36aa2edf9b1d38c123e3e6ad029
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3829529
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-08-12 17:14:46 +00:00
Zequan Wu a7a8b9c300 Fix int64_t format in fprintf by using PRIx64.
Change-Id: Ic03ecc055c4eb097fbaaf8c8cd2c0a68d5aea8a0
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3826785
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-08-11 22:03:01 +00:00
Nelson Billing c44d14ac89 Fix garbage header being prepended to native symbol uploads.
Change-Id: I96887504ad9dc47dda6ebc5be7c193a1eb1f94d1
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3825137
Reviewed-by: Zequan Wu <zequanwu@google.com>
2022-08-10 20:38:02 +00:00
Zequan Wu f1f7b5272f Check sh_type for symbol table and finish ProcessDIEs if any DIE processing goes wrong
- If symbol table section is malformed, skip them.
- SkipDIE and ProcessDIE return nullptr when processing goes wrong due to malformed debug info, stop processing in this case.

Bug: 1349354
Change-Id: Ia1d3e3591bbd2dad8b9eb351c1882cfc03bfad4b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3821448
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-08-10 18:01:58 +00:00
Lorenzo Alberto Maria Ambrosi 7e4ea04094 Add error messages on pdb Open function
This implements the error messages from
https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/idiadatasource-loaddataforexe?view=vs-2022
and
https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/idiadatasource-loaddatafrompdb?view=vs-2022
instead of having just a generic error message.

Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzothunder.ambrosi@gmail.com>
Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=866
Change-Id: I23c0e80d31afb402a70cb0cdded78d3d34ac5fff
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3810512
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-08-10 01:58:11 +00:00