[Lldb-commits] [lldb] [lldb] Add Get(Non)SyntheticValue formatter bytecodes (PR #174839)
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 12 09:52:25 PST 2026
https://github.com/kastiglione updated https://github.com/llvm/llvm-project/pull/174839
>From 4d8682fbab40de01fd118cb57e485d701c8f1200 Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Wed, 7 Jan 2026 10:57:06 -0800
Subject: [PATCH] [lldb] Add Get(Non)SyntheticValue formatter bytecodes
---
lldb/docs/resources/formatterbytecode.rst | 3 ++-
lldb/examples/python/formatter_bytecode.py | 6 ++++++
.../lldb/DataFormatters/FormatterBytecode.def | 2 ++
lldb/source/DataFormatters/FormatterBytecode.cpp | 12 ++++++++++++
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/lldb/docs/resources/formatterbytecode.rst b/lldb/docs/resources/formatterbytecode.rst
index 3c671f217c52e..f6a7b66fa728e 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``
@@ -237,4 +239,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/include/lldb/DataFormatters/FormatterBytecode.def b/lldb/include/lldb/DataFormatters/FormatterBytecode.def
index ae5ab234e7860..ea10b17dc38de 100644
--- a/lldb/include/lldb/DataFormatters/FormatterBytecode.def
+++ b/lldb/include/lldb/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)
diff --git a/lldb/source/DataFormatters/FormatterBytecode.cpp b/lldb/source/DataFormatters/FormatterBytecode.cpp
index 62e4413237cc0..9a1e74e4afa6a 100644
--- a/lldb/source/DataFormatters/FormatterBytecode.cpp
+++ b/lldb/source/DataFormatters/FormatterBytecode.cpp
@@ -511,6 +511,18 @@ llvm::Error Interpret(ControlStack &control, DataStack &data, Signatures sig) {
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);
More information about the lldb-commits
mailing list