| Issue |
235686
|
| Summary |
[LLDB] Zero-length arrays and zero-sized fields are ignored in PDB debug info
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Walnut356
|
Tested using LLDB 23, but this has definitely been the case for quite a while.
```rust
#![allow(unused)]
use std::{
alloc::{Layout, alloc_zeroed},
ptr,
};
#[derive(Clone, Copy)]
#[repr(C)]
struct Sized {
f1: u16,
f2: u8,
f3: u8,
}
#[repr(C)]
struct A {
x: u64,
y: u16,
data: [Sized],
}
fn main() -> Result<(), std::alloc::LayoutError> {
unsafe {
let base_l = Layout::new::<u64>().extend(Layout::new::<u16>())?.0;
let a_l = base_l.extend(Layout::array::<Sized>(3)?)?.0;
let a = ptr::slice_from_raw_parts(alloc_zeroed(a_l), 3) as *mut A;
Ok(()) // #break
}
}
```
When compiled with PDB debuginfo:
```
(lldb) script lldb.frame.var("a").GetNonSyntheticValue().GetChildAtIndex(0).Dereference().GetType()
struct A {
unsigned long long x;
unsigned short y;
}
```
When compiled with DWARF debuginfo:
```
(lldb) script lldb.frame.var("a").GetNonSyntheticValue().GetChildAtIndex(0).Dereference().GetType()
struct A {
unsigned long long x;
unsigned short y;
rust_playground::Sized data[];
}
```
The zero-sized type absolutely exists in the PDB field list and type data as well, so i'm not sure why this culling is happening.
```
llvm-pdbutil dump --types "./target/debug/rust_playground.pdb"
...
0x1089 | LF_STRUCTURE [size = 80] `rust_playground::Sized`
unique name: `f2757b2809a0f2e4a3dd0abc0b7dc4c4`
vtable: <no type>, base list: <no type>, field list: <no type>
options: forward ref (-> 0x108E) | has unique name, sizeof 0
0x108A | LF_ARRAY [size = 16]
size: 0, index type: 0x0023 (unsigned __int64), element type: 0x1089
0x108B | LF_FIELDLIST [size = 44]
- LF_MEMBER [name = `x`, Type = 0x0023 (unsigned __int64), offset = 0, attrs = private] - LF_MEMBER [name = `y`, Type = 0x0021 (unsigned short), offset = 8, attrs = private]
- LF_MEMBER [name = `data`, Type = 0x108A, offset = 10, attrs = private]
0x108C | LF_STRUCTURE [size = 76] `rust_playground::A`
unique name: `a3dd72b9e65190b512b47d085d6d6861`
vtable: <no type>, base list: <no type>, field list: 0x108B
options: has unique name, sizeof 16
0x108D | LF_FIELDLIST [size = 52]
- LF_MEMBER [name = `f1`, Type = 0x0021 (unsigned short), offset = 0, attrs = private]
- LF_MEMBER [name = `f2`, Type = 0x0020 (unsigned char), offset = 2, attrs = private]
- LF_MEMBER [name = `f3`, Type = 0x0020 (unsigned char), offset = 3, attrs = private]
0x108E | LF_STRUCTURE [size = 80] `rust_playground::Sized`
unique name: `f2757b2809a0f2e4a3dd0abc0b7dc4c4`
vtable: <no type>, base list: <no type>, field list: 0x108D
...
```
This happens with zero-sized types (e.g. `()`) as well iirc, not just 0-length arrays.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs