Exclude top-level macro expansions from source location override.
This commit is contained in:
parent
c14f87e3b0
commit
d113b39fbf
@ -138,13 +138,20 @@ pub fn debug_loc(&mut self, source_info: mir::SourceInfo) -> (DIScope, Span) {
|
||||
while span.expn_id != NO_EXPANSION && span.expn_id != COMMAND_LINE_EXPN {
|
||||
if let Some(callsite_span) = cm.with_expn_info(span.expn_id,
|
||||
|ei| ei.map(|ei| ei.call_site.clone())) {
|
||||
// When the current function itself is a result of macro expansion,
|
||||
// we stop at the function body level because no line stepping can occurr
|
||||
// at the level above that.
|
||||
if self.mir.span.expn_id != NO_EXPANSION &&
|
||||
span.expn_id == self.mir.span.expn_id {
|
||||
break;
|
||||
}
|
||||
span = callsite_span;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let scope = self.scope_metadata_for_loc(source_info.scope, span.lo);
|
||||
// Use span of the outermost call site, while keeping the original lexical scope
|
||||
// Use span of the outermost expansion site, while keeping the original lexical scope.
|
||||
(scope, span)
|
||||
}
|
||||
}
|
||||
|
17
src/test/debuginfo/macro-stepping.inc
Normal file
17
src/test/debuginfo/macro-stepping.inc
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2013-2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn included() {
|
||||
foo!(); // #inc-loc1
|
||||
|
||||
foo2!(); // #inc-loc2
|
||||
|
||||
zzz(); // #inc-loc3
|
||||
}
|
@ -44,6 +44,17 @@
|
||||
// gdb-command:frame
|
||||
// gdb-check:[...]#loc6[...]
|
||||
|
||||
// gdb-command:continue
|
||||
// gdb-command:step
|
||||
// gdb-command:frame
|
||||
// gdb-check:[...]#inc-loc1[...]
|
||||
// gdb-command:next
|
||||
// gdb-command:frame
|
||||
// gdb-check:[...]#inc-loc2[...]
|
||||
// gdb-command:next
|
||||
// gdb-command:frame
|
||||
// gdb-check:[...]#inc-loc3[...]
|
||||
|
||||
// === LLDB TESTS ==================================================================================
|
||||
|
||||
// lldb-command:set set stop-line-count-before 0
|
||||
@ -68,6 +79,17 @@
|
||||
// lldb-command:frame select
|
||||
// lldb-check:[...]#loc5[...]
|
||||
|
||||
// lldb-command:continue
|
||||
// lldb-command:step
|
||||
// lldb-command:frame select
|
||||
// lldb-check:[...]#inc-loc1[...]
|
||||
// lldb-command:next
|
||||
// lldb-command:frame select
|
||||
// lldb-check:[...]#inc-loc2[...]
|
||||
// lldb-command:next
|
||||
// lldb-command:frame select
|
||||
// lldb-check:[...]#inc-loc3[...]
|
||||
|
||||
macro_rules! foo {
|
||||
() => {
|
||||
let a = 1;
|
||||
@ -99,6 +121,10 @@ fn main() {
|
||||
"world");
|
||||
|
||||
zzz(); // #loc6
|
||||
|
||||
included(); // #break
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
|
||||
include!("macro-stepping.inc");
|
||||
|
Loading…
Reference in New Issue
Block a user