llvm / llvm/llvm-project

[LLDB] Type name output in summary string does not match `SBValue.GetTypeName`

Open
#220,183 1 comment 0 reactions 0 assignees View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

LLDB version: lldb version 23.1.0-rc3 (https://github.com/llvm/llvm-project revision 7196f931f212fc7c406066b2628a0ff4ea0ee344)
clang revision 7196f931f212fc7c406066b2628a0ff4ea0ee344
llvm revision 7196f931f212fc7c406066b2628a0ff4ea0ee344

Windows 10, here is a simple example using Rust 1.98, compiled for `x86_64-pc-windows-gnu`, though I would assume this works the same on any non-msvc target:

```rust
fn main() {
let mut x: u8 = 97;
let x1 = &raw const x;
zzz(); // #break
}

fn zzz() {()}
```

After breaking, here are the commands and outputs:

```
(lldb) type summary add --summary-string "${var}" "unsigned char *"
(lldb) v
(unsigned char) x = 'a'
(unsigned char *) x1 = 0x0000007a847ffb1f *const u8 @ 0x0000007a847ffb20
(lldb) script lldb.frame.var("x1").GetTypeName()
'unsigned char *'
```

Note that `SBValue.GetTypeName()` and the variable printing display `unsigned char *`, whereas the summary string prints the correct name, `*const u8`.

Probably related to how the type names that are present in the DWARF debug info are ignored/overridden, as described here: https://github.com/llvm/llvm-project/issues/196812

Contributor guide

Open the contributing guide

Research direction

Reproduce the mismatch on Windows with the Rust example, then compare `SBValue.GetTypeName()`, normal variable output, and the `type summary add --summary-string "${var}"` result. Trace how LLDB formats the pointer summary and how it handles the DWARF type name; done means the summary string and type-name output agree without regressing the shown commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.