aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2025-02-28 08:14:30 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2025-02-28 08:29:55 +0300
commit7832b72a0dcd94337d67ffa846eb7f389329e6bc (patch)
tree6c1f7a4d892d15292a329b12e85bb7f2f345b8d6 /contrib/libs
parent5581d11ad7e3cf76f13a2698ed2d2a8df2fa11c4 (diff)
downloadydb-7832b72a0dcd94337d67ffa846eb7f389329e6bc.tar.gz
Update contrib/libs/cxxsupp/libcxxrt to 2024-10-22
This brings [PR #41](https://github.com/libcxxrt/libcxxrt/pull/41) from upstream which provides the logic similar to `fix_trace_format.patch`. commit_hash:e090272f3f529d314a55199847093e4101306600
Diffstat (limited to 'contrib/libs')
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/.yandex_meta/override.nix6
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/exception.cc67
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/patches/do-upcast-not-cast-to.patch17
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/patches/pr41.1-move-trace.patch74
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/patches/pr41.2-fix-trace-format.patch48
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/patches/pr47-dont-use-static.patch23
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/patches/pr49-cosmetics.patch24
-rw-r--r--contrib/libs/cxxsupp/libcxxrt/ya.make4
8 files changed, 89 insertions, 174 deletions
diff --git a/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/override.nix b/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/override.nix
index d80f39e895..c7e6589089 100644
--- a/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/override.nix
+++ b/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/override.nix
@@ -1,12 +1,12 @@
pkgs: attrs: with pkgs; rec {
- version = "2024-10-14";
- revision = "76435c4451aeb5e04e9500b090293347a38cef8d";
+ version = "2024-10-22";
+ revision = "5bf955548df364bc6efe4add80947b8689c74e2a";
src = fetchFromGitHub {
owner = "libcxxrt";
repo = "libcxxrt";
rev = "${revision}";
- hash = "sha256-U7mq79/0xbyRr2+KUMKgEvyd2lfr3Q5GrByt/8J9sC8=";
+ hash = "sha256-YxMYouW/swdDP/YtNGFlFpBFIc5Pl08mCIl07V3OsCE=";
};
nativeBuildInputs = [ cmake ];
diff --git a/contrib/libs/cxxsupp/libcxxrt/exception.cc b/contrib/libs/cxxsupp/libcxxrt/exception.cc
index 088e62e449..93aafd1168 100644
--- a/contrib/libs/cxxsupp/libcxxrt/exception.cc
+++ b/contrib/libs/cxxsupp/libcxxrt/exception.cc
@@ -287,12 +287,16 @@ namespace std
using namespace ABI_NAMESPACE;
+#ifdef LIBCXXRT_NO_DEFAULT_TERMINATE_DIAGNOSTICS
+/** The global termination handler. */
+static atomic<terminate_handler> terminateHandler = abort;
+#else
/**
* Callback function used with _Unwind_Backtrace().
*
* Prints a stack trace. Used only for debugging help.
*
- * Note: As of FreeBSD 8.1, dladd() still doesn't work properly, so this only
+ * Note: As of FreeBSD 8.1, dladdr() still doesn't work properly, so this only
* correctly prints function names from public, relocatable, symbols.
*/
static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
@@ -313,24 +317,20 @@ static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
}
static void terminate_with_diagnostics() {
- __cxa_eh_globals *globals = __cxa_get_globals();
- __cxa_exception *ex = globals->caughtExceptions;
+ __cxa_eh_globals *globals = __cxa_get_globals();
+ __cxa_exception *ex = globals->caughtExceptions;
- if (ex != nullptr) {
- fprintf(stderr, "uncaught exception:\n address -> %p\n", (void*)ex);
+ if (ex != nullptr) {
+ fprintf(stderr, "Terminating due to uncaught exception %p", static_cast<void*>(ex));
ex = realExceptionFromException(ex);
-
- const __class_type_info *e_ti =
+ const __class_type_info *e_ti =
static_cast<const __class_type_info*>(&typeid(std::exception));
- const __class_type_info *throw_ti =
+ const __class_type_info *throw_ti =
dynamic_cast<const __class_type_info*>(ex->exceptionType);
-
if (throw_ti) {
void* ptr = ex + 1;
-
if (throw_ti->__do_upcast(e_ti, &ptr)) {
std::exception* e = static_cast<std::exception*>(ptr);
-
if (e) {
fprintf(stderr, " what() -> \"%s\"\n", e->what());
}
@@ -342,14 +342,19 @@ static void terminate_with_diagnostics() {
const char *mangled = ex->exceptionType->name();
int status;
demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status);
- fprintf(stderr, " type -> %s\n", status == 0 ? demangled : mangled);
+ fprintf(stderr, " of type %s\n", status == 0 ? demangled : mangled);
if (status == 0) { free(demangled); }
+
+ _Unwind_Backtrace(trace, 0);
}
- abort();
+
+ abort();
}
/** The global termination handler. */
static atomic<terminate_handler> terminateHandler = terminate_with_diagnostics;
+#endif
+
/** The global unexpected exception handler. */
static atomic<unexpected_handler> unexpectedHandler = std::terminate;
@@ -788,7 +793,8 @@ void __cxa_free_dependent_exception(void *thrown_exception)
* Report a failure that occurred when attempting to throw an exception.
*
* If the failure happened by falling off the end of the stack without finding
- * a handler, prints a back trace before aborting.
+ * a handler, catch the exception before calling terminate. The default
+ * terminate handler will print a backtrace before aborting.
*/
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
extern "C" void *__cxa_begin_catch(void *e) _LIBCXXRT_NOEXCEPT;
@@ -810,39 +816,6 @@ static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exce
#endif
case _URC_END_OF_STACK:
__cxa_begin_catch (&(thrown_exception->unwindHeader));
- std::terminate();
- fprintf(stderr, "Terminating due to uncaught exception %p",
- static_cast<void*>(thrown_exception));
- thrown_exception = realExceptionFromException(thrown_exception);
- static const __class_type_info *e_ti =
- static_cast<const __class_type_info*>(&typeid(std::exception));
- const __class_type_info *throw_ti =
- dynamic_cast<const __class_type_info*>(thrown_exception->exceptionType);
- if (throw_ti)
- {
- std::exception *e =
- static_cast<std::exception*>(e_ti->cast_to(static_cast<void*>(thrown_exception+1),
- throw_ti));
- if (e)
- {
- fprintf(stderr, " '%s'", e->what());
- }
- }
-
- size_t bufferSize = 128;
- char *demangled = static_cast<char*>(malloc(bufferSize));
- const char *mangled = thrown_exception->exceptionType->name();
- int status;
- demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status);
- fprintf(stderr, " of type %s\n",
- status == 0 ? demangled : mangled);
- if (status == 0) { free(demangled); }
- // Print a back trace if no handler is found.
- // TODO: Make this optional
- _Unwind_Backtrace(trace, 0);
-
- // Just abort. No need to call std::terminate for the second time
- abort();
break;
}
std::terminate();
diff --git a/contrib/libs/cxxsupp/libcxxrt/patches/do-upcast-not-cast-to.patch b/contrib/libs/cxxsupp/libcxxrt/patches/do-upcast-not-cast-to.patch
new file mode 100644
index 0000000000..93fce488a5
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxxrt/patches/do-upcast-not-cast-to.patch
@@ -0,0 +1,17 @@
+--- contrib/libs/cxxsupp/libcxxrt/exception.cc (index)
++++ contrib/libs/cxxsupp/libcxxrt/exception.cc (working tree)
+@@ -321,7 +321,7 @@ static void terminate_with_diagnostics() {
+- if (throw_ti)
+- {
+- std::exception *e =
+- static_cast<std::exception*>(e_ti->cast_to(static_cast<void*>(ex+1), throw_ti));
+- if (e)
+- {
+- fprintf(stderr, " '%s'", e->what());
++ if (throw_ti) {
++ void* ptr = ex + 1;
++ if (throw_ti->__do_upcast(e_ti, &ptr)) {
++ std::exception* e = static_cast<std::exception*>(ptr);
++ if (e) {
++ fprintf(stderr, " what() -> \"%s\"\n", e->what());
++ }
diff --git a/contrib/libs/cxxsupp/libcxxrt/patches/pr41.1-move-trace.patch b/contrib/libs/cxxsupp/libcxxrt/patches/pr41.1-move-trace.patch
deleted file mode 100644
index b1331c9445..0000000000
--- a/contrib/libs/cxxsupp/libcxxrt/patches/pr41.1-move-trace.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-commit 690915810d43430667f8d7b84fc7f88784f68fdf (HEAD -> update-libcxxrt)
-author: thegeorg
-date: 2025-02-26T13:56:00+03:00
-
- Revert "Simplify libcxxrt patches"
-
- This reverts commit 4358151e7723e37a39cf6f5478bfa336aa687fd4, reversing
- changes made to ad7618a2219d22bcd89a67fe082f290b4a9656ef.
-
---- contrib/libs/cxxsupp/libcxxrt/exception.cc (27ffe99a31d7fb0dd8a933c936f70853dac6041a)
-+++ contrib/libs/cxxsupp/libcxxrt/exception.cc (690915810d43430667f8d7b84fc7f88784f68fdf)
-@@ -287,6 +287,30 @@ namespace std
-
- using namespace ABI_NAMESPACE;
-
-+/**
-+ * Callback function used with _Unwind_Backtrace().
-+ *
-+ * Prints a stack trace. Used only for debugging help.
-+ *
-+ * Note: As of FreeBSD 8.1, dladd() still doesn't work properly, so this only
-+ * correctly prints function names from public, relocatable, symbols.
-+ */
-+static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
-+{
-+ Dl_info myinfo;
-+ int mylookup =
-+ dladdr(reinterpret_cast<void *>(__cxa_current_exception_type), &myinfo);
-+ void *ip = reinterpret_cast<void*>(_Unwind_GetIP(context));
-+ Dl_info info;
-+ if (dladdr(ip, &info) != 0)
-+ {
-+ if (mylookup == 0 || strcmp(info.dli_fname, myinfo.dli_fname) != 0)
-+ {
-+ printf("%p:%s() in %s\n", ip, info.dli_sname, info.dli_fname);
-+ }
-+ }
-+ return _URC_CONTINUE_UNWIND;
-+}
-
-
- /** The global termination handler. */
-@@ -760,31 +785,6 @@ void __cxa_free_dependent_exception(void *thrown_exception)
- }
-
- /**
-- * Callback function used with _Unwind_Backtrace().
-- *
-- * Prints a stack trace. Used only for debugging help.
-- *
-- * Note: As of FreeBSD 8.1, dladd() still doesn't work properly, so this only
-- * correctly prints function names from public, relocatable, symbols.
-- */
--static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
--{
-- Dl_info myinfo;
-- int mylookup =
-- dladdr(reinterpret_cast<void *>(__cxa_current_exception_type), &myinfo);
-- void *ip = reinterpret_cast<void*>(_Unwind_GetIP(context));
-- Dl_info info;
-- if (dladdr(ip, &info) != 0)
-- {
-- if (mylookup == 0 || strcmp(info.dli_fname, myinfo.dli_fname) != 0)
-- {
-- printf("%p:%s() in %s\n", ip, info.dli_sname, info.dli_fname);
-- }
-- }
-- return _URC_CONTINUE_UNWIND;
--}
--
--/**
- * Report a failure that occurred when attempting to throw an exception.
- *
- * If the failure happened by falling off the end of the stack without finding
diff --git a/contrib/libs/cxxsupp/libcxxrt/patches/pr41.2-fix-trace-format.patch b/contrib/libs/cxxsupp/libcxxrt/patches/pr41.2-fix-trace-format.patch
deleted file mode 100644
index a70c234b4f..0000000000
--- a/contrib/libs/cxxsupp/libcxxrt/patches/pr41.2-fix-trace-format.patch
+++ /dev/null
@@ -1,48 +0,0 @@
---- contrib/libs/cxxsupp/libcxxrt/exception.cc (index)
-+++ contrib/libs/cxxsupp/libcxxrt/exception.cc (working tree)
-@@ -312,9 +312,44 @@ static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
- return _URC_CONTINUE_UNWIND;
- }
-
-+static void terminate_with_diagnostics() {
-+ __cxa_eh_globals *globals = __cxa_get_globals();
-+ __cxa_exception *ex = globals->caughtExceptions;
-+
-+ if (ex != nullptr) {
-+ fprintf(stderr, "uncaught exception:\n address -> %p\n", (void*)ex);
-+ ex = realExceptionFromException(ex);
-+
-+ const __class_type_info *e_ti =
-+ static_cast<const __class_type_info*>(&typeid(std::exception));
-+ const __class_type_info *throw_ti =
-+ dynamic_cast<const __class_type_info*>(ex->exceptionType);
-+
-+ if (throw_ti) {
-+ void* ptr = ex + 1;
-+
-+ if (throw_ti->__do_upcast(e_ti, &ptr)) {
-+ std::exception* e = static_cast<std::exception*>(ptr);
-+
-+ if (e) {
-+ fprintf(stderr, " what() -> \"%s\"\n", e->what());
-+ }
-+ }
-+ }
-+
-+ size_t bufferSize = 128;
-+ char *demangled = static_cast<char*>(malloc(bufferSize));
-+ const char *mangled = ex->exceptionType->name();
-+ int status;
-+ demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status);
-+ fprintf(stderr, " type -> %s\n", status == 0 ? demangled : mangled);
-+ if (status == 0) { free(demangled); }
-+ }
-+ abort();
-+}
-
- /** The global termination handler. */
--static atomic<terminate_handler> terminateHandler = abort;
-+static atomic<terminate_handler> terminateHandler = terminate_with_diagnostics;
- /** The global unexpected exception handler. */
- static atomic<unexpected_handler> unexpectedHandler = std::terminate;
-
diff --git a/contrib/libs/cxxsupp/libcxxrt/patches/pr47-dont-use-static.patch b/contrib/libs/cxxsupp/libcxxrt/patches/pr47-dont-use-static.patch
new file mode 100644
index 0000000000..e9427a4f5e
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxxrt/patches/pr47-dont-use-static.patch
@@ -0,0 +1,23 @@
+From 7b33a3cb0a09c6cda952c6209404fcbf5177fc22 Mon Sep 17 00:00:00 2001
+From: Yuriy Chernyshov <thegeorg@yandex-team.com>
+Date: Tue, 25 Feb 2025 11:20:35 +0100
+Subject: [PATCH] Do not use static for a local variable
+
+This looks like a typo
+---
+ src/exception.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/exception.cc b/src/exception.cc
+index 5034809..9bcf903 100644
+--- a/exception.cc
++++ b/exception.cc
+@@ -337,7 +337,7 @@ static void terminate_with_diagnostics() {
+ if (ex != nullptr) {
+ fprintf(stderr, "Terminating due to uncaught exception %p", static_cast<void*>(ex));
+ ex = realExceptionFromException(ex);
+- static const __class_type_info *e_ti =
++ const __class_type_info *e_ti =
+ static_cast<const __class_type_info*>(&typeid(std::exception));
+ const __class_type_info *throw_ti =
+ dynamic_cast<const __class_type_info*>(ex->exceptionType);
diff --git a/contrib/libs/cxxsupp/libcxxrt/patches/pr49-cosmetics.patch b/contrib/libs/cxxsupp/libcxxrt/patches/pr49-cosmetics.patch
new file mode 100644
index 0000000000..740aed0c11
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxxrt/patches/pr49-cosmetics.patch
@@ -0,0 +1,24 @@
+From 9a9bcd8ef3e635194f9bfaa1085b8ed2b88455e3 Mon Sep 17 00:00:00 2001
+From: Yuriy Chernyshov <thegeorg@yandex-team.com>
+Date: Thu, 27 Feb 2025 16:38:01 +0100
+Subject: [PATCH] Merge short lines into one
+
+We still need to reduce the diff with our downstream, as #41 does not work for us out of the box.
+---
+ src/exception.cc | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/exception.cc b/src/exception.cc
+index 9bcf903..ccf32de 100644
+--- a/exception.cc
++++ b/exception.cc
+@@ -356,8 +356,7 @@ static void terminate_with_diagnostics() {
+ const char *mangled = ex->exceptionType->name();
+ int status;
+ demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status);
+- fprintf(stderr, " of type %s\n",
+- status == 0 ? demangled : mangled);
++ fprintf(stderr, " of type %s\n", status == 0 ? demangled : mangled);
+ if (status == 0) { free(demangled); }
+
+ _Unwind_Backtrace(trace, 0);
diff --git a/contrib/libs/cxxsupp/libcxxrt/ya.make b/contrib/libs/cxxsupp/libcxxrt/ya.make
index f9eb8743d8..0c0299ba8b 100644
--- a/contrib/libs/cxxsupp/libcxxrt/ya.make
+++ b/contrib/libs/cxxsupp/libcxxrt/ya.make
@@ -11,9 +11,9 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(2024-10-14)
+VERSION(2024-10-22)
-ORIGINAL_SOURCE(https://github.com/libcxxrt/libcxxrt/archive/76435c4451aeb5e04e9500b090293347a38cef8d.tar.gz)
+ORIGINAL_SOURCE(https://github.com/libcxxrt/libcxxrt/archive/5bf955548df364bc6efe4add80947b8689c74e2a.tar.gz)
PEERDIR(
contrib/libs/libunwind