aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-11-24 04:11:52 -0500
committerAndrew Kelley <andrew@ziglang.org>2024-11-24 17:28:12 -0500
commitc894ac09a31380319ba9cfdc82025fcc614a8cc0 (patch)
tree5f1b32932432f1c414fbe20aa3288ead4fbc2b44 /src/codegen/c.zig
parent6d781e0955e7dd2b6cc17a5bb43c790e19a07ac0 (diff)
downloadzig-c894ac09a31380319ba9cfdc82025fcc614a8cc0.tar.gz
zig-c894ac09a31380319ba9cfdc82025fcc614a8cc0.zip
dwarf: fix stepping through an inline loop containing one statement
Previously, stepping from the single statement within the loop would always exit the loop because all of the code unrolled from the loop is associated with the same line and treated by the debugger as one line.
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 0410023588..56466b4395 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -3289,6 +3289,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail,
.try_ptr_cold => try airTryPtr(f, inst),
.dbg_stmt => try airDbgStmt(f, inst),
+ .dbg_empty_stmt => try airDbgEmptyStmt(f, inst),
.dbg_var_ptr, .dbg_var_val, .dbg_arg_inline => try airDbgVar(f, inst),
.float_from_int,
@@ -4601,6 +4602,11 @@ fn airDbgStmt(f: *Function, inst: Air.Inst.Index) !CValue {
return .none;
}
+fn airDbgEmptyStmt(f: *Function, _: Air.Inst.Index) !CValue {
+ try f.object.writer().writeAll("(void)0;\n");
+ return .none;
+}
+
fn airDbgInlineBlock(f: *Function, inst: Air.Inst.Index) !CValue {
const pt = f.object.dg.pt;
const zcu = pt.zcu;