feat(uftrace): enable auto-update, upgrade to 0.11

- enable luajit support

Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
This commit is contained in:
Aditya Alok 2022-04-15 01:46:19 +05:30
parent c6090e7d2f
commit 65e3eae5fe
No known key found for this signature in database
GPG Key ID: 345AE134142077D8
3 changed files with 45 additions and 33 deletions

View File

@ -2,17 +2,26 @@ TERMUX_PKG_HOMEPAGE=https://uftrace.github.io/slide
TERMUX_PKG_DESCRIPTION="Function (graph) tracer for user-space"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.9.4
TERMUX_PKG_REVISION=4
TERMUX_PKG_VERSION=0.11
TERMUX_PKG_SRCURL=https://github.com/namhyung/uftrace/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=418d30c959d3b6d0dcafd55e588a5d414a9984b30f2522a5af004a268824a5a2
TERMUX_PKG_SHA256=101dbb13cb3320ee76525ec26426f2aa1de4e3ee5af74f79cb403ae4d2c6c871
TERMUX_PKG_DEPENDS="capstone, libandroid-glob, libandroid-spawn, libelf, libdw, ncurses, python"
# On x86_64 utils/script-luajit.c:154:12 uses some sse2 feature even if sse2 is disabled.
# `error: sse2 register return with sse2 disabled`
[[ "${TERMUX_ARCH}" != "x86_64" ]] && TERMUX_PKG_DEPENDS+=", libluajit"
TERMUX_PKG_BUILD_DEPENDS="argp"
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag"
termux_step_pre_configure() {
# uftrace uses custom configure script implementation, so we need to provide some flags
export CFLAGS="${CFLAGS} -I${TERMUX_PREFIX}/include -I${TERMUX_PREFIX}/include/python3.10 -DEFD_SEMAPHORE=1 -DEF_ARM_ABI_FLOAT_HARD=0x400 -w"
export LDFLAGS="${LDFLAGS} -Wl,--wrap=_Unwind_Resume -landroid-glob -largp -lpython3.10"
local _PYTHON_VERSION
_PYTHON_VERSION=$(
source $TERMUX_SCRIPTDIR/packages/python/build.sh
echo $_MAJOR_VERSION
)
export CFLAGS="${CFLAGS} -I${TERMUX_PREFIX}/include -I${TERMUX_PREFIX}/include/python${_PYTHON_VERSION} -DEFD_SEMAPHORE=1 -DEF_ARM_ABI_FLOAT_HARD=0x400 -w"
export LDFLAGS="${LDFLAGS} -Wl,--wrap=_Unwind_Resume -landroid-glob -largp -lpython${_PYTHON_VERSION}"
if [ "$TERMUX_ARCH" = "i686" ]; then
export ARCH="i386"

View File

@ -1,7 +1,6 @@
diff -uNr uftrace-0.9.3/libmcount/wrap.c uftrace-0.9.3.mod/libmcount/wrap.c
--- uftrace-0.9.3/libmcount/wrap.c 2019-07-13 17:25:47.000000000 +0300
+++ uftrace-0.9.3.mod/libmcount/wrap.c 2019-09-03 20:46:52.430226391 +0300
@@ -216,7 +216,6 @@
--- 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
*/
@ -9,7 +8,7 @@ diff -uNr uftrace-0.9.3/libmcount/wrap.c uftrace-0.9.3.mod/libmcount/wrap.c
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);
@@ -241,7 +240,6 @@
@@ -252,7 +251,6 @@
void mcount_hook_functions(void)
{
@ -17,7 +16,7 @@ diff -uNr uftrace-0.9.3/libmcount/wrap.c uftrace-0.9.3.mod/libmcount/wrap.c
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");
@@ -258,22 +256,7 @@
@@ -269,23 +267,7 @@
__visible_default int backtrace(void **buffer, int sz)
{
@ -31,6 +30,7 @@ diff -uNr uftrace-0.9.3/libmcount/wrap.c uftrace-0.9.3.mod/libmcount/wrap.c
- 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))
@ -41,7 +41,7 @@ diff -uNr uftrace-0.9.3/libmcount/wrap.c uftrace-0.9.3.mod/libmcount/wrap.c
}
__visible_default void __cxa_throw(void *exception, void *type, void *dest)
@@ -324,7 +307,8 @@
@@ -338,7 +320,8 @@
real_cxa_rethrow();
}
@ -51,7 +51,7 @@ diff -uNr uftrace-0.9.3/libmcount/wrap.c uftrace-0.9.3.mod/libmcount/wrap.c
{
struct mcount_thread_data *mtdp;
@@ -345,7 +329,7 @@
@@ -360,7 +343,7 @@
mcount_rstack_restore(mtdp);
}

