[lldb] Directly access object variable in GetObjectPointerValueObject (NFC)#193120
Open
kastiglione wants to merge 1 commit intollvm:mainfrom
Open
Conversation
Member
|
@llvm/pr-subscribers-lldb Author: Dave Lee (kastiglione) ChangesFull diff: https://github.com/llvm/llvm-project/pull/193120.diff 1 Files Affected:
diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp
index d39bcced48390..537a9cc4c4e35 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -35,11 +35,13 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanCallUserExpression.h"
+#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/State.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/ValueObject/ValueObjectConstResult.h"
+#include "lldb/lldb-enumerations.h"
#include "llvm/BinaryFormat/Dwarf.h"
using namespace lldb_private;
@@ -108,16 +110,13 @@ lldb::ValueObjectSP UserExpression::GetObjectPointerValueObject(
return {};
}
- lldb::VariableSP var_sp;
- lldb::ValueObjectSP valobj_sp;
+ if (auto var_list_sp = frame_sp->GetInScopeVariableList(false))
+ if (auto var_sp =
+ var_list_sp->FindVariable(ConstString(object_name), false))
+ return frame_sp->GetValueObjectForFrameVariable(var_sp,
+ lldb::eNoDynamicValues);
- return frame_sp->GetValueForVariableExpressionPath(
- object_name, lldb::eNoDynamicValues,
- StackFrame::eExpressionPathOptionCheckPtrVsMember |
- StackFrame::eExpressionPathOptionsNoFragileObjcIvar |
- StackFrame::eExpressionPathOptionsNoSyntheticChildren |
- StackFrame::eExpressionPathOptionsNoSyntheticArrayRange,
- var_sp, err);
+ return {};
}
lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp,
|
Contributor
Author
|
With this PR, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
GetObjectPointerValueObjectfunction does not need full variable path expressions, or any of its functionality. This function simply gets the value ofthisorself.