bpftrace numaid部分patch
Posted rtoax
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bpftrace numaid部分patch相关的知识,希望对你有一定的参考价值。
Or this patch is OK?
diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
index c0adc335..72e2d7e1 100644
--- a/src/ast/irbuilderbpf.cpp
+++ b/src/ast/irbuilderbpf.cpp
@@ -910,7 +910,7 @@ CallInst *IRBuilderBPF::CreateGetNumaId()
// long bpf_get_numa_node_id(void)
// Return: NUMA Node ID
- FunctionType *getnumaid_func_type = FunctionType::get(getInt64Ty(), false);
+ FunctionType *getnumaid_func_type = FunctionType::get(getInt32Ty(), false);
PointerType *getnumaid_func_ptr_type = PointerType::get(getnumaid_func_type, 0);
Constant *getnumaid_func = ConstantExpr::getCast(
Instruction::IntToPtr,
diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
index b7980f15..763a19b8 100644
--- a/src/ast/passes/codegen_llvm.cpp
+++ b/src/ast/passes/codegen_llvm.cpp
@@ -171,7 +171,8 @@ void CodegenLLVM::visit(Builtin &builtin)
else if (builtin.ident == "numaid")
- expr_ = b_.CreateGetNumaId();
+ Value *tmp = b_.CreateGetNumaId();
+ expr_ = b_.CreateZExt(tmp, b_.getInt64Ty());
else if (builtin.ident == "cpu")
以上是关于bpftrace numaid部分patch的主要内容,如果未能解决你的问题,请参考以下文章
bcc/filelife and bpftrace/segfault patch