termux-packages/packages/uftrace/libmcount-wrap.c.patch

63 lines
1.6 KiB
Diff
Raw Normal View History

--- a/libmcount/wrap.c 2022-04-15 17:55:05.279817913 +0000
+++ b/libmcount/wrap.c 2022-04-15 19:45:32.879129081 +0000
@@ -227,7 +227,6 @@
/*
* hooking functions
*/
-static int (*real_backtrace)(void **buffer, int sz);
static void (*real_cxa_throw)(void *exc, void *type, void *dest);
static void (*real_cxa_rethrow)(void);
static void * (*real_cxa_begin_catch)(void *exc);
@@ -252,7 +251,6 @@
void mcount_hook_functions(void)
{
- real_backtrace = dlsym(RTLD_NEXT, "backtrace");
real_cxa_throw = dlsym(RTLD_NEXT, "__cxa_throw");
real_cxa_rethrow = dlsym(RTLD_NEXT, "__cxa_rethrow");
real_cxa_begin_catch = dlsym(RTLD_NEXT, "__cxa_begin_catch");
@@ -269,23 +267,7 @@
__visible_default int backtrace(void **buffer, int sz)
{
- int ret;
- struct mcount_thread_data *mtdp;
-
- if (unlikely(real_backtrace == NULL))
- mcount_hook_functions();
-
- mtdp = get_thread_data();
- if (!check_thread_data(mtdp))
- mcount_rstack_restore(mtdp);
-
- pr_dbg("%s is called from [%d]\n", __func__, mtdp->idx);
- ret = real_backtrace(buffer, sz);
-
- if (!check_thread_data(mtdp))
- mcount_rstack_reset(mtdp);
-
- return ret;
+ return 0;
}
__visible_default void __cxa_throw(void *exception, void *type, void *dest)
@@ -338,7 +320,8 @@
real_cxa_rethrow();
}
-__visible_default void _Unwind_Resume(void *exception)
+void __real__Unwind_Resume(void *exception);
+__visible_default void __wrap__Unwind_Resume(void *exception)
{
struct mcount_thread_data *mtdp;
@@ -360,7 +343,7 @@
mcount_rstack_restore(mtdp);
}
- real_unwind_resume(exception);
+ __real__Unwind_Resume(exception);
}
__visible_default void * __cxa_begin_catch(void *exception)