Commit Graph

2117 Commits

Author SHA1 Message Date
Leonard Grey
57bed07ad4 Mac: update arch_utilities for macOS 13
The NXArch* family is deprecated in macOS 13. This change:
 - Uses the replacements where available
 - Silences deprecation warnings otherwise
 - Removes the Linux cross-compile shims in favor of having completely
 separate implementations for Mac and non-Mac. The logic of the Linux
 versions uses the same prepopulated data as before, but they no longer
 use NXArchInfo.

clang diagnostic disables are necessary due to https://crbug.com/1406057

Bug: chromium:1420654, google-breakpad:880, b/257505171
Change-Id: Iad777915a5a058551cfb3a7d3cf681cce180dfea
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4437109
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-04-27 16:39:19 +00:00
Leonard Grey
652e7dac80 Update Mac Headers
These are reimported from Apple's Github source drops, see exact
provenance in README. Most were imported as is, some were edited
to match previous versions, and as noted below

- Added arm headers where needed
- Removed (now) unused `/mach/i386/vm_param.h`
- Removed availability annotations
- Removed `__kernel_ptr_semantics`
- Added `defined(__aarch64__)` to all arm64 define guards

Bug: chromium:1420654, google-breakpad:880, b/257505171
Change-Id: I17bd03fa871a8f1dc4285daafa3d7b26c2186e2b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4482294
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-04-27 14:56:41 +00:00
Peter Boström
7b981b2135 Replace unsigned int with size_t for ModuleSerializer
This is a speculative fix for a memory bug where our symbol files are
looking like they've grown enough that serializing them will outgrow
UINT_MAX. Before this change a size_t is implicitly cast to a size_t in
unsigned int, allocate a buffer of that size and then continue to write
module data out of bounds.

I have not been able to reproduce the OOB write locally as the original
uploaded symbol data is gone, but I have been able to reproduce builds
where, if we enable inline frames and CFI dumping, the size grows to
3.6GB when serializing it, which is close enough to 4.2GB that the
wrapping theory seems reasonable on another board or build.

No effort is made here to prevent wrapping behavior on 32-bit systems.

Bug: b/237242489, chromium:1410232
Change-Id: I3d7ec03c51c298f10df3d5b1e5306433875c7919
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4477821
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-04-26 20:22:23 +00:00
Ben Hamilton
bfde407de5 [dump_syms] Relax name matching for marking symbols as multiple
Previously, the logic to mark a symbol as "multiple" would always fire
for C++ symbols for Apple `.dSYM`s built with `-gmlt`.

This was because for a C++ symbol like `void foo::bar::Baz()`, the
DWARF data would contain the truncated function name `Baz`, but the
STABS would contain the fully-qualified name `void foo::bar::Baz()`.

This CL relaxes the name matching to not mark as multiple:

