(This happened while doing the fix I found here: LLVM IR: expose variables to GDB?)
I am trying to compile some code written in a custom programming language. It is compiled to LLVM IR, and then compiled to an ELF by clang. However, I was trying to add debugging information to a call:
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
}))
I got a very nice error: 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.
How can I fix this error? I have the latest version of llvmlite: llvmlite==0.26.0
Note: this similar code does not generate any errors:
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
}))
I updated both llvm-6.0
, clang-6.0
, and llvmlite
, and this error still occurs.
I removed the code that compiled and ran the IR (via llvmlite.bindings). This fixed the assertion error. However, as I detailed here, there is still an issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With