rust/tests/debuginfo
Kyle Huey 652b502d9c Reorder stack spills so that constants come later.
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-17 16:45:26 -07:00
..
auxiliary [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
associated-types.rs Fixup tests 2024-08-18 17:41:01 -04:00
basic-types-globals-metadata.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
basic-types-globals.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
basic-types-metadata.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
basic-types-mut-globals.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
basic-types.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
borrowed-basic.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
borrowed-c-style-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
borrowed-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
borrowed-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
borrowed-tuple.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
borrowed-unique-basic.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
box.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
boxed-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
by-value-non-immediate-argument.rs Upgrade CI's mingw-w64 toolchain 2024-09-01 12:37:26 +02:00
by-value-self-argument-in-trait-impl.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
c-style-enum-in-composite.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
c-style-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
captured-fields-1.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
captured-fields-2.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
closure-in-generic-function.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
collapse-debuginfo-external-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-external-flag-overriden-by-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-external-flag.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-in-non-collapse-macro.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-no-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-static-external.rs Add debuginfo tests for collapse_debuginfo for statics. 2024-06-13 16:04:31 +02:00
collapse-debuginfo-static.rs Add debuginfo tests for collapse_debuginfo for statics. 2024-06-13 16:04:31 +02:00
collapse-debuginfo-with-attr-flag.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-with-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-with-yes-flag.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
constant-debug-locs.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
constant-in-match-pattern.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
constant-ordering-prologue.rs Reorder stack spills so that constants come later. 2024-09-17 16:45:26 -07:00
coroutine-locals.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
coroutine-objects.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
cross-crate-spans.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
cross-crate-type-uniquing.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
destructured-fn-argument.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
destructured-for-loop-variable.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
destructured-local.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
drop-locations.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
dummy_span.rs Add a test. 2024-08-19 17:10:43 -07:00
duration-type.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
embedded-visualizer-point.natvis Move /src/test to /tests 2023-01-11 09:32:08 +00:00
embedded-visualizer-point.py Move /src/test to /tests 2023-01-11 09:32:08 +00:00
embedded-visualizer.natvis Move /src/test to /tests 2023-01-11 09:32:08 +00:00
embedded-visualizer.py Move /src/test to /tests 2023-01-11 09:32:08 +00:00
embedded-visualizer.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
empty-string.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
enum-thinlto.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
evec-in-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
extern-c-fn.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
f16-natvis.rs Add Natvis visualiser and debuginfo tests for f16 2024-07-09 03:47:50 +01:00
fixed-sized-array.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
function-arg-initialization.rs Delete gdbg commands 2024-08-18 12:39:06 -04:00
function-arguments.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
function-call.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
function-names.rs remove const arg windows debug info tests 2024-06-05 22:39:42 +01:00
function-prologue-stepping-regular.rs Enable debuginfo tests that have been temporarily disabled for years 2024-08-11 14:20:15 -04:00
gdb-char.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
gdb-pretty-struct-and-enums.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
generic-enum-with-different-disr-sizes.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
generic-function.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
generic-functions-nested.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
generic-method-on-generic-struct.rs Fixup tests 2024-08-18 17:41:01 -04:00
generic-static-method-on-struct-and-enum.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
generic-struct-style-enum.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
generic-struct.rs Fixup tests 2024-08-18 17:41:01 -04:00
generic-tuple-style-enum.rs Delete lldbr annotations 2024-08-18 16:59:58 -04:00
include_string.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
issue-7712.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
issue-12886.rs Enable more debuginfo tests on Windows 2024-08-16 21:14:45 -04:00
issue-13213.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
issue-14411.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
issue-22656.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
issue-57822.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-in-for-loop.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-in-if-let.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
lexical-scope-in-if.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-in-match.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-in-parameterless-closure.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
lexical-scope-in-stack-closure.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-in-unconditional-loop.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-in-unique-closure.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-in-while.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scope-with-macro.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
lexical-scopes-in-block-expression.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
limited-debuginfo.rs Replace gdbr with gdbg 2024-08-18 12:39:07 -04:00
macro-stepping.inc Move /src/test to /tests 2023-01-11 09:32:08 +00:00
macro-stepping.rs Enable more debuginfo tests on Windows 2024-08-16 21:14:45 -04:00
marker-types.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
method-on-enum.rs Upgrade CI's mingw-w64 toolchain 2024-09-01 12:37:26 +02:00
method-on-generic-struct.rs Fixup tests 2024-08-18 17:41:01 -04:00
method-on-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
method-on-trait.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
method-on-tuple-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
msvc-pretty-enums.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
msvc-scalarpair-params.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
multi-byte-chars.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
multi-cgu.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
multiple-functions-equal-var-names.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
multiple-functions.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
mutable-locs.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
mutex.rs std: move Once implementations to sys 2024-03-12 15:41:06 +01:00
name-shadowing-and-scope-nesting.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
no_mangle-info.rs Fix remaining LLDB commands. 2024-03-15 20:30:45 +01:00
numeric-types.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
option-like-enum.rs Make option-like-enum.rs UB-free and portable 2024-08-27 19:12:14 -04:00
packed-struct-with-destructor.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
packed-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
path.rs Add rust-lldb pretty printing for Path and PathBuf 2024-03-29 18:02:26 -06:00
pretty-huge-vec.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
pretty-slices.rs Replace gdbr with gdbg 2024-08-18 12:39:07 -04:00
pretty-std-collections-hash.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
pretty-std-collections.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
pretty-std.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
pretty-uninitialized-vec.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
range-types.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
rc_arc.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
recursive-enum.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
recursive-struct.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
reference-debuginfo.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
regression-bad-location-list-67992.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
result-types.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
rwlock-read.rs std: move Once implementations to sys 2024-03-12 15:41:06 +01:00
rwlock-write.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
self-in-default-method.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
self-in-generic-default-method.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
shadowed-argument.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
shadowed-variable.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
should-fail.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
simd.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
simple-lexical-scope.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
simple-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
simple-tuple.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
skip_second_statement_collapse.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
skip_second_statement.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
static-method-on-struct-and-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
step-into-match.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
strings-and-strs.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
struct-in-enum.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
struct-in-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
struct-namespace.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
struct-style-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
struct-with-destructor.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
text-to-include-1.txt Move /src/test to /tests 2023-01-11 09:32:08 +00:00
text-to-include-2.txt Move /src/test to /tests 2023-01-11 09:32:08 +00:00
text-to-include-3.txt Move /src/test to /tests 2023-01-11 09:32:08 +00:00
thread-names.rs Enable more debuginfo tests on Windows 2024-08-16 21:14:45 -04:00
thread.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
trait-pointers.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
tuple-in-struct.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
tuple-in-tuple.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
tuple-struct.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
tuple-style-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
type-names.cdb.js Move /src/test to /tests 2023-01-11 09:32:08 +00:00
type-names.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
union-smoke.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
unique-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
unit-type.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
unreachable-locals.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
unsized.rs Replace gdbr with gdbg 2024-08-18 12:39:07 -04:00
var-captured-in-nested-closure.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
var-captured-in-sendable-closure.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
var-captured-in-stack-closure.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
vec-slices.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
vec.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
zst-interferes-with-prologue.rs Don't leave debug locations for constants sitting on the builder indefinitely. 2024-09-06 23:12:18 +00:00