@@ -205,7 +205,8 @@ fn calculate_debuginfo_offset<
205
205
_ => {
206
206
// Sanity check for `can_use_in_debuginfo`.
207
207
assert ! ( !elem. can_use_in_debuginfo( ) ) ;
208
- bug ! ( "unsupported var debuginfo projection `{:?}`" , projection)
208
+ // TODO: Temporarily disabled for testing purposes.
209
+ // bug!("unsupported var debuginfo projection `{:?}`", projection)
209
210
}
210
211
}
211
212
}
@@ -377,6 +378,52 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
377
378
}
378
379
}
379
380
381
+ pub ( crate ) fn debug_new_value_to_local (
382
+ & self ,
383
+ bx : & mut Bx ,
384
+ local : mir:: Local ,
385
+ base : PlaceValue < Bx :: Value > ,
386
+ layout : TyAndLayout < ' tcx > ,
387
+ projection : & [ mir:: PlaceElem < ' tcx > ] ,
388
+ ) {
389
+ let full_debug_info = bx. sess ( ) . opts . debuginfo == DebugInfo :: Full ;
390
+ if !full_debug_info {
391
+ return ;
392
+ }
393
+
394
+ let vars = match & self . per_local_var_debug_info {
395
+ Some ( per_local) => & per_local[ local] ,
396
+ None => return ,
397
+ } ;
398
+
399
+ for var in vars. iter ( ) . cloned ( ) {
400
+ self . debug_new_value_to_local_as_var ( bx, base, layout, projection, var) ;
401
+ }
402
+ }
403
+
404
+ fn debug_new_value_to_local_as_var (
405
+ & self ,
406
+ bx : & mut Bx ,
407
+ base : PlaceValue < Bx :: Value > ,
408
+ layout : TyAndLayout < ' tcx > ,
409
+ projection : & [ mir:: PlaceElem < ' tcx > ] ,
410
+ var : PerLocalVarDebugInfo < ' tcx , Bx :: DIVariable > ,
411
+ ) {
412
+ let Some ( dbg_var) = var. dbg_var else { return } ;
413
+ let Some ( dbg_loc) = self . dbg_loc ( var. source_info ) else { return } ;
414
+ let DebugInfoOffset { direct_offset, indirect_offsets, result : _ } =
415
+ calculate_debuginfo_offset ( bx, projection, layout) ;
416
+ bx. dbg_var_addr (
417
+ dbg_var,
418
+ dbg_loc,
419
+ false ,
420
+ base. llval ,
421
+ direct_offset,
422
+ & indirect_offsets,
423
+ var. fragment ,
424
+ ) ;
425
+ }
426
+
380
427
fn debug_introduce_local_as_var (
381
428
& self ,
382
429
bx : & mut Bx ,
@@ -386,7 +433,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
386
433
) {
387
434
let Some ( dbg_var) = var. dbg_var else { return } ;
388
435
let Some ( dbg_loc) = self . dbg_loc ( var. source_info ) else { return } ;
389
-
390
436
let DebugInfoOffset { direct_offset, indirect_offsets, result : _ } =
391
437
calculate_debuginfo_offset ( bx, var. projection , base. layout ) ;
392
438
@@ -421,6 +467,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
421
467
bx. dbg_var_addr (
422
468
dbg_var,
423
469
dbg_loc,
470
+ true ,
424
471
alloca. val . llval ,
425
472
Size :: ZERO ,
426
473
& [ Size :: ZERO ] ,
@@ -430,6 +477,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
430
477
bx. dbg_var_addr (
431
478
dbg_var,
432
479
dbg_loc,
480
+ true ,
433
481
base. val . llval ,
434
482
direct_offset,
435
483
& indirect_offsets,
@@ -455,7 +503,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
455
503
let base = FunctionCx :: spill_operand_to_stack ( operand, Some ( name) , bx) ;
456
504
bx. clear_dbg_loc ( ) ;
457
505
458
- bx. dbg_var_addr ( dbg_var, dbg_loc, base. val . llval , Size :: ZERO , & [ ] , fragment) ;
506
+ bx. dbg_var_addr ( dbg_var, dbg_loc, true , base. val . llval , Size :: ZERO , & [ ] , fragment) ;
459
507
}
460
508
}
461
509
}
0 commit comments