[Lldb-commits] [lldb] [lldb] Make SBType know its dynamic-ness (PR #207743)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/207743 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make SBType know its dynamic-ness (PR #207743)
https://github.com/labath updated
https://github.com/llvm/llvm-project/pull/207743
>From df80d3e2dd9aaa38f175030bb30b5387e01271ae Mon Sep 17 00:00:00 2001
From: Pavel Labath
Date: Wed, 8 Jul 2026 10:12:52 +0200
Subject: [PATCH] [lldb] Return static SBType for static SBValues
The type should reflect our view of the value. To enable looking at the
nested types of dynamic types, I change TypeImpl::FindDirectNestedType
to prefer dynamic types (if it exists). To get the previous behavior,
explicitly ask for a static type from the value.
---
lldb/source/API/SBValue.cpp | 2 ++
lldb/source/Symbol/Type.cpp | 2 +-
lldb/test/API/python_api/type/TestTypeList.py | 23 +++
lldb/test/API/python_api/type/main.cpp| 11 +
4 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 9b84fb975c302..a4d8a790071de 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -229,6 +229,8 @@ SBType SBValue::GetType() {
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
TypeImplSP type_sp;
+ if (value_sp && GetPreferDynamicValue() == eNoDynamicValues)
+value_sp = value_sp->GetStaticValue();
if (value_sp) {
type_sp = std::make_shared(value_sp->GetTypeImpl());
sb_type.SetSP(type_sp);
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 7681d7065a522..9b62018bbd3d8 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -1215,7 +1215,7 @@ bool TypeImpl::GetDescription(lldb_private::Stream &strm,
CompilerType TypeImpl::FindDirectNestedType(llvm::StringRef name) {
if (name.empty())
return CompilerType();
- return GetCompilerType(/*prefer_dynamic=*/false)
+ return GetCompilerType(/*prefer_dynamic=*/true)
.GetDirectNestedTypeWithName(name);
}
diff --git a/lldb/test/API/python_api/type/TestTypeList.py
b/lldb/test/API/python_api/type/TestTypeList.py
index e4dc810169089..1097f75e4e49a 100644
--- a/lldb/test/API/python_api/type/TestTypeList.py
+++ b/lldb/test/API/python_api/type/TestTypeList.py
@@ -300,6 +300,29 @@ def test_nested_typedef(self):
self.assertTrue(the_typedef)
self.assertEqual(the_typedef.GetTypedefedType().GetName(), "int")
+@expectedFailureWindows # Dynamic type resolution not implemented
+def test_dynamic_values(self):
+"""Test FindDirectNestedType on dynamic values"""
+
+self.build()
+lldbutil.run_to_line_breakpoint(self, lldb.SBFileSpec(self.source),
self.line)
+polymorphic = (
+self.frame()
+.FindVariable("polymorphic")
+.GetDynamicValue(lldb.eDynamicDontRunTarget)
+)
+self.DebugSBValue(polymorphic)
+polymorphic_type = polymorphic.GetType().GetPointeeType()
+self.DebugSBType(polymorphic_type)
+nested = polymorphic_type.FindDirectNestedType("Nested")
+self.DebugSBType(nested)
+self.assertEqual(nested.GetName(), "PolymorphicDerived::Nested")
+
+static = polymorphic.GetStaticValue()
+self.DebugSBValue(static)
+static_type = static.GetType().GetPointeeType()
+self.assertFalse(static_type.FindDirectNestedType("Nested"))
+
def test_GetByteAlign(self):
"""Exercise SBType::GetByteAlign"""
self.build()
diff --git a/lldb/test/API/python_api/type/main.cpp
b/lldb/test/API/python_api/type/main.cpp
index 449f77db0d75e..3d31790be05ee 100644
--- a/lldb/test/API/python_api/type/main.cpp
+++ b/lldb/test/API/python_api/type/main.cpp
@@ -63,6 +63,15 @@ struct WithNestedTypedef {
};
WithNestedTypedef::TheTypedef typedefed_value;
+struct PolymorphicBase {
+ virtual void foo() {}
+};
+
+struct PolymorphicDerived : PolymorphicBase {
+ struct Nested {};
+ Nested get() { return {}; }
+};
+
int main (int argc, char const *argv[])
{
Task *task_head = new Task(-1, NULL);
@@ -100,5 +109,7 @@ int main (int argc, char const *argv[])
PointerInfo<3>::Masks1 mask1 = PointerInfo<3>::Masks1::pointer_mask;
PointerInfo<3>::Masks2 mask2 = PointerInfo<3>::Masks2::pointer_mask;
+PolymorphicBase *polymorphic = new PolymorphicDerived();
+
return 0; // Break at this line
}
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make SBType know its dynamic-ness (PR #207743)
https://github.com/labath updated
https://github.com/llvm/llvm-project/pull/207743
>From ce18af4f2bfc92aff6de0b7f925bcaae8bc80d91 Mon Sep 17 00:00:00 2001
From: Pavel Labath
Date: Mon, 6 Jul 2026 16:18:04 +0200
Subject: [PATCH 1/3] [lldb] Make SBType know its dynamic-ness
SBType (via lldb_private::TypeImpl) stores both static and dynamic
types, but there's no way (at the SB level) to choose which view to
access. At the lldb_private level, one could pass arguments to the
GetCompilerType function, but there one often did not know which value
to pass, which resulted in a mostly random distribution of constants.
This patch makes TypeImpl store the dynamic property, similar to
ValueImpl does for SBValue. It also adds the Get{Static,Dynamic}Type
accessors to toggle it. For testing, I add a test case which accesses
the nested type of a dynamic type -- something that was not possible
before this patch, and my motivation for implementing this.
---
lldb/include/lldb/API/SBType.h| 4 +
lldb/include/lldb/Symbol/Type.h | 13 ++-
lldb/source/API/SBTarget.cpp | 4 +-
lldb/source/API/SBType.cpp| 98 +++
lldb/source/API/SBTypeNameSpecifier.cpp | 2 +-
lldb/source/API/SBValue.cpp | 8 +-
.../DataFormatters/FormatterBytecode.cpp | 2 +-
lldb/source/Symbol/Type.cpp | 14 +--
lldb/test/API/python_api/type/TestTypeList.py | 13 +++
lldb/test/API/python_api/type/main.cpp| 11 +++
10 files changed, 111 insertions(+), 58 deletions(-)
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 9ad3244686328..6b65a4ed490bb 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -148,6 +148,10 @@ class SBType {
bool IsValid() const;
+ SBType GetStaticType();
+
+ SBType GetDynamicType(lldb::DynamicValueType use_dynamic);
+
uint64_t GetByteSize();
uint64_t GetByteAlign();
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 84666a04818a5..b76c9936f2255 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -17,6 +17,7 @@
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"
@@ -644,6 +645,12 @@ class TypeImpl {
void SetType(const CompilerType &compiler_type, const CompilerType &dynamic);
+ lldb::DynamicValueType GetUseDynamic() { return m_use_dynamic; }
+
+ void SetUseDynamic(lldb::DynamicValueType use_dynamic) {
+m_use_dynamic = use_dynamic;
+ }
+
bool operator==(const TypeImpl &rhs) const;
bool operator!=(const TypeImpl &rhs) const;
@@ -674,9 +681,9 @@ class TypeImpl {
TypeImpl GetCanonicalType() const;
- CompilerType GetCompilerType(bool prefer_dynamic);
+ CompilerType GetCompilerType() const;
- CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic);
+ CompilerType::TypeSystemSPWrapper GetTypeSystem();
bool GetDescription(lldb_private::Stream &strm,
lldb::DescriptionLevel description_level);
@@ -693,6 +700,8 @@ class TypeImpl {
lldb::ModuleWP m_exe_module_wp;
CompilerType m_static_type;
CompilerType m_dynamic_type;
+
+ lldb::DynamicValueType m_use_dynamic = lldb::eDynamicDontRunTarget;
};
class TypeListImpl {
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 669c05c42fd1a..e5f34d1069e4d 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1454,7 +1454,7 @@ SBValue SBTarget::CreateValueFromAddress(const char
*name, SBAddress addr,
lldb::addr_t load_addr(addr.GetLoadAddress(*this));
ExecutionContext exe_ctx(
ExecutionContextRef(ExecutionContext(m_opaque_sp.get(), false)));
-CompilerType ast_type(type.GetSP()->GetCompilerType(true));
+CompilerType ast_type(type.GetSP()->GetCompilerType());
new_value_sp = ValueObject::CreateValueObjectFromAddress(name, load_addr,
exe_ctx,
ast_type);
}
@@ -1472,7 +1472,7 @@ lldb::SBValue SBTarget::CreateValueFromData(const char
*name, lldb::SBData data,
DataExtractorSP extractor(*data);
ExecutionContext exe_ctx(
ExecutionContextRef(ExecutionContext(m_opaque_sp.get(), false)));
-CompilerType ast_type(type.GetSP()->GetCompilerType(true));
+CompilerType ast_type(type.GetSP()->GetCompilerType());
new_value_sp = ValueObject::CreateValueObjectFromData(name, *extractor,
exe_ctx, ast_type);
}
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index f58902dcf44d8..87621e8eb537b 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -123,12 +123,30 @@ SBType::operator bool() const {
return m_opaque_sp->IsVa
[Lldb-commits] [lldb] [lldb] Make SBType know its dynamic-ness (PR #207743)
https://github.com/labath updated
https://github.com/llvm/llvm-project/pull/207743
>From ce18af4f2bfc92aff6de0b7f925bcaae8bc80d91 Mon Sep 17 00:00:00 2001
From: Pavel Labath
Date: Mon, 6 Jul 2026 16:18:04 +0200
Subject: [PATCH 1/2] [lldb] Make SBType know its dynamic-ness
SBType (via lldb_private::TypeImpl) stores both static and dynamic
types, but there's no way (at the SB level) to choose which view to
access. At the lldb_private level, one could pass arguments to the
GetCompilerType function, but there one often did not know which value
to pass, which resulted in a mostly random distribution of constants.
This patch makes TypeImpl store the dynamic property, similar to
ValueImpl does for SBValue. It also adds the Get{Static,Dynamic}Type
accessors to toggle it. For testing, I add a test case which accesses
the nested type of a dynamic type -- something that was not possible
before this patch, and my motivation for implementing this.
---
lldb/include/lldb/API/SBType.h| 4 +
lldb/include/lldb/Symbol/Type.h | 13 ++-
lldb/source/API/SBTarget.cpp | 4 +-
lldb/source/API/SBType.cpp| 98 +++
lldb/source/API/SBTypeNameSpecifier.cpp | 2 +-
lldb/source/API/SBValue.cpp | 8 +-
.../DataFormatters/FormatterBytecode.cpp | 2 +-
lldb/source/Symbol/Type.cpp | 14 +--
lldb/test/API/python_api/type/TestTypeList.py | 13 +++
lldb/test/API/python_api/type/main.cpp| 11 +++
10 files changed, 111 insertions(+), 58 deletions(-)
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 9ad3244686328..6b65a4ed490bb 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -148,6 +148,10 @@ class SBType {
bool IsValid() const;
+ SBType GetStaticType();
+
+ SBType GetDynamicType(lldb::DynamicValueType use_dynamic);
+
uint64_t GetByteSize();
uint64_t GetByteAlign();
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 84666a04818a5..b76c9936f2255 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -17,6 +17,7 @@
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"
@@ -644,6 +645,12 @@ class TypeImpl {
void SetType(const CompilerType &compiler_type, const CompilerType &dynamic);
+ lldb::DynamicValueType GetUseDynamic() { return m_use_dynamic; }
+
+ void SetUseDynamic(lldb::DynamicValueType use_dynamic) {
+m_use_dynamic = use_dynamic;
+ }
+
bool operator==(const TypeImpl &rhs) const;
bool operator!=(const TypeImpl &rhs) const;
@@ -674,9 +681,9 @@ class TypeImpl {
TypeImpl GetCanonicalType() const;
- CompilerType GetCompilerType(bool prefer_dynamic);
+ CompilerType GetCompilerType() const;
- CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic);
+ CompilerType::TypeSystemSPWrapper GetTypeSystem();
bool GetDescription(lldb_private::Stream &strm,
lldb::DescriptionLevel description_level);
@@ -693,6 +700,8 @@ class TypeImpl {
lldb::ModuleWP m_exe_module_wp;
CompilerType m_static_type;
CompilerType m_dynamic_type;
+
+ lldb::DynamicValueType m_use_dynamic = lldb::eDynamicDontRunTarget;
};
class TypeListImpl {
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 669c05c42fd1a..e5f34d1069e4d 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1454,7 +1454,7 @@ SBValue SBTarget::CreateValueFromAddress(const char
*name, SBAddress addr,
lldb::addr_t load_addr(addr.GetLoadAddress(*this));
ExecutionContext exe_ctx(
ExecutionContextRef(ExecutionContext(m_opaque_sp.get(), false)));
-CompilerType ast_type(type.GetSP()->GetCompilerType(true));
+CompilerType ast_type(type.GetSP()->GetCompilerType());
new_value_sp = ValueObject::CreateValueObjectFromAddress(name, load_addr,
exe_ctx,
ast_type);
}
@@ -1472,7 +1472,7 @@ lldb::SBValue SBTarget::CreateValueFromData(const char
*name, lldb::SBData data,
DataExtractorSP extractor(*data);
ExecutionContext exe_ctx(
ExecutionContextRef(ExecutionContext(m_opaque_sp.get(), false)));
-CompilerType ast_type(type.GetSP()->GetCompilerType(true));
+CompilerType ast_type(type.GetSP()->GetCompilerType());
new_value_sp = ValueObject::CreateValueObjectFromData(name, *extractor,
exe_ctx, ast_type);
}
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index f58902dcf44d8..87621e8eb537b 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -123,12 +123,30 @@ SBType::operator bool() const {
return m_opaque_sp->IsVa
[Lldb-commits] [lldb] [lldb] Make SBType know its dynamic-ness (PR #207743)
llvmorg-github-actions[bot] wrote:
@llvm/pr-subscribers-lldb
Author: Pavel Labath (labath)
Changes
SBType (via lldb_private::TypeImpl) stores both static and dynamic types, but
there's no way (at the SB level) to choose which view to access. At the
lldb_private level, one could pass arguments to the GetCompilerType function,
but there one often did not know which value to pass, which resulted in a
mostly random distribution of constants.
This patch makes TypeImpl store the dynamic property, similar to ValueImpl does
for SBValue. It also adds the Get{Static,Dynamic}Type accessors to toggle it.
For testing, I add a test case which accesses the nested type of a dynamic type
-- something that was not possible before this patch, and my motivation for
implementing this.
---
Patch is 22.79 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/207743.diff
10 Files Affected:
- (modified) lldb/include/lldb/API/SBType.h (+4)
- (modified) lldb/include/lldb/Symbol/Type.h (+11-2)
- (modified) lldb/source/API/SBTarget.cpp (+2-2)
- (modified) lldb/source/API/SBType.cpp (+57-41)
- (modified) lldb/source/API/SBTypeNameSpecifier.cpp (+1-1)
- (modified) lldb/source/API/SBValue.cpp (+4-4)
- (modified) lldb/source/DataFormatters/FormatterBytecode.cpp (+1-1)
- (modified) lldb/source/Symbol/Type.cpp (+7-7)
- (modified) lldb/test/API/python_api/type/TestTypeList.py (+13)
- (modified) lldb/test/API/python_api/type/main.cpp (+11)
``diff
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 9ad3244686328..6b65a4ed490bb 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -148,6 +148,10 @@ class SBType {
bool IsValid() const;
+ SBType GetStaticType();
+
+ SBType GetDynamicType(lldb::DynamicValueType use_dynamic);
+
uint64_t GetByteSize();
uint64_t GetByteAlign();
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 84666a04818a5..b76c9936f2255 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -17,6 +17,7 @@
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"
@@ -644,6 +645,12 @@ class TypeImpl {
void SetType(const CompilerType &compiler_type, const CompilerType &dynamic);
+ lldb::DynamicValueType GetUseDynamic() { return m_use_dynamic; }
+
+ void SetUseDynamic(lldb::DynamicValueType use_dynamic) {
+m_use_dynamic = use_dynamic;
+ }
+
bool operator==(const TypeImpl &rhs) const;
bool operator!=(const TypeImpl &rhs) const;
@@ -674,9 +681,9 @@ class TypeImpl {
TypeImpl GetCanonicalType() const;
- CompilerType GetCompilerType(bool prefer_dynamic);
+ CompilerType GetCompilerType() const;
- CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic);
+ CompilerType::TypeSystemSPWrapper GetTypeSystem();
bool GetDescription(lldb_private::Stream &strm,
lldb::DescriptionLevel description_level);
@@ -693,6 +700,8 @@ class TypeImpl {
lldb::ModuleWP m_exe_module_wp;
CompilerType m_static_type;
CompilerType m_dynamic_type;
+
+ lldb::DynamicValueType m_use_dynamic = lldb::eDynamicDontRunTarget;
};
class TypeListImpl {
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 669c05c42fd1a..e5f34d1069e4d 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1454,7 +1454,7 @@ SBValue SBTarget::CreateValueFromAddress(const char
*name, SBAddress addr,
lldb::addr_t load_addr(addr.GetLoadAddress(*this));
ExecutionContext exe_ctx(
ExecutionContextRef(ExecutionContext(m_opaque_sp.get(), false)));
-CompilerType ast_type(type.GetSP()->GetCompilerType(true));
+CompilerType ast_type(type.GetSP()->GetCompilerType());
new_value_sp = ValueObject::CreateValueObjectFromAddress(name, load_addr,
exe_ctx,
ast_type);
}
@@ -1472,7 +1472,7 @@ lldb::SBValue SBTarget::CreateValueFromData(const char
*name, lldb::SBData data,
DataExtractorSP extractor(*data);
ExecutionContext exe_ctx(
ExecutionContextRef(ExecutionContext(m_opaque_sp.get(), false)));
-CompilerType ast_type(type.GetSP()->GetCompilerType(true));
+CompilerType ast_type(type.GetSP()->GetCompilerType());
new_value_sp = ValueObject::CreateValueObjectFromData(name, *extractor,
exe_ctx, ast_type);
}
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index f58902dcf44d8..87621e8eb537b 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -123,12 +123,30 @@ SBType::operator bool() const {
return m_opaque_sp->IsValid();
}
+SBType SBType::GetStaticType() {
+ LLDB_INSTRUMENT_VA(t
[Lldb-commits] [lldb] [lldb] Make SBType know its dynamic-ness (PR #207743)
https://github.com/labath created
https://github.com/llvm/llvm-project/pull/207743
SBType (via lldb_private::TypeImpl) stores both static and dynamic types, but
there's no way (at the SB level) to choose which view to access. At the
lldb_private level, one could pass arguments to the GetCompilerType function,
but there one often did not know which value to pass, which resulted in a
mostly random distribution of constants.
This patch makes TypeImpl store the dynamic property, similar to ValueImpl does
for SBValue. It also adds the Get{Static,Dynamic}Type accessors to toggle it.
For testing, I add a test case which accesses the nested type of a dynamic type
-- something that was not possible before this patch, and my motivation for
implementing this.
>From ce18af4f2bfc92aff6de0b7f925bcaae8bc80d91 Mon Sep 17 00:00:00 2001
From: Pavel Labath
Date: Mon, 6 Jul 2026 16:18:04 +0200
Subject: [PATCH] [lldb] Make SBType know its dynamic-ness
SBType (via lldb_private::TypeImpl) stores both static and dynamic
types, but there's no way (at the SB level) to choose which view to
access. At the lldb_private level, one could pass arguments to the
GetCompilerType function, but there one often did not know which value
to pass, which resulted in a mostly random distribution of constants.
This patch makes TypeImpl store the dynamic property, similar to
ValueImpl does for SBValue. It also adds the Get{Static,Dynamic}Type
accessors to toggle it. For testing, I add a test case which accesses
the nested type of a dynamic type -- something that was not possible
before this patch, and my motivation for implementing this.
---
lldb/include/lldb/API/SBType.h| 4 +
lldb/include/lldb/Symbol/Type.h | 13 ++-
lldb/source/API/SBTarget.cpp | 4 +-
lldb/source/API/SBType.cpp| 98 +++
lldb/source/API/SBTypeNameSpecifier.cpp | 2 +-
lldb/source/API/SBValue.cpp | 8 +-
.../DataFormatters/FormatterBytecode.cpp | 2 +-
lldb/source/Symbol/Type.cpp | 14 +--
lldb/test/API/python_api/type/TestTypeList.py | 13 +++
lldb/test/API/python_api/type/main.cpp| 11 +++
10 files changed, 111 insertions(+), 58 deletions(-)
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 9ad3244686328..6b65a4ed490bb 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -148,6 +148,10 @@ class SBType {
bool IsValid() const;
+ SBType GetStaticType();
+
+ SBType GetDynamicType(lldb::DynamicValueType use_dynamic);
+
uint64_t GetByteSize();
uint64_t GetByteAlign();
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 84666a04818a5..b76c9936f2255 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -17,6 +17,7 @@
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"
@@ -644,6 +645,12 @@ class TypeImpl {
void SetType(const CompilerType &compiler_type, const CompilerType &dynamic);
+ lldb::DynamicValueType GetUseDynamic() { return m_use_dynamic; }
+
+ void SetUseDynamic(lldb::DynamicValueType use_dynamic) {
+m_use_dynamic = use_dynamic;
+ }
+
bool operator==(const TypeImpl &rhs) const;
bool operator!=(const TypeImpl &rhs) const;
@@ -674,9 +681,9 @@ class TypeImpl {
TypeImpl GetCanonicalType() const;
- CompilerType GetCompilerType(bool prefer_dynamic);
+ CompilerType GetCompilerType() const;
- CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic);
+ CompilerType::TypeSystemSPWrapper GetTypeSystem();
bool GetDescription(lldb_private::Stream &strm,
lldb::DescriptionLevel description_level);
@@ -693,6 +700,8 @@ class TypeImpl {
lldb::ModuleWP m_exe_module_wp;
CompilerType m_static_type;
CompilerType m_dynamic_type;
+
+ lldb::DynamicValueType m_use_dynamic = lldb::eDynamicDontRunTarget;
};
class TypeListImpl {
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 669c05c42fd1a..e5f34d1069e4d 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1454,7 +1454,7 @@ SBValue SBTarget::CreateValueFromAddress(const char
*name, SBAddress addr,
lldb::addr_t load_addr(addr.GetLoadAddress(*this));
ExecutionContext exe_ctx(
ExecutionContextRef(ExecutionContext(m_opaque_sp.get(), false)));
-CompilerType ast_type(type.GetSP()->GetCompilerType(true));
+CompilerType ast_type(type.GetSP()->GetCompilerType());
new_value_sp = ValueObject::CreateValueObjectFromAddress(name, load_addr,
exe_ctx,
ast_type);
}
@@ -1472,7 +1472,7 @@ lldb::SBValue SBTarget::CreateValueFromData(const char
*name, lldb::SBData data,
Dat
