bpf: make test py_test_tools_smoke pass on arm64
Changes include:
. Add PT_REGS_FP to access base(FP) register in x64
. Use macros, intead of directly ctx-><reg_name>
in a few places
. Let userspace fill in the value of PAGE_SIZE.
Otherwise, arm64 needs additional headers to
get this value for kernel.
. In tools/wakeuptime.py, arm64 and x86_64 have
the same stack walker mechanism. But they
have different symbol/macro to represent
kernel start address.
With these changes, the test py_test_tools_smoke
can pass on arm64.
Signed-off-by: Yonghong Song <yhs@fb.com>
diff --git a/tools/memleak.py b/tools/memleak.py
index 484c386..a9030f7 100755
--- a/tools/memleak.py
+++ b/tools/memleak.py
@@ -14,6 +14,7 @@
from bcc import BPF
from time import sleep
from datetime import datetime
+import resource
import argparse
import subprocess
import os
@@ -366,6 +367,7 @@
bpf_source = bpf_source.replace("SHOULD_PRINT", "1" if trace_all else "0")
bpf_source = bpf_source.replace("SAMPLE_EVERY_N", str(sample_every_n))
+bpf_source = bpf_source.replace("PAGE_SIZE", str(resource.getpagesize()))
size_filter = ""
if min_size is not None and max_size is not None: