auto merge of #8329 : michaelwoerister/rust/lexical_scopes_alt, r=graydon
This pull request re-implements handling of visibility scopes and source code positions in debug info. It should now be very stable and properly handle
+ variable shadowing
+ expanded code (macros and the new for-loop de-sugaring, for example)
+ variables in the middle of nested scopes
+ bindings declared in the head of match statement arms.
all of which did not work at all or did not work reliably before. Those interested in a more detailed description of the problems at hand, I kindly refer to http://michaelwoerister.github.io/2013/08/03/visibility-scopes.html
Why doesn't the `populate_scope_map()` function use `syntax::visit`?
Because it would not improve this particular AST walker (see: 69dc790849 (commitcomment-3781426))
Cheers,
Michael
This commit is contained in:
commit
433fbe8fcf
20 changed files with 2196 additions and 157 deletions
77
src/test/debug-info/lexical-scope-in-for-loop.rs
Normal file
77
src/test/debug-info/lexical-scope-in-for-loop.rs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// FIRST ITERATION
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = 1
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$2 = -1
|
||||
// debugger:continue
|
||||
|
||||
// SECOND ITERATION
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 2
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = -2
|
||||
// debugger:continue
|
||||
|
||||
// THIRD ITERATION
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = 3
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$6 = -3
|
||||
// debugger:continue
|
||||
|
||||
// AFTER LOOP
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$7 = 1000000
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
|
||||
let range = [1, 2, 3];
|
||||
|
||||
let x = 1000000; // wan meeeljen doollaars!
|
||||
|
||||
for &x in range.iter() {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = -1 * x;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
128
src/test/debug-info/lexical-scope-in-if.rs
Normal file
128
src/test/debug-info/lexical-scope-in-if.rs
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// BEFORE if
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = 999
|
||||
// debugger:print y
|
||||
// check:$2 = -1
|
||||
// debugger:continue
|
||||
|
||||
// AT BEGINNING of 'then' block
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 999
|
||||
// debugger:print y
|
||||
// check:$4 = -1
|
||||
// debugger:continue
|
||||
|
||||
// AFTER 1st redeclaration of 'x'
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = 1001
|
||||
// debugger:print y
|
||||
// check:$6 = -1
|
||||
// debugger:continue
|
||||
|
||||
// AFTER 2st redeclaration of 'x'
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$7 = 1002
|
||||
// debugger:print y
|
||||
// check:$8 = 1003
|
||||
// debugger:continue
|
||||
|
||||
// AFTER 1st if expression
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$9 = 999
|
||||
// debugger:print y
|
||||
// check:$10 = -1
|
||||
// debugger:continue
|
||||
|
||||
// BEGINNING of else branch
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$11 = 999
|
||||
// debugger:print y
|
||||
// check:$12 = -1
|
||||
// debugger:continue
|
||||
|
||||
// BEGINNING of else branch
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$13 = 1004
|
||||
// debugger:print y
|
||||
// check:$14 = 1005
|
||||
// debugger:continue
|
||||
|
||||
// BEGINNING of else branch
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$15 = 999
|
||||
// debugger:print y
|
||||
// check:$16 = -1
|
||||
// debugger:continue
|
||||
|
||||
use std::util;
|
||||
|
||||
fn main() {
|
||||
|
||||
let x = 999;
|
||||
let y = -1;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
if x < 1000 {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 1001;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 1002;
|
||||
let y = 1003;
|
||||
zzz();
|
||||
sentinel();
|
||||
} else {
|
||||
util::unreachable();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
if x > 1000 {
|
||||
util::unreachable();
|
||||
} else {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 1004;
|
||||
let y = 1005;
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
79
src/test/debug-info/lexical-scope-in-managed-closure.rs
Normal file
79
src/test/debug-info/lexical-scope-in-managed-closure.rs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$2 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 1000
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = 2.5
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$6 = false
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
|
||||
let x = false;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let managed_closure: @fn(int) = |x| {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 2.5;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = true;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
};
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
managed_closure(1000);
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
148
src/test/debug-info/lexical-scope-in-match.rs
Normal file
148
src/test/debug-info/lexical-scope-in-match.rs
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$1 = 231
|
||||
// debugger:print not_shadowed
|
||||
// check:$2 = 232
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$3 = 233
|
||||
// debugger:print not_shadowed
|
||||
// check:$4 = 232
|
||||
// debugger:print local_to_arm
|
||||
// check:$5 = 234
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$6 = 236
|
||||
// debugger:print not_shadowed
|
||||
// check:$7 = 232
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$8 = 237
|
||||
// debugger:print not_shadowed
|
||||
// check:$9 = 232
|
||||
// debugger:print local_to_arm
|
||||
// check:$10 = 238
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$11 = 239
|
||||
// debugger:print not_shadowed
|
||||
// check:$12 = 232
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$13 = 241
|
||||
// debugger:print not_shadowed
|
||||
// check:$14 = 232
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$15 = 243
|
||||
// debugger:print *local_to_arm
|
||||
// check:$16 = 244
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print shadowed
|
||||
// check:$17 = 231
|
||||
// debugger:print not_shadowed
|
||||
// check:$18 = 232
|
||||
// debugger:continue
|
||||
|
||||
struct Struct {
|
||||
x: int,
|
||||
y: int
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
let shadowed = 231;
|
||||
let not_shadowed = 232;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
match (233, 234) {
|
||||
(shadowed, local_to_arm) => {
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
}
|
||||
|
||||
match (235, 236) {
|
||||
// with literal
|
||||
(235, shadowed) => {
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match Struct { x: 237, y: 238 } {
|
||||
Struct { x: shadowed, y: local_to_arm } => {
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
}
|
||||
|
||||
match Struct { x: 239, y: 240 } {
|
||||
// ignored field
|
||||
Struct { x: shadowed, _ } => {
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
}
|
||||
|
||||
match Struct { x: 241, y: 242 } {
|
||||
// with literal
|
||||
Struct { x: shadowed, y: 242 } => {
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match (243, 244) {
|
||||
(shadowed, ref local_to_arm) => {
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
79
src/test/debug-info/lexical-scope-in-stack-closure.rs
Normal file
79
src/test/debug-info/lexical-scope-in-stack-closure.rs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$2 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 1000
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = 2.5
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$6 = false
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
|
||||
let x = false;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let stack_closure: &fn(int) = |x| {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 2.5;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = true;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
};
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
stack_closure(1000);
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
127
src/test/debug-info/lexical-scope-in-unconditional-loop.rs
Normal file
127
src/test/debug-info/lexical-scope-in-unconditional-loop.rs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// FIRST ITERATION
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = 0
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$2 = 1
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 101
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = 101
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = -987
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$6 = 101
|
||||
// debugger:continue
|
||||
|
||||
|
||||
// SECOND ITERATION
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$7 = 1
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$8 = 2
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$9 = 102
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$10 = 102
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$11 = -987
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$12 = 102
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$13 = 2
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
|
||||
let mut x = 0;
|
||||
|
||||
loop {
|
||||
if x >= 2 {
|
||||
break;
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
x += 1;
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// Shadow x
|
||||
let x = x + 100;
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// open scope within loop's top level scope
|
||||
{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = -987;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
// Check that we get the x before the inner scope again
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
79
src/test/debug-info/lexical-scope-in-unique-closure.rs
Normal file
79
src/test/debug-info/lexical-scope-in-unique-closure.rs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$2 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 1000
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = 2.5
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$6 = false
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
|
||||
let x = false;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let unique_closure: ~fn(int) = |x| {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 2.5;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = true;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
};
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
unique_closure(1000);
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
123
src/test/debug-info/lexical-scope-in-while.rs
Normal file
123
src/test/debug-info/lexical-scope-in-while.rs
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// FIRST ITERATION
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = 0
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$2 = 1
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 101
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = 101
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = -987
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$6 = 101
|
||||
// debugger:continue
|
||||
|
||||
|
||||
// SECOND ITERATION
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$7 = 1
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$8 = 2
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$9 = 102
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$10 = 102
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$11 = -987
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$12 = 102
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$13 = 2
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
|
||||
let mut x = 0;
|
||||
|
||||
while x < 2 {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
x += 1;
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// Shadow x
|
||||
let x = x + 100;
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// open scope within loop's top level scope
|
||||
{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = -987;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
// Check that we get the x before the inner scope again
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
129
src/test/debug-info/lexical-scope-with-macro.rs
Normal file
129
src/test/debug-info/lexical-scope-with-macro.rs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$1 = 10
|
||||
// debugger:print b
|
||||
// check:$2 = 34
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$3 = 890242
|
||||
// debugger:print b
|
||||
// check:$4 = 34
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$5 = 10
|
||||
// debugger:print b
|
||||
// check:$6 = 34
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$7 = 102
|
||||
// debugger:print b
|
||||
// check:$8 = 34
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$9 = 110
|
||||
// debugger:print b
|
||||
// check:$10 = 34
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$11 = 10
|
||||
// debugger:print b
|
||||
// check:$12 = 34
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$13 = 10
|
||||
// debugger:print b
|
||||
// check:$14 = 34
|
||||
// debugger:print c
|
||||
// check:$15 = 400
|
||||
// debugger:continue
|
||||
|
||||
macro_rules! trivial(
|
||||
($e1:expr) => ($e1)
|
||||
)
|
||||
|
||||
macro_rules! no_new_scope(
|
||||
($e1:expr) => (($e1 + 2) - 1)
|
||||
)
|
||||
|
||||
macro_rules! new_scope(
|
||||
() => ({
|
||||
let a = 890242;
|
||||
zzz();
|
||||
sentinel();
|
||||
})
|
||||
)
|
||||
|
||||
macro_rules! shadow_within_macro(
|
||||
($e1:expr) => ({
|
||||
let a = $e1 + 2;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let a = $e1 + 10;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
macro_rules! dup_expr(
|
||||
($e1:expr) => (($e1) + ($e1))
|
||||
)
|
||||
|
||||
|
||||
fn main() {
|
||||
|
||||
let a = trivial!(10);
|
||||
let b = no_new_scope!(33);
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
new_scope!();
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
shadow_within_macro!(100);
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let c = dup_expr!(10 * 20);
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
344
src/test/debug-info/lexical-scopes-in-block-expression.rs
Normal file
344
src/test/debug-info/lexical-scopes-in-block-expression.rs
Normal file
|
|
@ -0,0 +1,344 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// STRUCT EXPRESSION
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$1 = -1
|
||||
// debugger:print ten
|
||||
// check:$2 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$3 = 11
|
||||
// debugger:print ten
|
||||
// check:$4 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$5 = -1
|
||||
// debugger:print ten
|
||||
// check:$6 = 10
|
||||
// debugger:continue
|
||||
|
||||
// FUNCTION CALL
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$7 = -1
|
||||
// debugger:print ten
|
||||
// check:$8 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$9 = 12
|
||||
// debugger:print ten
|
||||
// check:$10 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$11 = -1
|
||||
// debugger:print ten
|
||||
// check:$12 = 10
|
||||
// debugger:continue
|
||||
|
||||
// TUPLE EXPRESSION
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$13 = -1
|
||||
// debugger:print ten
|
||||
// check:$14 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$15 = 13
|
||||
// debugger:print ten
|
||||
// check:$16 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$17 = -1
|
||||
// debugger:print ten
|
||||
// check:$18 = 10
|
||||
// debugger:continue
|
||||
|
||||
// VEC EXPRESSION
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$19 = -1
|
||||
// debugger:print ten
|
||||
// check:$20 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$21 = 14
|
||||
// debugger:print ten
|
||||
// check:$22 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$23 = -1
|
||||
// debugger:print ten
|
||||
// check:$24 = 10
|
||||
// debugger:continue
|
||||
|
||||
// REPEAT VEC EXPRESSION
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$25 = -1
|
||||
// debugger:print ten
|
||||
// check:$26 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$27 = 15
|
||||
// debugger:print ten
|
||||
// check:$28 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$29 = -1
|
||||
// debugger:print ten
|
||||
// check:$30 = 10
|
||||
// debugger:continue
|
||||
|
||||
// ASSIGNMENT EXPRESSION
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$31 = -1
|
||||
// debugger:print ten
|
||||
// check:$32 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$33 = 16
|
||||
// debugger:print ten
|
||||
// check:$34 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$35 = -1
|
||||
// debugger:print ten
|
||||
// check:$36 = 10
|
||||
// debugger:continue
|
||||
|
||||
|
||||
// ARITHMETIC EXPRESSION
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$37 = -1
|
||||
// debugger:print ten
|
||||
// check:$38 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$39 = 17
|
||||
// debugger:print ten
|
||||
// check:$40 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$41 = -1
|
||||
// debugger:print ten
|
||||
// check:$42 = 10
|
||||
// debugger:continue
|
||||
|
||||
// INDEX EXPRESSION
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$43 = -1
|
||||
// debugger:print ten
|
||||
// check:$44 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$45 = 18
|
||||
// debugger:print ten
|
||||
// check:$46 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print val
|
||||
// check:$47 = -1
|
||||
// debugger:print ten
|
||||
// check:$48 = 10
|
||||
// debugger:continue
|
||||
|
||||
struct Point {
|
||||
x: int,
|
||||
y: int
|
||||
}
|
||||
|
||||
fn a_function(x: int) -> int {
|
||||
x + 1
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
let val = -1;
|
||||
let ten = 10;
|
||||
|
||||
// surrounded by struct expression
|
||||
let point = Point {
|
||||
x: {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 1;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
},
|
||||
y: 10
|
||||
};
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// surrounded by function call
|
||||
let _ = a_function({
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 2;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
});
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
|
||||
// surrounded by tup
|
||||
let _ = ({
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 3;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
}, 0);
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// surrounded by vec
|
||||
let _ = [{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 4;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
}, 0, 0];
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// surrounded by repeat vec
|
||||
let _ = [{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 5;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
}, ..10];
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// assignment expression
|
||||
let mut var = 0;
|
||||
var = {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 6;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
};
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// arithmetic expression
|
||||
var = 10 + -{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 7;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
} * 5;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
// index expression
|
||||
let a_vector = [10, ..20];
|
||||
let _ = a_vector[{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let val = ten + 8;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
val
|
||||
}];
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
95
src/test/debug-info/name-shadowing-and-scope-nesting.rs
Normal file
95
src/test/debug-info/name-shadowing-and-scope-nesting.rs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = false
|
||||
// debugger:print y
|
||||
// check:$2 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 10
|
||||
// debugger:print y
|
||||
// check:$4 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = 10.5
|
||||
// debugger:print y
|
||||
// check:$6 = 20
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$7 = true
|
||||
// debugger:print y
|
||||
// check:$8 = 2220
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$9 = 203203.5
|
||||
// debugger:print y
|
||||
// check:$10 = 2220
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$11 = 10.5
|
||||
// debugger:print y
|
||||
// check:$12 = 20
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
let x = false;
|
||||
let y = true;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 10;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 10.5;
|
||||
let y = 20;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
{
|
||||
let x = true;
|
||||
let y = 2220;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 203203.5;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
59
src/test/debug-info/shadowed-argument.rs
Normal file
59
src/test/debug-info/shadowed-argument.rs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = false
|
||||
// debugger:print y
|
||||
// check:$2 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 10
|
||||
// debugger:print y
|
||||
// check:$4 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = 10.5
|
||||
// debugger:print y
|
||||
// check:$6 = 20
|
||||
// debugger:continue
|
||||
|
||||
fn a_function(x: bool, y: bool) {
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 10;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 10.5;
|
||||
let y = 20;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
a_function(false, true);
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
|
|
@ -8,42 +8,51 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-test
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = false
|
||||
// debugger:print y
|
||||
// check:$2 = true
|
||||
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 10
|
||||
|
||||
// debugger:print y
|
||||
// check:$4 = true
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = false
|
||||
// check:$5 = 10.5
|
||||
// debugger:print y
|
||||
// check:$5 = 11
|
||||
// check:$6 = 20
|
||||
// debugger:continue
|
||||
|
||||
fn main() {
|
||||
let x = false;
|
||||
let y = true;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
{
|
||||
let x = 10;
|
||||
zzz();
|
||||
}
|
||||
let x = 10;
|
||||
|
||||
let y = 11;
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 10.5;
|
||||
let y = 20;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
87
src/test/debug-info/simple-lexical-scope.rs
Normal file
87
src/test/debug-info/simple-lexical-scope.rs
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$1 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$2 = false
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$3 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$4 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$5 = 10.5
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$6 = 10
|
||||
// debugger:continue
|
||||
|
||||
// debugger:finish
|
||||
// debugger:print x
|
||||
// check:$7 = false
|
||||
// debugger:continue
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = false;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 10;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
{
|
||||
zzz();
|
||||
sentinel();
|
||||
|
||||
let x = 10.5;
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
zzz();
|
||||
sentinel();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
fn sentinel() {()}
|
||||
Loading…
Add table
Add a link
Reference in a new issue