Set the DICompileUnit emissionKind
This commit is contained in:
parent
75d0bceb0a
commit
cff0750090
3 changed files with 50 additions and 6 deletions
|
|
@ -13,7 +13,7 @@ use value::Value;
|
|||
|
||||
use llvm;
|
||||
use llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor,
|
||||
DICompositeType, DILexicalBlock, DIFlags};
|
||||
DICompositeType, DILexicalBlock, DIFlags, DebugEmissionKind};
|
||||
use llvm_util;
|
||||
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
|
@ -846,6 +846,7 @@ pub fn compile_unit_metadata(tcx: TyCtxt,
|
|||
let producer = CString::new(producer).unwrap();
|
||||
let flags = "\0";
|
||||
let split_name = "\0";
|
||||
let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
|
||||
|
||||
unsafe {
|
||||
let file_metadata = llvm::LLVMRustDIBuilderCreateFile(
|
||||
|
|
@ -859,7 +860,8 @@ pub fn compile_unit_metadata(tcx: TyCtxt,
|
|||
tcx.sess.opts.optimize != config::OptLevel::No,
|
||||
flags.as_ptr() as *const _,
|
||||
0,
|
||||
split_name.as_ptr() as *const _);
|
||||
split_name.as_ptr() as *const _,
|
||||
kind);
|
||||
|
||||
if tcx.sess.opts.debugging_opts.profile {
|
||||
let cu_desc_metadata = llvm::LLVMRustMetadataAsValue(debug_context.llcontext,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use super::debuginfo::{
|
|||
DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
|
||||
DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
|
||||
DIGlobalVariableExpression, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
|
||||
DINameSpace, DIFlags, DISPFlags,
|
||||
DINameSpace, DIFlags, DISPFlags, DebugEmissionKind,
|
||||
};
|
||||
|
||||
use libc::{c_uint, c_int, size_t, c_char};
|
||||
|
|
@ -605,6 +605,26 @@ pub mod debuginfo {
|
|||
const SPFlagOptimized = (1 << 4);
|
||||
}
|
||||
}
|
||||
|
||||
/// LLVMRustDebugEmissionKind
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub enum DebugEmissionKind {
|
||||
NoDebug,
|
||||
FullDebug,
|
||||
LineTablesOnly,
|
||||
}
|
||||
|
||||
impl DebugEmissionKind {
|
||||
pub fn from_generic(kind: rustc::session::config::DebugInfo) -> Self {
|
||||
use rustc::session::config::DebugInfo;
|
||||
match kind {
|
||||
DebugInfo::None => DebugEmissionKind::NoDebug,
|
||||
DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
|
||||
DebugInfo::Full => DebugEmissionKind::FullDebug,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern { pub type ModuleBuffer; }
|
||||
|
|
@ -1381,7 +1401,8 @@ extern "C" {
|
|||
isOptimized: bool,
|
||||
Flags: *const c_char,
|
||||
RuntimeVer: c_uint,
|
||||
SplitName: *const c_char)
|
||||
SplitName: *const c_char,
|
||||
kind: DebugEmissionKind)
|
||||
-> &'a DIDescriptor;
|
||||
|
||||
pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue