Skip to content

Commit 11e58fd

Browse files
---
yaml --- r: 144043 b: refs/heads/try2 c: 5c9d7c2 h: refs/heads/master i: 144041: 170501f 144039: 2c27805 v: v3
1 parent 8839507 commit 11e58fd

File tree

7 files changed

+214
-7
lines changed

7 files changed

+214
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 6c49c2df763f8cf1817bc651582deba8bb35a29d
8+
refs/heads/try2: 5c9d7c2072ef93adf9912643d025e48ac832c3a6
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/driver/driver.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,14 @@ pub fn build_session_options(binary: @str,
691691
let extra_debuginfo = debugging_opts & session::extra_debug_info != 0;
692692
let debuginfo = debugging_opts & session::debug_info != 0 ||
693693
extra_debuginfo;
694+
695+
// If debugging info is generated, do not collapse monomorphized function instances.
696+
// Functions with equivalent llvm code still need separate debugging descriptions because names
697+
// might differ.
698+
if debuginfo {
699+
debugging_opts |= session::no_monomorphic_collapse;
700+
}
701+
694702
let statik = debugging_opts & session::statik != 0;
695703

696704
let addl_lib_search_paths = getopts::opt_strs(matches, "L").map(|s| Path(*s));

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,10 @@ pub fn create_argument_metadata(bcx: @mut Block,
256256
}
257257
}
258258

