[Lldb-commits] [lldb] [API] add GetSyntheticValue (PR #95959)

Vincent Belliard via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 20 17:14:41 PDT 2024


https://github.com/v-bulle updated https://github.com/llvm/llvm-project/pull/95959

>From 27a00b54bc991dfb4747e0d37b15878beebaabba Mon Sep 17 00:00:00 2001
From: Vincent Belliard <v-bulle at github.com>
Date: Wed, 12 Jun 2024 14:23:15 -0700
Subject: [PATCH] [API] add GetSyntheticValue

---
 lldb/include/lldb/API/SBValue.h |  2 ++
 lldb/source/API/SBValue.cpp     | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 65920c76df7a8..bec816fb45184 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -89,6 +89,8 @@ class LLDB_API SBValue {
 
   lldb::SBValue GetNonSyntheticValue();
 
+  lldb::SBValue GetSyntheticValue();
+
   lldb::DynamicValueType GetPreferDynamicValue();
 
   void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic);
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 9d7efba024d11..6b77c0e95cedd 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -761,6 +761,18 @@ lldb::SBValue SBValue::GetNonSyntheticValue() {
   return value_sb;
 }
 
+lldb::SBValue SBValue::GetSyntheticValue() {
+  LLDB_INSTRUMENT_VA(this);
+
+  SBValue value_sb;
+  if (IsValid()) {
+    ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
+                                       m_opaque_sp->GetUseDynamic(), true));
+    value_sb.SetSP(proxy_sp);
+  }
+  return value_sb;
+}
+
 lldb::DynamicValueType SBValue::GetPreferDynamicValue() {
   LLDB_INSTRUMENT_VA(this);
 



More information about the lldb-commits mailing list