Skip to content

Commit 996bfd0

Browse files
authored
Merge pull request rust-lang#802 from bjorn3/debuginfo_locals
Debuginfo locals
2 parents 306bf8e + beda104 commit 996bfd0

File tree

9 files changed

+756
-419
lines changed

9 files changed

+756
-419
lines changed

src/base.rs

+18-14
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
1717
let mut debug_context = cx
1818
.debug_context
1919
.as_mut()
20-
.map(|debug_context| FunctionDebugContext::new(tcx, debug_context, mir, func_id, &name, &sig));
20+
.map(|debug_context| FunctionDebugContext::new(debug_context, instance, func_id, &name));
2121

2222
// Make FunctionBuilder
2323
let mut func = Function::with_name_signature(ExternalName::user(0, 0), sig);
24+
func.collect_debug_info();
2425
let mut func_ctx = FunctionBuilderContext::new();
2526
let mut bcx = FunctionBuilder::new(&mut func, &mut func_ctx);
2627

@@ -60,6 +61,7 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
6061
let instance = fx.instance;
6162
let clif_comments = fx.clif_comments;
6263
let source_info_set = fx.source_info_set;
64+
let local_map = fx.local_map;
6365

6466
#[cfg(debug_assertions)]
6567
crate::pretty_clif::write_clif_file(cx.tcx, "unopt", instance, &func, &clif_comments, None);
@@ -72,26 +74,28 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
7274
context.func = func;
7375
cx.module.define_function(func_id, context).unwrap();
7476

75-
let value_ranges = context
76-
.build_value_labels_ranges(cx.module.isa())
77-
.expect("value location ranges");
78-
7977
// Write optimized function to file for debugging
8078
#[cfg(debug_assertions)]
81-
crate::pretty_clif::write_clif_file(
82-
cx.tcx,
83-
"opt",
84-
instance,
85-
&context.func,
86-
&clif_comments,
87-
Some(&value_ranges),
88-
);
79+
{
80+
let value_ranges = context
81+
.build_value_labels_ranges(cx.module.isa())
82+
.expect("value location ranges");
83+
84+
crate::pretty_clif::write_clif_file(
85+
cx.tcx,
86+
"opt",
87+
instance,
88+
&context.func,
89+
&clif_comments,
90+
Some(&value_ranges),
91+
);
92+
}
8993

9094
// Define debuginfo for function
9195
let isa = cx.module.isa();
9296
debug_context
9397
.as_mut()
94-
.map(|x| x.define(tcx, context, isa, &source_info_set));
98+
.map(|x| x.define(context, isa, &source_info_set, local_map));
9599

96100
// Clear context to make it usable for the next function
97101
context.clear();

0 commit comments

Comments
 (0)