gpt4 book ai didi

python - 使用 LLVMlite 在 LLVM 中断言失败

转载 作者:太空狗 更新时间:2023-10-29 21:57:44 45 4
gpt4 key购买 nike

(这是我在此处找到的修复程序时发生的:LLVM IR: expose variables to GDB?)

我正在尝试编译一些用自定义编程语言编写的代码。它被编译为 LLVM IR,然后通过 clang 编译为 ELF。但是,我试图将调试信息添加到调用中:

res = self.builder.call(fn, args)
res.set_metadata('dbg', self.module.add_debug_info('DILocation', {
'line': i.meta.line,
'column': i.meta.column,
'scope': self.subprogram
}))

我得到一个非常好的错误:python: /root/miniconda3/conda-bld/llvmdev_1531160641630/work/include/llvm/Support/Casting.h:106: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::DIBasicType; From = llvm::Metadata]: Assertion 'Val && "isa<> used on a null pointer"' failed.我该如何解决这个错误?我有最新版本的 llvmlite:llvmlite==0.26.0

注意:这段类似的代码不会产生任何错误:

res = fncall(self.builder, self.module, fn, args).eval()  
# equivalent to self.builder.call(fn, args, name='called_{0}'.format(fn.name)) but defined in a class
res.set_metadata('dbg', self.module.add_debug_info('DILocation', {
'line': i.meta.line,
'column': i.meta.column,
'scope': self.subprogram
}))

我同时更新了 llvm-6.0 , clang-6.0 , 和 llvmlite , 并且仍然出现此错误。

最佳答案

我删除了编译和运行 IR 的代码(通过 llvmlite.bindings)。这修复了断言错误。然而,正如我详述的here , 还是有问题。

关于python - 使用 LLVMlite 在 LLVM 中断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53528676/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com