Commit Graph

840 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
e80652b627 ship cmake bits with tar.gz distribution
Fixes issue #1321.
2022-01-14 23:08:57 -08:00
Volodymyr Nikolaichuk
003775aa81 free memory with mmap(PROT_NONE, MAP_FIXED) 2021-12-12 22:29:36 -08:00
Natale Patriciello
852fb6df03 Implement free_definite_size
In Monterey, it seems that free_definite_size is required (despite
the documentation saying that is optional). The implementation
just forward the call to free.

Signed-off-by: Natale Patriciello <natale.patriciello@gmail.com>
2021-12-12 22:28:06 -08:00
stdpain
c25941200e fix cmake gperftools_enable_libunwind invalid 2021-06-20 10:07:42 -07:00
Robert Scott
43504ab709 tcmalloc page fences: add TCMALLOC_PAGE_FENCE_READABLE option 2021-06-20 10:02:06 -07:00
Matt T. Proud
d57a9ea8bc README: replace "golang" moniker with "Go"
This commit replaces the "golang" moniker in the README file with the
appropriate name of "Go" per https://golang.org/doc/faq#go_or_golang.

In this context, no disambiguation is required.
2021-06-20 09:55:45 -07:00
Aliaksey Kandratsenka
f7c6fb6c8e bump version to 2.9.1 2021-03-02 19:32:07 -08:00
Aliaksey Kandratsenka
c2f60400a8 prefer backtrace() on OSX
It seems to work and _Unwind_Backtrace which is configured otherwise
doesn't.
2021-02-28 17:52:17 -08:00
Aliaksey Kandratsenka
a015377a54 Set tcmalloc heap limit prior to testing oom
Otherwise it can take long time to OOM on osex.
2021-02-28 17:47:56 -08:00
Aliaksey Kandratsenka
c939dd5531 correctly check sized delete hint when asserts are on
We previously tested wrong assumption that larger than page size size
classes have addresses aligned on page size. New code is making proper
check of size class.

Also added is unit test coverage for this previously failing
condition. And we now also run "assert-ful" unittests for big tcmalloc
too, not only tcmalloc_minimal configuration.

This fixes github issue #1254
2021-02-28 15:54:22 -08:00
Aliaksey Kandratsenka
47b5b59ca9 bump version to 2.9 2021-02-21 15:16:06 -08:00
Aliaksey Kandratsenka
d7cbc8c2ff unbreak cmake build
It was trying to use third_party/valgrind.h header which I recently
removed.
2021-02-21 15:01:01 -08:00
Aliaksey Kandratsenka
be0bbdb340 amputate various unused bits from elfcore.h 2021-02-21 14:29:40 -08:00
Aliaksey Kandratsenka
42bab59f25 liberate profile handler from linux_syscall_support
We can get thread's tid in more portable way via libc syscall wrapper.
2021-02-21 14:29:34 -08:00
Aliaksey Kandratsenka
4629511e99 liberate spinlock futex waits from linux_syscall_support includes
We've been using libc syscall wrapper some time now.
2021-02-21 14:28:44 -08:00
Aliaksey Kandratsenka
2e7094a862 liberate malloc_hook_mmap_linux.h from linux_syscall_support
It was not used some time now, as we're rightfully trusting libc
syscall wrapper instead.
2021-02-21 14:28:25 -08:00
Aliaksey Kandratsenka
35301e2e59 add missing noopt wrappings around more operator new calls
This fixes tests passing on clang which otherwise eliminates those
new/delete calls so checking for hooks being called failed.
2021-02-21 12:41:36 -08:00
Venkatesh Srinivas
fa412adfe3 Fix thread-safety (annotalysis) annotations
tcmalloc contains some thread-safety annotations; however those
annotations have not been exercised for some time, as they used
macros/attributes only supported by a legacy branch of gcc.

