From 4789a69b3f5ac537bb428edd11922b9a0cd3e398 Mon Sep 17 00:00:00 2001 From: Stefan Koehler Date: Wed, 26 Jun 2024 10:09:40 +0200 Subject: [PATCH 1/2] Bugfix: ValueError: invalid literal for int() with base 10 On ARM64 the file "/usr/include/asm-generic/unistd.h" includes entries like "#define __SYSCALL(x, y)" which result in valueError - this additional check avoids it. --- bin/xcapture-bpf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/xcapture-bpf b/bin/xcapture-bpf index 40752de..b18ecf5 100755 --- a/bin/xcapture-bpf +++ b/bin/xcapture-bpf @@ -49,7 +49,7 @@ def extract_system_call_ids(unistd_64_fh): for name_prefix in ['__NR_', '__NR3264_']: for line in unistd_64_fh.readlines(): tokens = line.split() - if tokens and len(tokens) == 3 and tokens[0] == '#define': + if tokens and len(tokens) == 3 and tokens[0] == '#define' and tokens[2].isnumeric() is True: _, s_name, s_id = tokens s_id = int(s_id) if s_name.startswith(name_prefix): From 559b3669877f341f5441fbbfbfd0fd15a22d9214 Mon Sep 17 00:00:00 2001 From: Stefan Koehler Date: Wed, 26 Jun 2024 10:30:38 +0200 Subject: [PATCH 2/2] Bug-Fix: /virtual/main.c:78:22: error: use of undeclared identifier '__NR_poll' On ARM64 there is no system call __NR_poll. Added a conditional compilation check on CPU architecture to avoid this error. --- bin/xcapture-bpf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/xcapture-bpf.c b/bin/xcapture-bpf.c index e0c4bda..d448e75 100644 --- a/bin/xcapture-bpf.c +++ b/bin/xcapture-bpf.c @@ -70,7 +70,11 @@ struct thread_state_t { BPF_HASH(tsa, u32, struct thread_state_t, 16384); TRACEPOINT_PROBE(raw_syscalls, sys_enter) { +#if defined(__x86_64__) if (args->id == __NR_poll || args->id == __NR_getrusage) +#elif defined(__aarch64__) + if (args->id == __NR_getrusage) +#endif return 0; struct thread_state_t t_empty = {};