diff options
| author | bors <bors@rust-lang.org> | 2013-07-20 09:10:34 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-07-20 09:10:34 -0700 |
| commit | 8aae6edce09a8e2a32a154acb55c9879dbebf99c (patch) | |
| tree | d77d6659847631f404dcf08529e3b3bd0b7fa4e2 /src/test/debug-info/borrowed-managed-basic.rs | |
| parent | 3a1db2d1e631feede472396fced1806dfd3cf677 (diff) | |
| parent | a1303cc81565a019d59be28940a94caf0f9329bf (diff) | |
| download | rust-8aae6edce09a8e2a32a154acb55c9879dbebf99c.tar.gz rust-8aae6edce09a8e2a32a154acb55c9879dbebf99c.zip | |
auto merge of #7710 : michaelwoerister/rust/WP4, r=jdm
This pull request includes various improvements: + Composite types (structs, tuples, boxes, etc) are now handled more cleanly by debuginfo generation. Most notably, field offsets are now extracted directly from LLVM types, as opposed to trying to reconstruct them. This leads to more stable handling of edge cases (e.g. packed structs or structs implementing drop). + `debuginfo.rs` in general has seen a major cleanup. This includes better formatting, more readable variable and function names, removal of dead code, and better factoring of functionality. + Handling of `VariantInfo` in `ty.rs` has been improved. That is, the `type VariantInfo = @VariantInfo_` typedef has been replaced with explicit uses of @VariantInfo, and the duplicated logic for creating VariantInfo instances in `ty::enum_variants()` and `typeck::check::mod::check_enum_variants()` has been unified into a single constructor function. Both function now look nicer too :) + Debug info generation for enum types is now mostly supported. This includes: + Good support for C-style enums. Both DWARF and `gdb` know how to handle them. + Proper description of tuple- and struct-style enum variants as unions of structs. + Proper handling of univariant enums without discriminator field. + Unfortunately `gdb` always prints all possible interpretations of a union, so debug output of enums is verbose and unintuitive. Neither `LLVM` nor `gdb` support DWARF's `DW_TAG_variant` which allows to properly describe tagged unions. Adding support for this to `LLVM` seems doable. `gdb` however is another story. In the future we might be able to use `gdb`'s Python scripting support to alleviate this problem. In agreement with @jdm this is not a high priority for now. + The debuginfo test suite has been extended with 14 test files including tests for packed structs (with Drop), boxed structs, boxed vecs, vec slices, c-style enums (standalone and embedded), empty enums, tuple- and struct-style enums, and various pointer types to the above. ~~What is not yet included is DI support for some enum edge-cases represented as described in `trans::adt::NullablePointer`.~~ Cheers, Michael PS: closes #7819, fixes #7712
Diffstat (limited to 'src/test/debug-info/borrowed-managed-basic.rs')
| -rw-r--r-- | src/test/debug-info/borrowed-managed-basic.rs | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/test/debug-info/borrowed-managed-basic.rs b/src/test/debug-info/borrowed-managed-basic.rs new file mode 100644 index 00000000000..9087bb36fa5 --- /dev/null +++ b/src/test/debug-info/borrowed-managed-basic.rs @@ -0,0 +1,114 @@ +// 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 + +// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only +// its numerical value. + +// compile-flags:-Z extra-debug-info +// debugger:break zzz +// debugger:run +// debugger:finish +// debugger:print *bool_ref +// check:$1 = true + +// debugger:print *int_ref +// check:$2 = -1 + +// debugger:print *char_ref +// check:$3 = 97 + +// debugger:print/d *i8_ref +// check:$4 = 68 + +// debugger:print *i16_ref +// check:$5 = -16 + +// debugger:print *i32_ref +// check:$6 = -32 + +// debugger:print *i64_ref +// check:$7 = -64 + +// debugger:print *uint_ref +// check:$8 = 1 + +// debugger:print/d *u8_ref +// check:$9 = 100 + +// debugger:print *u16_ref +// check:$10 = 16 + +// debugger:print *u32_ref +// check:$11 = 32 + +// debugger:print *u64_ref +// check:$12 = 64 + +// debugger:print *float_ref +// check:$13 = 1.5 + +// debugger:print *f32_ref +// check:$14 = 2.5 + +// debugger:print *f64_ref +// check:$15 = 3.5 + + +fn main() { + let bool_box: @bool = @true; + let bool_ref: &bool = bool_box; + + let int_box: @int = @-1; + let int_ref: &int = int_box; + + let char_box: @char = @'a'; + let char_ref: &char = char_box; + + let i8_box: @i8 = @68; + let i8_ref: &i8 = i8_box; + + let i16_box: @i16 = @-16; + let i16_ref: &i16 = i16_box; + + let i32_box: @i32 = @-32; + let i32_ref: &i32 = i32_box; + + let i64_box: @i64 = @-64; + let i64_ref: &i64 = i64_box; + + let uint_box: @uint = @1; + let uint_ref: &uint = uint_box; + + let u8_box: @u8 = @100; + let u8_ref: &u8 = u8_box; + + let u16_box: @u16 = @16; + let u16_ref: &u16 = u16_box; + + let u32_box: @u32 = @32; + let u32_ref: &u32 = u32_box; + + let u64_box: @u64 = @64; + let u64_ref: &u64 = u64_box; + + let float_box: @float = @1.5; + let float_ref: &float = float_box; + + let f32_box: @f32 = @2.5; + let f32_ref: &f32 = f32_box; + + let f64_box: @f64 = @3.5; + let f64_ref: &f64 = f64_box; + zzz(); +} + +fn zzz() {()} \ No newline at end of file |
