(这是在做我在此处找到的修复程序时发生的:LLVM IR: expose variables to GDB?)
我正在尝试编译一些使用自定义编程语言编写的代码。它被编译为LLVM IR,然后通过clang编译为ELF。但是,我试图将调试信息添加到呼叫中:
var points = [];
var r;
var lines = 30;
function setup() {
createCanvas(window.innerWidth, window.windowHeight);
angleMode(DEGREES);
// get the points of the corners of the hexagon
r = Math.min(width, height) * 0.4;
var angle = 60;
for (var i = 1; i < 7; i++) {
var tempX = r * sin((angle * i + 30) % 360)
var tempY = r * cos((angle * i + 30) % 360)
points.push([tempX, tempY]);
}
background(0);
stroke(0, 0, 255);
//rectMode(CENTER);
}
function draw() {
background(0);
// draw the lines of ...
push();
translate(width/2, height/2);
rotate(frameCount * 0.75);
beginShape();
for (var i = 0; i < points.length; i++) {
// ... the hexagon perimeter
line(points[i][0], points[i][1], points[(i + 1) % 6][0], points[(i + 1) % 6][1]);
var tempAngle = 240 + i * 60;
var tempX = r * 1.1545 * sin(tempAngle) + points[i][0];
var tempY = r * 1.1545 * cos(tempAngle) + points[i][1];
for (var j = 0; j < lines + 1; j++) {
// ... the lines inside the hexagon
var tempAngle2 = tempAngle = (30 / lines * j) + 210 + i * 60;
var distance = r / cos(30 / lines * j);
var tempX2 = distance * sin(tempAngle2) + points[i][0];
var tempY2 = distance * cos(tempAngle2) + points[i][1];;
line(points[i][0], points[i][1], tempX2, tempY2);
}
endShape();
}
pop();
}
我遇到一个非常好的错误:<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.js"></script>
如何解决该错误?我拥有llvmlite的最新版本: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==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
,并且仍然发生此错误。