259-
/// Sets the current debug location at the beginning of the span
259+
/// Sets the current debug location at the beginning of the span.
260260
///
261-
/// Maps to a call to llvm::LLVMSetCurrentDebugLocation(...)
261+
/// Maps to a call to llvm::LLVMSetCurrentDebugLocation(...). The node_id parameter is used to
262+
/// reliably find the correct visibility scope for the code position.
262263
pub fn update_source_pos(fcx: &FunctionContext,
263264
node_id: ast::NodeId,
264265
span: span) {
@@ -357,6 +358,7 @@ pub fn create_function_metadata(fcx: &mut FunctionContext) -> DISubprogram {
357358
llvm::LLVMDIBuilderCreateSubroutineType(DIB(cx), file_metadata, fn_signature)
358359
};
359360

361+
// get_template_parameters() will append a `<...>` clause to the function name if necessary.
360362
let mut function_name = cx.sess.str_of(ident).to_owned();
361363
let template_parameters = get_template_parameters(fcx,
362364
generics,
@@ -404,8 +406,8 @@ pub fn create_function_metadata(fcx: &mut FunctionContext) -> DISubprogram {
404406
}
405407
_ => cx.sess.span_bug(span,
406408
fmt!("debuginfo::create_function_metadata() - \
407-
FunctionContext::entry_bcx::node_info points to wrong type of ast_map entry. \
408-
Expected: ast_map::node_block, actual: %?", *entry_block))
409+
FunctionContext::entry_bcx::node_info points to wrong type of ast_map \
410+
entry. Expected: ast_map::node_block, actual: %?", *entry_block))
409411
}
410412

411413
fcx.debug_context = Some(fn_debug_context);
@@ -508,7 +510,7 @@ pub fn create_function_metadata(fcx: &mut FunctionContext) -> DISubprogram {
508510
let actual_type_name = ty_to_str(cx.tcx, actual_type);
509511
name_to_append_suffix_to.push_str(actual_type_name);
510512
if index != generics.ty_params.len() - 1 {
511-
name_to_append_suffix_to.push_str(", ");
513+
name_to_append_suffix_to.push_str(",");
512514
}
513515

514516
do cx.sess.str_of(ident).to_c_str().with_ref |name| {
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
12+
13+
// compile-flags:-Z extra-debug-info
14+
// debugger:set print union on
15+
// debugger:break zzz
16+
// debugger:run
17+
// debugger:finish
18+
19+
// debugger:print case1
20+
// check:$1 = {{Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {Case1, a = 0, b = 2088533116, c = 2088533116}, {Case1, a = 0, b = 8970181431921507452}}
21+
22+
// debugger:print case2
23+
// check:$2 = {{Case2, a = 0, b = 4369, c = 4369, d = 4369, e = 4369}, {Case2, a = 0, b = 286331153, c = 286331153}, {Case2, a = 0, b = 1229782938247303441}}
24+
25+
// debugger:print case3
26+
// check:$3 = {{Case3, a = 0, b = 22873, c = 22873, d = 22873, e = 22873}, {Case3, a = 0, b = 1499027801, c = 1499027801}, {Case3, a = 0, b = 6438275382588823897}}
27+
28+
// debugger:print univariant
29+
// check:$4 = {a = -1}
30+
31+
// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
32+
// substituted with something of size `xx` bits and the same alignment as an integer type of the
33+
// same size.
34+
35+
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
36+
// the size of the discriminant value is machine dependent, this has be taken into account when
37+
// datatype layout should be predictable as in this case.
38+
enum Regular<T16, T32, T64> {
39+
Case1 { a: T64, b: T16, c: T16, d: T16, e: T16},
40+
Case2 { a: T64, b: T32, c: T32},
41+
Case3 { a: T64, b: T64 }
42+
}
43+
44+
enum Univariant<T> {
45+
TheOnlyCase { a: T }
46+
}
47+
48+
fn main() {
49+
50+
// In order to avoid endianess trouble all of the following test values consist of a single
51+
// repeated byte. This way each interpretation of the union should look the same, no matter if
52+
// this is a big or little endian machine.
53+
54+
// 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
55+
// 0b01111100011111000111110001111100 = 2088533116
56+
// 0b0111110001111100 = 31868
57+
// 0b01111100 = 124
58+
let case1: Regular<u16, u32, i64> = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
59+
60+
// 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
61+
// 0b00010001000100010001000100010001 = 286331153
62+
// 0b0001000100010001 = 4369
63+
// 0b00010001 = 17
64+
let case2: Regular<i16, u32, i64> = Case2 { a: 0, b: 286331153, c: 286331153 };
65+
66+
// 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
67+
// 0b01011001010110010101100101011001 = 1499027801
68+
// 0b0101100101011001 = 22873
69+
// 0b01011001 = 89
70+
let case3: Regular<u16, i32, u64> = Case3 { a: 0, b: 6438275382588823897 };
71+
72+
let univariant = TheOnlyCase { a: -1 };
73+
74+
zzz();
75+
}
76+
77+
fn zzz() {()}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
12+
13+
// compile-flags:-Z extra-debug-info
14+
// debugger:break zzz
15+
// debugger:run
16+
17+
// debugger:finish
18+
// debugger:print int_int
19+
// check:$1 = {key = 0, value = 1}
20+
// debugger:print int_float
21+
// check:$2 = {key = 2, value = 3.5}
22+
// debugger:print float_int
23+
// check:$3 = {key = 4.5, value = 5}
24+
// debugger:print float_int_float
25+
// check:$4 = {key = 6.5, value = {key = 7, value = 8.5}}
26+
27+
struct AGenericStruct<TKey, TValue> {
28+
key: TKey,
29+
value: TValue
30+
}
31+
32+
fn main() {
33+
34+
let int_int = AGenericStruct { key: 0, value: 1 };
35+
let int_float = AGenericStruct { key: 2, value: 3.5 };
36+
let float_int = AGenericStruct { key: 4.5, value: 5 };
37+
let float_int_float = AGenericStruct { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } };
38+
39+
zzz();
40+
}
41+
42+
fn zzz() {()}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
12+
13+
// compile-flags:-Z extra-debug-info
14+
// debugger:set print union on
15+
// debugger:break zzz
16+
// debugger:run
17+
// debugger:finish
18+
19+
// debugger:print case1
20+
// check:$1 = {{Case1, 0, 31868, 31868, 31868, 31868}, {Case1, 0, 2088533116, 2088533116}, {Case1, 0, 8970181431921507452}}
21+
22+
// debugger:print case2
23+
// check:$2 = {{Case2, 0, 4369, 4369, 4369, 4369}, {Case2, 0, 286331153, 286331153}, {Case2, 0, 1229782938247303441}}
24+
25+
// debugger:print case3
26+
// check:$3 = {{Case3, 0, 22873, 22873, 22873, 22873}, {Case3, 0, 1499027801, 1499027801}, {Case3, 0, 6438275382588823897}}
27+
28+
// debugger:print univariant
29+
// check:$4 = {-1}
30+
31+
32+
// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
33+
// substituted with something of size `xx` bits and the same alignment as an integer type of the
34+
// same size.
35+
36+
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
37+
// the size of the discriminant value is machine dependent, this has be taken into account when
38+
// datatype layout should be predictable as in this case.
39+
enum Regular<T16, T32, T64> {
40+
Case1(T64, T16, T16, T16, T16),
41+
Case2(T64, T32, T32),
42+
Case3(T64, T64)
43+
}
44+
45+
enum Univariant<T64> {
46+
TheOnlyCase(T64)
47+
}
48+
49+
fn main() {
50+
51+
// In order to avoid endianess trouble all of the following test values consist of a single
52+
// repeated byte. This way each interpretation of the union should look the same, no matter if
53+
// this is a big or little endian machine.
54+
55+
// 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
56+
// 0b01111100011111000111110001111100 = 2088533116
57+
// 0b0111110001111100 = 31868
58+
// 0b01111100 = 124
59+
let case1: Regular<u16, u32, u64> = Case1(0_u64, 31868_u16, 31868_u16, 31868_u16, 31868_u16);
60+
61+
// 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
62+
// 0b00010001000100010001000100010001 = 286331153
63+
// 0b0001000100010001 = 4369
64+
// 0b00010001 = 17
65+
let case2: Regular<i16, i32, i64> = Case2(0_i64, 286331153_i32, 286331153_i32);
66+
67+
// 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
68+
// 0b01011001010110010101100101011001 = 1499027801
69+
// 0b0101100101011001 = 22873
70+
// 0b01011001 = 89
71+
let case3: Regular<i16, i32, i64> = Case3(0_i64, 6438275382588823897_i64);
72+
73+
let univariant = TheOnlyCase(-1_i64);
74+
75+
zzz();
76+
}
77+
78+
fn zzz() {()}

branches/try2/src/test/debug-info/struct-style-enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ fn main() {
7070
zzz();
7171
}
7272

73-
fn zzz() {()}
73+
fn zzz() {()}

0 commit comments

Comments
 (0)