llvm / llvm/llvm-project

[lldb] SBValue clone results in an incorrect type summary

Open
#183,578 4 comments 0 reactions 0 assignees View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

In the lldb-dap test suite, I found an issue when I use `SBValue::Clone` where it seems the cloned value loses the type summary.

In this case its happening in https://github.com/llvm/llvm-project/blob/af15474262100ade9a8fcfd05f9e05c7ba23ff8c/lldb/test/API/tools/lldb-dap/variables/children/main.cpp#L18

```bash
$ lldb /Users/harjohn/Projects/lldb-build/lldb-test-build.noindex/tools/lldb-dap/variables/children/TestDAP_variables_children/a.out
(lldb) break set -n test_return_variable_with_children
(lldb) r
(lldb) thread step-out
(lldb) script
>>> rv = lldb.thread.return_value
>>> rv_clone = rv.Clone("(Return Value)")
>>> rv
(NonPrimitive) $0 = (buffer = "hello world!", x = 10, y = 20)
>>> rv_clone
(NonPrimitive) (Return Value) = (buffer = char[16] @ 0x00000008835a9ca0, x = 10, y = 20)
```

Contributor guide

Open the contributing guide

Research direction

Start with lldb/test/API/tools/lldb-dap/variables/children/main.cpp at the reported return-value example, then reproduce the LLDB commands using SBValue::Clone. Compare the original value and its clone, and verify that the clone retains the original type summary instead of displaying the raw char array representation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.