From 2a003ea76245ebf8417137c75d95874a91d1a09f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 Jun 2024 11:06:31 +0200 Subject: executor: factor out is_kernel_pc helper Factor out is_kernel_pc helper and add kernel pc range for test OS for testing. --- executor/executor_linux.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'executor/executor_linux.h') diff --git a/executor/executor_linux.h b/executor/executor_linux.h index 445a278e2..984c0ba62 100644 --- a/executor/executor_linux.h +++ b/executor/executor_linux.h @@ -193,18 +193,22 @@ static bool is_kernel_data(uint64 addr) #endif } +// Returns >0 for yes, <0 for no, 0 for don't know. +static int is_kernel_pc(uint64 pc) +{ +#if GOARCH_386 || GOARCH_amd64 + // Text/modules range for x86_64. + return pc >= 0xffffffff80000000ull && pc < 0xffffffffff000000ull ? 1 : -1; +#else + return 0; +#endif +} + static bool use_cover_edges(uint64 pc) { #if GOARCH_amd64 || GOARCH_arm64 if (is_gvisor) return false; // gvisor coverage is not a trace, so producing edges won't work -#endif -#if GOARCH_386 || GOARCH_amd64 - // Text/modules range for x86_64. - if (pc < 0xffffffff80000000ull || pc >= 0xffffffffff000000ull) { - debug("got bad pc: 0x%llx\n", pc); - doexit(0); - } #endif return true; } -- cgit mrf-deployment