Skip to content

Commit 74953d3

Browse files
committed
---
yaml --- r: 63435 b: refs/heads/snap-stage3 c: 6db3302 h: refs/heads/master i: 63433: 55cfefd 63431: 3fde4cd v: v3
1 parent e331a76 commit 74953d3

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1079e41143e2f94fc0f969b967aaf89b2f4448a2
4+
refs/heads/snap-stage3: 6db3302b354c47dba4463752e21c37049860b761
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/trans/debuginfo.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct _DebugContext {
6767
names: namegen,
6868
crate_file: ~str,
6969
builder: DIBuilderRef,
70-
curr_loc: (int, int),
70+
curr_loc: (uint, uint),
7171
created_files: HashMap<~str, DIFile>,
7272
created_functions: HashMap<ast::node_id, DISubprogram>,
7373
created_blocks: HashMap<ast::node_id, DILexicalBlock>,
@@ -82,7 +82,7 @@ pub fn mk_ctxt(llmod: ModuleRef, crate: ~str, intr: @ident_interner) -> DebugCon
8282
names: new_namegen(intr),
8383
crate_file: crate,
8484
builder: builder,
85-
curr_loc: (-1, -1),
85+
curr_loc: (0, 0),
8686
created_files: HashMap::new(),
8787
created_functions: HashMap::new(),
8888
created_blocks: HashMap::new(),
@@ -619,9 +619,13 @@ pub fn create_local_var(bcx: block, local: @ast::local) -> DIVariable {
619619
fmt!("No entry in lllocals table for %?", local.node.id));
620620
}
621621
};
622+
623+
set_debug_location(bcx, loc.line, loc.col.to_uint());
622624
unsafe {
623-
llvm::LLVMDIBuilderInsertDeclareAtEnd(dcx.builder, llptr, var_md, bcx.llbb);
625+
let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(dcx.builder, llptr, var_md, bcx.llbb);
626+
llvm::LLVMSetInstDebugLocation(trans::build::B(bcx), instr);
624627
}
628+
625629
return var_md;
626630
}
627631

@@ -668,10 +672,12 @@ pub fn create_arg(bcx: block, arg: ast::arg, sp: span) -> Option<DIVariable> {
668672
}
669673
}
670674

671-
fn create_debug_loc(line: int, col: int, scope: DIScope) -> DILocation {
672-
let elems = ~[C_i32(line as i32), C_i32(col as i32), scope, ptr::null()];
675+
fn set_debug_location(bcx: block, line: uint, col: uint) {
676+
let blockmd = create_block(bcx);
677+
let elems = ~[C_i32(line as i32), C_i32(col as i32), blockmd, ptr::null()];
673678
unsafe {
674-
return llvm::LLVMMDNode(vec::raw::to_ptr(elems), elems.len() as libc::c_uint);
679+
let dbg_loc = llvm::LLVMMDNode(vec::raw::to_ptr(elems), elems.len() as libc::c_uint);
680+
llvm::LLVMSetCurrentDebugLocation(trans::build::B(bcx), dbg_loc);
675681
}
676682
}
677683

@@ -686,16 +692,14 @@ pub fn update_source_pos(bcx: block, sp: span) {
686692
let loc = cm.lookup_char_pos(sp.lo);
687693
let cx = bcx.ccx();
688694
let mut dcx = dbg_cx(cx);
689-
if (loc.line.to_int(), loc.col.to_int()) == dcx.curr_loc {
690-
return;
691-
}
692695

693-
dcx.curr_loc = (loc.line.to_int(), loc.col.to_int());
694-
let blockmd = create_block(bcx);
695-
let dbgscope = create_debug_loc(loc.line.to_int(), loc.col.to_int(), blockmd);
696-
unsafe {
697-
llvm::LLVMSetCurrentDebugLocation(trans::build::B(bcx), dbgscope);
696+
let loc = (loc.line, loc.col.to_uint());
697+
if loc == dcx.curr_loc {
698+
return;
698699
}
700+
debug!("setting_location to %u %u", loc.first(), loc.second());
701+
dcx.curr_loc = loc;
702+
set_debug_location(bcx, loc.first(), loc.second());
699703
}
700704

701705
pub fn create_function(fcx: fn_ctxt) -> DISubprogram {

0 commit comments

Comments
 (0)