浏览代码

Improve metadata for `context`

gingerBill 3 年之前
父节点
当前提交
42ad54c28e
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/llvm_backend_debug.cpp

+ 6 - 1
src/llvm_backend_debug.cpp

@@ -1050,5 +1050,10 @@ void lb_add_debug_context_variable(lbProcedure *p, lbAddr const &ctx) {
 	token.string = str_lit("context");
 	token.pos = pos;
 
-	lb_add_debug_local_variable(p, ctx.addr.value, t_context, token);
+	LLVMValueRef ptr = ctx.addr.value;
+	while (LLVMIsABitCastInst(ptr)) {
+		ptr = LLVMGetOperand(ptr, 0);
+	}
+
+	lb_add_debug_local_variable(p, ptr, t_context, token);
 }