| author | |
| committer | |
| log | a6420d9985eeb325f302a1252d32dc30f89f40ee |
| tree | c3651486e9c9dda73bb17a5a3f8d1417b0d2850c |
| parent | de207594e40d659eb2d6d9fd3813c66ee5ae4340 |
Commit d28006153e dropped the deferred restore of the debug location's
scope in genBodyDebugScope. Since then, instructions emitted after a
nested body inherit the body's lexical block as their location scope.
This breaks variable info for locals initialized by a try expression:
their dbg_var_ptr is emitted right after the try's block, so the
dbg.declare gets a location scoped to the inner lexical block, and LLVM
places the variable's DIE inside a DW_TAG_lexical_block whose ranges end
with that block. Debuggers then consider the variable out of scope for
the rest of the function.
Closes #307051 files changed, 1 insertions(+), 0 deletions(-)
src/codegen/llvm/FuncGen.zig+1| ... | ... | @@ -718,6 +718,7 @@ fn genBodyDebugScope( |
| 718 | 718 | .scope = self.scope.toOptional(), |
| 719 | 719 | .inlined_at = self.inlined_at, |
| 720 | 720 | } }; |
| 721 | defer self.wip.debug_location.location.scope = old_scope.toOptional(); | |
| 721 | 722 | |
| 722 | 723 | try self.genBody(body, coverage_point); |
| 723 | 724 | } |