Skip to content

Commit a248e34

Browse files
committed
auto merge of #10235 : mletterle/rust/issue-9226, r=jdm
ty_nil will now report as "()" in gdb ty_bot will now report as "!" in gdb Added test to confirm basic types debugging metadata. This fixes #9226
2 parents e0c01ca + ca2f302 commit a248e34

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

src/librustc/middle/trans/debuginfo.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,8 @@ fn basic_type_metadata(cx: &mut CrateContext, t: ty::t) -> DIType {
10151015
debug!("basic_type_metadata: {:?}", ty::get(t));
10161016

10171017
let (name, encoding) = match ty::get(t).sty {
1018-
ty::ty_nil | ty::ty_bot => (~"uint", DW_ATE_unsigned),
1018+
ty::ty_nil => (~"()", DW_ATE_unsigned),
1019+
ty::ty_bot => (~"!", DW_ATE_unsigned),
10191020
ty::ty_bool => (~"bool", DW_ATE_boolean),
10201021
ty::ty_char => (~"char", DW_ATE_unsigned_char),
10211022
ty::ty_int(int_ty) => match int_ty {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
// compile-flags:-Z extra-debug-info
12+
// debugger:rbreak zzz
13+
// debugger:run
14+
// debugger:finish
15+
// debugger:whatis unit
16+
// check:type = ()
17+
// debugger:whatis b
18+
// check:type = bool
19+
// debugger:whatis i
20+
// check:type = int
21+
// debugger:whatis c
22+
// check:type = char
23+
// debugger:whatis i8
24+
// check:type = i8
25+
// debugger:whatis i16
26+
// check:type = i16
27+
// debugger:whatis i32
28+
// check:type = i32
29+
// debugger:whatis i64
30+
// check:type = i64
31+
// debugger:whatis u
32+
// check:type = uint
33+
// debugger:whatis u8
34+
// check:type = u8
35+
// debugger:whatis u16
36+
// check:type = u16
37+
// debugger:whatis u32
38+
// check:type = u32
39+
// debugger:whatis u64
40+
// check:type = u64
41+
// debugger:whatis f32
42+
// check:type = f32
43+
// debugger:whatis f64
44+
// check:type = f64
45+
// debugger:info functions _yyy
46+
// check:[...]
47+
// check:! basic-types-metadata::_yyy()();
48+
// debugger:detach
49+
// debugger:quit
50+
51+
#[allow(unused_variable)];
52+
53+
fn main() {
54+
let unit: () = ();
55+
let b: bool = false;
56+
let i: int = -1;
57+
let c: char = 'a';
58+
let i8: i8 = 68;
59+
let i16: i16 = -16;
60+
let i32: i32 = -32;
61+
let i64: i64 = -64;
62+
let u: uint = 1;
63+
let u8: u8 = 100;
64+
let u16: u16 = 16;
65+
let u32: u32 = 32;
66+
let u64: u64 = 64;
67+
let f32: f32 = 2.5;
68+
let f64: f64 = 3.5;
69+
_zzz();
70+
}
71+
72+
fn _zzz() {()}
73+
fn _yyy() -> ! {fail!()}

0 commit comments

Comments
 (0)