parent
ce4c514001
commit
092cae12f9
1 changed files with 15 additions and 0 deletions
|
@ -122,8 +122,23 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
blocks.sort_by_key(|block| func.offsets[*block]); // Ensure inst offsets always increase
|
blocks.sort_by_key(|block| func.offsets[*block]); // Ensure inst offsets always increase
|
||||||
|
|
||||||
let line_strings = &mut self.debug_context.dwarf.line_strings;
|
let line_strings = &mut self.debug_context.dwarf.line_strings;
|
||||||
|
let function_span = self.mir.span;
|
||||||
let mut last_file = None;
|
let mut last_file = None;
|
||||||
let mut create_row_for_span = |line_program: &mut LineProgram, span: Span| {
|
let mut create_row_for_span = |line_program: &mut LineProgram, span: Span| {
|
||||||
|
// Based on https://github.com/rust-lang/rust/blob/e369d87b015a84653343032833d65d0545fd3f26/src/librustc_codegen_ssa/mir/mod.rs#L116-L131
|
||||||
|
// In order to have a good line stepping behavior in debugger, we overwrite debug
|
||||||
|
// locations of macro expansions with that of the outermost expansion site
|
||||||
|
// (unless the crate is being compiled with `-Z debug-macros`).
|
||||||
|
let span = if !span.from_expansion() ||
|
||||||
|
tcx.sess.opts.debugging_opts.debug_macros {
|
||||||
|
span
|
||||||
|
} else {
|
||||||
|
// Walk up the macro expansion chain until we reach a non-expanded span.
|
||||||
|
// We also stop at the function body level because no line stepping can occur
|
||||||
|
// at the level above that.
|
||||||
|
rustc_span::hygiene::walk_chain(span, function_span.ctxt())
|
||||||
|
};
|
||||||
|
|
||||||
let loc = tcx.sess.source_map().lookup_char_pos(span.lo());
|
let loc = tcx.sess.source_map().lookup_char_pos(span.lo());
|
||||||
|
|
||||||
// line_program_add_file is very slow.
|
// line_program_add_file is very slow.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue