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
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
collapse-debuginfo-external-flag-overriden-by-attr.rs
collapse-debuginfo-external-flag.rs
collapse-debuginfo-in-non-collapse-macro.rs
collapse-debuginfo-no-attr.rs
collapse-debuginfo-static-external.rs
collapse-debuginfo-static.rs
collapse-debuginfo-with-attr-flag.rs
collapse-debuginfo-with-attr.rs
collapse-debuginfo-with-yes-flag.rs
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
embedded-visualizer-point.natvis
embedded-visualizer-point.py
embedded-visualizer.natvis
embedded-visualizer.py
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
fixed-sized-array.rs
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
function-names.rs
function-prologue-stepping-regular.rs
gdb-char.rs
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
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
macro-stepping.rs Enable more debuginfo tests on Windows 2024-08-16 21:14:45 -04:00
marker-types.rs
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
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
mutex.rs
name-shadowing-and-scope-nesting.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
no_mangle-info.rs
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
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
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
rc_arc.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
recursive-enum.rs
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
rwlock-read.rs
rwlock-write.rs
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
skip_second_statement.rs
static-method-on-struct-and-enum.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
step-into-match.rs
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
text-to-include-2.txt
text-to-include-3.txt
thread-names.rs Enable more debuginfo tests on Windows 2024-08-16 21:14:45 -04:00
thread.rs
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
type-names.rs
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