Author: Dave Lee Date: 2026-02-12T10:07:17-08:00 New Revision: 4baab258b877b2df50bedffe364cbc2a06d644ae
URL: https://github.com/llvm/llvm-project/commit/4baab258b877b2df50bedffe364cbc2a06d644ae DIFF: https://github.com/llvm/llvm-project/commit/4baab258b877b2df50bedffe364cbc2a06d644ae.diff LOG: [lldb] Add Get(Non)SyntheticValue formatter bytecodes (#174839) `GetSyntheticValue` in synthetic providers which need to operate on raw root values, but will often want to use the synthetic value of children, or nested children. Added: Modified: lldb/docs/resources/formatterbytecode.rst lldb/examples/python/formatter_bytecode.py lldb/include/lldb/DataFormatters/FormatterBytecode.def lldb/source/DataFormatters/FormatterBytecode.cpp Removed: ################################################################################ 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); _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
