Skip to content

Fix: added UnionSyntheticProvider for LLDB#154055

Open
Mottl wants to merge 1 commit intorust-lang:mainfrom
Mottl:union-lldb-formatter
Open

Fix: added UnionSyntheticProvider for LLDB#154055
Mottl wants to merge 1 commit intorust-lang:mainfrom
Mottl:union-lldb-formatter

Conversation

@Mottl
Copy link

@Mottl Mottl commented Mar 18, 2026

This PR fixes crashing of rust-lldb when union inside union holds variants which are aligned differently.

The following code will crash rust-lldb while inspecting AlignedStruct:

use std::mem::ManuallyDrop;

#[repr(C, align(8))]
struct AlignedStruct {
    data: [u8; 16],
}

union SomeUnion {
    a: (),
    b: ManuallyDrop<AlignedStruct>,
}

fn main() {
    let s = SomeUnion {
        b: ManuallyDrop::new(AlignedStruct {
            data: *b"Hello World\0\0\0\0\0",
        }),
    };
    println!("break here"); // breakpoint here and expand `s`
}

Trying to expand s will crash lldb with SIGSEGV

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 18, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Mark-Simulacrum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants