[Lldb-commits] [lldb] [lldb] Add Get(Non)SyntheticValue formatter bytecodes (PR #174839)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 7 11:09:31 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Dave Lee (kastiglione)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/174839.diff
4 Files Affected:
- (modified) lldb/docs/resources/formatterbytecode.rst (+2-1)
- (modified) lldb/examples/python/formatter_bytecode.py (+6)
- (modified) lldb/source/DataFormatters/FormatterBytecode.cpp (+12)
- (modified) lldb/source/DataFormatters/FormatterBytecode.def (+2)
``````````diff
diff --git a/lldb/docs/resources/formatterbytecode.rst b/lldb/docs/resources/formatterbytecode.rst
index edaf56a1122e2..2f76de7bbb9f8 100644
--- a/lldb/docs/resources/formatterbytecode.rst
+++ b/lldb/docs/resources/formatterbytecode.rst
@@ -154,6 +154,8 @@ Sel. Mnemonic Stack Effect
0x15 ``get_type`` ``(Object @get_type -> Type)`` ``SBValue::GetType``
0x16 ``get_template_argument_type`` ``(Object UInt @get_template_argument_type -> Type)`` ``SBValue::GetTemplateArgumentType``
0x17 ``cast`` ``(Object Type @cast -> Object)`` ``SBValue::Cast``
+0x18 ``get_synthetic_value`` ``(Object @get_synthetic_value -> Object)`` ``SBValue::GetSyntheticValue``
+0x19 ``get_non_synthetic_value`` ``(Object @get_non_synthetic_value -> Object)`` ``SBValue::GetNonSyntheticValue``
0x20 ``get_value`` ``(Object @get_value -> Object)`` ``SBValue::GetValue``
0x21 ``get_value_as_unsigned`` ``(Object @get_value_as_unsigned -> UInt)`` ``SBValue::GetValueAsUnsigned``
0x22 ``get_value_as_signed`` ``(Object @get_value_as_signed -> Int)`` ``SBValue::GetValueAsSigned``
@@ -236,4 +238,3 @@ Error handling
~~~~~~~~~~~~~~
In version 1 errors are unrecoverable, the entire expression will fail if any kind of error is encountered.
-
diff --git a/lldb/examples/python/formatter_bytecode.py b/lldb/examples/python/formatter_bytecode.py
index 36a14be283f31..1559207e0981e 100644
--- a/lldb/examples/python/formatter_bytecode.py
+++ b/lldb/examples/python/formatter_bytecode.py
@@ -95,6 +95,8 @@ def define_selector(n, name):
define_selector(0x15, "get_type")
define_selector(0x16, "get_template_argument_type")
define_selector(0x17, "cast")
+define_selector(0x18, "get_synthetic_value")
+define_selector(0x19, "get_non_synthetic_value")
define_selector(0x20, "get_value")
define_selector(0x21, "get_value_as_unsigned")
define_selector(0x22, "get_value_as_signed")
@@ -437,6 +439,10 @@ def next_byte():
n = data.pop()
valobj = data.pop()
data.append(valobj.GetTemplateArgumentType(n))
+ elif sel == sel_get_synthetic_value:
+ data.append(data.pop().GetSyntheticValue())
+ elif sel == sel_get_non_synthetic_value:
+ data.append(data.pop().GetNonSyntheticValue())
elif sel == sel_get_value:
data.append(data.pop().GetValue())
elif sel == sel_get_value_as_unsigned:
diff --git a/lldb/source/DataFormatters/FormatterBytecode.cpp b/lldb/source/DataFormatters/FormatterBytecode.cpp
index 714de74abcb3c..6192246983341 100644
--- a/lldb/source/DataFormatters/FormatterBytecode.cpp
+++ b/lldb/source/DataFormatters/FormatterBytecode.cpp
@@ -511,6 +511,18 @@ llvm::Error Interpret(std::vector<ControlStackElement> &control,
data.Push(type.GetTypeTemplateArgument(index, true));
break;
}
+ case sel_get_synthetic_value: {
+ TYPE_CHECK(Object);
+ POP_VALOBJ(valobj);
+ data.Push(valobj->GetSyntheticValue());
+ break;
+ }
+ case sel_get_non_synthetic_value: {
+ TYPE_CHECK(Object);
+ POP_VALOBJ(valobj);
+ data.Push(valobj->GetNonSyntheticValue());
+ break;
+ }
case sel_get_value: {
TYPE_CHECK(Object);
POP_VALOBJ(valobj);
diff --git a/lldb/source/DataFormatters/FormatterBytecode.def b/lldb/source/DataFormatters/FormatterBytecode.def
index 29e0bee541c73..09a27ae7dde34 100644
--- a/lldb/source/DataFormatters/FormatterBytecode.def
+++ b/lldb/source/DataFormatters/FormatterBytecode.def
@@ -71,6 +71,8 @@ DEFINE_SELECTOR(0x13, get_child_index)
DEFINE_SELECTOR(0x15, get_type)
DEFINE_SELECTOR(0x16, get_template_argument_type)
DEFINE_SELECTOR(0x17, cast)
+DEFINE_SELECTOR(0x18, get_synthetic_value)
+DEFINE_SELECTOR(0x19, get_non_synthetic_value)
DEFINE_SELECTOR(0x20, get_value)
DEFINE_SELECTOR(0x21, get_value_as_unsigned)
``````````
</details>
https://github.com/llvm/llvm-project/pull/174839
More information about the lldb-commits
mailing list