Commit Graph

214 Commits

Author SHA1 Message Date
bors
12c4d3f34d Auto merge of #162804 - maxdexh:nuke-unique-in-vec, r=hanna-kruppe
Remove usages of `Unique` from `RawVec`



See [zulip](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Can.20we.20nuke.20.60Unique.60.3F/with/624141418).

Probably needs a perf run, because it touches code that might be very sensitive to build times and debug mode

r? libs
2026-09-20 13:11:30 +00:00
Max Dexheimer
16337b6cfd Remove usages of Unique from RawVec 2026-09-20 12:58:26 +02:00
beetrees
b7bad07da0 Add Natvis visualiser and debuginfo tests for f128 2026-09-18 19:04:42 +01:00
bors
6474e99989 Auto merge of #162598 - Walnut356:msvc_scopes, r=jieyouxu
Fix the remaining `tests/debuginfo` failures on `msvc` 



Fixes the remainder of the failing tests from https://github.com/rust-lang/rust/issues/161657

I used lldb 22.1 to individually check each of the `S_DEFRANGE_REGISTER_REL_INDIR` node (using e.g. `llvm-pdbutil dump --symbols ".\build\x86_64-pc-windows-gnu\test\debuginfo\<test_name>.lldb\a.pdb" | rg "unknown \(4471\)"`)

Any tests with an `unknown (4471)` node (4471/0x1177 being the enum value for `S_DEFRANGE_REGISTER_REL_INDIR`) got an `[msvc]` revision to disable on LLDB older than 23.1.0.

I then updated to LLDB 23.1.0 and disabled any remaining test failures that ocurred due to the variable shadowing behavior (so that they do not instantly break when we eventually run 23 in CI). Technically we could have avoided disabling those tests by using the python API to inspect individual slots of the frame, or by printing the whole frame at each step and matching against that, but the amount of effort seems not worth it until [we determine whether or not LLDB can/will improve its behavior here.](https://github.com/llvm/llvm-project/issues/221696).

One note, LLDB 23 seems to like it even less when we use the parent debugger instance for the test harness. I'll fix that in a followup PR since it requires a little bit of fiddling to get it to work with LLDB <23 (the short version is it's much harder to exit with a non-0 status code when using a nested debugger instance. We should be able to run something like `os.kill(os.getpid(), signal.SIGTERM)` from the internal python to kill the parent LLDB process to work around that)

There were a few fixes that required special handling

### `borrowed-basic.rs`, `basic-types-globals.rs`, `reference-debuginfo.rs` 

LLDB appears to have changed their default formatting for chars again in v23.1.0 (`U+0x00000061 U'a'` -> `U+0061 U'a'`) luckily these are similar enough that we can use a wildcard to pass in both cases


### `dummy-span.rs`

There was a conditional to prevent using the (0,0) default dummy span on MSVC with a comment explaining why (it would default to the first line of the file instead). I removed the `is_msvc` check and this test worked and didn't break anything else so, best guess this got fixed at some point and the comment was outdated?

In any case, with this PR, the entirety of `tests/debuginfo` passes on `linux-gnu`, `windows-gnu`, and `windows-msvc` 🎉🎉

<img width="847" height="444" alt="image" src="https://github.com/user-attachments/assets/4c0f14d1-5ad4-4234-8380-59ad18ad6309" />


<img width="817" height="208" alt="image" src="https://github.com/user-attachments/assets/87819fcd-cdbb-4fd4-b2f8-c6cf2ecf5db3" />


r? @Kobzol, @jieyouxu
2026-09-13 03:03:32 +00:00
bors
adcc5f3bdc Auto merge of #160377 - Walnut356:gdb_di_repr, r=Kobzol,jieyouxu
Add `gdb-repr` directive for `tests/debuginfo`



Part of https://github.com/rust-lang/rust/issues/148483 and followup to https://github.com/rust-lang/rust/pull/158298. Applies (approximately) identical logic to GDB.

