Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
78caecf
Special case DUMMY_SP to emit line 0/column 0 locations on DWARF plat…
khuey Aug 4, 2024
e587855
Use Span::is_dummy().
khuey Aug 4, 2024
5dc4a19
Fix warning.
khuey Aug 4, 2024
8a61674
WASI fixing unsafe_op_in_unsafe_fn for std::{os, sys}
g0djan Aug 5, 2024
1687c55
bootstrap: fix clean's `remove_dir_all` implementation
jieyouxu Aug 17, 2024
35752cf
Update `library/Cargo.toml` in weekly job
tgross35 Aug 19, 2024
76fbf0a
Test wholearchive on rust staticlib
ChrisDenton Aug 18, 2024
3c735a0
Add a test.
khuey Aug 20, 2024
4e9725c
Add a comment.
khuey Aug 20, 2024
9d7574f
rustdoc: animate the `:target` highlight
notriddle Aug 19, 2024
40af214
Make import libraries compatible with wholearchive
ChrisDenton Aug 19, 2024
e424e7f
Avoid extra `cast()`s after `CStr::as_ptr()`
cuviper Aug 20, 2024
be44e4d
Rollup merge of #128432 - g0djan:godjan/wasi_prohibit_implicit_unsafe…
tgross35 Aug 21, 2024
7b4bb15
Rollup merge of #128627 - khuey:DUMMY_SP-line-no, r=nnethercote
tgross35 Aug 21, 2024
6e7889d
Rollup merge of #129187 - jieyouxu:squeaky-clean-windows-symlinks, r=…
tgross35 Aug 21, 2024
bf47bb9
Rollup merge of #129257 - ChrisDenton:rename-null-descriptor, r=jieyouxu
tgross35 Aug 21, 2024
fdbe094
Rollup merge of #129264 - tgross35:dependencies-ci-library, r=Kobzol
tgross35 Aug 21, 2024
4785bcc
Rollup merge of #129284 - notriddle:notriddle/animate-target=light, r…
tgross35 Aug 21, 2024
54b3197
Rollup merge of #129332 - cuviper:cstr-cast, r=compiler-errors
tgross35 Aug 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,17 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
inlined_at: Option<&'ll DILocation>,
span: Span,
) -> &'ll DILocation {
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo());
// When emitting debugging information, DWARF (i.e. everything but MSVC)
// treats line 0 as a magic value meaning that the code could not be
// attributed to any line in the source. That's also exactly what dummy
// spans are. Make that equivalence here, rather than passing dummy spans
// to lookup_debug_loc, which will return line 1 for them.
let (line, col) = if span.is_dummy() && !self.sess().target.is_like_msvc {
(0, 0)
} else {
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo());
(line, col)
};

unsafe { llvm::LLVMRustDIBuilderCreateDebugLocation(line, col, scope, inlined_at) }
}
Expand Down
45 changes: 45 additions & 0 deletions tests/debuginfo/dummy_span.rs
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() { () }