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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>