forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debuginfo: Added test cases for structs, tuples, enums, etc passed by…
… value. Also updated documentation comments in debuginfo and renamed DebugContext to CrateDebugContext.
- Loading branch information
1 parent
5e040e9
commit dde633e
Showing
9 changed files
with
206 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// 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. | ||
|
||
// compile-flags:-Z extra-debug-info | ||
// debugger:break zzz | ||
// debugger:run | ||
|
||
// debugger:finish | ||
// debugger:print s | ||
// check:$1 = {a = 1, b = 2.5} | ||
// debugger:continue | ||
|
||
// debugger:finish | ||
// debugger:print x | ||
// check:$2 = {a = 3, b = 4.5} | ||
// debugger:print y | ||
// check:$3 = 5 | ||
// debugger:print z | ||
// check:$4 = 6.5 | ||
// debugger:continue | ||
|
||
// debugger:finish | ||
// debugger:print a | ||
// check:$5 = {7, 8, 9.5, 10.5} | ||
// debugger:continue | ||
|
||
// debugger:finish | ||
// debugger:print a | ||
// check:$6 = {11.5, 12.5, 13, 14} | ||
// debugger:continue | ||
|
||
// debugger:finish | ||
// debugger:print x | ||
// check:$7 = {{Case1, x = 0, y = 8970181431921507452}, {Case1, 0, 2088533116, 2088533116}} | ||
// debugger:continue | ||
|
||
#[deriving(Clone)] | ||
struct Struct { | ||
a: int, | ||
b: float | ||
} | ||
|
||
#[deriving(Clone)] | ||
struct StructStruct { | ||
a: Struct, | ||
b: Struct | ||
} | ||
|
||
fn fun(s: Struct) { | ||
zzz(); | ||
} | ||
|
||
fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) { | ||
zzz(); | ||
} | ||
|
||
fn tup(a: (int, uint, float, float)) { | ||
zzz(); | ||
} | ||
|
||
struct Newtype(float, float, int, uint); | ||
|
||
fn new_type(a: Newtype) { | ||
zzz(); | ||
} | ||
|
||
// The first element is to ensure proper alignment, irrespective of the machines word size. Since | ||
// the size of the discriminant value is machine dependent, this has be taken into account when | ||
// datatype layout should be predictable as in this case. | ||
enum Enum { | ||
Case1 { x: i64, y: i64 }, | ||
Case2 (i64, i32, i32), | ||
} | ||
|
||
fn by_val_enum(x: Enum) { | ||
zzz(); | ||
} | ||
|
||
fn main() { | ||
fun(Struct { a: 1, b: 2.5 }); | ||
fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } }); | ||
tup((7, 8, 9.5, 10.5)); | ||
new_type(Newtype(11.5, 12.5, 13, 14)); | ||
|
||
// 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452 | ||
// 0b01111100011111000111110001111100 = 2088533116 | ||
// 0b0111110001111100 = 31868 | ||
// 0b01111100 = 124 | ||
by_val_enum(Case1 { x: 0, y: 8970181431921507452 }); | ||
} | ||
|
||
fn zzz() {()} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// 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. | ||
|
||
// 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 | ||
// debugger:print closure_local | ||
// check:$7 = 8 | ||
// debugger:continue | ||
|
||
#[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 = || { | ||
let closure_local = 8; | ||
|
||
let nested_closure = || { | ||
zzz(); | ||
variable = constant + a_struct.a + struct_ref.a + *owned + *managed + closure_local; | ||
}; | ||
|
||
// breaking here will yield a wrong value for 'constant'. In particular, GDB will | ||
// read the value of the register that supposedly contains the pointer to 'constant' | ||
// and try derefence it. The register, however, already contains the actual value, and | ||
// not a pointer to it. -mw | ||
// zzz(); | ||
|
||
nested_closure(); | ||
}; | ||
|
||
closure(); | ||
} | ||
|
||
fn zzz() {()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dde633e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+
dde633e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors: retry
dde633e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors: retry