aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/StackFrame.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-07-03 14:10:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-07-03 14:10:23 +0000
commit145449b1e420787bb99721a429341fa6be3adfb6 (patch)
tree1d56ae694a6de602e348dd80165cf881a36600ed /lldb/source/Target/StackFrame.cpp
parentecbca9f5fb7d7613d2b94982c4825eb0d33d6842 (diff)
Diffstat (limited to 'lldb/source/Target/StackFrame.cpp')
-rw-r--r--lldb/source/Target/StackFrame.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 58de26b23b65..1e3dbc73a04e 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -29,6 +29,7 @@
#include "lldb/Target/StackFrameRecognizer.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegisterValue.h"
@@ -551,7 +552,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
if (!var_sp && (options & eExpressionPathOptionsAllowDirectIVarAccess)) {
// Check for direct ivars access which helps us with implicit access to
- // ivars with the "this->" or "self->"
+ // ivars using "this" or "self".
GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock);
lldb::LanguageType method_language = eLanguageTypeUnknown;
bool is_instance_method = false;
@@ -562,7 +563,13 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
var_sp = variable_list->FindVariable(method_object_name);
if (var_sp) {
separator_idx = 0;
- var_expr_storage = "->";
+ if (Type *var_type = var_sp->GetType())
+ if (auto compiler_type = var_type->GetForwardCompilerType())
+ if (!compiler_type.IsPointerType())
+ var_expr_storage = ".";
+
+ if (var_expr_storage.empty())
+ var_expr_storage = "->";
var_expr_storage += var_expr;
var_expr = var_expr_storage;
synthetically_added_instance_object = true;
@@ -1336,9 +1343,8 @@ lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
auto c_type_system_or_err =
target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC);
if (auto err = c_type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(
- lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD),
- std::move(err), "Unable to guess value for given address");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Thread), std::move(err),
+ "Unable to guess value for given address");
return ValueObjectSP();
} else {
CompilerType void_ptr_type =
@@ -1384,7 +1390,7 @@ ValueObjectSP GetValueForOffset(StackFrame &frame, ValueObjectSP &parent,
}
int64_t child_offset = child_sp->GetByteOffset();
- int64_t child_size = child_sp->GetByteSize().getValueOr(0);
+ int64_t child_size = child_sp->GetByteSize().value_or(0);
if (offset >= child_offset && offset < (child_offset + child_size)) {
return GetValueForOffset(frame, child_sp, offset - child_offset);
@@ -1417,8 +1423,8 @@ ValueObjectSP GetValueForDereferincingOffset(StackFrame &frame,
}
if (offset >= 0 && uint64_t(offset) >= pointee->GetByteSize()) {
- int64_t index = offset / pointee->GetByteSize().getValueOr(1);
- offset = offset % pointee->GetByteSize().getValueOr(1);
+ int64_t index = offset / pointee->GetByteSize().value_or(1);
+ offset = offset % pointee->GetByteSize().value_or(1);
const bool can_create = true;
pointee = base->GetSyntheticArrayMember(index, can_create);
}