View File

@ -1,73 +1,76 @@
+++ ./cmds/info.c 2019-08-26 14:53:01.793449309 +0300
@@ -1146,7 +1146,7 @@
--- a/cmds/info.c 2022-04-15 17:55:05.276817917 +0000
+++ b/cmds/info.c 2022-04-15 20:29:53.138225790 +0000
@@ -1226,7 +1226,7 @@
ret = open_info_file(opts, &handle);
if (ret < 0) {
- pr_warn("cannot open record data: %s: %m\n", opts->dirname);
+ pr_warn("cannot open record data: %s: %s\n", opts->dirname, strerror(errno));
+ pr_warn("cannot open record data: %s: %m\n", opts->dirname, strerror(errno));
return -1;
}
+++ ./cmds/report.c 2019-08-26 14:57:29.911809302 +0300
@@ -1,6 +1,7 @@
--- a/cmds/report.c 2022-04-15 17:55:05.277817916 +0000
+++ b/cmds/report.c 2022-04-15 20:31:47.514057989 +0000
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
+#include <errno.h>
#include "uftrace.h"
#include "utils/utils.h"
@@ -523,7 +524,7 @@
@@ -441,7 +442,7 @@
report_calc_avg(&base_tree);
if (open_data_file(&dummy_opts, &data.handle) < 0) {
- pr_warn("cannot open record data: %s: %m\n", opts->diff);
+ pr_warn("cannot open record data: %s: %s\n", opts->diff, strerror(errno));
+ pr_warn("cannot open record data: %s: %m\n", opts->diff, strerror(errno));
goto out;
}
@@ -609,7 +610,7 @@
@@ -547,7 +548,7 @@
ret = open_data_file(opts, &handle);
if (ret < 0) {
- pr_warn("cannot open record data: %s: %m\n", opts->dirname);
+ pr_warn("cannot open record data: %s: %s\n", opts->dirname, strerror(errno));
+ pr_warn("cannot open record data: %s: %m\n", opts->dirname, strerror(errno));
return -1;
}
+++ ./cmds/dump.c 2019-08-26 14:59:44.802869609 +0300
@@ -5,6 +5,7 @@
--- a/cmds/dump.c 2022-04-15 17:55:05.276817917 +0000
+++ b/cmds/dump.c 2022-04-15 20:33:03.603946364 +0000
@@ -4,6 +4,7 @@
#include <inttypes.h>
#include <time.h>
#include <assert.h>
#include <sys/stat.h>
+#include <errno.h>
#include "uftrace.h"
#include "version.h"
@@ -1582,7 +1583,7 @@
@@ -1644,7 +1645,7 @@
ret = open_data_file(opts, &handle);
if (ret < 0) {
- pr_warn("cannot open record data: %s: %m\n", opts->dirname);
+ pr_warn("cannot open record data: %s: %s\n", opts->dirname, strerror(errno));
+ pr_warn("cannot open record data: %s: %m\n", opts->dirname, strerror(errno));
return -1;
}
+++ ./cmds/replay.c 2019-08-26 15:01:30.621223877 +0300
@@ -4,6 +4,7 @@
--- a/cmds/replay.c 2022-04-15 17:55:05.277817916 +0000
+++ b/cmds/replay.c 2022-04-15 20:33:53.498873171 +0000
@@ -3,6 +3,7 @@
#include <signal.h>
#include <inttypes.h>
#include <stdio_ext.h>
#include <assert.h>
+#include <errno.h>
#include "uftrace.h"
#include "utils/utils.h"
@@ -1111,7 +1112,7 @@
@@ -1221,7 +1222,7 @@
ret = open_data_file(opts, &handle);
if (ret < 0) {
- pr_warn("cannot open record data: %s: %m\n", opts->dirname);
+ pr_warn("cannot open record data: %s: %s\n", opts->dirname, strerror(errno));
+ pr_warn("cannot open record data: %s: %m\n", opts->dirname, strerror(errno));
return -1;
}