[Lldb-commits] [lldb] [lldb] Accept optional module in Value::ResolveValue (PR #66286)

via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 13 13:29:12 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb
            
<details>
<summary>Changes</summary>
Value::ResolveValue calls Value::GetValueAsData as part of its implementation. The latter can receive an optional Module pointer, which is always null when called from the former. Allow threading in the Module in Value::ResolveValue.

rdar://115021869
--
Full diff: https://github.com/llvm/llvm-project/pull/66286.diff

3 Files Affected:

- (modified) lldb/include/lldb/Core/Value.h (+1-1) 
- (modified) lldb/source/Core/Value.cpp (+2-2) 
- (modified) lldb/source/Core/ValueObject.cpp (+1-1) 


<pre>
diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index ead23acc6f9b1a2..d0c338ffec0cd3d 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -107,7 +107,7 @@ class Value {
 
   Type *GetType();
 
-  Scalar &ResolveValue(ExecutionContext *exe_ctx);
+  Scalar &ResolveValue(ExecutionContext *exe_ctx, Module *module = nullptr);
 
   const Scalar &GetScalar() const { return m_value; }
 
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index 5a2631ca501f6c7..8efcfd3b4a1adac 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -572,7 +572,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
   return error;
 }
 
-Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) {
+Scalar &Value::ResolveValue(ExecutionContext *exe_ctx, Module *module) {
   const CompilerType &compiler_type = GetCompilerType();
   if (compiler_type.IsValid()) {
     switch (m_value_type) {
@@ -587,7 +587,7 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) {
     {
       DataExtractor data;
       lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS);
-      Status error(GetValueAsData(exe_ctx, data, nullptr));
+      Status error(GetValueAsData(exe_ctx, data, module));
       if (error.Success()) {
         Scalar scalar;
         if (compiler_type.GetValueAsScalar(
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 3e9116f2d922933..ebfc1cf4d6fe9e1 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -334,7 +334,7 @@ bool ValueObject::ResolveValue(Scalar &scalar) {
   {
     ExecutionContext exe_ctx(GetExecutionContextRef());
     Value tmp_value(m_value);
-    scalar = tmp_value.ResolveValue(&exe_ctx);
+    scalar = tmp_value.ResolveValue(&exe_ctx, GetModule().get());
     if (scalar.IsValid()) {
       const uint32_t bitfield_bit_size = GetBitfieldBitSize();
       if (bitfield_bit_size)
</pre>
</details>


https://github.com/llvm/llvm-project/pull/66286


More information about the lldb-commits mailing list