Skip to content

Commit 7ff4524

Browse files
committed
Use a proper C string for the gdb script section name
1 parent 130851e commit 7ff4524

File tree

1 file changed

+3
-2
lines changed
  • src/librustc_trans/trans/debuginfo

1 file changed

+3
-2
lines changed

src/librustc_trans/trans/debuginfo/gdb.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ pub fn insert_reference_to_gdb_debug_scripts_section_global(ccx: &CrateContext)
5454
/// section.
5555
pub fn get_or_insert_gdb_debug_scripts_section_global(ccx: &CrateContext)
5656
-> llvm::ValueRef {
57-
let section_var_name = "__rustc_debug_gdb_scripts_section__";
57+
let c_section_var_name = "__rustc_debug_gdb_scripts_section__\0";
58+
let section_var_name = &c_section_var_name[..c_section_var_name.len()-1];
5859

5960
let section_var = unsafe {
6061
llvm::LLVMGetNamedGlobal(ccx.llmod(),
61-
section_var_name.as_ptr() as *const _)
62+
c_section_var_name.as_ptr() as *const _)
6263
};
6364

6465
if section_var == ptr::null_mut() {

0 commit comments

Comments
 (0)