https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/174839

None

>From cdb793384df3d8aa4b36fbd2bb71e8f5fb432500 Mon Sep 17 00:00:00 2001
From: Dave Lee <[email protected]>
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/source/DataFormatters/FormatterBytecode.cpp | 12 ++++++++++++
 lldb/source/DataFormatters/FormatterBytecode.def |  2 ++
 4 files changed, 22 insertions(+), 1 deletion(-)

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)

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to