/
vshmidt
/
llama.cpp
Обзор
Документация
Войти
/
vshmidt
/
llama.cpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ggml/src/ggml.cpp
26 строк
738 B
Daniel Tang
ggml : Print backtrace on uncaught C++ exceptions (ggml/1232)
01 июн 2025, 13:43
01 июн 2025, 13:43
fedf034
Код
Авторство
О чём код?
#include "ggml-impl.h" #include <cstdlib> #include <exception> static std::terminate_handler previous_terminate_handler; GGML_NORETURN static void ggml_uncaught_exception() { ggml_print_backtrace(); if (previous_terminate_handler) { previous_terminate_handler(); } abort(); // unreachable unless previous_terminate_handler was nullptr } static bool ggml_uncaught_exception_init = []{ const char * GGML_NO_BACKTRACE = getenv("GGML_NO_BACKTRACE"); if (GGML_NO_BACKTRACE) { return false; } const auto prev{std::get_terminate()}; GGML_ASSERT(prev != ggml_uncaught_exception); previous_terminate_handler = prev; std::set_terminate(ggml_uncaught_exception); return true; }();