debuginfo: Support for variables captured in closures and closure type descriptions.
This commit is contained in:
parent
67555d9bd4
commit
b81ea86530
11 changed files with 560 additions and 193 deletions
58
src/test/debug-info/var-captured-in-managed-closure.rs
Normal file
58
src/test/debug-info/var-captured-in-managed-closure.rs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// 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 constant
|
||||
// check:$1 = 1
|
||||
// debugger:print a_struct
|
||||
// check:$2 = {a = -2, b = 3.5, c = 4}
|
||||
// debugger:print *owned
|
||||
// check:$3 = 5
|
||||
// debugger:print managed->val
|
||||
// check:$4 = 6
|
||||
|
||||
#[allow(unused_variable)];
|
||||
|
||||
struct Struct {
|
||||
a: int,
|
||||
b: float,
|
||||
c: uint
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let constant = 1;
|
||||
|
||||
let a_struct = Struct {
|
||||
a: -2,
|
||||
b: 3.5,
|
||||
c: 4
|
||||
};
|
||||
|
||||
let owned = ~5;
|
||||
let managed = @6;
|
||||
|
||||
let closure: @fn() = || {
|
||||
zzz();
|
||||
do_something(&constant, &a_struct.a, owned, managed);
|
||||
};
|
||||
|
||||
closure();
|
||||
}
|
||||
|
||||
fn do_something(_: &int, _:&int, _:&int, _:&int) {
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
56
src/test/debug-info/var-captured-in-sendable-closure.rs
Normal file
56
src/test/debug-info/var-captured-in-sendable-closure.rs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
// 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 constant
|
||||
// check:$1 = 1
|
||||
// debugger:print a_struct
|
||||
// check:$2 = {a = -2, b = 3.5, c = 4}
|
||||
// debugger:print *owned
|
||||
// check:$3 = 5
|
||||
|
||||
#[allow(unused_variable)];
|
||||
|
||||
struct Struct {
|
||||
a: int,
|
||||
b: float,
|
||||
c: uint
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let constant = 1;
|
||||
|
||||
let a_struct = Struct {
|
||||
a: -2,
|
||||
b: 3.5,
|
||||
c: 4
|
||||
};
|
||||
|
||||
let owned = ~5;
|
||||
|
||||
let closure: ~fn() = || {
|
||||
zzz();
|
||||
do_something(&constant, &a_struct.a, owned);
|
||||
};
|
||||
|
||||
closure();
|
||||
}
|
||||
|
||||
fn do_something(_: &int, _:&int, _:&int) {
|
||||
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
61
src/test/debug-info/var-captured-in-stack-closure.rs
Normal file
61
src/test/debug-info/var-captured-in-stack-closure.rs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// 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 variable
|
||||
// check:$1 = 1
|
||||
// debugger:print constant
|
||||
// check:$2 = 2
|
||||
// debugger:print a_struct
|
||||
// check:$3 = {a = -3, b = 4.5, c = 5}
|
||||
// debugger:print *struct_ref
|
||||
// check:$4 = {a = -3, b = 4.5, c = 5}
|
||||
// debugger:print *owned
|
||||
// check:$5 = 6
|
||||
// debugger:print managed->val
|
||||
// check:$6 = 7
|
||||
|
||||
#[allow(unused_variable)];
|
||||
|
||||
struct Struct {
|
||||
a: int,
|
||||
b: float,
|
||||
c: uint
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut variable = 1;
|
||||
let constant = 2;
|
||||
|
||||
let a_struct = Struct {
|
||||
a: -3,
|
||||
b: 4.5,
|
||||
c: 5
|
||||
};
|
||||
|
||||
let struct_ref = &a_struct;
|
||||
let owned = ~6;
|
||||
let managed = @7;
|
||||
|
||||
let closure = || {
|
||||
zzz();
|
||||
variable = constant + a_struct.a + struct_ref.a + *owned + *managed;
|
||||
};
|
||||
|
||||
closure();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
Loading…
Add table
Add a link
Reference in a new issue