chat: локальное удаление канала (Android) + db_sync инстансы в куче
This commit is contained in:
1 parent
ddfffad1ed
commit
7c8d65db78
30 files changed
+466
-42
No files matched your search
@@ -7,6 +7,7 @@
|
||||
*
|
||||
* Mirrors UtunNode::runLoop() from tools/chatgui/transport/utun_node.cpp:221-372.
|
||||
*/
|
||||
#define _GNU_SOURCE 1 /* dladdr (Linux); no-op on Android/bionic */
|
||||
#include "instance_lite.h"
|
||||
#include "utun_instance.h"
|
||||
#include "config_parser.h"
|
||||
@@ -34,6 +35,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <unwind.h>
|
||||
#include <dlfcn.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <openssl/evp.h>
|
||||
@@ -203,10 +206,36 @@ static void on_link_status_changed(struct ETCP_CONN* conn, struct ETCP_LINK* lin
|
||||
static volatile int g_signal_caught = 0;
|
||||
static volatile int g_signal_num = 0;
|
||||
|
||||
struct crash_bt_state { void** frames; int count; int max; };
|
||||
|
||||
static _Unwind_Reason_Code crash_bt_cb(struct _Unwind_Context* ctx, void* arg) {
|
||||
struct crash_bt_state* st = (struct crash_bt_state*)arg;
|
||||
if (st->count < st->max) {
|
||||
void* pc = (void*)_Unwind_GetIP(ctx);
|
||||
if (pc) st->frames[st->count++] = pc;
|
||||
return _URC_NO_REASON;
|
||||
}
|
||||
return _URC_END_OF_STACK;
|
||||
}
|
||||
|
||||
static void crash_signal_handler(int sig, siginfo_t* info, void* ctx) {
|
||||
(void)ctx;
|
||||
g_signal_caught = 1; g_signal_num = sig;
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_GENERAL, "CRASH signal=%d code=%d addr=%p thread still alive", sig, info->si_code, info->si_addr);
|
||||
void* frames[64];
|
||||
struct crash_bt_state st = { frames, 0, 64 };
|
||||
_Unwind_Backtrace(crash_bt_cb, &st);
|
||||
IL_LOGE("CRASH backtrace %d frames:", st.count);
|
||||
for (int i = 0; i < st.count; i++) {
|
||||
Dl_info dli;
|
||||
if (dladdr(frames[i], &dli) && dli.dli_sname) {
|
||||
IL_LOGE(" #%02d %p %s+%p (%s)", i, frames[i], dli.dli_sname,
|
||||
(void*)((char*)frames[i] - (char*)dli.dli_saddr),
|
||||
dli.dli_fname ? dli.dli_fname : "?");
|
||||
} else {
|
||||
IL_LOGE(" #%02d %p (no symbol)", i, frames[i]);
|
||||
}
|
||||
}
|
||||
signal(sig, SIG_DFL);
|
||||
raise(sig);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user