I still need to test things on `windows-gnu` (and locally try a few more tests to see if there's any glaring issues). There's also a few bike-sheddy things.

The main way this differs from the LLDB implementation is that GDB doesn't use `lldb_batchmode/runner.py` to orchestrate the commands. Instead, I have `compiletest` import `from_gdb.py` which registers a custom `repr` CLI command. GDB's batch processing works as normal, but dispatches to our logic automatically whenever it encounters `repr <var_name>`.

An additional `repr-finalize` CLI command is also registered to implement the checks that ensure we encountered all expected types/vars, and verifies that there were no errors before saving blessed data.

r? @Kobzol, @jieyouxu
2026-09-12 14:45:47 +00:00
khyperia
0c35264566 migrate tests 2026-09-11 17:08:12 +02:00
Walnut
0f64cbe6a0 gate/disable msvc scope & S_DEFRANGE_REGISTER_REL_INDIR debuginfo tests 2026-09-10 09:21:08 -05:00
Walnut
ae019ac33d rearrange debug test logic file structure 2026-09-08 05:05:37 -05:00
Walnut
7e0525173e convert basic-types to gdb-repr 2026-09-08 05:01:45 -05:00
Walnut
ca69880cd9 Add msvc revisions to some debuginfo tests 2026-09-07 04:52:01 -05:00
Walnut
2f5678e30b fix 0-length array formatting 2026-09-07 04:08:12 -05:00
Jonathan Brouwer
2a91880bde Rollup merge of #162364 - Walnut356:debuginfo_repr, r=jieyouxu
Use `#[repr(C)]` on debuginfo test structs

This fixes a couple of issues.

* LLDB reading PDB debug info re-orders fields and displays them in offset order instead of source-order like DWARF. While this has been [fixed upstream](https://github.com/llvm/llvm-project/pull/218731), it'll be quite a while before it's reflected in CI runners and such
* For all targets, the structs were often written (and named) under the assumption that they would have specific layouts. Nothing was actually enforcing those assumed layouts, so very often a type would be named e.g. `HasInternalPadding` but rust would reorder it such that no internal padding existed.

`struct-with-destructor.rs` is still iffy. I'll test it when I get home and can update my main PC's LLDB.

On my remote PC (lldb 22.1.2) it didn't fix the test, and it looked like the variable was straight up being read incorrectly:

 ```
// expected:
 (struct_with_destructor::NestedOuter) nested = {a:{a:{x:7890, y:9870}}}
// got:
 (struct_with_destructor::NestedOuter) nested = {a:{a:{y:1378684509906, x:9870}}
 ```
On my laptop when manually inspecting it (CodeLLDB which uses 22.1.8 under the hood) everything looked fine, so it might have been a bug that LLDB patched.

Part of the MSVC test fixes for https://github.com/rust-lang/rust/issues/161657

r? @Kobzol, @jieyouxu

---

test-jobs: aarch64-apple-1
test-jobs: aarch64-msvc-1
test-jobs: x86_64-msvc-1
test-jobs: x86_64-mingw-1
2026-09-06 20:23:11 +02:00
Walnut
81fcec33da use #[repr(C)] on debuginfo test structs 2026-09-06 05:28:04 -05:00
Walnut
cc3786db90 force u8/i8 numeric formatting for lldb 2026-09-06 03:09:37 -05:00
cyrgani
d86e422962 remove box_patterns from remaining tests 2026-08-25 08:03:22 +00:00
Walnut
0d74fb7a10 re-bless pretty-std on windows 2026-08-23 00:57:14 -05:00
Walnut
dae325089f lower minimum lldb to 21.1 2026-08-17 00:38:40 -05:00
Walnut
817d95a65e json trimming 2026-08-15 07:07:59 -05:00
Walnut
1370460d65 convert pretty-std to lldb-repr 2026-08-13 04:45:45 -05:00
Adwin White
10e95f40c5 disable some tests for ohos target 2026-08-11 14:13:19 +08:00
Jonathan Brouwer
103f5d6831 Rollup merge of #159834 - Walnut356:ptr_str, r=Mark-Simulacrum
Apply str debugger visualizer to `*const str`, `*mut str` and `Box<str>`

Fairly straightforward. Note that the MSVC changes very likely aren't exercised by CI. My GSoC project is actively working on fixing that, but in the meantime i can personally verify that it works (note that the `ref$<str$> *` type name confirms this is MSVC):

<img width="318" height="138" alt="image" src="https://github.com/user-attachments/assets/fd868f16-d9a5-438a-a155-a429771bf525" />
2026-08-08 22:16:45 +02:00
Walnut
64f6b622ac add lldb-repr check logic 2026-07-25 05:26:07 -05:00
Walnut
69edf45897 apply str visualizer to *const, *mut and Box<str> 2026-07-24 07:11:05 -05:00
Jonathan Brouwer
f2d833478f Rollup merge of #159215 - Walnut356:lldb_vers, r=Kobzol,jieyouxu
[compiletest] Differentiate between LLVM LLDB and Apple LLDB

This patch causes `compiletest` to treat LLVM and Apple LLDB versions uniquely, including modified `min-version` directives. We'll need this level of granularity going forward:

* rust-lang/rust#158298 requires LLVM LLDB `22.1.x`. Currently, `compiletest` only cares about major versions.
* @jieyouxu's efforts to [pin debugger versions](https://github.com/rust-lang/compiler-team/issues/1012)

Any tests that specified `min-lldb-version` have been updated to equivalent `min-apple-lldb-version` and `min-llvm-lldb-version` directives to preserve existing test filters.

r? @Kobzol, @jieyouxu
2026-07-19 17:04:33 +02:00
Walnut
785c42b4a8 differentiate between LLVM LLDB and Apple LLDB 2026-07-16 21:10:15 -05:00
Jieyou Xu
810a7aa41f tests: gate tests/deubinfo/function-call.rs on min GDB 15.1
See RUST-159073, this test has been flaky with

```
/checkout/obj/build/x86_64-unknown-linux-gnu/test/debuginfo/function-call.gdb/function-call.debugger.script:11: Error in sourced command file:
Couldn't write extended state status: Bad address.
```

on linux CI jobs under various environments and hosts/targets. I tried
running this under GDB 15.1 locally (WSL, `x86_64-unknown-linux-gnu`)
but could not reproduce. CI typically uses GDB 12.1 with Ubuntu 22.04.
So gate this test with min GDB 15.1 which prevents it from running in CI
to workaround the flakiness but still allow running it locally under
GDB >= 15.1.

It's *possible* there's a genuine problem here.
2026-07-17 00:17:09 +08:00
Jieyou Xu
85f2c700f9 tests: only run lexical-scope-in-match.rs for LLDB >= 21 2026-06-30 09:19:47 +08:00
Jonathan Brouwer
3a29576be2 Rollup merge of #153238 - shua:lldb-rcstr, r=davidtwco
debuginfo: slices are DW_TAG_array_type's

Rust debuginfo for unsized structs with embedded slice types is lacking, and it makes it difficult for debuggers to correctly print types like `Rc<str>` (eg rust-lang/rust#114195). Specifically, these three structs would have essentially the same debug info (modulo some names):
```rust
struct Foo { a: u32, s: str } // unsized
struct Bar { a: u32, s: [u8] } // unsized
struct Baz { a: u32, s: u8 }
```

This changes how the compiler generates debuginfo in this case, and I used existing compilers (gcc, clang) handling of C flexible member arrays as a reference.
2026-06-12 20:40:46 +02:00
Jieyou Xu
d5435fceb2 Disable tests/debuginfo/pretty-std.rs OsString cdb check
Since approx. Windows SDK 20348, the corresponding cdb (and/or its
underlying WinDbg engine) changed or regressed the `OsStr`/`OsString`
visualization, and no longer renders the emoji. Since approx. SDK/cdb
26100, the output formatting of the string containing UTF-8 (i.e. the
multi-byte emoji grapheme) seems to have further regressed (e.g. the end
quotation mark is no longer shown and command output becomes garbled).

Relevant issues:

* RUST-88840
* RUST-148743
* RUST-88796
2026-06-06 03:16:59 +08:00
bors
4f84d9fac4 Auto merge of #157234 - Walnut356:test_package, r=jieyouxu
Convert `lldb_batchmode` to a package

The new testing logic for https://github.com/rust-lang/rust/issues/148483 will end up being a couple of python files, and it doesn't make sense to have them all as freefloating scripts in `src/etc`. 

I also made sure to update occurrences of `lldb_batchmode.py` in the code and documentation to point to the new package instead.
2026-06-02 02:00:45 +00:00
Walnut
c191595d37 convert lldb_batchmode to a package 2026-06-01 01:51:55 -05:00
Walnut
d1d26f096c update tests w/ new struct summary 2026-06-01 00:57:56 -05:00
shua
3914f38be2 adding debuginfo tests for str repr llvm di 2026-05-28 23:29:35 +02:00
Jieyou Xu
a6361c8127 Disable tests/debuginfo/numeric-types.rs v nz_{i,u}size checks
On lldb 22 (locally lldb 22.1.6) I see

```
v nz_isize
error: Invalid type: Cannot determine size
[...]
v nz_usize
error: Invalid type: Cannot determine size
```

AFAICT this might be an upstream issue, as reported in
<https://github.com/llvm/llvm-project/issues/196812>. Let's disable for
now to not have `./x test` fail for contributors using lldb 22.
2026-05-24 20:09:10 +02:00
fallofpheonix
6ed5bf2f52 Remove po checks from debuginfo path test 2026-05-24 00:43:32 +05:30
fallofpheonix
d4e4f9a0ee Use print instead of po in debuginfo path test 2026-05-20 14:20:48 +05:30
shua
31ce9e781d debuginfo: slices are DW_TAG_array_type's 2026-05-16 10:23:01 +02:00
Oli Scherer
8882bf04b7 Remove rustc_layout_scalar_valid_range attr from debuginfo 2026-05-03 10:59:52 +02:00
Nicholas Nethercote
d944ea10e6 Remove WithCachedTypeInfo::stable_hash.
We store a stable hash value in the most common interned values (e.g.
types, predicates, regions). This is 16 bytes of data.

- In non-incremental builds it's a straightforward performance loss: the
  stable hash isn't computed or used, and the 16 bytes of space goes to
  waste (but it still gets hashed when interning).

- In incremental builds it avoids some hashing but doesn't seem to
  actually be a genuine performance win, and the complexity doesn't seem
  worth it.
2026-04-23 12:13:19 +10:00
Martin Nordholts
98242676d9 tests/debuginfo/basic-stepping.rs: Remove FIXME related to ZSTs
We don't consider it a bug that users can't break on initialization of
some non-zero sized types (see comment on `maximally-steppable` at the
top of the file), so it does not make sense to consider it a bug that
users can't break on initialization of some zero-sized types.
2026-04-16 06:05:12 +02:00
Jonathan Brouwer
978fb762ac Rollup merge of #153941 - Enselic:fully-steppable, r=saethlin
tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable

Some optimization passes [_improve_](https://github.com/rust-lang/compiler-team/issues/319) compile times. So we want to run some passes even with `-Copt-level=0`. That means that some debuggable lines can be optimized away. Document that as expected behavior.

Closes https://github.com/rust-lang/rust/issues/33013.

Replaces https://github.com/rust-lang/rust/pull/151426. See that PR for some discussion.
2026-04-13 20:20:00 +02:00
León Orell Valerian Liehr
357f670fde Rename #[rustc_layout] to #[rustc_dump_layout] 2026-04-10 12:13:48 +02:00
Walnut
3c52bb5527 directly point to tuple summary 2026-04-02 09:44:38 -05:00
Walnut
eca09dedef fix tests 2026-03-31 05:01:25 -05:00
Martin Nordholts
686ddd3e2e tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable
Some optimization passes _improve_ compile times [1]. So we want to run
some passes even with `-Copt-level=0`. That means that some of the lines
in the test can be optimized away. To make regression testing more
robust, we also want to run the test with such passes disabled. The
solution is to use two revisions. One with default `-Copt-level=0`
passes, and one "even less optimized", with enough optimization passes
disabled to keep the maximum number of lines steppable.

[1]: https://github.com/rust-lang/compiler-team/issues/319
2026-03-16 18:39:40 +01:00
Martin Nordholts
a27fdfbf01 tests/debuginfo/basic-stepping.rs: Remove ignore-aarch64
It works now.
2026-03-14 18:24:49 +01:00
Martin Nordholts
17c079625c tests/debuginfo/basic-stepping.rs: Add cdb test 2026-03-14 06:46:57 +01:00
Martin Nordholts
512d5fd676 tests/debuginfo/basic-stepping.rs: Add lldb test
Also move the FIXME to the source code to avoid duplication, and also
suppress harmless warnings that are annoying when you compile manually.
2026-03-12 20:30:21 +01:00
Jonathan Brouwer
77658bcda3 Rollup merge of #152593 - spirali:valtreekind-list, r=lcnr
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`

This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind`

```
   // FIXME(mgca): Use a `List` here instead of a boxed slice
    Branch(Box<[I::Const]>),
```

It introduces `Interner::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places.

r? lcnr
2026-03-06 18:49:47 +01:00
joboet
88cec3a1c0 update debuginfo visualizers and tests 2026-03-02 11:57:03 +01:00