You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codegen debug info: no DWARF variables anywhere; generic (mono) and closure functions get no subprogram #1348
Found while fixing the stage binaries' file/line attribution (branch fix-stage-debug-info).
Variables were never emitted.src/compiler/LlvmBridge.w binds LLVMDIBuilderCreateAutoVariable, LLVMDIBuilderCreateParameterVariable and LLVMDIBuilderInsertDeclareRecordAtEnd, and Codegen.debug_get_di_type builds DI types, but nothing calls wl_di_create_auto_variable / wl_di_create_parameter_variable / wl_di_insert_declare. So frame variable in lldb always says "no variable information is available in debug info for this compile unit" — for every With program, not only the compiler. This is a missing feature, not the attribution bug.
Monomorphized and closure bodies get no DISubprogram. Only gen_function_dispatch_at (src/CodegenDispatch.w) calls debug_enter_function. gen_function_mir_mono (called with fn_node = 0 from Codegen.w and CodegenDispatch.w:96) and the closure path (CodegenDispatch.w ~17295) never create one, so generic functions (every Vec[T]/HashMap[K,V] method, every generic helper) and closures have no line table: lldb can't break in them by file:line. The closure path also inherits di_current_scope and the builder's current location from the enclosing function, so its instructions carry locations scoped to another function's subprogram. That's harmless only because the closure has no SP of its own, and it breaks as soon as closures get one.
Needed:
mono: resolve the generic decl node (Sema.fn_symbol_decl_node / generic_fn_node_for_symbol), enter a subprogram in that node's file (AstPool.file), set per-statement locations like gen_function_mir, and save/restore di_current_scope + the builder's debug location (LLVMGetCurrentDebugLocation2) around the nested emission.
closures: same, with the closure's own node.
variables: DILocalVariable + dbg.declare records for MIR locals that have a user name and a stack slot, and for parameters.
Acceptance: br set -f <Module>.w -l <n> inside a generic method and a closure stops there; frame variable shows params/locals in a Sema method on with-stage2.
Activity
Codegen debug info: DWARF variables for parameters and bindings; a sp…
Codegen debug info: DWARF variables for parameters and bindings; a sp…