[all-commits] [llvm/llvm-project] 40a361: [lldb-dap] Updating VariableDescription to use Get...
John Harrison via All-commits
all-commits at lists.llvm.org
Fri Jan 12 14:12:43 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 40a361acf5ce255054c5b2e5f67a24325bfe0398
https://github.com/llvm/llvm-project/commit/40a361acf5ce255054c5b2e5f67a24325bfe0398
Author: John Harrison <harjohn at google.com>
Date: 2024-01-12 (Fri, 12 Jan 2024)
Changed paths:
M lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
M lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
M lldb/test/API/tools/lldb-dap/variables/main.cpp
M lldb/tools/lldb-dap/JSONUtils.cpp
M lldb/tools/lldb-dap/JSONUtils.h
M lldb/tools/lldb-dap/lldb-dap.cpp
Log Message:
-----------
[lldb-dap] Updating VariableDescription to use GetDescription() as a fallback. (#77026)
When generating a `display_value` for a variable the current approach
calls `SBValue::GetValue()` and `SBValue::GetSummary()` to generate a
`display_value` for the `SBValue`. However, there are cases where both
of these return an empty string and the fallback is to print a pointer
and type name instead (e.g. `FooBarType @ 0x00321`).
For swift types, lldb includes a langauge runtime plugin that can
generate a description of the object but this is only used with
`SBValue::GetDescription()`.
For example:
```
$ lldb swift-binary
... stop at breakpoint ...
lldb> script
>>> event = lldb.frame.GetValueForVariablePath("event")
>>> print("Value", event.GetValue())
Value None
>>> print("Summary", event.GetSummary())
Summary None
>>> print("Description", event) # __str__ calls SBValue::GetDescription()
Description (main.Event) event = (name = "Greetings", time = 2024-01-04 23:38:06 UTC)
```
With this change, if GetValue and GetSummary return empty then we try
`SBValue::GetDescription()` as a fallback before using the previous
logic of printing `<type> @ <addr>`.
More information about the All-commits
mailing list