Skip to content

[lldb] Accept optional module in Value::ResolveValue #66286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

augusto2112
Copy link
Contributor

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

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
@augusto2112 augusto2112 requested a review from a team as a code owner September 13, 2023 20:28
@llvmbot llvmbot added the lldb label Sep 13, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 13, 2023

@llvm/pr-subscribers-lldb

Changes 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)
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)

@augusto2112 augusto2112 merged commit 705f24c into llvm:main Sep 13, 2023
augusto2112 added a commit to augusto2112/llvm-project that referenced this pull request Sep 13, 2023
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
(cherry picked from commit 705f24c)
augusto2112 added a commit to swiftlang/llvm-project that referenced this pull request Sep 13, 2023
[lldb] Accept optional module in Value::ResolveValue (llvm#66286)
Copy link
Collaborator

@clayborg clayborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change testable in a test case? I assume it must be somehow as it is fixing a bug?

@adrian-prantl
Copy link
Collaborator

IIUC, this is an infrastructure change that fixes a test failure in swift branch. Augusto can speak to whether it's testable on main.

@augusto2112
Copy link
Contributor Author

@clayborg as Adrian said, this fixes a test failure downstream. I don't there's any visible change in behavior to test in main, unfortunately.

@clayborg
Copy link
Collaborator

@clayborg as Adrian said, this fixes a test failure downstream. I don't there's any visible change in behavior to test in main, unfortunately.

Gotcha. Let me guess: Swift? :-)

@augusto2112
Copy link
Contributor Author

@clayborg as Adrian said, this fixes a test failure downstream. I don't there's any visible change in behavior to test in main, unfortunately.

Gotcha. Let me guess: Swift? :-)

Exactly :)

ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants