Commit Graph

8 Commits

Author SHA1 Message Date
Avi Kivity
aa1270a00c treewide: change assert() to SCYLLA_ASSERT()
assert() is traditionally disabled in release builds, but not in
scylladb. This hasn't caused problems so far, but the latest abseil
release includes a commit [1] that causes a 1000 insn/op regression when
NDEBUG is not defined.

Clearly, we must move towards a build system where NDEBUG is defined in
release builds. But we can't just define it blindly without vetting
all the assert() calls, as some were written with the expectation that
they are enabled in release mode.

To solve the conundrum, change all assert() calls to a new SCYLLA_ASSERT()
macro in utils/assert.hh. This macro is always defined and is not conditional
on NDEBUG, so we can later (after vetting Seastar) enable NDEBUG in release
mode.

[1] 66ef711d68

Closes scylladb/scylladb#20006
2024-08-05 08:23:35 +03:00
Michael Livshin
80c9455413 build_id: cache the value
The CPU cost of iterating over the relevant ELF structures is probably
negligible (despite the amount of code involved), but there is no need
to keep the containing page mapped in RAM when it doesn't have to be.

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
2022-06-02 11:21:05 +03:00
Avi Kivity
720e9521f0 utils: build_id: correct fmt include
fmt::print(std::ostream&) is in <fmt/ostream.h>

Closes #9641
2021-11-17 09:02:57 +02:00
Avi Kivity
379454c235 utils: convert fmt::fprintf() to fmt::print()
Standardizing on a common format language.
2021-10-27 17:02:00 +03:00
Avi Kivity
a55b434a2b treewide: extent copyright statements to present day 2021-06-06 19:18:49 +03:00
Avi Kivity
af8fd8c8d8 utils: build_id: fix ubsan false positive on pointer arithmetic
get_nt_build_id() constructs a pointer by adding a base and an
offset, but if the base happens to be zero, that is undefined
under C++ rules (altough legal ELF).

Fix by performing the addition on integers, and only then
casting to a pointer.

Closes #7379
2020-10-11 17:23:40 +03:00
Benny Halevy
9256d2f504 build_id: simplify callback pointer type casting
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2020-08-03 15:55:18 +03:00
Benny Halevy
bf6e8f66d9 build_id: mv sources to utils/
The root directory is already overcrowded.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2020-08-03 15:55:16 +03:00