Commit graph

1839 commits

Author SHA1 Message Date
Michael Forney
5bba75bfd6 Remove true/false defines in convert_UTF.cc
These are left over from when this file was written in C.

In C++, true and false are keywords, so this is no longer necessary.
In fact, redefining a keyword is not actually permitted in ISO C++
(https://eel.is/c++draft/macro.names#2), and is rejected by MSVC.

Change-Id: I2f4a6eae7f8dd4d91b8ee6588c7ae5e8f20bd0d0
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2105831
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-19 03:19:55 +00:00
Michael Forney
23e6fbf571 Use ULONG_MAX instead of __WORDSIZE to determine native ELF architecture
__WORDSIZE is an internal libc definition. Instead, we can use
ULONG_MAX from limits.h, whose value corresponds to the machine's
native word size.

This allows us to remove the fallback definition of __WORDSIZE in
the Android compatibility headers.

Bug: google-breakpad:631
Change-Id: I7b9e6f3b2121f78ccad9e32bf26acac518aefd8f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2107100
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-17 06:30:52 +00:00
Michael Forney
2633712387 Roll src/src/third_party/lss/ f70e2f164..fd00dbbd0 (2 commits)
https://chromium.googlesource.com/linux-syscall-support/+log/f70e2f1641e2..fd00dbbd0c06

$ git log f70e2f164..fd00dbbd0 --date=short --no-merges --format='%ad %ae %s'
2020-03-10 mforney Avoid conflict with getdents64 defined by libc
2019-01-26 vapier futex: change to 6 args

Created with:
  roll-dep src/src/third_party/lss

Bug: google-breakpad:631
Change-Id: Icc248237dcc7bdc3f7b74cd8556efcaf3b4b1c31
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2106526
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-17 01:52:33 +00:00
Michael Forney
e780d58fd7 Use breakpad_getcontext on all Linux platforms missing getcontext
getcontext is also not available on musl libc, so generalize
breakpad_getcontext so it can be used as a fallback for non-Android
platforms as well.

On x86_64 and i386, ucontext_t uses an Android-specific offset for
storage of FP registers, since its sigset_t differs in size. So,
make the definition of MCONTEXT_FPREGS_MEM and UCONTEXT_FPREGS_MEM_OFFSET
conditional on whether we are building for Android.

On glibc and musl, signal.h and asm/sigcontext.h can't be included
together, so in breakpad_context_unittest.cc, only compare the libc
and kernel _fpstate when on Android.

Bug: google-breakpad:631
Change-Id: If81d73c4101bae946e9a3655b8d1c40a34ab6c38
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2102135
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-16 21:27:07 +00:00
Mike Frysinger
02b7be4065 convert_UTF: try to update xcode files
Bug: google-breakpad:725
Change-Id: I8c5f9a828e1bb6a2a5603fbfaa127f6dfe64a4b4
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1803770
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-14 21:20:18 +00:00
Michael Forney
a5fa28ddf0 Fix some bugs in CheckMicrodumpContents
The crash address from the microdump was never checked against
anything. Instead, the test was checking the value of a constant.

On 32-bit systems, an intptr_t cannot represent kCrashAddress
(0xDEADDEAD), causing a failure when the crash address is parsed
from the microdump. Instead, use uintptr_t, which matches the type
of kCrashAddress.

Change-Id: Ib5612743803609f7801dcfb98deaa8779e362025
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2100816
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-13 01:50:14 +00:00
Michael Forney
9de167a349 Remove sys/signal.h compatibility header
Since a03ad96dbd, sys/signal.h is no longer required.

Change-Id: I64e6235e1bffb3728d6050389bad6e7a99389741
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097666
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-11 11:52:48 +00:00
Michael Forney
9bc5d7024f Add google_crashdump_uploader_test to .gitignore
Change-Id: I5c5e5c85ec49a76e5f4c7c6a0f662398e6cdc6ee
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097681
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-11 11:50:39 +00:00
Michael Forney
98c883b5cf Remove redundant LINUX_HOST conditional
We are already in a LINUX_HOST conditional block, so there is no need
to check for it again.

Change-Id: Ifbe283ffa47373c98d2653f1014445d1a435c715
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2093144
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-11 11:49:47 +00:00
Michael Forney
75ca6a193d Use public fpregset_t type to define fpstate_t
The _libc_fpstate struct tag is an implementation detail of glibc,
and musl uses a different struct tag, _fpstate.

Unfortunately, the public type fpregset_t is a pointer type, so is
not suitable for allocating storage, or referring to constant
storage. Instead, we can use std::remove_pointer<fpregset_t>::type
to refer to the pointed-to type, regardless of the struct tag.

Bug: google-breakpad:631
Change-Id: Iaf47f15b2d834dd8de839431f65a481e9b0c7f9e
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2096171
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-10 23:49:55 +00:00
Michael Forney
a0f647d7f3 Use ULONG_MAX instead of __WORDSIZE to determine ELF class
__WORDSIZE is an internal libc definition. Instead, we can use
ULONG_MAX from limits.h, whose value corresponds to the machine's
native word size.

Bug: google-breakpad:631
Change-Id: If69caf578286d678585d1510c01562b969b5061f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097352
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-10 23:31:09 +00:00
Michael Forney
a03ad96dbd Use standard header locations for poll.h and signal.h
sys/poll.h and sys/signal.h just redirect to the standardized
location for these headers, poll.h and signal.h.

On musl libc, including the incorrect header path results in a
warning, and since breakpad is built with -Werror, this is an error.

In exception_handler.cc, signal.h is already included earlier, so
we can drop the sys/signal.h include.

Bug: google-breakpad:631
Change-Id: If36d326453e3267d38a5b92ed1301f828e46befe
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097344
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-10 22:52:40 +00:00
Michael Forney
3f6f16b059 Use sched_yield instead of pthread_yield
pthread_yield is not a standard POSIX function, and is not available
in musl libc. The man page says to "Use the standardized sched_yield(2)
instead"[0].

On glibc, pthread_yield is exactly equivalent to sched_yield[1].

On bionic, pthread_yield is also not available, so on Android, the
tests define a wrapper that just calls sched_yield. This wrapper
is no longer necessary if we just use sched_yield in the first
place.

[0] http://man7.org/linux/man-pages/man3/pthread_yield.3.html
[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_yield.c

Bug: google-breakpad:631
Change-Id: Ie4c6be8c17cdc2f5396a7fe972fa51a97573b049
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097340
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-10 22:49:56 +00:00
Mike Frysinger
4f3f0acd6f Revert "Add new dwarf 5 enums, plus some dwarf4 enums."
This reverts commit 0c0e24f709.

Reason for revert: This is causing breakage on CrOS due to unhandled
enums and dwarf5 support is in limbo, so pull this back out for now.

Bug: google-breakpad:812
Change-Id: I22dd5d87efb8bc83596d51d15a6808c41afb3fd2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2095872
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-10 18:30:06 +00:00
Mike Frysinger
fea1913f29 Revert "Add dwarf5 compilation-unit header handling."
This reverts commit dbd454dbe4.

Reason for revert: The parent CL is causing breakage on CrOS due to
unhandled enums.  Before we can revert that, we need to revert this.

Bug: google-breakpad:812
Change-Id: I7c2446f3cd8ed9f6411e90dbdd2434bc463b2f6c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2095798
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-10 18:29:58 +00:00
Mark Mentovai
52b33b2a4b dump_syms: Reintroduce warnings inadvertently removed by 47cd498384
Previously, dump_syms produced warnings whenever a DW_AT_specification
or DW_AT_abstract_origin attribute was a forward reference. 47cd498384
allowed those attributes to carry forward references, removing the
warnings altogether. It was not correct to remove the warnings entirely.
References that do not point to valid DIEs should still produce
warnings, whether a back reference or a forward reference.

This reintroduces those warnings as appropriate.

Bug: google-breakpad:813
Test: dumper_unittest SimpleCU.UnknownAbstractOrigin,Specifications.BadOffset
Change-Id: Ie7222c7a1886bab31423f27e2fbcce93e69625b3
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2090103
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-03-06 17:08:57 +00:00
Nelson Billing
c7522272ff Add "type" option to sym_upload sym-upload-v2 mode.
- "sym-upload-v2" protocol now supports specifying a symbol file "type".
- Known types are "breakpad" (default option, previously this was only
effectively the only option), "elf", "pe", "macho", "debug_only", "dwp",
"pdb", and "dsym".
- When type other than breakpad is specified, sym_upload tool requires
the code_file and debug_id value (that it otherwise would have gotten
from the text of the Breakpad symbol file).
- This ultimately means that sym_upload can be used to upload native
symbol files now, in addition to Breakpad symbol files.

Change-Id: I3a331ba16f199d1d0025df735716ba5de298f522
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2078670
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-02-27 22:04:31 +00:00
Nelson Billing
815497495e Make LibcurlWrapper support static linking.
- Didn't used to support statically linked libcurl, now it does (like
HttpUpload does).

Change-Id: Ic014548225b129f0c1c9ffe6a671f5bd2352b6e6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2068947
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2020-02-22 00:03:09 +00:00
Joshua Peraza
a4c536dc2d linux: fix symupload build failures
Change-Id: I58612eb70173d79c2aeb755d8c7f5677cb3a8fb8
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2067608
Reviewed-by: Nelson Billing <nbilling@google.com>
2020-02-21 18:37:25 +00:00
Joshua Peraza
5e1c53a442 android: truncate lower of two overlapping modules
Previously, the processor truncated the upper of two
overlapping module ranges to compensate for incorrect
reporting of module ranges by the Breakpad client.
Crashpad correctly reports module load ranges, so
this truncation strategy is no longer necessary.

However, when partitioned libraries are used, the base
library may have a range which encompasses the other
partitions. When this is combined with the truncate
upper merge strategy, the base library's executable
segment is truncated causing symbolization failures.

This patch changes Android's merge strategy to truncate
the lower range (which is still the base library, but
this strategy truncates from the high end of the
library's range, instead of its base).

Bug: b/149845120
Change-Id: Ic75ecd3e919432690740eb21ebd4265fc0bbaa86
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2067952
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-02-21 04:06:35 +00:00
Nelson Billing
bbad9f255d Add optional new symbol upload API to sym_upload.
Change-Id: I6a49e9f4a699fa6f5f8e9f0fc86afb4cb342a442
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1422400
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-02-20 16:50:31 +00:00
Ivan Penkov
216cea7bca Update Xcode project files to fix build errors.
* Renamed convert_UTF.c to convert_UTF.cc
* Enabled to use C++17 for [[clang::fallthrough]] defined in src/common/macros.h

Patch by Hiro Komatsu

Change-Id: I5de7f7dd4c8bf231a004144a5c82828c59ddcfd6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2026761
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-29 18:53:05 +00:00
Michael Forney
647158232b Roll src/src/third_party/lss/ 8048ece6c..f70e2f164 (3 commits)
https://chromium.googlesource.com/linux-syscall-support/+log/8048ece6c16c..f70e2f1641e2

$ git log 8048ece6c..f70e2f164 --date=short --no-merges --format='%ad %ae %s'
2020-01-22 mforney Avoid conflict with pread64/pwrite64 defined by libc
2019-12-05 jperaza arm, ppc, mips32: fix fallocate and add tests
2019-11-13 jperaza Add sigtimedwait and sigprocmask wrappers

Created with:
  roll-dep src/src/third_party/lss

Change-Id: I63e1e0722a338875f53884565ea4c2706ec67037
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2020986
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2020-01-25 07:52:19 +00:00
Sim Sun
13c1568702 arm64: recover register X30(LR) when fallback to frame pointer unwinder
Stackwalk can't recover caller's register X30($LR) value by STACK CFI info.
This will lead unwinding stop immediately when fallback to frame pointer unwinder.

This PR will use try to use second last frame to recover register X30($LR) by frame pointer.
And we will give up correction if STACK CFI info doesn't agree with frame pointer info.

Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=808
Change-Id: I50649e3398e268b02ff297e83db21d05705c2a2d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1992641
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2020-01-21 16:57:57 +00:00
Joshua Peraza
4e15f7d230 Extract the exception record from the minidump
Change-Id: Ia622560960513e24b21184532f2272a09b9cdc95
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1986339
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
2020-01-03 20:47:38 +00:00
Joshua Peraza
e5ef907c2e ios: build for arm64e
When __DARWIN_OPAQUE_ARM_THREAD_STATE64 is set (by default when building
for arm64e), fp, lr, sp, pc, and flags (but not x or cpsr) in thread
state are prepended with "__opaque" and intended to be accessed via
supplied getters which may also authenticate pointers. We don't want to
authenticate those pointers (since we expect they may be invalid and
want to recover those invalid values) so access them directly.

Bug: b/140375065
Change-Id: Ibe6c1dbfb5d68a9d350614445fa06d48873f8549
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1986868
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-03 17:56:11 +00:00
Sterling Augustine
dbd454dbe4 Add dwarf5 compilation-unit header handling.
Fix a small typo in DW_LANG__Python.

Change-Id: I1fe54e501a5e8da5057ecc9ac00c7e7259a9bb3f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1967975
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-12-19 04:44:17 +00:00
Sterling Augustine
0c0e24f709 Add new dwarf 5 enums, plus some dwarf4 enums.
Change-Id: Ibe0b529664dd48a423cb453b786d08c5b7abec19
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1965462
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-12-12 20:46:16 +00:00
Nelson Billing
f32b83eb08 Enable reading DWARF4 CIEs with 32 bit addresses.
- Reading DWARF4 CIEs was added in
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/406012 but it
was only enabled for 64bit builds, since it would error out if the CIE
address size was not 8 bytes.
- Added a unit test to ensure that 32bit continues to work.

Change-Id: I824bb40cdf12056d39da335adb55ed315970fb88
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1941034
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-12-05 21:20:42 +00:00
Bryan Klimt
5bc3092b30 Add a variable to allow adding an extra include path for LSS.
I have a project where we are trying to include breakpad as a git
submodule. The only problem getting it to build with ndk-build is that
the linux_syscall_support.h header is missing. Normally, this header
would be downloaded by the depot_tools. But we cannot install
depot_tools on our CI machines.

So, we would like to include the header as a separate submodule in our
repo. The only change we would need to make to breakpad to make that
work is to add this optional variable to the C header search path. In
the normal case, this variable will not be set and nothing will be
different. But we can set the variable to allow us to build without
installing depot_tools.

I have manually tested this using a separate project that links to
breakpad in this way.

Change-Id: Id116b2af1c1ba0a08464c213d8982b24a1821ee7
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1930179
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-12-04 19:46:05 +00:00
Mark Mentovai
47cd498384 dump_syms: handle forward reference DWARF attributes
DW_AT_specification and DW_AT_abstract_origin attributes carry
references to other DIEs. Nothing prevents the DIEs referred to from
appearing later in .debug_info than the DIE containing the referring
attribute, but dump_syms incompletly implemented its handling of these
references, and was only able to resolve them when they were
back-references.

This will fix the chronic warnings produced by dump_syms of the form:

dump_syms: the DIE at offset <offset> has a {DW_AT_specification,
DW_AT_abstract_origin} attribute referring to the die at offset
<offset>, which either was not marked as {a declaration, an inline}, or
comes later in the file

Patch by Greg Clayton

Bug: breakpad:441
Change-Id: I98957d64a234c22afb6d0153f1bdc09e6a600b1d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1946706
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-12-02 18:47:46 +00:00
Jon Turney
1f1d950d6a Fix compilation of http_upload.cc with Windows gcc
Fix compilation of http_upload.cc with Windows gcc after 548ca6e3, by
moving the definition of GetFileContents(), so it comes after the
definition of WideToMBCP(), which it uses (under !_MSC_VER).

common/windows/http_upload.cc: In function ‘bool {anonymous}::GetFileContents(const wstring&, std::vector<char>*)’:
common/windows/http_upload.cc:80:19: error: ‘WideToMBCP’ was not declared in this scope

Change-Id: I1646b39263e97bbf3bd8cb1ae209be238023110f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1928929
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-11-22 18:29:21 +00:00
Mark Mentovai
f6fe7cc55a mac processor: Add mapping for EXC_BAD_ACCESS/KERN_CODESIGN_ERROR
This code indicates termination under “kill” semantics due to a module’s
code signature becoming invalid.

Bug: chromium:1023239
Change-Id: I3d453af9ef6c6925edcf9c08dbd78e563877522f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1930177
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2019-11-22 17:52:59 +00:00
Jon Turney
62f10f30ba Fix 'make distcheck'
Update EXTRA_DIST to allow 'make distcheck' to work

Change-Id: I2f840e6e86039d590af601a55e20fb9f6caf3a08
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1924253
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-11-19 15:20:39 +00:00
Sylvain Defresne
792e6b2143 Remove dependency of uploader.mm on GTMLogger
The file GTMLogger shipped with breakpad is a copy of the version
from google_toolbox_for_mac. Having uploader.mm depend on GTMLogger
causes pain to iOS projects that want to integrate both breakpad
and google_toolbox_for_mac.

Since the file uploader.mm mixed uses of fprintf and GTMLogger to
log errors and warning, convert it to only use fprintf to stderr.

Bug: none
Change-Id: I68313ccf6951676a2859f44225281813722096ba
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1911755
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-11-12 16:17:19 +00:00
Christopher Grant
5915ea929c Add fallthrough annotations on new C++ switches
A recent commit converted some source from C to C++. Chrome has
checks against unannotated switch case fallthroughs in C++ code, so the
converted source needs annotations.

Bug: 990190
Change-Id: Ib92435b4877be936f837928a70b552ec4975d42a
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1898429
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-11-05 03:39:54 +00:00
Mark Mentovai
8c62281f8b Revert "Remove use of "register" keyword, deprecated in C++17"
This reverts commit 07411862ea.

We were a bit overzealous in removing “register” here. Both clang and
GCC correctly disallow “register” as a storage class specifier in C++17
mode by producing an error in ordinary use. However, they require
“register” to be specified for explicit register variables, and do not
produce an error in this case.

Change-Id: I223f2652c6da4215d6e8788d902e767c94b8c29d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1894875
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-11-01 03:49:20 +00:00
Joshua Peraza
5085b1d0df linux, client: set module name from DT_SONAME
3e56ef9d changed dump_syms to set the module name from DT_SONAME
expecting that clients were already using DT_SONAME when it was
present. The Breakpad client previously only used DT_SONAME as the name
for a module if it detected that it was likely mapped from a zip file.
This patch updates the Breakpad Linux client to always use the
DT_SONAME in minidumps if it's present.

Also included are changes to address comments that were missed from
that review.

Bug: 1016924
Change-Id: I4aae8c05e6793d4b0598049a8964ddd4cb0c6194
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1889231
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-10-30 17:54:00 +00:00
Christopher Grant
d27fd9ae7e linux, dump_syms: Make style consistent in module unittest
Make the following consistent within the file:

- 0x...ULL for unsigned literals.
- On pointers, put the asterisk with the type.

Context: Made a previous change and saw a mix of styles. Make it
consistent for the sake of visual consistency.

Bug: None
Change-Id: I0f80aedc0ca0295be3c70bd88822cbb82d0415ba
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1888434
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-10-29 20:30:25 +00:00
Christopher Grant
862c9f47ef linux, dump_syms: Filter module entries outside specified ranges
Partitioned libraries generated with lld and llvm-objcopy currently
contain a superset of debug information, beyond what applies to the
library itself. This is because objcopy cannot split up debug
information by partition - instead, it places a copy of all debug
information into each partition.

In lieu of potential future support for lld or objcopy becoming able to
split up debug information, let dump_syms do the next best thing:

- Find the address ranges of all PT_LOAD segments in the lib.
- Supply these to the Module being generated.
- Filter additions to the Module based on these ranges.

Bug: 990190
Change-Id: Ib5f279f42e3f6ea79eed9665efbcc23c3c5d25dc
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1884699
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-10-29 19:03:12 +00:00
Jake Ehrlich
17958ef62c Add options to set OS and filename
This allows Fuchsia to use dump_syms directly without a
postprocessing step.

Change-Id: I84507f8bedddfcdcdb237119457c8ddf8ac354d5
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1850718
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-10-24 22:05:33 +00:00
Joshua Peraza
3e56ef9d4e linux, dump_syms: set module name from DT_SONAME
The Breakpad and Crashpad clients will use an object's DT_SONAME as
the name for a module if it exists. Previously, linux dump_syms would
assume the basename of an input elf file matches that value, causing
symbol lookups to fail if they were mismatched. This patch updates
dump_syms to use DT_SONAME as the module name, if present.

Bug: 1016924
Change-Id: I5eff0cf06c703841df3fb552cb5a8e1e50a20c64
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1876763
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-10-24 18:59:59 +00:00
Mike Frysinger
db1cda2653 convert_UTF: rewrite in C++
This allows us to namespace the symbols properly.

Bug: google-breakpad:725
Change-Id: Iea8052547eef6c0acb299c1995781735c6d8994f
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1769236
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-09-04 20:25:23 +00:00
Mike Frysinger
abfe08e789 codereview.settings: do not force squashing behavior
Leave it to the user to decide how to manage their local tree state.

Bug: 993518
Change-Id: Ic026f9bdc11e1a16f91da74f1b173753c6efa88c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1753593
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-08-14 17:56:21 +00:00
Mark Mentovai
07411862ea Remove use of "register" keyword, deprecated in C++17
"register" as a storage class specifier has been deprecated since C++11,
and has been removed from C++17 while remaining a reserved word. See
C++17 5.11 and C.4.3.

Change-Id: I2dbab8a7061cb680d902644d39ea1a7fbc930e5c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1749329
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-08-12 18:36:48 +00:00
Mark Mentovai
01dfa81f1b Mac dump_syms: accept __DWARF segment without __debug_info section
A .dSYM may validly contain a __DWARF segment without any __debug_info
section. This can occur for Chromium Framework in a component build of
Chromium, because in that case, all of the code is in other libraries
that Chromium Framework depends on.

This was previously tested by an assertion, but the assertion did not
trigger in NDEBUG (release) builds. In NDEBUG builds, this condition
would lead to an out-of-bounds read, detected by AddressSanitizer.

Instead of an assertion, the check is now always done at runtime.
Instead of being fatal, it's now just a warning, because it's been
established that __DWARF without __debug_info can occur.

(In the Chromium case, it remains pointless to run dump_syms via the
"chrome_dump_syms" target on a component build, as it'll only attempt to
symbolize Chromium Framework, and not any of the libraries that Chromium
Framework depends on that actually contain the code.)

Bug: chromium:991206
Change-Id: I6c9c75f0be7901813e3eaae54aff38c1afe73ca9
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1741610
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2019-08-07 16:43:11 +00:00
Mike Frysinger
ef04c9c028 string_conversion: fix pointer math
Since target_ptr is of type uint16_t* already, we don't need to scale
the byte count as the language does that for us.  If it were void*, we
would need this code, but it's not.

In practice it's probably not a big deal due to how we preallocated
memory: when converting UTF8->UTF16, we'd reserve the same number of
code units, and UTF8 takes more code units per codepoint than UTF16,
so the UTF16 vector is always oversized.

When converting UTF32->UTF16, we also reserve the same number of
code units, but since one UTF32 code unit could require two UTF16
code units (for U+10000 codepoints and higher), we would probably
corrupt memory in the process.  The APIs in this module don't seem
to take into account that range in general, so for now I'm only
fixing the memory corruption.

Bug: google-breakpad:768
Change-Id: Ibfaea4e866733ff8d99b505e72c500bd40d11a74
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1732888
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-08-05 17:38:16 +00:00
Mike Frysinger
4beee493f6 guid_creater: include string.h for memcpy
Bug: google-breakpad:779
Change-Id: If0cfb036ee924178033c89d4dc3e2ce75ddd46f2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1732887
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-08-04 04:11:55 +00:00
Mike Frysinger
f0d43bc16b minidump_processor: fix typo in BUS_ADRALN
Bug: google-breakpad:787
Change-Id: I9f7144b3456abb750142eae9f989133bf4f27885
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1734586
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-08-04 04:11:34 +00:00
Henri Hyyryläinen
55499d616c Updated lss to fix compiling with GCC 9
Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=795
Change-Id: I1494c1d2493616b6b263111137ef7aceeb31be44
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1733536
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2019-08-03 14:31:16 +00:00