forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#128627 - khuey:DUMMY_SP-line-no, r=nnethercote
Special case DUMMY_SP to emit line 0/column 0 locations on DWARF platforms. Line 0 has a special meaning in DWARF. From the version 5 spec: The compiler may emit the value 0 in cases where an instruction cannot be attributed to any source line. DUMMY_SP spans cannot be attributed to any line. However, because rustc internally stores line numbers starting at zero, lookup_debug_loc() adjusts every line number by one. Special casing DUMMY_SP to actually emit line 0 ensures rustc communicates to the debugger that there's no meaningful source code for this instruction, rather than telling the debugger to jump to line 1 randomly.
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//@ min-lldb-version: 310 | ||
|
||
//@ compile-flags:-g | ||
|
||
// === GDB TESTS =================================================================================== | ||
|
||
// gdb-command:run 7 | ||
|
||
// gdb-command:next | ||
// gdb-command:next | ||
// gdb-check:[...]#loc1[...] | ||
// gdb-command:next | ||
// gdb-check:[...]#loc2[...] | ||
|
||
// === LLDB TESTS ================================================================================== | ||
|
||
// lldb-command:run 7 | ||
|
||
// lldb-command:next | ||
// lldb-command:next | ||
// lldb-command:frame select | ||
// lldb-check:[...]#loc1[...] | ||
// lldb-command:next | ||
// lldb-command:frame select | ||
// lldb-check:[...]#loc2[...] | ||
|
||
use std::env; | ||
use std::num::ParseIntError; | ||
|
||
fn main() -> Result<(), ParseIntError> { | ||
let args = env::args(); | ||
let number_str = args.skip(1).next().unwrap(); | ||
let number = number_str.parse::<i32>()?; | ||
zzz(); // #break | ||
if number % 7 == 0 { | ||
// This generates code with a dummy span for | ||
// some reason. If that ever changes this | ||
// test will not test what it wants to test. | ||
return Ok(()); // #loc1 | ||
} | ||
println!("{}", number); | ||
Ok(()) | ||
} // #loc2 | ||
|
||
fn zzz() { () } |