Skip to content

Commit

Permalink
debuginfo: Don't emit DW_LANG_RUST unless explicitly demanded
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Apr 19, 2016
1 parent c2aaad4 commit e8828e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"dump MIR state at various points in translation"),
orbit: bool = (false, parse_bool,
"get MIR where it belongs - everywhere; most importantly, in orbit"),
rust_debuginfo: bool = (false, parse_bool,
"emit Rust-specific debuginfo instead of fallback encoding"),
}

pub fn default_lib_output() -> CrateType {
Expand Down
11 changes: 10 additions & 1 deletion src/librustc_trans/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ use syntax::parse::token;
// From DWARF 5.
// See http://www.dwarfstd.org/ShowIssue.php?issue=140129.1
const DW_LANG_RUST: c_uint = 0x1c;
const DW_LANG_UNKNOWN: c_uint = 0x0;

#[allow(non_upper_case_globals)]
const DW_ATE_boolean: c_uint = 0x02;
#[allow(non_upper_case_globals)]
Expand Down Expand Up @@ -1013,10 +1015,17 @@ pub fn compile_unit_metadata(cx: &CrateContext) -> DIDescriptor {
let producer = CString::new(producer).unwrap();
let flags = "\0";
let split_name = "\0";

let language = if cx.sess().opts.debugging_opts.rust_debuginfo {
DW_LANG_RUST
} else {
DW_LANG_UNKNOWN
};

return unsafe {
llvm::LLVMDIBuilderCreateCompileUnit(
debug_context(cx).builder,
DW_LANG_RUST,
language,
compile_unit_name,
work_dir.as_ptr(),
producer.as_ptr(),
Expand Down

0 comments on commit e8828e1

Please sign in to comment.