Pull request #1251 converted those macros to support modern
versions of clang; this CR fixes the annotations that were
enabled. For the most part, this just requires re-enabling
annotations on member functions that take/release locks. For the
tcmalloc fork (pre-fork and post-fork) handlers, we mark the
functions as exempt from this analysis, as it takes a dynamic
number of locks.
2021-02-17 17:50:43 -08:00
Venkatesh Srinivas
cc496aecb8 tcmalloc: Switch thread-safety annotations to support clang
tcmalloc contains its own copy of thread_annotations.h, wrapper
macros for static thread-safety analysis expressions. These thread-
safety expressions allow asserting (at compile time) that certain
locks are held or excluded or certain data is protected by specific
locks; they are checked at compile-time by recent versions of clang
or a gcc branch (https://gcc.gnu.org/wiki/ThreadSafetyAnnotation).

Convert the #if-guard and macro names from the no-longer-supported
gcc branch's defines & macros to the versions supported by recent
versions of clang.
2021-02-17 16:23:17 -08:00
Aliaksey Kandratsenka
96ba58e19b bump version to 2.9rc 2021-02-14 23:18:57 -08:00
Aliaksey Kandratsenka
9ce32aefa9 upgrade test bot to xenial (ubuntu 16.04 LTS)
Older glibc seemingly doesn't have right unwind info for signal frame,
so fails recently upgraded stacktrace_unittest. But since this version
is not supported anymore, lets just test newer glibc.
2021-02-14 23:02:28 -08:00
Aliaksey Kandratsenka
91ff311449 don't default to generic_fp without frame pointers
I.e. on x86-64 and riscv.
2021-02-14 22:39:30 -08:00
Aliaksey Kandratsenka
4cf7dd0a75 enable emergency_malloc on all architectures with mmap
It is actually needed for libgcc backtracer from time to time. And
we've seen libunwind to need it too. Plus we've not heard of any
problems with it. So lets just always enable it.

This should fix github issue #1248.
2021-02-14 22:28:34 -08:00
Aliaksey Kandratsenka
37087ec536 prefer libunwind on x86-64 even with -fno-omit-frame-pointer
Libunwind is mostly safe on x86-64 and most of OS (e.g. libc) is
compiled without frame pointers anyways. Even when libc is built with
frame pointers, various libc asm routines (e.g. memcpy) are not. And
even for code built with frame pointers we actually sometimes get
SIGPROF inside function prologues, before frame pointer is
established. Which then causes imperfect backtraces.

Libunwind should handle this all (when it doesn't crash or deadlock).
2021-02-14 22:12:47 -08:00
Aliaksey Kandratsenka
f4aa2a435e implement generic frame pointer backtracer
This supports frame pointer backtracing on x86-64, aarch64 and
riscv-s (should work for both 32 and 64 bits).

Also added is detection of borked libunwind on aarch64-s. In this case
frame pointer unwinder is preferred.
2021-02-14 22:11:09 -08:00
Aliaksey Kandratsenka
17bab484ae always respect --enable-frame-pointers
Previously it only was respected on x86_64, but this days lots of modern
ABIs are without frame pointers by default (e.g. arm64 and riscv, and
even older mips).
2021-02-14 16:44:28 -08:00
Aliaksey Kandratsenka
22c0eceddc add emacs mode line annotations to remaining files 2021-02-14 16:29:14 -08:00
Aliaksey Kandratsenka
b12139ddba delete-trailing-whitespace on all files 2021-02-14 16:13:15 -08:00
Aliaksey Kandratsenka
419c85814d amputate unused dynamic annotations support 2021-02-14 16:09:17 -08:00
Aliaksey Kandratsenka
73a72cdb61 don't check for snprintf 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
95b52b0504 don't check for unused uname symbol 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
01c2697fac amputate unused SleepForMilliseconds from sysinfo.{h,cc} 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
ac68c97187 don't check for useless __builtin_stack_pointer
It doesn't seem to be supported anyways, and we're not using it too.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
7271bb72be unbreak cmake check for TLS support 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
7c106ca241 don't bother checking for stl namespace and use std
Because there are no compilers left that don't do std namespace.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
0d6f32b9ce use standard way to print size_t-sized ints
I.e. just use zu/zd/zx instead of finding out right size and defining
PRI{u,x,d}S defines. Compilers have long caught up to this part of
standard.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
0c11d35f4a amputate checking for __int64
Since everything supports stdint.h this days.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
92718aaaeb amputate checking for conflict-signal.h
It was never found or used.
2021-02-14 15:12:19 -08:00
Aliaksey Kandratsenka
9bb2937261 amputate checking for inline keyword support
It is supported everywhere now.
2021-02-14 15:12:19 -08:00
Đoàn Trần Công Danh
d9c4c3b481 profile-handler: use documented sigev_notify_thread_id in sigevent
sigevent(7) is documented to have sigev_notify_thread_id as its member.
In glibc system, it's a macro expanded to the legacy _sigev_un._tid,
_sigev_un._tid is obviously an internal implementation detail as
signaled by its underscore prefix. And this macro was hidden inside
linux/signal.h in older version of glibc.

On Linux that use musl libc, sigev_notify_thread_id is also a macro, but
it's expanded to __sev_fields.sigev_notify_thread_id

[alkondratenko@gmail.com: amputated broken linux/signal.h dependency]
[alkondratenko@gmail.com: see https://github.com/gperftools/gperftools/pull/1250]
Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
2021-02-14 12:50:10 -08:00
Đoàn Trần Công Danh
43459feb33 configure.ac: check for features.h once 2021-02-14 11:28:07 -08:00
Venkatesh Srinivas
290b123c01 atomicops: Remove Acquire_Store / Release_Load
gperftools' internal atomicops library included atomic
Release Load and Acquire Store operations; those operations
were unused and expressed ordering constraints that aren't
expressible in the C++ standard memory model.

Remove them, to make a transition to C++11 atomics easier
and to avoid confusing use of them.
2021-02-14 11:23:42 -08:00
SSE4
3b1c60cc4e Add support for Elbrus 2000 (e2k) 2021-01-30 13:45:18 -08:00
Jarno Rajahalme
c5747615da syscall: Mark x8 as clobbered
Mark arm64 register x8 as clobbered by syscall body inline assembly as
it is being used to store the syscall number. Otherwise the compiler
may try to use it for some other purpose.

This fix is derived from a resolution to clang Bugzilla report
https://bugs.llvm.org/show_bug.cgi?id=48798.  See this report for a
minimal reproducer derived from the code fixed here as well as the
resolution.

This should fix SEGFAULTs as reported in
https://github.com/envoyproxy/envoy/issues/14756.

Fixes: #1241
Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
2021-01-30 13:43:03 -08:00
Aliaksey Kandratsenka
d8eb315fb1 bump version to 2.8.1 2020-12-20 23:35:08 -08:00
Aliaksey Kandratsenka
6ed61f8e91 add note that cmake build is preliminary 2020-12-19 19:14:50 -08:00
okhowang(王沛文)
6bbf2ed150 Update cmake 2020-12-19 18:52:40 -08:00
Isaac Hier
913d3eb7d7 Fix a few macros for Apple 2020-12-19 18:52:40 -08:00
Isaac Hier
64a73b1cb8 Work on fixing linking errors in stacktrace 2020-12-19 18:52:40 -08:00
Isaac Hier
b788d51eb4 Fix conditional definitions 2020-12-19 18:52:40 -08:00