Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
39d4faf9
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
39d4faf9
编写于
7月 20, 2015
作者:
B
bors
浏览文件
操作
浏览文件
下载
差异文件
Auto merge of #27025 - dotdash:issue-26484, r=pnkfelix
See the commits for details r? @arielb1
上级
4e51763e
3d65c7ff
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
84 addition
and
28 deletion
+84
-28
src/librustc_trans/trans/debuginfo/metadata.rs
src/librustc_trans/trans/debuginfo/metadata.rs
+23
-4
src/librustc_trans/trans/debuginfo/mod.rs
src/librustc_trans/trans/debuginfo/mod.rs
+37
-23
src/test/debuginfo/basic-types-metadata.rs
src/test/debuginfo/basic-types-metadata.rs
+4
-1
src/test/run-pass/issue-26484.rs
src/test/run-pass/issue-26484.rs
+20
-0
未找到文件。
src/librustc_trans/trans/debuginfo/metadata.rs
浏览文件 @
39d4faf9
...
...
@@ -796,12 +796,31 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
}
}
ty
::
TyBareFn
(
_
,
ref
barefnty
)
=>
{
subroutine_type_metadata
(
cx
,
unique_type_id
,
&
barefnty
.sig
,
usage_site_span
)
let
fn_metadata
=
subroutine_type_metadata
(
cx
,
unique_type_id
,
&
barefnty
.sig
,
usage_site_span
)
.metadata
;
match
debug_context
(
cx
)
.type_map
.borrow
()
.find_metadata_for_unique_id
(
unique_type_id
)
{
Some
(
metadata
)
=>
return
metadata
,
None
=>
{
/* proceed normally */
}
};
// This is actually a function pointer, so wrap it in pointer DI
MetadataCreationResult
::
new
(
pointer_type_metadata
(
cx
,
t
,
fn_metadata
),
false
)
}
ty
::
TyClosure
(
def_id
,
substs
)
=>
{
let
infcx
=
infer
::
normalizing_infer_ctxt
(
cx
.tcx
(),
&
cx
.tcx
()
.tables
);
let
sig
=
infcx
.closure_type
(
def_id
,
substs
)
.sig
;
subroutine_type_metadata
(
cx
,
unique_type_id
,
&
sig
,
usage_site_span
)
let
upvars
=
infcx
.closure_upvars
(
def_id
,
substs
)
.unwrap
();
let
upvar_types
=
upvars
.iter
()
.map
(|
u
|
u
.ty
)
.collect
::
<
Vec
<
_
>>
();
prepare_tuple_metadata
(
cx
,
t
,
&
upvar_types
[
..
],
unique_type_id
,
usage_site_span
)
.finalize
(
cx
)
}
ty
::
TyStruct
(
def_id
,
substs
)
=>
{
prepare_struct_metadata
(
cx
,
...
...
@@ -920,7 +939,7 @@ pub fn scope_metadata(fcx: &FunctionContext,
}
}
fn
diverging_type_metadata
(
cx
:
&
CrateContext
)
->
DIType
{
pub
fn
diverging_type_metadata
(
cx
:
&
CrateContext
)
->
DIType
{
unsafe
{
llvm
::
LLVMDIBuilderCreateBasicType
(
DIB
(
cx
),
...
...
src/librustc_trans/trans/debuginfo/mod.rs
浏览文件 @
39d4faf9
...
...
@@ -18,7 +18,8 @@
create_DIArray
,
is_node_local_to_unit
};
use
self
::
namespace
::{
namespace_for_item
,
NamespaceTreeNode
};
use
self
::
type_names
::
compute_debuginfo_type_name
;
use
self
::
metadata
::{
type_metadata
,
file_metadata
,
scope_metadata
,
TypeMap
,
compile_unit_metadata
};
use
self
::
metadata
::{
type_metadata
,
diverging_type_metadata
};
use
self
::
metadata
::{
file_metadata
,
scope_metadata
,
TypeMap
,
compile_unit_metadata
};
use
self
::
source_loc
::
InternalDebugLocation
;
use
llvm
;
...
...
@@ -29,8 +30,8 @@
use
rustc
::
ast_map
;
use
trans
::
common
::{
NodeIdAndSpan
,
CrateContext
,
FunctionContext
,
Block
};
use
trans
;
use
trans
::
monomorphize
;
use
middle
::
ty
::
Ty
;
use
trans
::
{
monomorphize
,
type_of
}
;
use
middle
::
ty
::
{
self
,
Ty
}
;
use
session
::
config
::{
self
,
FullDebugInfo
,
LimitedDebugInfo
,
NoDebugInfo
};
use
util
::
nodemap
::{
NodeMap
,
FnvHashMap
,
FnvHashSet
};
...
...
@@ -40,7 +41,7 @@
use
std
::
ptr
;
use
std
::
rc
::
Rc
;
use
syntax
::
codemap
::{
Span
,
Pos
};
use
syntax
::{
ast
,
codemap
,
ast_util
};
use
syntax
::{
a
bi
,
a
st
,
codemap
,
ast_util
};
use
syntax
::
attr
::
IntType
;
use
syntax
::
parse
::
token
::{
self
,
special_idents
};
...
...
@@ -325,7 +326,6 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
let
function_type_metadata
=
unsafe
{
let
fn_signature
=
get_function_signature
(
cx
,
fn_ast_id
,
&*
fn_decl
,
param_substs
,
span
);
llvm
::
LLVMDIBuilderCreateSubroutineType
(
DIB
(
cx
),
file_metadata
,
fn_signature
)
...
...
@@ -402,35 +402,49 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
fn
get_function_signature
<
'a
,
'tcx
>
(
cx
:
&
CrateContext
<
'a
,
'tcx
>
,
fn_ast_id
:
ast
::
NodeId
,
fn_decl
:
&
ast
::
FnDecl
,
param_substs
:
&
Substs
<
'tcx
>
,
error_reporting_span
:
Span
)
->
DIArray
{
if
cx
.sess
()
.opts.debuginfo
==
LimitedDebugInfo
{
return
create_DIArray
(
DIB
(
cx
),
&
[]);
}
let
mut
signature
=
Vec
::
with_capacity
(
fn_decl
.inputs
.len
()
+
1
);
// Return type -- llvm::DIBuilder wants this at index 0
assert_type_for_node_id
(
cx
,
fn_ast_id
,
error_reporting_span
);
let
return_type
=
cx
.tcx
()
.node_id_to_type
(
fn_ast_id
);
let
return_type
=
monomorphize
::
apply_param_substs
(
cx
.tcx
(),
param_substs
,
&
return_type
);
if
return_type
.is_nil
()
{
signature
.push
(
ptr
::
null_mut
())
let
fn_type
=
cx
.tcx
()
.node_id_to_type
(
fn_ast_id
);
let
(
sig
,
abi
)
=
match
fn_type
.sty
{
ty
::
TyBareFn
(
_
,
ref
barefnty
)
=>
{
(
cx
.tcx
()
.erase_late_bound_regions
(
&
barefnty
.sig
),
barefnty
.abi
)
}
ty
::
TyClosure
(
def_id
,
substs
)
=>
{
let
closure_type
=
cx
.tcx
()
.closure_type
(
def_id
,
substs
);
(
cx
.tcx
()
.erase_late_bound_regions
(
&
closure_type
.sig
),
closure_type
.abi
)
}
_
=>
cx
.sess
()
.bug
(
"get_function_metdata: Expected a function type!"
)
};
let
sig
=
monomorphize
::
apply_param_substs
(
cx
.tcx
(),
param_substs
,
&
sig
);
let
mut
signature
=
Vec
::
with_capacity
(
sig
.inputs
.len
()
+
1
);
// Return type -- llvm::DIBuilder wants this at index 0
signature
.push
(
match
sig
.output
{
ty
::
FnConverging
(
ret_ty
)
=>
match
ret_ty
.sty
{
ty
::
TyTuple
(
ref
tys
)
if
tys
.is_empty
()
=>
ptr
::
null_mut
(),
_
=>
type_metadata
(
cx
,
ret_ty
,
codemap
::
DUMMY_SP
)
},
ty
::
FnDiverging
=>
diverging_type_metadata
(
cx
)
});
let
inputs
=
&
if
abi
==
abi
::
RustCall
{
type_of
::
untuple_arguments
(
cx
,
&
sig
.inputs
)
}
else
{
sig
nature
.push
(
type_metadata
(
cx
,
return_type
,
codemap
::
DUMMY_SP
));
}
sig
.inputs
}
;
// Arguments types
for
arg
in
&
fn_decl
.inputs
{
assert_type_for_node_id
(
cx
,
arg
.pat.id
,
arg
.pat.span
);
let
arg_type
=
cx
.tcx
()
.node_id_to_type
(
arg
.pat.id
);
let
arg_type
=
monomorphize
::
apply_param_substs
(
cx
.tcx
(),
param_substs
,
&
arg_type
);
signature
.push
(
type_metadata
(
cx
,
arg_type
,
codemap
::
DUMMY_SP
));
for
&
argument_type
in
inputs
{
signature
.push
(
type_metadata
(
cx
,
argument_type
,
codemap
::
DUMMY_SP
));
}
return
create_DIArray
(
DIB
(
cx
),
&
signature
[
..
]);
...
...
src/test/debuginfo/basic-types-metadata.rs
浏览文件 @
39d4faf9
...
...
@@ -42,8 +42,10 @@
// gdb-check:type = f32
// gdb-command:whatis f64
// gdb-check:type = f64
// gdb-command:whatis fnptr
// gdb-check:type = [...] (*)([...])
// gdb-command:info functions _yyy
// gdb-check:[...]![...]_yyy([...])
([...])
;
// gdb-check:[...]![...]_yyy([...]);
// gdb-command:continue
#![allow(unused_variables)]
...
...
@@ -65,6 +67,7 @@ fn main() {
let
u64
:
u64
=
64
;
let
f32
:
f32
=
2.5
;
let
f64
:
f64
=
3.5
;
let
fnptr
:
fn
()
=
_
zzz
;
_
zzz
();
// #break
if
1
==
1
{
_
yyy
();
}
}
...
...
src/test/run-pass/issue-26484.rs
0 → 100644
浏览文件 @
39d4faf9
// Copyright 2015 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:-g
fn
helper
<
F
:
FnOnce
(
usize
)
->
bool
>
(
_
f
:
F
)
{
print!
(
""
);
}
fn
main
()
{
let
cond
=
0
;
helper
(|
v
|
v
==
cond
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录