1) Symbols which were missing names entirely in the DWARF (e.g, "<name omitted">)`
2) Symbols whose fully-qualified name includes the truncated name as a substring

Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883
Change-Id: I26ded7ca84d964aa4a73da19e4bdd7e686e2c998
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4470047
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-04-24 19:59:30 +00:00
Ben Hamilton
f548d75c9f [dump_syms/Mac] New -x option to prefer extern names when there's a mismatch
When built with -gmlt, .dSYMs are (by design) missing the
`DW_AT_linkage_name` which Breakpad uses to fill out the
(name-mangled) function names.

Thankfully, the .dSYM contains both the old-school LC_SYMTAB command
containing the STABS-format symbols (which include the fully-qualified
C++ symbol names we want, but no actual compilation unit data), as
well as the LC_SEGMENT_64 containing the __DWARF segment with the
minimal -gmlt debug information (which excludes the name-mangled C++
symbols).

Unfortunately, since the .dSYM's STABS does not define compilation
units, the usual path in `StabsReader` ignores all the fully-qualified
C++ symbol names for the functions:

bd9d94c708/src/common/stabs_reader.cc (100)

Fortunately, when built for macOS platforms (`HAVE_MACH_O_NLIST_H`),
`StabsReader` supports storing all the STABS-format symbols as
`Extern`s, regardless of whether or not they're in a compilation unit:

bd9d94c708/src/common/stabs_reader.cc (119)

Currently, when there's both a `Function` and an `Extern` with the same address, `Module` discards the `Extern`:

bd9d94c708/src/common/module.cc (161)

This CL adds a new `-x` option to the Mac `dump_syms` which prefers
the Extern function name if there's a mismatch.

Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883
Change-Id: I0d32adc64fbf567600b0a5ca63c71c422b7f0f8c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4453650
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-04-24 16:46:57 +00:00
Ziad Youssef
16cee17997 Fix alignment of the brief output of minidump_stackwalk
Bug: 1435239
Change-Id: I4ea6cbe89d5ef0907f7e07c454e4533995996521
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4459351
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-04-24 15:41:17 +00:00
Yuki Wang
bd9d94c708 Set O_NONBLOCK for opening file to prevent hanging when file unavailable.
Bug: 277976345
Change-Id: Iddf55d8e172f98c76ae7167f609fb53c4c60fa48
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4437089
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-04-17 21:23:19 +00:00
Thomas Gales
b1775c56b2 Convert RISC-V numeric identifiers to strings
Printing the register values as part of the stack trace relies on the
CPU architecture being "riscv" or "riscv64" rather than the numeric
identifiers (0x8005 and 0x8006, respectively).

Fixed: 1432306

Test: Run `minidump_stackwalk` on a RISC-V minidump
Change-Id: I0009da687438d51047e2ee39ffa1c50d78798caa
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4416399
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-04-11 21:51:18 +00:00
Alex Gough
f6e42357d4 Add maxsize for xstate areas
Breakpad skips the xstate area in x64 contexts but allowed this area
to be of unconstrained size. This hits problems if the size is greater
than Chrome's maximum allocation size, so we change to skipping a
maximum size. The maximum is chosen to allow the full set of states
today, plus some slack for the future:

Based on Intel x64 manual 13.5 XSAVE-MANAGED STATE

* => further bytes might be reserved

| Size | Region           |
|  576 | Legacy + header  |
|  384 | AVX State        |
|   80 | MPX State        |
| 1600 | AVX-512 State    |
|   72*| PT State         |
|    8 | pkru state       |
|    8 | pasid state      |
|   16 | CET state        |
|    8 | HDC State        |
|   96?| uintr state      |
|  808*| lbr state        |
|    8 | hwp state        |
|   16 | amx state        |

== 3680 so jump up a bit for the future to 2**12.

Bug:1425631
Change-Id: Ie08555651977cdbfa1c351c661118f13238213c4
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4379497
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2023-04-01 01:52:18 +00:00
Thomas Gales
4d8bb33976 Add RISC-V register names
RISC-V register names are needed in order to load DWARF call frame
information.

Bug: fuchsia:124084
Change-Id: I2791b3a38ea35ddc2bb293f60f75dcc86338e354
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4376827
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2023-03-29 04:37:32 +00:00
Thomas Gales
b0dc1f3529 Add EM_RISCV as recognized value for ELF e_machine
`dump_syms` fails to write symbol file without knowing how to convert
the ELF `e_machine` field to a string.

Use "riscv" as the value because ELF `e_machine` does not distinguish
between 32 bit and 64 bit RISC-V.

Test: run `dump_syms` on the libc++ that's shipped with the Clang
toolchain, or any other riscv binary: `./dump_syms -r -n libc++.so -o
Fuchsia <clang_path>/lib/riscv64-unknown-fuchsia/libc++.so.2.0`
Bug: fuchsia:124084
Change-Id: Ic04db96ec3d3d484350bdd0b90c9dfb70d7f7eb2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4376828
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2023-03-28 20:32:38 +00:00
Leonard Grey
c179ddaa58 Mac: don't call NXFindBestFatArch
`NXFindBestFatArch` is deprecated in macOS 13. We use this when an
architecture is passed in via the `-a` flag. Unfortunately, neither
of the potential replacements can help with this use case:

- `macho_for_each_slice` as suggested in a reply to FB11955188 just
enumerates slices, without the logic for inexact matches (for example,
x86_64h -> x86_64 or arm64e -> arm64).
- `macho_best_slice` as recommended by the deprecation notice only
supports finding a suitable slice to run on the local machine.

We could adapt the logic in `NXFindBestFatArch` but it gets quite
complex for some architectures. Instead, this change adapts the
`NXFindBestFatArch` polyfill used in `dump_syms_mac` for Linux, which
returns an exact match if possible, and the first slice that matches
the requested CPU type otherwise. I think this is probably Good
Enough for most cases; if not, we can try porting the x86_64 and ARM
logic and falling back to this for the rest.

Change-Id: I3b269dab7246eced768cecd994e915debd95721a
Bug: chromium:14206541420654
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4335477
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-03-27 19:07:21 +00:00
Ben Hamilton
9cc38fec8b [dump_syms/Mac] New -n MODULE arg to Mac dump_syms
Previously, dump_syms always used the basename of the on-disk file as
the Breakpad module name and required that the on-disk filename of the dSYM and binary file match, or it would exit with an error.

Build automation often uses filenames unrelated to the Breakpad module
name, so this CL adds a new optional "-n MODULE" argument to Mac
dump_syms that allows passing in the Breakpad module name from outside.

In this case, the basename of the on-disk file(s) is ignored and
no longer required to match.

Change-Id: Ic38e8cf762c79bce61d289b397293eff6c0039ce
Bug: b/273531493
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4338857
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-03-20 18:43:06 +00:00
Ziad Youssef
9bf8d1ec52 Remove extra comma in minidump_stackwalk.cc
Bug: 1374075
Change-Id: I1fb0f73b286625f3c99735e51418393af891a2b8
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4345752
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-03-16 16:13:59 +00:00
Ziad Youssef
309534f959 Add brief flag to minidump_stackwalk
The added flag will print only one line per frame for the requesting
thread (This is mostly the crashing thread).

Refactor the code for printing the frame so it can be reused.

Bug: 1374075
Change-Id: I8a1c8b1a09740fcaa23c3cc642468622ee64ea73
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4339771
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-03-15 18:04:57 +00:00
Leonard Grey
3848d7e3b5 Mac: delete unused macho_dump.cc
The only references to this are in derelict Xcode projects.

Bug: chromium:1420654
Change-Id: If0d7064f32bab23630f79f459bb1dc429a203b88
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4329733
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-03-10 22:43:47 +00:00
Leonard Grey
ef55207540 Mac: stop using NXArchInfo as a vocabulary type
It's deprecated in macOS 13/iOS 16, so this is an incremental step towards using newly introduced APIs for those OSes.

Since the description field is no longer available in the new
mach-o/util.h API, stop using it, especially since architecture name is
sufficiently informative.

Bug: chromium:1420654
Change-Id: If2cec4f1fc88d13a71f011822bff61f173486b68
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4322265
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-03-09 14:55:49 +00:00
Ian Barkley-Yeung
f5123d7196 Add #include <config.h> to the beginning of all cc files
Added
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
to the beginning of all source files that didn't have it.

This ensures that configuration options are respected in all source
files. In particular, it ensures that the defines needed to fix Large
File System issues are set before including system headers.

More generally, it ensures consistency between the source files, and
avoids the possibility of ODR violations between source files that were
including config.h and source files that were not.

Process:
Ran
find . \( -name third_party -prune \) -o \( -name '.git*' -prune \) -o \( \( -name '*.cc' -o -name '*.c' \) -exec sed -i '0,/^#include/ s/^#include/#ifdef HAVE_CONFIG_H\n#include <config.h>  \/\/ Must come first\n#endif\n\n#include/' {} + \)
and then manually fixed up src/common/linux/guid_creator.cc,
src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc,
src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc,
src/common/stabs_reader.h, and src/common/linux/breakpad_getcontext.h.

BUG=google-breakpad:877
Fixed: google-breakpad:877
TEST=./configure && make && make check
TEST=Did the find/sed in ChromeOS's copy, ensured emerge-hana google-breakpad
worked and had fewer LFS violations.
TEST=Did the find/sed in Chrome's copy, ensured compiling hana, windows, linux, and
eve still worked (since Chrome doesn't used config.h)

Change-Id: I16cededbba0ea0c28e919b13243e35300999e799
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4289676
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2023-02-27 19:31:32 +00:00
Brian Sheedy
abb105db21 Fix sprintf usage
Changes a recent introduction of sprintf to snprintf since sprintf is
deprecated in Chromium.

Bug: crashpad:329
Change-Id: Icd346da4c86bd8e867266dfebaf617991dd90113
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4261633
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-02-16 20:36:10 +00:00
Brian Sheedy
984e043d79 Print Crashpad annotation objects
Updates minidump_dump to print out any Crashpad annotation objects that
are in a minidump. If an annotation contains a string value, it will be
printed out as such, otherwise it will be printed out as hex bytes.

Bug: crashpad:329
Change-Id: Ieecd6381c623f9011b16357742f7145a118dbc3c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4261631
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-02-16 19:10:15 +00:00
Xinan Lin
5f72a811c1 [linux] Report error message if failed to send http request
If symupload client failed to connect the backend, we need this error
message to be exposed. This could help the failure we are facing in
official staging builders.

BUG=chromium:1401761
TEST=NA

Change-Id: Ic720aff9cb523c38553d6c02bf72aa5b95e862a7
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4240299
Reviewed-by: Nelson Billing <nbilling@google.com>
2023-02-13 16:11:34 +00:00
Leonard Grey
5687ac51ca Fix Mac build
f617814017
missed marking `IsCanonicalAddress` Linux-only.

Bug: None
Change-Id: Ia936db4b5541f22abcc884d410e7eae3818b4c0f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4227418
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-02-07 20:47:56 +00:00
Hiroyuki Komatsu
bc25ffb613 Change CLANG_CXX_LANGUAGE_STANDARD from "c++0x" to "c++17".
* This fixes build errors with `xcodebuild`.
* CLANG_CXX_LANGUAGE_STANDARD represents "-std" (e.g. "=std=c++17").

Change-Id: Ibeeccb2d77518d2e767a6cf4840ff673427d98ba
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4218220
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Nelson Billing <nbilling@google.com>
2023-02-06 21:30:05 +00:00
Mark Brand
38115b0c5f Refactor DisassemblerObjdump.
This change removes ScopedTmpFile from DisassemblerObjdump, and
replaces it with the use of the implementation in linux/common.

It also switches to using ScopedPipe to read the output from objdump,
and directly execing objdump instead of using system.

Change-Id: I6d425190fb4a20d6b265c72aa7315026687cb86a
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3971919
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2023-01-31 00:35:06 +00:00
Mark Brand
5daa41904a Add ScopedPipe.
This provides a similar wrapper to ScopedTmpFile for linux pipes.

Change-Id: I53b377085322f61d87525d215ecd703f13ae9ae7
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3971918
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-01-31 00:34:58 +00:00
Mark Brand
9a87ff661e Add ScopedTmpFile.
This replaces the existing AutoTestFile implementation with a simpler
implementation that uses O_TMPFILE to avoid having the temporary files
linked in the filesystem.

Refactor the existing tests to use the new ScopedTmpFile instead of
duplicating the same ScopedTestFile wrapper into each test.

Change-Id: Iee9416e52269eff271f748ec9d822aee6e28f59a
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3971917
Reviewed-by: Lei Zhang <thestig@chromium.org>
2023-01-31 00:34:48 +00:00
Mark Brand
f617814017 Remove disassembler_objdump from the build on non-linux platforms.
Change-Id: I29d628ac7cf79bfca1794ba325c945a0f122b360
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3964364
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2023-01-31 00:34:35 +00:00
Leonard Grey
95857a18bb Mac: add shell script to coordinate dumping and uploading macOS system symbols.
This checks in an edited version of a script that has been used by the
Chrome Mac team for this purpose. It expects to reside in the same
place as `dump_syms`, `dsc_extractor`[0], `symupload` and `upload_system_symbols` binaries.

When called, it will:
- Locate and extract any dyld_shared_caches found on the system
- Dump the above
- Dump any remaining uncached system libraries
- Write the results to a directory passed as an argument
- Provide (but not call) an `upload_system_symbols` invocation
to upload the results

[0] Not yet checked in

Bug: 1400770

Change-Id: I30610c23d0c979e34dd3830eeedb5ceeae8ce66b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4111109
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-30 15:31:26 +00:00
Jason Jeremy Iman
bae713be2e LibcurlWrapper uses curl_global_cleanup
LibcurlWrapper is missing a curl_global_cleanup causing a memory
leak. The curl_global_init is called automatically when calling
curl_easy_init without first doing curl_global_init.

BUG=chromium:1405410
TEST=units with asan

Change-Id: I4982fd5265b0df91076ed428f1134a681a7f28c6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4189295
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-01-27 20:36:21 +00:00
Justin Cohen
236743ed04 Update LICENSE file.
Change-Id: I36d77f3efb30bf83911e25b7f9de6cfe1cdb2e7e
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4199755
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-01-27 20:35:32 +00:00
Zaid Elkurdi
a4f148b7a5 Add support for reading annotation objects in Crashpad modules
At the moment, the Minidump class only supports reading simple and
list annotations from Crashpad minidumps. This change adds support
for reading annotation objects stored in Crashpad modules
(MDRawModuleCrashpadInfo) and exposes them via a new getter in
MinidumpCrashpadInfo.

Change-Id: I033fc4a4fdff5901babc2472e0150f79af56b830
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4195756
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-01-26 20:22:33 +00:00
Justin Cohen
2c86c995b4 Use portable PRIu64 for printing uint64_t address_mask.
Change-Id: I12b3970adc06cb48e9112726b423ab61271d0044
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4184479
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-20 21:27:48 +00:00
Justin Cohen
fc1a202855 Add address mask to MinidumpCrashpadInfo.
Support reading both old and new crashpad_info structs.

Change-Id: I780792988671683fedfbb5122fe8a14bf0a8b793
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3982824
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-20 19:24:04 +00:00
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