about summary refs log tree commit diff
path: root/tests/debuginfo
AgeCommit message (Collapse)AuthorLines
2024-10-11rename RcBox in other places tooJonathan Dönszelmann-2/+1
2024-09-23Check ABI target compatibility for function pointersTamme Dittrich-2/+2
This check was previously only performed on functions not function pointers. Co-authored-by: Folkert <folkert@folkertdev.nl>
2024-09-17Reorder stack spills so that constants come later.Kyle Huey-0/+35
Currently constants are "pulled forward" and have their stack spills emitted first. This confuses LLVM as to where to place breakpoints at function entry, and results in argument values being wrong in the debugger. It's straightforward to avoid emitting the stack spills for constants until arguments/etc have been introduced in debug_introduce_locals, so do that. Example LLVM IR (irrelevant IR elided): Before: define internal void @_ZN11rust_1289457binding17h2c78f956ba4bd2c3E(i64 %a, i64 %b, double %c) unnamed_addr #0 !dbg !178 { start: %c.dbg.spill = alloca [8 x i8], align 8 %b.dbg.spill = alloca [8 x i8], align 8 %a.dbg.spill = alloca [8 x i8], align 8 %x.dbg.spill = alloca [4 x i8], align 4 store i32 0, ptr %x.dbg.spill, align 4, !dbg !192 ; LLVM places breakpoint here. #dbg_declare(ptr %x.dbg.spill, !190, !DIExpression(), !192) store i64 %a, ptr %a.dbg.spill, align 8 #dbg_declare(ptr %a.dbg.spill, !187, !DIExpression(), !193) store i64 %b, ptr %b.dbg.spill, align 8 #dbg_declare(ptr %b.dbg.spill, !188, !DIExpression(), !194) store double %c, ptr %c.dbg.spill, align 8 #dbg_declare(ptr %c.dbg.spill, !189, !DIExpression(), !195) ret void, !dbg !196 } After: define internal void @_ZN11rust_1289457binding17h2c78f956ba4bd2c3E(i64 %a, i64 %b, double %c) unnamed_addr #0 !dbg !178 { start: %x.dbg.spill = alloca [4 x i8], align 4 %c.dbg.spill = alloca [8 x i8], align 8 %b.dbg.spill = alloca [8 x i8], align 8 %a.dbg.spill = alloca [8 x i8], align 8 store i64 %a, ptr %a.dbg.spill, align 8 #dbg_declare(ptr %a.dbg.spill, !187, !DIExpression(), !192) store i64 %b, ptr %b.dbg.spill, align 8 #dbg_declare(ptr %b.dbg.spill, !188, !DIExpression(), !193) store double %c, ptr %c.dbg.spill, align 8 #dbg_declare(ptr %c.dbg.spill, !189, !DIExpression(), !194) store i32 0, ptr %x.dbg.spill, align 4, !dbg !195 ; LLVM places breakpoint here. #dbg_declare(ptr %x.dbg.spill, !190, !DIExpression(), !195) ret void, !dbg !196 } Note in particular the position of the "LLVM places breakpoint here" comment relative to the stack spills for the function arguments. LLVM assumes that the first instruction with with a debug location is the end of the prologue. As LLVM does not currently offer front ends any direct control over the placement of the prologue end reordering the IR is the only mechanism available to fix argument values at function entry in the presence of MIR optimizations like SingleUseConsts. Fixes #128945
2024-09-13Auto merge of #130052 - khuey:clear-dilocation-after-const-emission, ↵bors-0/+72
r=michaelwoerister Don't leave debug locations for constants sitting on the builder indefinitely Because constants are currently emitted *before* the prologue, leaving the debug location on the IRBuilder spills onto other instructions in the prologue and messes up both line numbers as well as the point LLVM chooses to be the prologue end. Example LLVM IR (irrelevant IR elided): Before: ``` define internal { i64, i64 } `@_ZN3tmp3Foo18var_return_opt_try17he02116165b0fc08cE(ptr` align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8, !dbg !357 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) ``` After: ``` define internal { i64, i64 } `@_ZN3tmp3Foo18var_return_opt_try17h00b17d08874ddd90E(ptr` align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) ``` Note in particular how !357 from %residual.dbg.spill's dbg_declare no longer falls through onto the store to %self.dbg.spill. This fixes argument values at entry when the constant is a ZST (e.g. `<Option as Try>::Residual`). This fixes #130003 (but note that it does *not* fix issues with argument values and non-ZST constants, which emit their own stores that have debug info on them, like #128945). r? `@michaelwoerister`
2024-09-09Ban non-array SIMDScott McMurray-32/+32
2024-09-06Don't leave debug locations for constants sitting on the builder indefinitely.Kyle Huey-0/+72
Because constants are currently emitted *before* the prologue, leaving the debug location on the IRBuilder spills onto other instructions in the prologue and messes up both line numbers as well as the point LLVM chooses to be the prologue end. Example LLVM IR (irrelevant IR elided): Before: define internal { i64, i64 } @_ZN3tmp3Foo18var_return_opt_try17he02116165b0fc08cE(ptr align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8, !dbg !357 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) After: define internal { i64, i64 } @_ZN3tmp3Foo18var_return_opt_try17h00b17d08874ddd90E(ptr align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) Note in particular how !357 from %residual.dbg.spill's dbg_declare no longer falls through onto the store to %self.dbg.spill. This fixes argument values at entry when the constant is a ZST (e.g. <Option as Try>::Residual). This fixes #130003 (but note that it does *not* fix issues with argument values and non-ZST constants, which emit their own stores that have debug info on them, like #128945).
2024-09-01Upgrade CI's mingw-w64 toolchainMateusz Mikuła-0/+3
2024-08-27Make option-like-enum.rs UB-free and portableBen Kimock-25/+14
2024-08-21Rollup merge of #128627 - khuey:DUMMY_SP-line-no, r=nnethercoteMatthias Krüger-0/+45
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.
2024-08-19Add a test.Kyle Huey-0/+45
2024-08-18Fixup testsBen Kimock-13/+13
2024-08-18Convert lldbg- to lldb-Ben Kimock-716/+716
2024-08-18Delete lldbr annotationsBen Kimock-677/+0
2024-08-18Delete min-lldb-version: 310Ben Kimock-158/+2
2024-08-18Delete redundant gdb-version requirements and related commentsBen Kimock-47/+0
2024-08-18Grep for enabled and clean up those hitsBen Kimock-22/+0
2024-08-18Fix up a special caseBen Kimock-7/+0
2024-08-18Replace gdbr with gdbgBen Kimock-461/+461
2024-08-18Delete gdbg commandsBen Kimock-398/+0
2024-08-16Enable more debuginfo tests on WindowsBen Kimock-12/+8
2024-08-16Re-enable debuginfo tests on freebsdBen Kimock-4/+0
2024-08-16Auto merge of #128913 - saethlin:unignore-debuginfo-tests, r=compiler-errorsbors-72/+48
Enable debuginfo tests that have been "temporarily disabled" for the past 6 years The PR history is a bit of a mess because I had to test this a lot with try-jobs, so I'll try to summarize the non-obvious changes here. A number of tests now have `min-lldb-version: 1800`. Those tests should have gotten an lldb version jump either in https://github.com/rust-lang/rust/pull/124781 or long ago. Note that all such tests with that lldb version requirement do not run in Apple CI. `tests/debuginfo/drop-locations.rs` is staying disabled for now because gdb doesn't know to stop on the drop calls produced by a `}`: https://github.com/rust-lang/rust/issues/128971 `tests/debuginfo/function-arg-initialization.rs` now has `-Zmir-enable-passes=-SingleUseConsts`; without that we initialize the const before the function prelude: https://github.com/rust-lang/rust/issues/128945 `tests/debuginfo/by-value-non-immediate-argument.rs` fails because we don't generate a function prelude for unused non-immediate arguments, even with all optimizations disabled, and this seems to confuse debuggers on aarch64: https://github.com/rust-lang/rust/issues/128973 `tests/debuginfo/pretty-std.rs` is staying disabled on windows-gnu because our test harness doesn't know how to load our pretty-printers on that target: https://github.com/rust-lang/rust/issues/128981 `tests/debuginfo/method-on-enum.rs` and `tests/debuginfo/option-like-enum.rs` encounter some kind of gdb bug on i686-pc-windows-gnu. I don't know enough about that situation to write a good issue. I plan on doing more work on this test suite. There's clearly a lot more basic cleanup work to do here.
2024-08-15Disable macro-stepping on current lldbBen Kimock-1/+2
2024-08-13Require gdb version on some testsBen Kimock-9/+4
2024-08-13Use the `enum2$` Natvis visualiser for repr128 C-style enumsbeetrees-0/+50
2024-08-11Fix debuginfo providers/testsBen Kimock-6/+6
2024-08-11Enable debuginfo tests that have been temporarily disabled for yearsBen Kimock-71/+51
2024-08-09Polymorphize RawVecBen Kimock-1/+1
2024-08-07Disallow setting built-in cfgs via set the command-lineUrgau-2/+2
2024-07-09Add Natvis visualiser and debuginfo tests for `f16`beetrees-33/+152
2024-06-13Add debuginfo tests for collapse_debuginfo for statics.Dario Nieuwenhuis-0/+48
2024-06-05remove const arg windows debug info testsBoxy-3/+0
2024-06-05Fix function-names.rs testMichael Goulet-2/+2
2024-06-05Bless tests and handle tests/crashesBoxy-2/+2
2024-06-01Increase vtable layout sizeMark Rousskov-3/+3
This improves LLVM's codegen by allowing vtable loads to be hoisted out of loops (as just one example).
2024-05-20Fix `tests/debuginfo/strings-and-strs`.Nicholas Nethercote-2/+2
It fails on my machine because it embeds pointer addresses in the expected output. This commit replaces the addresses with `0x[...]`.
2024-05-11lldb-formatters: Use StdSliceSyntheticProvider for &strVladimir Makayev-3/+66
2024-05-05Implement lldb formattter for "clang encoded" enums (LLDB 18.1+)Vladimir Makayev-23/+102
Summary: I landed a fix last year to enable `DW_TAG_variant_part` encoding in LLDBs (https://reviews.llvm.org/D149213). This PR is a corresponding fix in synthetic formatters to decode that information. This is in no way perfect implementation but at least it improves the status quo. But most types of enums will be visible and debuggable in some way. I've also updated most of the existing tests that touch enums and re-enabled test cases based on LLDB for enums. Test Plan: ran tests `./x test tests/debuginfo/`. Also tested manually in LLDB CLI and LLDB VSCode Other Thoughs A better approach would probably be adopting [formatters from codelldb](https://github.com/vadimcn/codelldb/blob/master/formatters/rust.py). There is some neat hack that hooks up summary provider via synthetic provider which can ultimately fix more display issues for Rust types and enums too. But getting it to work well might take more time that I have right now.
2024-04-26Update lldb only testsVadim Petrochenkov-0/+2
2024-04-25debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and ↵Vadim Petrochenkov-92/+18
`#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local). `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-10/+17
And suggest adding the `#[coroutine]` to the closure
2024-04-22Stabilize generic `NonZero`.Markus Reiter-2/+0
2024-04-15disable two debuginfo tests under gdb 15Rémy Rakic-0/+4
it seems gdb 15 regresses some of our debuginfo tests. disable them temporarily so that CI doesn't randomly start failing soon.
2024-03-29Add rust-lldb pretty printing for Path and PathBufNathan Henrie-0/+29
Fixes https://github.com/rust-lang/rust/issues/120553 Fixes https://github.com/rust-lang/rust/issues/48462
2024-03-17Auto merge of #121885 - reitermarkus:generic-nonzero-inner, ↵bors-1656/+1648
r=oli-obk,wesleywiser Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type. Tracking issue: https://github.com/rust-lang/rust/issues/120257 r? `@dtolnay`
2024-03-15Fix unknown `dwim-print` command.Markus Reiter-4/+4
2024-03-15Fix remaining LLDB commands.Markus Reiter-29/+29
2024-03-15Use explicit LLDB commands instead of `print`/`p` aliases.Markus Reiter-838/+830
2024-03-14Remove LLDB persistent results in `compiletest`.Markus Reiter-826/+824
2024-03-14Fix `StdNonZeroNumberSummaryProvider`.Markus Reiter-12/+14